:root {
  --primary-color: #2a0a22;
  --secondary-color: #8b0000;
  --accent-color: #4a0419;
  --text-color: #e0e0e0;
  --dark-bg: #0a0a0a;
  --window-bg: rgba(10, 10, 14, 0.85);
  --window-border: rgba(180, 20, 20, 0.4);
  --menu-hover: rgba(120, 20, 20, 0.3);
  --blood-color: #8b0000;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@font-face {
  font-family: 'Nightmare';
  src: url('https://fonts.googleapis.com/css2?family=Creepster&display=swap');
}

body {
  background-color: var(--dark-bg);
  color: var(--text-color);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  transition: all 0.5s;
}

#desktop {
  height: 100vh;
  width: 100vw;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

#icons-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  padding: 20px;
  max-width: 100%;
}

.desktop-icon {
  width: 80px;
  height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: all 0.2s;
}

.desktop-icon:hover {
  background-color: rgba(139, 0, 0, 0.2);
  transform: scale(1.05);
}

.desktop-icon img {
  width: 48px;
  height: 48px;
  margin-bottom: 5px;
  filter: drop-shadow(0 0 5px rgba(255,0,0,0.4));
}

.desktop-icon .icon-name {
  font-size: 12px;
  text-align: center;
  word-wrap: break-word;
  max-width: 80px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.window {
  position: absolute;
  background-color: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.window.broken {
  transform: skew(2deg, 1deg);
  background-image: linear-gradient(rgba(10, 10, 14, 0.85), rgba(50, 0, 0, 0.4));
  box-shadow: 0 8px 32px rgba(139, 0, 0, 0.4);
}

.window.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

.window.active.broken {
  transform: skew(2deg, 1deg) scale(1);
}

.window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  cursor: move;
}

.window-title {
  font-size: 14px;
  font-weight: 500;
}

.window-controls {
  display: flex;
  gap: 8px;
}

.window-button {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
}

.window-close {
  background-color: #8b0000;
}

.window-minimize {
  background-color: #8b4500;
}

.window-maximize {
  background-color: #4a0419;
}

.window-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  max-height: calc(100% - 40px);
}

#taskbar {
  height: 40px;
  background-color: rgba(10, 5, 10, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  padding: 0 15px;
  justify-content: space-between;
  box-shadow: 0 -2px 10px rgba(139, 0, 0, 0.4);
}

#start-button {
  padding: 5px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

#start-button:hover {
  background-color: var(--menu-hover);
}

#start-button img {
  width: 20px;
  height: 20px;
}

#start-menu {
  position: absolute;
  bottom: 45px;
  left: 10px;
  width: 250px;
  background-color: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  padding: 10px;
  display: none;
  z-index: 1000;
}

.start-menu-item {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.start-menu-item:hover {
  background-color: var(--menu-hover);
}

.start-menu-item img {
  width: 24px;
  height: 24px;
}

.taskbar-icons {
  display: flex;
  gap: 10px;
}

.taskbar-icon {
  width: 24px;
  height: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.taskbar-icon:hover {
  transform: scale(1.1);
}

#clock {
  font-size: 13px;
}

/* Conversation window styling */
.conversation-window {
  width: 80%;
  max-width: 800px;
  height: 70%;
  max-height: 600px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
}

.conversation-window.active {
  transform: translate(-50%, -50%) scale(1);
}

.conversation-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.conversation-header {
  padding: 10px 15px;
  background-color: rgba(30, 10, 15, 0.8);
  border-radius: 5px 5px 0 0;
}

.layer-title {
  font-size: 18px;
  margin-bottom: 5px;
  color: var(--secondary-color);
}

.conversation-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: fadeIn 0.5s;
}

.speaker {
  font-weight: 600;
  color: var(--secondary-color);
}

.message {
  padding: 10px 15px;
  background-color: rgba(40, 10, 15, 0.7);
  border-radius: 5px;
  max-width: 90%;
  align-self: flex-start;
  line-height: 1.4;
}

.dialog.player .message {
  align-self: flex-end;
  background-color: rgba(60, 10, 20, 0.7);
}

.conversation-nav {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background-color: rgba(30, 10, 15, 0.8);
  border-radius: 0 0 5px 5px;
}

.nav-button {
  padding: 8px 15px;
  background-color: var(--primary-color);
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-button:hover {
  background-color: var(--secondary-color);
}

.nav-button:disabled {
  background-color: #444;
  cursor: not-allowed;
}

.endings-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px 0;
}

.ending-button {
  padding: 8px 15px;
  background-color: var(--accent-color);
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

.ending-button:hover {
  background-color: var(--secondary-color);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.glitch-effect {
  animation: glitch 2s infinite;
  position: relative;
}

@keyframes glitch {
  0% { transform: none; opacity: 1; }
  7% { transform: skew(-0.5deg, -0.9deg); opacity: 0.75; }
  10% { transform: none; opacity: 1; }
  27% { transform: none; opacity: 1; }
  30% { transform: skew(0.8deg, -0.1deg); opacity: 0.9; }
  35% { transform: none; opacity: 1; }
  52% { transform: none; opacity: 1; }
  55% { transform: skew(-1deg, 0.2deg); opacity: 0.8; }
  60% { transform: none; opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.nightmare-glitch {
  animation: nightmareGlitch 0.8s infinite;
  position: relative;
  text-shadow: 0 0 5px red;
}

@keyframes nightmareGlitch {
  0% { transform: none; opacity: 1; text-shadow: 2px 0 1px rgba(255,0,0,0.5), -2px 0 1px rgba(0,0,255,0.5); }
  25% { transform: translate(-2px, 1px); opacity: 0.75; text-shadow: -2px 0 1px rgba(255,0,0,0.5), 2px 0 1px rgba(0,0,255,0.5); }
  40% { transform: translate(2px, -1px); opacity: 0.9; text-shadow: 2px 0 1px rgba(255,0,0,0.5), -2px 0 1px rgba(0,0,255,0.5); }
  60% { transform: translate(-1px, -1px); opacity: 0.8; text-shadow: -2px 0 1px rgba(255,0,0,0.5), 2px 0 1px rgba(0,0,255,0.5); }
  80% { transform: translate(1px, 1px); opacity: 1; text-shadow: 2px 0 1px rgba(255,0,0,0.5), -2px 0 1px rgba(0,0,255,0.5); }
  100% { transform: none; opacity: 1; text-shadow: 2px 0 1px rgba(255,0,0,0.5), -2px 0 1px rgba(0,0,255,0.5); }
}

.severe-glitch {
  animation: severeGlitch 0.3s infinite;
  display: inline-block;
}

@keyframes severeGlitch {
  0% { transform: none; }
  20% { transform: translate(-4px, 2px) skew(10deg); }
  40% { transform: translate(4px, -2px) skew(-5deg); }
  60% { transform: translate(-2px, -2px) skew(-10deg); }
  80% { transform: translate(2px, 2px) skew(5deg); }
  100% { transform: none; }
}

.blood-drip {
  position: relative;
}

.blood-drip::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 15px;
  background: var(--blood-color);
  animation: drip 4s infinite;
}

@keyframes drip {
  0% { height: 0; opacity: 0; }
  20% { height: 0; opacity: 1; }
  60% { height: 15px; opacity: 1; }
  80% { height: 25px; opacity: 0; }
  100% { height: 0; opacity: 0; }
}

.butterfly {
  position: absolute;
  pointer-events: none;
  z-index: 999;
  opacity: 0.7;
  transition: all 0.5s;
}

.corrupted-butterfly {
  filter: hue-rotate(180deg) contrast(1.5) drop-shadow(0 0 5px red);
  animation: flicker 4s infinite;
}

@keyframes flicker {
  0% { opacity: 0.7; }
  5% { opacity: 0.2; }
  10% { opacity: 0.7; }
  15% { opacity: 0.2; }
  20% { opacity: 0.7; }
  100% { opacity: 0.7; }
}

#notification {
  position: absolute;
  bottom: 60px;
  right: 20px;
  background-color: var(--window-bg);
  border: 1px solid var(--window-border);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  max-width: 300px;
  transform: translateY(150%);
  transition: transform 0.3s;
  z-index: 1000;
}

#notification.show {
  transform: translateY(0);
}

.notification-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: var(--secondary-color);
}

#jumpscare {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#jumpscare.active {
  opacity: 1;
}

#jumpscare img {
  max-width: 90%;
  max-height: 90%;
  transform: scale(0.8);
  animation: jumpscareAnim 0.3s forwards;
}

@keyframes jumpscareAnim {
  0% { transform: scale(0.8); }
  100% { transform: scale(1.1); }
}

.blood-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: url('blood_overlay.png');
  background-size: cover;
  opacity: 0;
  z-index: 100;
  transition: opacity 3s;
}

.blood-overlay.visible {
  opacity: 0.2;
}

.static-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('noise.png');
  background-size: cover;
  opacity: 0.05;
  pointer-events: none;
  z-index: 50;
}

.vhs-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 49;
}

#vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 48;
}

/* Hidden eyes that appear randomly */
.hidden-eye {
  position: absolute;
  width: 30px;
  height: 15px;
  background: radial-gradient(circle at center, #ff0000 30%, transparent 70%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
  z-index: 200;
  animation: eyeBlink 3s forwards;
}

@keyframes eyeBlink {
  0% { opacity: 0; }
  10% { opacity: 0.7; }
  20% { opacity: 0; }
  30% { opacity: 0.7; }
  40% { opacity: 0; }
  50% { opacity: 0.7; }
  95% { opacity: 0.7; }
  100% { opacity: 0; }
}

#monitor-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 47;
  background: radial-gradient(
    ellipse at center,
    rgba(10, 10, 10, 0) 0%,
    rgba(10, 10, 10, 0.2) 80%,
    rgba(10, 10, 10, 0.8) 100%
  );
}

/* Adding sound controls */
#audio-controls {
  position: fixed;
  bottom: 60px;
  left: 20px;
  background-color: var(--window-bg);
  border: 1px solid var(--window-border);
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.8;
  transition: opacity 0.3s;
}

#audio-controls:hover {
  opacity: 1;
}

.audio-button {
  background-color: var(--primary-color);
  border: none;
  color: var(--text-color);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.audio-button:hover {
  background-color: var(--secondary-color);
}

.audio-status {
  font-size: 12px;
}