/* === BOOT & REBOOT STYLES === */
#boot-overlay, #reboot-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  z-index: 100000; cursor: none;
  background: rgba(0,0,0,1);
}
#boot-overlay .boot-text { font-family: 'Courier New', monospace; color:#00ff00; font-size:28px; text-shadow:0 0 6px #00ff00; }
#reboot-overlay { display:none; opacity:0; }
#reboot-overlay .reboot-text { font-family:'Courier New', monospace; color:#ff0000; font-size:32px; text-shadow:0 0 8px #ff0000; }
#boot-overlay.hidden { animation: flicker-out 1.5s forwards ease-in-out; }
#reboot-overlay.visible { display:flex; animation: fade-in 0.8s forwards ease; }
#reboot-overlay.hidden { animation: flicker-out 1.2s forwards ease-in-out; }
@keyframes fade-in { from { opacity:0 } to { opacity:1 } }
@keyframes flicker-out {
  0%{opacity:1} 20%{opacity:.8} 30%{opacity:1} 50%{opacity:.4} 60%{opacity:.9} 80%{opacity:.2} 100%{opacity:0;visibility:hidden}
}

/* === BASE / BACKGROUNDS / SPOTLIGHT / CRT === */
html, body { height:100%; margin:0; padding:0; cursor:none; font-family: Arial, sans-serif; overflow: hidden; }
body {
  background: url("Backgrounds/main_bg.jpg") center center fixed;
  background-size: 150% 150%;
  transition: background-position .12s linear, background-size .3s ease;
  background-color: black;
}
body.secret-mode {
  background: url("Backgrounds/Weak.gif") center center fixed;
  background-size: 150% 150%;
}
body::before {
  content: "";
  position: fixed; top:0; left:0; width:100%; height:100%;
  pointer-events:none;
  background: radial-gradient(circle at var(--mouse-x,50%) var(--mouse-y,50%),
    rgba(255,255,255,0.08) 100px,
    rgba(0,0,0,0.85) 420px);
  z-index: 30;
}
body::after {
  content:""; position:fixed; top:0; left:0; width:100%; height:100%;
  pointer-events:none;
  background:
    repeating-linear-gradient(to bottom,
      rgba(0,0,0,0.12) 0px,
      rgba(0,0,0,0.12) 2px,
      transparent 2px,
      transparent 4px),
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.7) 100%);
  z-index: 50;
  animation: crt-flicker 0.06s infinite alternate;
  opacity: 1;
  transition: background 25s linear;
}
@keyframes crt-flicker { 0%{opacity:0.82;filter:brightness(.95);} 25%{opacity:0.95;filter:brightness(1.05);} 50%{opacity:1;filter:brightness(.9);} 75%{opacity:0.92;filter:brightness(1.08);} 100%{opacity:0.86;filter:brightness(.9);} }

body.rampage-mode::after {
  background:
    repeating-linear-gradient(to bottom,
      rgba(0,0,0,0.12) 0px,
      rgba(0,0,0,0.12) 2px,
      transparent 2px,
      transparent 4px),
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.98) 100%);
}


/* === RETRO CURSOR === */
#retro-cursor {
  position: fixed;
  width: 26px; height: 26px;
  background: url('UntitledAssets/retro-cursor2.png') no-repeat center center;
  background-size: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 99999;
}

/* === DESKTOP ICONS === */
#desktop {
  position: relative;
  width: 100%;
  height: calc(100% - 44px);
  padding: 10px;
  box-sizing: border-box;
}
.icon {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width:100px; height:100px; user-select:none; cursor:pointer;
  transition: filter 0.2s ease-out; /* Makes the flash dim smoothly */
  z-index: 10;
}
.icon img { width:80px; height:80px; display:block; }
.icon span { margin-top:6px; color:#fff; text-shadow:1px 1px 2px #000; font-size:12px; }
.icon.active-flash {
  filter: brightness(1.8) drop-shadow(0 0 5px rgba(255, 255, 100, 0.7));
  transition: filter 0.1s ease-out;
}
#icon1 { top: 10px; left: 10px; }
#icon2 { top: 10px; left: 120px; }
#icon3 { top: 10px; left: 230px; }
#icon4 { top: 130px; left: 10px; }
#icon5 { top: 130px; left: 120px; }
#icon6 { top: 250px; left: 10px; }
#icon7 { bottom: 54px; right: 120px; }
#icon8 { bottom: 54px; right: 230px; }
#icon9 {
  position: absolute;
  top: 50%; left: 50%;
  z-index:70; display:none; opacity:0; pointer-events:none;
}
@keyframes glitchy-appear {
  0%{ opacity:0; transform:translate(-50%,-50%) skewX(-8deg) }
  100%{ opacity:1; transform:translate(-50%,-50%) skewX(0deg) }
}

/* === DESKTOP PETS === */
#parallax-container {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1;
  transition: transform 0.12s linear;
}
.desktop-pet {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}
.desktop-pet.interactive {
  pointer-events: auto;
  cursor: pointer;
}
#pet-house {
  background-image: url('Pets/House.gif');
  width: 500px; height: 500px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
#pet-sun {
  background-image: url('Pets/Sun.gif');
  width: 180px; height: 180px;
  position: fixed;
  top: 20px; right: 20px;
  z-index: 2;
}
#pet-humanoid {
  background-image: url('UntitledAssets/PLACEHOLDER.png');
  width: 250px; height: 450px;
  position: fixed;
  bottom: 10px;
  right: 500px;
  z-index: 11;
}
body.secret-mode #pet-humanoid { background-image: url('UntitledAssets/PLACEHOLDER2.png'); }
body.secret-mode #pet-house,
body.secret-mode #pet-sun { display: none; }
#pet-house.talking { background-image: url('Pets/HouseYappin.gif'); }
#pet-sun.talking { background-image: url('Pets/SunTalking.gif'); }

/* === WINDOWS / POPUPS === */
.window {
  position: absolute;
  width: 420px; height: 320px;
  background: #fff;
  border: 2px solid #000;
  display:none;
  z-index: 55;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  resize: both;
  overflow: auto;
  min-width: 200px; min-height: 150px;
}
.window-header { background:#222; color:#fff; padding:6px 8px; display:flex; align-items:center; justify-content:space-between; cursor:grab; user-select:none; }
.window-header span { flex-grow: 1; }
.window-content { padding:12px; height: calc(100% - 40px); overflow:auto; color:#222; }
.close-btn, .minimize-btn {
  background: #C0C0C0;
  border: 2px outset #FFFFFF;
  border-right-color: #808080;
  border-bottom-color: #808080;
  color: #000;
  font-weight: bold;
  cursor: pointer;
  width: 24px; height: 24px;
  display: flex;
  align-items: center; justify-content: center;
  margin-left: 4px; padding: 0;
  font-family: 'Pixelated MS Sans Serif', 'MS Sans Serif', Arial, sans-serif;
  font-size: 16px; line-height: 1;
}
.close-btn { font-size: 18px; line-height: 1; }
.minimize-btn { font-size: 20px; line-height: 0.5; }
.close-btn:active, .minimize-btn:active {
  border: 2px inset #808080;
  border-left-color: #FFFFFF;
  border-top-color: #FFFFFF;
}
#lightbox { z-index: 9999; }
.window.minimized { display: none !important; }
.window-content img { max-width: 100%; height: auto; }

/* === HUMANOID DIALOGUE WINDOW === */
#humanoid-dialogue-content { display: flex; flex-direction: column; gap: 8px; background: #f0f0f0; color: #000; }
.dialogue-button { width: 100%; padding: 10px; text-align: left; background: #C0C0C0; border: 2px outset #FFFFFF; border-right-color: #808080; border-bottom-color: #808080; cursor: pointer; }
.dialogue-button:active { border-style: inset; }

/* === TASKBAR === */
#taskbar { position: fixed; bottom:0; left:0; width:100%; height:44px; background:#ebae8e; display:flex; align-items:center; padding:0 10px; z-index:10; border-top:2px solid #555; }
.taskbar-start button { background:#ebae8e; border:1px solid #555; color:#fff; padding:6px 10px; cursor:pointer; font-weight:bold; }
#taskbar-windows { display:flex; align-items:center; gap:6px; flex-grow: 1; margin-left: 10px; }
.taskbar-window-button {
  width: 40px; height: 36px; padding:4px;
  background: #C0C0C0;
  border: 2px outset #FFFFFF;
  border-right-color: #808080;
  border-bottom-color: #808080;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.taskbar-window-button:active { border: 2px inset #808080; border-left-color: #FFFFFF; border-top-color: #FFFFFF; background: #A0A0A0; }
.taskbar-window-button img { max-width:100%; max-height:100%; display:block; }
#taskbar-clock {
  font-family: 'Courier New', monospace;
  color: #00ff00; background: #000;
  border: 2px inset #555;
  margin-left: auto; margin-right: 5px;
  height: 32px; padding: 0 10px;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}

/* === CALCULATOR STYLES === */
.calculator { width: 260px; padding: 10px; background: #111; border-radius: 8px; color: limegreen; font-family: monospace; margin: 20px auto; }
.calc-display { width: calc(100% - 12px); height: 40px; margin-bottom: 10px; background-color: #0a0a0a; color: #00ff00; border: 1px solid #00ff00; text-align: right; font-size: 1.2em; padding: 5px; box-sizing: border-box; }
.calc-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.calc-buttons button { background: #222; border: 1px solid limegreen; color: limegreen; padding: 10px; font-size: 1.1em; cursor: pointer; transition: background 0.1s ease; }
.calc-buttons button:hover { background: #333; }
.calc-buttons .clear { grid-column: span 4; background: darkred; color: white; }

/* === START MENU STYLES === */
#start-menu .window-content { padding: 4px; background: #C0C0C0; font-family: 'MS Sans Serif', Arial, sans-serif; font-size: 14px; height: 100%; box-sizing: border-box; }
#start-menu ul { list-style: none; margin: 0; padding: 0; }
#start-menu li { padding: 5px 10px; display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
#start-menu li:hover { background: #000080; color: #FFFFFF; }
#start-menu li img { width: 24px; height: 24px; }
#start-menu li[data-app-id="reboot-option"]:hover { background: #A00000; color: #FFFFFF; }

/* === RAMPAGE MODE STYLES === */
body.rampage-glitch {
  animation: rampage-shake 0.05s infinite alternate;
}
@keyframes rampage-shake {
  0% { transform: translate(0, 0) skew(-2deg, 0); }
  100% { transform: translate(4px, -2px) skew(0, 5deg); }
}

/* MODIFIED: Added animation to .rampage-art */
.rampage-art {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 50vmin !important;
  height: 50vmin !important;
  resize: none !important;
  animation: slow-grow 3s ease-out forwards;
}

.rampage-art .window-header .close-btn,
.rampage-art .window-header .minimize-btn {
  display: none !important;
}
.glitch-clone {
  position: fixed;
  z-index: 40;
  background-size: cover;
  background-position: center;
  border: 2px solid white;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
  opacity: 0.8;
  transition: top 0.2s linear, left 0.2s linear;
}

/* ADDED: Keyframes for the slow-grow animation */
@keyframes slow-grow {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}


/* === UNLOCKED APP STYLES === */
#icon10 { }

#icon10.unlocked {
  display: flex !important;
  animation: unlocked-appear 1s ease-out;
}

@keyframes unlocked-appear {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === WINDOW HEADER GLITCH STYLES === */
.window-header span.header-glitch {
  color: #ff5a5a; /* The red color */
  text-shadow:
    0 0 6px rgba(255,90,90,0.7),
    -1px 0 1px rgba(0,0,0,0.6);
  display: inline-block;
  transform-origin: center;
  animation: header-jitter 120ms linear;
}

#player-captions {
  position: fixed;
  bottom: 12%; /* Positions it near the bottom like movie subs */
  left: 50%;
  transform: translateX(-50%);
  z-index: 200000; 
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 25px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 20px;
  text-align: center;
  border-radius: 4px;
  pointer-events: none; /* So it doesn't block mouse clicks */
  text-shadow: 2px 2px 0px #000;
  max-width: 80%;
  border: 1px solid rgba(255,255,255,0.2);
}

@keyframes header-jitter {
  0% { transform: translateX(0px) translateY(0px) rotate(0deg); }
  25% { transform: translateX(-1px) translateY(0px) rotate(-0.6deg); }
  50% { transform: translateX(1px) translateY(-1px) rotate(0.6deg); }
  75% { transform: translateX(-1px) translateY(1px) rotate(-0.4deg); }
  100% { transform: translateX(0px) translateY(0px) rotate(0deg); }
}