:root {
  color-scheme: dark;
  --bg: #070807;
  --panel: #111310;
  --ink: #d9ddd2;
  --muted: #7d8279;
  --acid: #b6ff31;
  --cyan: #00ece0;
  --magenta: #ff2aa1;
  --red: #ff3b24;
  --line: #41473d;
  --mono: "Courier New", Consolas, monospace;
}

* { box-sizing: border-box; }
::selection { color: #050605; background: var(--acid); }
html { background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 18%, #161a15 0, var(--bg) 50%);
  color: var(--ink);
  font-family: var(--mono);
  cursor: default;
}
button, input { font: inherit; }
button, a, [data-file] { cursor: pointer; }
.is-hidden { visibility: hidden; }

.noise, .scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}
.noise {
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.scanlines {
  opacity: .16;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.45) 3px 4px);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: #010201;
  color: #b8ff72;
}
.boot__screen { width: min(860px, calc(100vw - 36px)); min-height: 520px; padding: 28px; border: 1px solid #24401d; box-shadow: inset 0 0 80px #071206, 0 0 60px #000; }
.boot__brand { color: #6b9b53; border-bottom: 1px solid #24401d; padding-bottom: 12px; }
.boot__log { min-height: 390px; line-height: 1.55; font-size: clamp(13px, 2vw, 17px); }
.boot__log p { margin: 0; animation: line-in .1s both; }
.boot__log .fatal { color: var(--red); font-weight: 700; }
.boot__skip { float: right; }

.os { width: min(1460px, 100%); margin: auto; padding: 14px; transition: filter .12s, transform .12s; }
.statusbar { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 9px 12px; border: 1px solid var(--line); background: #0b0d0a; font-size: 12px; text-transform: uppercase; }
.statusbar strong { color: var(--acid); }
.warning { color: var(--red); }

.hero { display: grid; grid-template-columns: minmax(340px, .92fr) 1.08fr; gap: clamp(28px, 5vw, 86px); align-items: center; min-height: 70vh; padding: clamp(28px, 6vw, 90px) 3vw; }
.ape-frame { position: relative; border: 1px solid #697064; padding: 33px 8px 8px; background: #bdbdbd; box-shadow: 11px 11px 0 #000; transform: rotate(-.45deg); }
.ape-frame__title { position: absolute; top: 6px; left: 7px; right: 7px; padding: 5px 8px; color: #fff; background: #000080; font-size: 12px; white-space: nowrap; overflow: hidden; }
.ape-frame img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #222; filter: contrast(1.06); }
.ape-frame__label { display: block; padding: 8px 4px 2px; color: #111; font-size: 11px; }
.eyebrow { color: var(--cyan); font-size: 12px; letter-spacing: .18em; }
h1 { position: relative; max-width: 780px; margin: 18px 0 14px; color: #eceee9; font-size: clamp(42px, 6.4vw, 96px); line-height: .87; letter-spacing: -.075em; text-transform: uppercase; text-shadow: 3px 0 0 rgba(255,42,161,.5), -3px 0 0 rgba(0,236,224,.45); }
.ticker { display: inline-block; margin: 12px 0 18px; color: #050605; background: var(--acid); padding: 7px 12px; font-size: clamp(24px, 3vw, 42px); font-weight: 900; transform: rotate(1.5deg); }
.cursor { animation: blink .8s steps(1) infinite; }
.hero-copy__note { max-width: 540px; color: var(--muted); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.sys-button { border: 2px solid #d6d6d6; border-right-color: #3a3a3a; border-bottom-color: #3a3a3a; border-radius: 0; padding: 10px 16px; color: #111; background: #bdbdbd; box-shadow: 2px 2px 0 #000; cursor: pointer; }
.sys-button:active { border-color: #3a3a3a #d6d6d6 #d6d6d6 #3a3a3a; transform: translate(2px,2px); box-shadow: none; }
.sys-button--danger { color: #fff; background: #980e00; }

.terminal-shell { margin: 0 3vw 60px; border: 2px solid #d1d1d1; border-right-color: #353535; border-bottom-color: #353535; background: #000; box-shadow: 12px 12px 0 rgba(0,0,0,.65); }
.window-title { display: flex; justify-content: space-between; padding: 7px 9px; color: #fff; background: #000080; font-weight: 700; }
.terminal { height: 210px; overflow: auto; padding: 16px; color: #aef58d; font-size: 13px; line-height: 1.55; }
.terminal p { margin: 0 0 4px; }
.terminal__prompt { color: #fff; }
.terminal-input { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid #234320; color: var(--acid); }
.terminal-input input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--acid); background: transparent; caret-color: var(--acid); }

.corruption-meter { height: 4px; border: 1px solid #242820; border-top: 0; background: #020302; overflow: hidden; }
.corruption-meter i { display: block; width: 87%; height: 100%; background: linear-gradient(90deg, var(--acid), #d8ff23 70%, var(--red)); box-shadow: 0 0 8px var(--acid); transition: width .3s linear; }
.statusbar__sound { margin-left: auto; border: 0; padding: 0; color: var(--cyan); background: none; cursor: pointer; }
.press-count { margin-top: 15px; color: #656b61; font-size: 11px; }
.press-count span { color: var(--red); }

.broadcast-window { margin: 0 3vw 34px; overflow: hidden; border: 2px solid #d1d1d1; border-right-color: #353535; border-bottom-color: #353535; background: #020302; box-shadow: 12px 12px 0 rgba(0,0,0,.65); }
.broadcast-window img { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover; }
.broadcast-window__status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; padding: 7px 10px; border-top: 1px solid #2f362d; color: #788073; font-size: 10px; }
.desktop-window { position: relative; touch-action: auto; }
.desktop-window.is-focused { outline: 1px solid rgba(182,255,49,.25); }
.drag-handle { cursor: move; user-select: none; touch-action: none; }
.window-controls { display: inline-flex; gap: 3px; }
.window-controls button { min-width: 23px; height: 21px; border: 1px solid #fff; border-right-color: #222; border-bottom-color: #222; color: #111; background: #c0c0c0; line-height: 15px; }
.desktop-window.is-minimized > :not(.window-title):not(.ape-frame__title) { display: none !important; }
.desktop-window.is-minimized { min-height: 0 !important; height: auto !important; }
.ape-frame.is-minimized { padding: 33px 8px 8px; }

.system-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(310px, .6fr); gap: 22px; margin: 0 3vw 60px; }
.system-grid__terminal { grid-row: span 1; margin: 0; }
.retro-window { border: 2px solid #dedede; border-right-color: #282828; border-bottom-color: #282828; color: #111; background: #bdbdbd; box-shadow: 9px 9px 0 rgba(0,0,0,.6); }
.file-menu { display: flex; gap: 20px; padding: 5px 9px; border-bottom: 1px solid #777; font-size: 12px; }
.file-tree { min-height: 246px; padding: 12px; background: #e5e5e5; font-size: 12px; }
.file-tree p { margin: 7px 0 2px; font-weight: 700; }
.file-tree button { display: block; width: 100%; border: 0; padding: 4px 6px 4px 20px; color: #111; background: transparent; text-align: left; cursor: pointer; }
.file-tree button:hover, .file-tree button:focus-visible { color: #fff; background: #000080; outline: 0; }
.file-tree em { color: #980e00; font-style: normal; }
.system-info { padding-bottom: 14px; }
.system-info dl { margin: 0; padding: 13px 15px; }
.system-info dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px; padding: 7px 0; border-bottom: 1px dotted #6e6e6e; }
.system-info dt { color: #555; }
.system-info dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.system-info .sys-button { margin-left: 15px; }
.network-links { position: relative; padding: 20px; border: 1px dashed #474d42; background: #0a0c09; }
.network-links::before { content: ""; position: absolute; inset: 6px; border: 1px solid #191d17; pointer-events: none; }
.network-links__title { position: relative; margin-top: 0; color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.network-links div { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.network-links a { padding: 10px; border: 1px solid #394136; color: var(--ink); text-decoration: none; }
.network-links a:hover { color: #020302; background: var(--acid); }
.network-links > p:last-child { position: relative; margin-bottom: 0; color: var(--muted); font-size: 11px; }
.network-links button { border: 0; color: var(--cyan); background: none; cursor: copy; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 16px 3vw 28px; border-top: 1px solid #292d27; color: #5d6259; font-size: 10px; }
footer button { border: 0; color: #8ca17d; background: none; cursor: pointer; font: inherit; }
footer button:hover { color: var(--acid); }

.popup-layer { position: fixed; right: 18px; bottom: 18px; z-index: 55; display: grid; gap: 12px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.window-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.file-popup-window { position: absolute; width: min(520px, calc(100vw - 24px)); min-width: 290px; pointer-events: auto; border: 2px solid #fff; border-right-color: #252525; border-bottom-color: #252525; color: #111; background: #c0c0c0; box-shadow: 12px 12px 0 rgba(0,0,0,.58); }
.file-popup-window .window-title { cursor: move; user-select: none; }
.file-popup-window__body { padding: 16px; }
.file-popup-window pre { max-height: 52vh; margin: 0 0 14px; padding: 14px; overflow: auto; border: 2px inset #fff; color: #111; background: #f3f0e7; white-space: pre-wrap; font: 13px/1.55 var(--mono); }
.file-popup-window__actions { display: flex; justify-content: flex-end; gap: 8px; }
.checklist { display: grid; gap: 7px; margin: 12px 0; }
.system-popup { pointer-events: auto; border: 2px solid #fff; border-right-color: #262626; border-bottom-color: #262626; color: #111; background: #c0c0c0; box-shadow: 9px 9px 0 rgba(0,0,0,.6); animation: popup-in .16s steps(2); }
.system-popup .window-title { font-size: 12px; }
.system-popup__body { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; padding: 16px; font-size: 12px; }
.system-popup__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: #b40000; font-size: 26px; font-weight: 700; }
.system-popup__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 14px; }
.system-popup__close, .window-title button { border: 1px solid #fff; border-right-color: #222; border-bottom-color: #222; color: #111; background: #c0c0c0; cursor: pointer; }

.retro-dialog { width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 24px); margin: auto; padding: 0; overflow: auto; border: 3px solid #fff; border-right-color: #262626; border-bottom-color: #262626; border-radius: 0; color: #111; background: #c0c0c0; box-shadow: 16px 16px 0 rgba(0,0,0,.65); }
.retro-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(2px); }
.dialog-body { padding: 18px; }
.dialog-body pre { min-height: 180px; margin: 10px 0; padding: 14px; overflow: auto; border: 2px inset #fff; color: #aef58d; background: #030503; white-space: pre-wrap; font: 13px/1.65 var(--mono); }
.scan-status { font-weight: 700; }
.scan-progress { height: 22px; border: 2px inset #fff; background: #343434; }
.scan-progress i { display: block; width: 0; height: 100%; background: repeating-linear-gradient(90deg, #000080 0 16px, transparent 16px 19px); transition: width .28s steps(4); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.certificate { position: relative; display: grid; place-items: center; gap: 10px; margin: 14px 0; padding: 24px 12px; border: 5px double #111; background: #d8d2b8; text-align: center; transform: rotate(-.5deg); }
.certificate::after { content: "404"; position: absolute; right: 18px; bottom: 8px; color: rgba(150,0,0,.22); font-size: 64px; font-weight: 900; transform: rotate(-16deg); }
.certificate strong { max-width: 100%; font-size: clamp(23px, 5vw, 36px); }
.certificate b { color: #8d0000; font-size: 24px; }
.lore-dialog { width: min(760px, calc(100vw - 24px)); }
.lore-dialog pre { min-height: 420px; color: #111; background: #f4f1e8; }

.critical-screen, .celebration { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; align-content: center; padding: 20px; color: #fff; background: #000; text-align: center; }
.fatal-window { width: min(660px, calc(100vw - 28px)); border: 3px solid #fff; border-right-color: #262626; border-bottom-color: #262626; color: #111; background: #c0c0c0; box-shadow: 16px 16px 0 rgba(255,0,0,.16); }
.fatal-window__body { padding: 28px; }
.fatal-window__body > strong { display: block; color: #111; font-size: clamp(20px, 4vw, 34px); }
.fatal-window pre { min-height: 72px; padding: 12px; color: #aef58d; background: #020302; text-align: left; white-space: pre-wrap; }
.return-prompt p { color: #8c0000; font-weight: 700; }
.return-prompt h2 { margin: 8px 0 20px; font-size: clamp(28px, 6vw, 56px); }
.return-prompt > div { display: flex; justify-content: center; gap: 20px; }
.monke-fullscreen { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; background: #000; animation: major-glitch .14s steps(2) infinite; }
.monke-fullscreen img { width: min(62vh, 82vw); border: 1px solid #333; }
.monke-fullscreen strong { margin-top: 12px; color: var(--acid); font-size: clamp(28px, 7vw, 92px); }
.reboot-log { width: min(760px, calc(100vw - 32px)); color: #b6ff78; background: #000; text-align: left; white-space: pre-wrap; font: clamp(13px, 2vw, 18px)/1.8 var(--mono); }
.celebration { background: repeating-linear-gradient(45deg, #000 0 20px, #26001b 20px 40px); animation: celebration .15s steps(2) infinite; }
.celebration p { color: var(--acid); }
.celebration strong { font-size: clamp(28px, 7vw, 84px); line-height: .92; }
.celebration span { margin-top: 24px; font-size: clamp(18px, 4vw, 36px); }
.celebration .sys-button { margin-top: 22px; }
.is-hidden { visibility: hidden !important; pointer-events: none !important; }

.banana-follower { position: fixed; z-index: 100; pointer-events: none; font-size: 30px; transform: translate(9px, 9px); }
.ape-ghost { position: fixed; z-index: 88; object-fit: cover; pointer-events: none; opacity: .68; filter: hue-rotate(90deg) saturate(2); mix-blend-mode: screen; }
body.monke-mode .ape-frame { transform: rotate(-2deg) scale(1.045); }
body.monke-mode .ape-frame img { filter: saturate(1.8) contrast(1.2); }
body.secret-specimen .ape-frame img { filter: invert(.12) hue-rotate(115deg) saturate(2) contrast(1.35); }
body.ui-tilt .os { transform: rotate(.7deg) scale(.985); }
body.glitch-minor .os { animation: minor-glitch .18s steps(2); }
body.glitch-major .os { animation: major-glitch .42s steps(3); filter: contrast(1.25) saturate(1.35); }
body.glitch-major h1, body.glitch-major .window-title { text-shadow: 7px 0 var(--magenta), -7px 0 var(--cyan); }
body.high-corruption .retro-window:nth-child(2n) { transform: translateX(2px); }
body.high-corruption .statusbar span:nth-child(3) { color: var(--magenta); }
body.corruption-stage-2 .cursor { animation-duration: .19s; }
body.corruption-stage-3 .window-title { text-shadow: 2px 0 var(--magenta), -2px 0 var(--cyan); }
body.corruption-stage-4 .ape-frame { overflow: visible; }
body.ape-escape .ape-frame img { position: relative; z-index: 4; transform: scale(1.07) translateX(-14px) !important; box-shadow: 12px 0 0 rgba(255,0,153,.35), -12px 0 0 rgba(0,236,224,.35); }
body.headline-duplicate h1::after { content: attr(data-text); position: absolute; inset: 5px 0 auto 8px; z-index: -1; color: var(--magenta); opacity: .75; clip-path: inset(35% 0 25% 0); }
body.system-frozen .os { pointer-events: none; filter: grayscale(1) contrast(1.3); }
body.system-frozen .cursor, body.system-frozen .os * { animation-play-state: paused !important; }
body.wait-cursor, body.wait-cursor * { cursor: wait !important; }
body.boot-crash .boot { animation: major-glitch .55s steps(3), flicker .08s steps(2) infinite; }

@keyframes popup-in { from { opacity: 0; transform: translate(28px, 12px); } }
@keyframes minor-glitch { 25% { transform: translateX(3px); filter: hue-rotate(30deg); } 60% { transform: translateX(-4px); } }
@keyframes major-glitch { 0% { transform: translate(0); } 20% { transform: translate(13px,-4px) skewX(1deg); } 40% { transform: translate(-9px,3px); clip-path: inset(12% 0 43% 0); } 60% { transform: translate(6px); clip-path: inset(62% 0 8% 0); } 100% { transform: none; clip-path: none; } }
@keyframes flicker { 50% { opacity: .6; } }
@keyframes celebration { 50% { filter: hue-rotate(80deg) invert(.15); transform: translateX(5px); } }

@keyframes line-in { from { opacity: 0; transform: translateX(-7px); } }
@keyframes blink { 50% { opacity: 0; } }
@media (max-width: 780px) {
  .os { padding: 8px; }
  .hero { grid-template-columns: 1fr; padding: 22px 6px 42px; gap: 28px; }
  .ape-frame { width: min(100%, 520px); margin: auto; }
  .hero-copy { text-align: center; }
  .hero-copy__note { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  h1 { font-size: clamp(38px, 14vw, 72px); }
  .terminal-shell { margin-inline: 0; }
  .broadcast-window { margin-inline: 0; }
  .system-grid { grid-template-columns: 1fr; margin-inline: 0; }
  .system-grid__terminal { order: -1; }
  .statusbar__sound { margin-left: 0; }
  .network-links div { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
  .popup-layer { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .desktop-window { left: 0 !important; top: 0 !important; z-index: auto !important; }
  .drag-handle { cursor: default; touch-action: auto; }
  .file-popup-window { left: 12px !important; right: 12px; top: 12vh !important; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
