/* ASCaiArt v2: late-'90s hacker desktop. Fonts are OFL bitmap-style faces, self-hosted. */
@font-face { font-family: "VT323"; src: url("webfonts/vt323.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("webfonts/pixelify-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Press Start 2P"; src: url("webfonts/press-start-2p.woff2") format("woff2"); font-display: swap; }

:root {
  --plat: #dcdcdc; --plat-hi: #ffffff; --plat-lo: #8a8a8a; --plat-dk: #555; --edge: #000;
  --accent: #6b5bff; --spark: #b49bff;
  --phos: #33ff66; --phos-dim: #17a63c; --term-bg: #020702;
  --ui: "Pixelify Sans", "Geneva", "Verdana", system-ui, sans-serif;
  --mono: "VT323", "Monaco", "Courier New", monospace;
  --pixel: "Press Start 2P", "VT323", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.4 var(--ui); color: #111; min-height: 100vh;
  background-color: #07040f;
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(107, 91, 255, 0.35), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(51, 255, 102, 0.16), transparent 60%),
    linear-gradient(rgba(51, 255, 102, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 255, 102, 0.06) 1px, transparent 1px);
  background-size: auto, auto, 24px 24px, 24px 24px;
  padding-bottom: 76px;
}
.skip { position: absolute; left: -999px; top: 30px; background: #000; color: var(--phos); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.sr-only, .offscreen { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; left: -9999px; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* menu bar */
.menubar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 2px; height: 28px; padding: 0 10px;
  background: linear-gradient(#f4f4f4, #d6d6d6); border-bottom: 1px solid #000; box-shadow: 0 1px 0 #fff inset;
  font: 600 14px var(--ui);
}
.mb-logo { width: 18px; height: 18px; margin-right: 8px; image-rendering: pixelated; }
.mb-item { background: none; border: 0; padding: 3px 9px; cursor: pointer; color: #000; border-radius: 0; }
.mb-item:hover, .mb-item:focus-visible { background: #2c2c8c; color: #fff; outline: none; }
.mb-spacer { flex: 1; }
.mb-online { font: 16px var(--mono); color: #0a6b28; margin-right: 12px; display: inline-flex; align-items: center; gap: 5px; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #1ddc4f; box-shadow: 0 0 6px #1ddc4f; display: inline-block; }
.mb-clock { font: 16px var(--mono); }

/* desktop layout */
.desktop { max-width: 1180px; margin: 0 auto; padding: 18px 14px; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.col-pal { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 44px; }

/* Platinum-ish windows */
.win {
  background: var(--plat); border: 1px solid var(--edge);
  box-shadow: inset 1px 1px 0 var(--plat-hi), inset -1px -1px 0 var(--plat-lo), 3px 3px 0 rgba(0, 0, 0, 0.55);
  min-width: 0;
}
.titlebar {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px; margin: 2px 2px 0;
  background: repeating-linear-gradient(#f8f8f8 0 1px, #b8b8b8 1px 2px) center / 100% 12px no-repeat, var(--plat);
  cursor: default; user-select: none; touch-action: none;
}
.titlebar.small { height: 16px; }
.wtitle { margin: 0 auto; padding: 0 10px; background: var(--plat); font: 700 14px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
.titlebar.small .wtitle { font-size: 11px; padding: 0 6px; }
.wbox { width: 13px; height: 13px; flex: none; background: linear-gradient(135deg, #fff, #aaa); border: 1px solid #333; box-shadow: inset 1px 1px 0 #fff; }
.titlebar.small .wbox { width: 10px; height: 10px; }
.win-body { padding: 14px 16px 16px; border-top: 1px solid var(--plat-lo); margin-top: 2px; }

/* hero */
.hero { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.logo-slot { width: 72px; height: 72px; flex: none; display: grid; place-items: center; }
.logo-slot img { width: 72px; height: 72px; image-rendering: pixelated; }
.brand { margin: 0; font: 400 clamp(20px, 4.2vw, 34px)/1.2 var(--pixel); color: #111; text-shadow: 2px 2px 0 var(--spark); letter-spacing: 0.02em; }
.spark { color: var(--accent); margin-right: 6px; display: inline-block; animation: twinkle 1.6s ease-in-out infinite; text-shadow: none; }
.tagline { margin: 6px 0 0; font: 22px/1.1 var(--mono); color: #222; }
.ai-word { color: var(--accent); background: linear-gradient(90deg, #6b5bff, #ff4fd8, #33ff66, #6b5bff); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 3s linear infinite; }
.blink { animation: blink 1s steps(1) infinite; }
.new { font: 12px var(--pixel); color: #fff; background: #d10000; padding: 2px 5px; vertical-align: middle; }

/* input */
.q-label { display: block; font: 20px var(--mono); margin-bottom: 4px; color: #222; }
.typebox { position: relative; background: #000; border: 1px solid #000; box-shadow: inset 2px 2px 0 #333, 1px 1px 0 #fff; }
.typebox input, .ghost {
  font: 34px/1.2 var(--mono); padding: 8px 14px; border: 0; width: 100%; margin: 0; letter-spacing: 0.02em;
}
.ghost { position: absolute; inset: 0; white-space: pre; overflow: hidden; pointer-events: none; color: transparent; }
.g-suggest { color: #1f7a3a; }
.typebox input { position: relative; background: transparent; color: var(--phos); outline: none; padding-right: 96px; caret-color: var(--phos); text-shadow: 0 0 6px rgba(51, 255, 102, 0.45); }
.typebox:focus-within { box-shadow: inset 2px 2px 0 #333, 0 0 0 2px var(--accent); }
.typebox input::placeholder { color: #1b5e2e; }
.pbtn, .chip {
  font: 600 14px var(--ui); color: #000; cursor: pointer; border: 1px solid #000; border-radius: 4px;
  background: linear-gradient(#fdfdfd, #cfcfcf); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #9a9a9a; min-height: 36px; padding: 5px 12px;
}
.pbtn:active, .chip:active { background: linear-gradient(#9a9a9a, #c4c4c4); box-shadow: inset 1px 1px 0 #666; }
.accept { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.hint { font-size: 13px; color: #333; margin: 6px 0 0; }
kbd { font: 15px var(--mono); border: 1px solid #555; border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: #fff; }

.ai-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font: 20px var(--mono); flex-wrap: wrap; }
.ai-badge { font: 10px var(--pixel); color: #fff; background: linear-gradient(90deg, #6b5bff, #ff4fd8); padding: 4px 6px; border: 1px solid #000; }
.ai-guess { color: #000; min-width: 4ch; }
.ai-guess.pop { animation: pop 0.35s ease-out; }
.meter { width: 120px; height: 12px; background: #000; border: 1px solid #000; box-shadow: inset 1px 1px 0 #333; position: relative; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: repeating-linear-gradient(90deg, var(--phos) 0 6px, #0b4 6px 8px); transition: width 0.12s; }
.ai-conf { color: #333; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 36px; }

/* terminal */
.term-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--plat-lo); margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid #000; border-radius: 4px; overflow: hidden; box-shadow: 1px 1px 0 #fff; }
.seg label { position: relative; padding: 4px 10px; cursor: pointer; font: 600 13px var(--ui); background: linear-gradient(#fdfdfd, #cfcfcf); border-right: 1px solid #777; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: #2c2c8c; color: #fff; }
.seg label:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }

.stage {
  --ink: var(--phos); --stage-bg: var(--term-bg);
  position: relative; margin: 0 10px; background: var(--stage-bg); color: var(--ink); border: 1px solid #000;
  box-shadow: inset 2px 2px 0 #222, inset 0 0 40px rgba(0, 0, 0, 0.9);
  min-height: 300px; padding: 16px 10px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px); }
.pic-wrap { margin: 0; width: 100%; display: flex; justify-content: center; }
.art { margin: 0; font-family: var(--mono); line-height: 1; white-space: pre; font-size: 16px; max-width: 100%; overflow-x: auto; color: var(--ink); text-shadow: 0 0 5px color-mix(in srgb, var(--ink) 55%, transparent); }
.art.inv { background: var(--ink); color: var(--stage-bg); text-shadow: none; padding: 6px 8px; }
.banner { opacity: 0.92; }
.empty { font: 22px var(--mono); color: var(--ink); margin: 0; }
.cursor { animation: blink 1s steps(1) infinite; }
.statusbar { display: flex; justify-content: space-between; gap: 10px; padding: 5px 12px 7px; font: 17px var(--mono); color: #222; }
.perf { color: #555; }

/* looks */
body.look-amber .stage { --ink: #ffb000; --stage-bg: #0a0600; }
body.look-amber .typebox input { color: #ffb000; caret-color: #ffb000; text-shadow: 0 0 6px rgba(255, 176, 0, 0.45); }
body.look-amber .g-suggest { color: #7a5500; }
body.look-ice .stage { --ink: #7fe8ff; --stage-bg: #00070a; }
body.look-rgb .stage { --ink: #e8e8ff; --stage-bg: #050505; }
body.l33t .tagline, body.l33t .q-label { letter-spacing: 0.04em; }
body.elite .stage { animation: hue 2.4s linear infinite; }
body.elite .brand { animation: hue 2.4s linear infinite; }

/* palettes (OneClick-style) */
.palette .pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 4px 6px 6px; border: 1px solid #000; }
.cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 4px 2px;
  background: linear-gradient(#fafafa, #d2d2d2); border: 0; border-right: 1px solid #888; border-bottom: 1px solid #888;
  box-shadow: inset 1px 1px 0 #fff; cursor: pointer; font: 600 12px var(--ui); color: #000; position: relative; text-align: center;
}
.cell:active, .cell:has(input:checked) { background: linear-gradient(#2c2c8c, #4a4ab8); color: #fff; box-shadow: inset 1px 1px 0 #111; }
.cell input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cell:focus-within, .cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.ico { font: 20px/1 var(--mono); }
.toast { min-height: 22px; margin: 0 8px 6px; font: 18px var(--mono); color: #0a6b28; }
.pal-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.looks { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #000; }
.cell.sw { min-height: 48px; }
.swatch { width: 22px; height: 12px; border: 1px solid #000; display: block; }
.sw-green .swatch { background: #33ff66; } .sw-amber .swatch { background: #ffb000; }
.sw-rgb .swatch { background: linear-gradient(90deg, #f33, #3f3, #33f); } .sw-ice .swatch { background: #7fe8ff; }
.ctl { display: flex; flex-direction: column; gap: 3px; font: 600 13px var(--ui); }
.ctl.check { flex-direction: row; align-items: center; gap: 8px; }
.ctl input[type=checkbox] { width: 18px; height: 18px; accent-color: #2c2c8c; }
.ctl input[type=range] { width: 100%; accent-color: #2c2c8c; min-height: 28px; }
select { padding: 4px 6px; border: 1px solid #000; border-radius: 4px; background: linear-gradient(#fdfdfd, #d7d7d7); min-height: 32px; font: 600 13px var(--ui); color: #000; }
.secrets p { margin: 0; font: 17px/1.3 var(--mono); }
.secrets code { font: 17px var(--mono); background: #000; color: var(--phos); padding: 0 4px; margin-right: 2px; white-space: nowrap; }
.palette.dragging { box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #888, 6px 6px 0 rgba(0, 0, 0, 0.5); }

/* ticker + footer */
.ticker { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; overflow: hidden; background: #000; border-top: 1px solid #333; }
.ticker-track { display: flex; width: max-content; animation: marquee 40s linear infinite; font: 20px/26px var(--mono); color: var(--phos); }
.ticker-track span { padding-right: 0; white-space: pre; }
.foot { margin: 0; padding: 2px 12px 6px; font-size: 12px; color: #9a9ab0; text-align: center; }
.foot a { color: var(--spark); }
.noscript { color: #fff; text-align: center; }

/* egg windows */
.egg-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.egg { position: absolute; pointer-events: auto; width: min(440px, calc(100vw - 20px)); animation: popin 0.16s ease-out; }
.egg .titlebar .close { cursor: pointer; padding: 0; }
.egg-body { padding: 10px 12px 12px; border-top: 1px solid var(--plat-lo); margin-top: 2px; }
.egg-term { background: #000; color: var(--phos); font: 19px/1.15 var(--mono); padding: 8px 10px; min-height: 120px; max-height: 260px; overflow: auto; white-space: pre-wrap; border: 1px solid #000; box-shadow: inset 2px 2px 0 #222; }
.egg-term .hl { color: #ff4fd8; } .egg-term .yl { color: #ffe14f; } .egg-term .wh { color: #fff; }
.egg-bar { height: 18px; border: 1px solid #000; background: #fff; margin: 8px 0 4px; position: relative; overflow: hidden; }
.egg-bar > span { position: absolute; inset: 0 auto 0 0; width: 0; background: repeating-linear-gradient(-45deg, #2c2c8c 0 8px, #6b5bff 8px 16px); }
.egg-note { font: 15px var(--mono); color: #333; margin: 6px 0 0; }
.egg-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.egg-big { font: 16px/1.5 var(--pixel); text-align: center; margin: 6px 0; }
.room { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.room-people { background: #fff; border: 1px solid #000; font: 16px/1.2 var(--mono); padding: 4px 6px; max-height: 260px; overflow: auto; }
.room-pal { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid #000; margin-top: 8px; }
.room-pal .cell { min-height: 40px; font-size: 11px; }
.away { background: #fffbe6; border: 1px solid #000; padding: 10px; font: 18px/1.3 var(--mono); text-align: center; color: #102; }
.away .rb { background: linear-gradient(90deg, #f33, #fb0, #3c3, #39f, #a3f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.w00t { position: fixed; pointer-events: none; z-index: 45; font: 22px var(--pixel); color: var(--phos); text-shadow: 2px 2px 0 #000; animation: fly 1.2s ease-out forwards; }
.splash { position: fixed; right: 14px; bottom: 90px; z-index: 39; width: 300px; pointer-events: none; animation: popin 0.2s ease-out, fadeaway 0.5s ease-in 2.6s forwards; }
.splash .egg-body { text-align: center; }
.splash pre { margin: 0; font: 15px/1 var(--mono); color: var(--phos); background: #000; padding: 8px; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(1.35) rotate(20deg); opacity: 0.6; } }
@keyframes shimmer { to { background-position: 300% 0; } }
@keyframes pop { 0% { transform: scale(1.25); color: var(--accent); } 100% { transform: scale(1); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes hue { to { filter: hue-rotate(360deg); } }
@keyframes popin { from { transform: scale(0.85); opacity: 0; } }
@keyframes fadeaway { to { opacity: 0; visibility: hidden; } }
@keyframes fly { to { transform: translate(var(--dx, 0), -180px) rotate(var(--rot, 0)); opacity: 0; } }

@media (max-width: 900px) {
  .desktop { grid-template-columns: 1fr; padding: 10px 8px; gap: 12px; }
  .col-pal { position: static; display: grid; grid-template-columns: 1fr; gap: 12px; }
  .palette { transform: none !important; }
}
@media (max-width: 640px) {
  .mb-online { display: none; }
  .mb-item { padding: 3px 6px; }
  .hero { gap: 10px; }
  .logo-slot { width: 52px; height: 52px; } .logo-slot img { width: 52px; height: 52px; }
  .tagline { font-size: 18px; }
  .typebox input, .ghost { font-size: 28px; }
  .win-body { padding: 12px; }
  .stage { min-height: 220px; margin: 0 6px; padding: 12px 4px; }
  .meter { width: 80px; }
  .egg { left: 10px !important; right: 10px; top: auto !important; bottom: 84px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ticker-track { transform: none; }
}
/* credits page */
.desktop.single { display: block; max-width: 760px; }
.credits h2 { font: 400 13px/1.6 var(--pixel); margin: 16px 0 4px; }
.credits h2:first-child { margin-top: 0; }
.credits p { margin: 0 0 8px; }
.credits a, a.mb-item { color: #2c2c8c; }
a.mb-item { text-decoration: none; }
@media (max-width: 640px) { .splash { display: none; } }
@media (max-width: 640px) { body { padding-bottom: 0; } .ticker { position: static; margin-top: 12px; } }
