/* =========================================================
   NOVA-9 — sci-fi / Gen Z theme
   ========================================================= */
:root {
  --bg: #05030f;
  --bg-2: #0d0920;
  --panel: rgba(20, 14, 48, .62);
  --panel-solid: #140e30;
  --line: rgba(160, 140, 255, .18);
  --text: #eeeaff;
  --muted: #a39cc8;
  --neon: #7cf7ff;      /* cyan */
  --neon-2: #c86bff;    /* violet */
  --neon-3: #ff5fa2;    /* pink */
  --lime: #c6ff4a;
  --glow: 0 0 18px rgba(124, 247, 255, .45);
  --holo: linear-gradient(120deg, #7cf7ff, #c86bff 45%, #ff5fa2 75%, #c6ff4a);
  --r: 18px;
  --display: 'Orbitron', 'Space Grotesk', system-ui, sans-serif;
  --body: 'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --hud-h: 68px;
}
html[data-cycle="day"] {
  --bg: #e9e4ff;
  --bg-2: #dcd3ff;
  --panel: rgba(255, 255, 255, .62);
  --panel-solid: #ffffff;
  --line: rgba(80, 50, 180, .18);
  --text: #1a1040;
  --muted: #5b5385;
  --neon: #0098b8;
  --neon-2: #7a2cff;
  --neon-3: #e0247a;
  --lime: #5f9e00;
  --glow: 0 0 14px rgba(122, 44, 255, .25);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(1200px 700px at 80% -10%, rgba(200,107,255,.22), transparent 60%),
              radial-gradient(900px 600px at -10% 30%, rgba(124,247,255,.12), transparent 60%),
              var(--bg);
  color: var(--text); font-family: var(--body); font-size: 17px; line-height: 1.6;
  overflow-x: hidden;
  transition: background-color .5s, color .5s;
}
html[data-cycle="day"] body {
  background: radial-gradient(1200px 700px at 80% -10%, rgba(255,95,162,.25), transparent 60%),
              radial-gradient(900px 600px at -10% 30%, rgba(124,247,255,.35), transparent 60%),
              var(--bg);
}
a { color: var(--neon); text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--neon-3); color: #fff; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.accent { color: var(--lime); }
.display { font-family: var(--display); letter-spacing: .02em; line-height: 1.05; margin: 0; }
.eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .25em; text-transform: uppercase; color: var(--neon); margin: 0 0 .6rem; }
.eyebrow::before { content: '// '; opacity: .6; }
.holo-text { background: var(--holo); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% auto; animation: holo 6s linear infinite; }
@keyframes holo { to { background-position: 200% center; } }

/* ---------- background layers ---------- */
#starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.grain { position: fixed; inset: -50%; z-index: 999; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite; }
@keyframes grain { 25% { transform: translate(-3%, 2%) } 50% { transform: translate(2%, -3%) } 75% { transform: translate(-2%, -2%) } }
#warp { position: fixed; inset: 0; z-index: 998; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at center, transparent 0, transparent 20%, rgba(124,247,255,.4) 60%, #fff 100%); transition: opacity .35s; }
#warp.on { opacity: 1; }

/* ---------- boot ---------- */
#boot { position: fixed; inset: 0; z-index: 2000; background: #020108; display: none; align-items: center; justify-content: center; }
#boot.show { display: flex; }
#boot.out { animation: bootOut .6s forwards; }
@keyframes bootOut { to { opacity: 0; transform: scale(1.08); filter: blur(6px); visibility: hidden; } }
.boot-inner { width: min(560px, 90vw); font-family: var(--mono); color: #7cf7ff; }
#boot-log { margin: 0 0 1rem; min-height: 11em; font-size: .9rem; white-space: pre-wrap; text-shadow: 0 0 8px rgba(124,247,255,.6); }
#boot-log .ok { color: #c6ff4a; }
.boot-bar { height: 4px; background: rgba(124,247,255,.15); border-radius: 4px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--holo); transition: width .25s; }
#boot-skip { margin-top: 1.2rem; background: none; border: 1px solid rgba(124,247,255,.3); color: #a39cc8; padding: .45rem .9rem; border-radius: 999px; font-family: var(--mono); font-size: .8rem; }
#boot-skip:hover { color: #fff; border-color: #7cf7ff; }

/* ---------- HUD header ---------- */
.hud { position: sticky; top: 0; z-index: 100; height: var(--hud-h); display: flex; align-items: center; gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom: 1px solid var(--line); transition: height .3s; }
.hud.shrink { height: 56px; }
.logo { display: flex; align-items: center; gap: .6rem; color: var(--text); font-family: var(--display); font-weight: 900; font-size: 1.15rem; letter-spacing: .08em; }
.logo-orb { width: 22px; height: 22px; border-radius: 50%; background: var(--holo); box-shadow: var(--glow); animation: spin 6s linear infinite; background-size: 200% 200%; }
@keyframes spin { to { transform: rotate(360deg); } }
.decks { display: flex; gap: .25rem; margin-left: auto; }
.deck-link { display: flex; flex-direction: column; line-height: 1.1; padding: .45rem .8rem; border-radius: 12px; color: var(--muted); font-weight: 500; font-size: .95rem; transition: .2s; }
.deck-link small { font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; opacity: .7; }
.deck-link:hover { color: var(--text); background: var(--panel); }
.deck-link.active { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), var(--glow); }
.deck-link.active small { color: var(--neon); opacity: 1; }
.hud-right { display: flex; align-items: center; gap: .4rem; }
.rank-chip { display: flex; align-items: center; gap: .5rem; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: .35rem .7rem; border-radius: 999px; font-family: var(--mono); font-size: .75rem; }
.rank-name { color: var(--lime); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.xp-bar { width: 60px; height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.xp-bar span { display: block; height: 100%; width: 0; background: var(--holo); transition: width .6s cubic-bezier(.2,.9,.3,1.3); }
.rank-chip.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.12); box-shadow: 0 0 24px var(--lime); } }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 1rem; display: grid; place-items: center; transition: .2s; }
.icon-btn:hover { border-color: var(--neon); box-shadow: var(--glow); }
.icon-btn[aria-pressed="true"] { border-color: var(--lime); }
.menu-btn { display: none; }
.streak-pill { position: fixed; top: calc(var(--hud-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 90; background: var(--panel-solid); border: 1px solid var(--line); padding: .35rem .9rem; border-radius: 999px; font-family: var(--mono); font-size: .8rem; box-shadow: var(--glow); animation: dropIn .5s; }
@keyframes dropIn { from { opacity: 0; transform: translate(-50%, -12px); } }

/* ---------- glitch ---------- */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; opacity: 0; }
.glitch:hover::before, .glitch.glitching::before { opacity: .8; color: var(--neon-3); animation: g1 .35s steps(2) infinite; }
.glitch:hover::after, .glitch.glitching::after { opacity: .8; color: var(--neon); animation: g2 .35s steps(2) infinite; }
@keyframes g1 { 0% { clip-path: inset(0 0 60% 0); transform: translate(-3px, -1px) } 100% { clip-path: inset(40% 0 20% 0); transform: translate(3px, 1px) } }
@keyframes g2 { 0% { clip-path: inset(60% 0 0 0); transform: translate(3px, 1px) } 100% { clip-path: inset(10% 0 55% 0); transform: translate(-3px, -1px) } }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; }
.wrap { width: min(1180px, 92vw); margin: 0 auto; }
section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section-head { max-width: 720px; margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.8rem, 4.5vw, 3rem); }
.section-head p { color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: .55rem; border: 0; padding: .9rem 1.4rem; border-radius: 14px; font-weight: 700; font-size: 1rem; transition: transform .15s, box-shadow .2s; }
.btn:active { transform: scale(.97); }
.btn-holo { background: var(--holo); background-size: 200% auto; color: #0b0620; box-shadow: 0 8px 30px rgba(200,107,255,.35); animation: holo 6s linear infinite; }
.btn-holo:hover { box-shadow: 0 10px 40px rgba(124,247,255,.5); transform: translateY(-2px); }
.btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--neon); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s, transform .7s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
.hero { min-height: calc(100vh - var(--hud-h)); display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 2rem; padding: 2rem 0 4rem; }
.hero h1 { font-size: clamp(2.6rem, 7.5vw, 5.8rem); font-weight: 900; }
.hero h1 .line { display: block; }
.hero p.lead { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--muted); max-width: 32ch; margin: 1.3rem 0 2rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: .8rem; }
.typed { font-family: var(--mono); color: var(--lime); font-size: .95rem; margin-top: 1.6rem; min-height: 1.6em; }
.typed::after { content: '▌'; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.planet-wrap { position: relative; aspect-ratio: 1; width: 100%; max-width: 520px; justify-self: center; }
#planet { width: 100%; height: 100%; cursor: grab; }
.planet-tag { position: absolute; font-family: var(--mono); font-size: .72rem; background: var(--panel-solid); border: 1px solid var(--line); padding: .3rem .6rem; border-radius: 8px; white-space: nowrap; animation: float 5s ease-in-out infinite; }
.planet-tag b { color: var(--lime); font-weight: 600; }
.planet-tag.t1 { top: 12%; left: -4%; }
.planet-tag.t2 { bottom: 16%; right: -2%; animation-delay: -2s; }
@keyframes float { 50% { transform: translateY(-10px); } }

/* marquee */
.marquee { overflow: hidden; border-block: 1px solid var(--line); background: var(--panel); padding: .9rem 0; }
.marquee-track { display: flex; gap: 3rem; width: max-content; animation: marq 28s linear infinite; font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: .1em; text-transform: uppercase; }
.marquee-track span { display: flex; align-items: center; gap: 3rem; }
.marquee-track span::after { content: '✦'; color: var(--neon-3); }
@keyframes marq { to { transform: translateX(-50%); } }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat { padding: 1.5rem; text-align: left; }
.stat .num { font-family: var(--display); font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 900; }
.stat .lbl { color: var(--muted); font-size: .9rem; }

/* story cards (swipeable) */
.stories { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 1rem; scrollbar-width: thin; }
.story { flex: 0 0 min(300px, 78vw); aspect-ratio: 9/14; scroll-snap-align: start; border-radius: 22px; padding: 1.4rem; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--line); transition: transform .3s; }
.story:hover { transform: translateY(-6px) rotate(-1deg); }
.story::before { content: ''; position: absolute; inset: 0; background: var(--bgimg); opacity: .9; z-index: -1; }
.story .emoji { position: absolute; top: 1.2rem; left: 1.2rem; font-size: 3rem; filter: drop-shadow(0 4px 12px rgba(0,0,0,.4)); }
.story .progress { position: absolute; top: .7rem; left: 1rem; right: 1rem; display: flex; gap: 4px; }
.story .progress i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); }
.story .progress i:first-child { background: #fff; }
.story h3 { font-family: var(--display); font-size: 1.35rem; margin: 0 0 .4rem; color: #fff; }
.story p { margin: 0; color: rgba(255,255,255,.85); font-size: .95rem; }

/* drop countdown */
.drop { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; padding: clamp(1.5rem, 4vw, 3rem); position: relative; overflow: hidden; }
.drop::after { content: ''; position: absolute; width: 400px; height: 400px; right: -120px; top: -160px; background: radial-gradient(circle, rgba(255,95,162,.35), transparent 70%); pointer-events: none; }
.countdown { display: flex; gap: .7rem; }
.cd-box { min-width: 78px; text-align: center; padding: .8rem .5rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
.cd-box b { display: block; font-family: var(--display); font-size: 2rem; }
.cd-box small { font-family: var(--mono); font-size: .65rem; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; }

/* ---------- missions ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.chip { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: .5rem 1rem; border-radius: 999px; font-family: var(--mono); font-size: .8rem; transition: .2s; }
.chip:hover { color: var(--text); }
.chip.on { color: #0b0620; background: var(--neon); border-color: var(--neon); }
.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.mission { padding: 1.5rem; position: relative; overflow: hidden; transform-style: preserve-3d; transition: transform .15s, box-shadow .3s, opacity .3s; will-change: transform; }
.mission::before { content: ''; position: absolute; inset: 0; background: radial-gradient(500px circle at var(--mx, 50%) var(--my, 50%), rgba(124,247,255,.18), transparent 40%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.mission:hover::before { opacity: 1; }
.mission:hover { box-shadow: var(--glow); }
.mission.hide { display: none; }
.mission .m-icon { font-size: 2.4rem; }
.mission h3 { font-family: var(--display); font-size: 1.2rem; margin: .8rem 0 .4rem; }
.mission p { color: var(--muted); font-size: .95rem; margin: 0 0 1rem; }
.mission .m-meta { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: .78rem; }
.tag { padding: .2rem .55rem; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); color: var(--neon); }
.diff { color: var(--neon-3); letter-spacing: .1em; }

/* ---------- persona quiz ---------- */
.quiz { max-width: 760px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 2.6rem); }
.quiz-progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 1.8rem; }
.quiz-progress span { display: block; height: 100%; width: 0; background: var(--holo); transition: width .4s; }
.q-title { font-family: var(--display); font-size: clamp(1.3rem, 3vw, 1.9rem); margin: 0 0 1.5rem; }
.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.q-opt { text-align: left; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); padding: 1rem 1.1rem; border-radius: 14px; font-size: 1rem; transition: .2s; }
.q-opt:hover { border-color: var(--neon); transform: translateY(-2px); box-shadow: var(--glow); }
.q-opt .e { font-size: 1.4rem; margin-right: .5rem; }
.q-anim { animation: qin .4s; }
@keyframes qin { from { opacity: 0; transform: translateX(20px); } }
.result { text-align: center; }
.result-grid { display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: center; text-align: left; }
#persona-canvas { width: 240px; aspect-ratio: 9/16; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.4); border: 1px solid var(--line); }
.result h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.traits { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }

/* ---------- arcade ---------- */
.arcade-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.2rem; }
.game-shell { position: relative; padding: .6rem; }
#game { width: 100%; aspect-ratio: 4/3; display: block; border-radius: 12px; background: #030110; touch-action: none; }
.game-overlay { position: absolute; inset: .6rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: rgba(3,1,16,.78); border-radius: 12px; padding: 1.5rem; color: #eeeaff; }
.game-overlay[hidden] { display: none; }
.game-overlay h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); }
.game-overlay p { color: #a39cc8; }
.game-overlay input { background: #0d0920; border: 1px solid rgba(160,140,255,.3); color: #fff; padding: .7rem 1rem; border-radius: 12px; font-family: var(--mono); text-align: center; margin: .6rem 0; width: min(260px, 100%); text-transform: uppercase; }
.game-hud { position: absolute; top: 1.3rem; left: 1.4rem; right: 1.4rem; display: flex; justify-content: space-between; font-family: var(--mono); font-size: .85rem; color: #7cf7ff; pointer-events: none; text-shadow: 0 0 8px rgba(124,247,255,.6); }
.board { padding: 1.3rem; }
.board h3 { font-family: var(--display); margin: 0 0 1rem; font-size: 1.1rem; }
.board ol { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.board li { counter-increment: r; display: flex; justify-content: space-between; gap: .5rem; padding: .55rem .2rem; border-bottom: 1px dashed var(--line); font-family: var(--mono); font-size: .88rem; }
.board li::before { content: counter(r, decimal-leading-zero); color: var(--muted); margin-right: .6rem; }
.board li span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li:nth-child(1) { color: var(--lime); }
.board li.me { background: rgba(124,247,255,.08); }
.controls-hint { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin-top: .8rem; }

/* ---------- comms ---------- */
.comms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.form { padding: clamp(1.3rem, 3vw, 2rem); display: grid; gap: .9rem; }
.form label { font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: grid; gap: .35rem; }
.form input, .form textarea, .form select { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; text-transform: none; letter-spacing: 0; font-size: 1rem; }
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--neon); box-shadow: var(--glow); }
.form textarea { min-height: 120px; resize: vertical; }
.form .hp { position: absolute; left: -9999px; }
.form-msg { font-family: var(--mono); font-size: .85rem; min-height: 1.3em; }
.stickers { display: flex; gap: .3rem; flex-wrap: wrap; }
.stickers button { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; font-size: 1.3rem; width: 44px; height: 44px; transition: .15s; }
.stickers button.on { border-color: var(--lime); transform: scale(1.1); box-shadow: 0 0 12px var(--lime); }
.wall { padding: 1.3rem; max-height: 720px; overflow-y: auto; }
.wall-list { display: grid; gap: .7rem; }
.tx { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem; display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; animation: qin .4s; }
.tx .st { grid-row: span 2; font-size: 1.8rem; align-self: center; }
.tx b { font-family: var(--mono); font-size: .8rem; color: var(--neon); }
.tx b time { color: var(--muted); font-weight: 400; margin-left: .4rem; }
.tx p { margin: 0; word-break: break-word; }

/* ---------- footer ---------- */
.console-footer { position: relative; z-index: 1; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 3rem clamp(1rem, 4vw, 3rem) 6rem; margin-top: 3rem; }
.foot-grid { width: min(1180px, 100%); margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 2rem; }
.foot-logo { font-family: var(--display); font-weight: 900; font-size: 1.6rem; }
.console-footer h4 { font-family: var(--mono); font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--neon); margin: 0 0 .8rem; }
.console-footer a { display: block; color: var(--muted); padding: .15rem 0; }
.console-footer a:hover { color: var(--text); }
.foot-bottom { width: min(1180px, 100%); margin: 2.5rem auto 0; color: var(--muted); font-size: .8rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1500; background: rgba(2,1,10,.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(620px, 100%); max-height: 88vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 22px; padding: 2rem; animation: pop .35s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
.modal-x { position: absolute; top: 1rem; right: 1rem; background: none; border: 0; color: var(--muted); font-size: 1.1rem; }
.modal-card h2 { font-size: 2rem; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; margin: 1.5rem 0 1rem; }
.badge { text-align: center; padding: 1rem .6rem; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); transition: .2s; }
.badge .bi { font-size: 2rem; display: block; }
.badge b { display: block; font-size: .85rem; margin-top: .3rem; }
.badge small { color: var(--muted); font-size: .72rem; display: block; line-height: 1.3; margin-top: .2rem; }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge.locked .bi { filter: blur(3px); }
.badge:not(.locked) { border-color: var(--lime); }
.badge button { margin-top: .5rem; background: none; border: 1px solid var(--line); color: var(--neon); border-radius: 8px; font-size: .7rem; padding: .2rem .5rem; font-family: var(--mono); }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 1600; display: grid; gap: .5rem; justify-items: center; pointer-events: none; }
.toast { background: var(--panel-solid); border: 1px solid var(--line); border-left: 3px solid var(--lime); padding: .65rem 1rem; border-radius: 12px; font-size: .92rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: toastIn .4s cubic-bezier(.2,.9,.3,1.3); max-width: min(420px, 92vw); }
.toast .xp { font-family: var(--mono); color: var(--lime); font-weight: 600; margin-right: .4rem; white-space: nowrap; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- sidekick ---------- */
.sidekick { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 1400; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.sk-bot { width: 62px; height: 62px; border-radius: 22px; border: 0; background: var(--holo); background-size: 200% 200%; animation: holo 6s linear infinite, bob 3s ease-in-out infinite; box-shadow: 0 10px 30px rgba(200,107,255,.45); position: relative; display: grid; place-items: center; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.sk-face { width: 44px; height: 30px; background: #0b0620; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.sk-eye { width: 8px; height: 12px; background: #7cf7ff; border-radius: 4px; box-shadow: 0 0 8px #7cf7ff; animation: skblink 4s infinite; transition: transform .1s; }
@keyframes skblink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.sk-antenna { position: absolute; top: -10px; left: 50%; width: 3px; height: 12px; background: #c6ff4a; transform: translateX(-50%); border-radius: 2px; }
.sk-antenna::after { content: ''; position: absolute; top: -6px; left: -3px; width: 9px; height: 9px; border-radius: 50%; background: #c6ff4a; box-shadow: 0 0 10px #c6ff4a; animation: blink 1.6s infinite; }
.sk-bot.talking .sk-face { animation: talk .25s infinite alternate; }
@keyframes talk { to { transform: scaleY(.85); } }
.sk-bubble { max-width: 260px; background: var(--panel-solid); border: 1px solid var(--line); padding: .7rem .95rem; border-radius: 16px 16px 4px 16px; font-size: .92rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); opacity: 0; transform: translateY(8px) scale(.95); transition: .3s; pointer-events: none; }
.sk-bubble.show { opacity: 1; transform: none; pointer-events: auto; }
.sk-chat { width: min(340px, calc(100vw - 2.4rem)); height: 420px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.45); animation: pop .3s; }
.sk-chat[hidden] { display: none; }
.sk-chat-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .8rem; color: var(--neon); }
.sk-chat-head button { background: none; border: 0; color: var(--muted); }
.sk-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.msg { max-width: 85%; padding: .55rem .8rem; border-radius: 14px; font-size: .9rem; animation: qin .25s; }
.msg.bot { background: var(--bg-2); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--neon-2); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg a { color: var(--lime); text-decoration: underline; }
.quick { display: flex; flex-wrap: wrap; gap: .3rem; }
.quick button { background: none; border: 1px solid var(--line); color: var(--neon); border-radius: 999px; font-size: .75rem; padding: .25rem .6rem; font-family: var(--mono); }
.sk-form { display: flex; gap: .4rem; padding: .7rem; border-top: 1px solid var(--line); }
.sk-form input { flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; color: var(--text); font: inherit; font-size: .9rem; }
.sk-form input:focus { outline: none; border-color: var(--neon); }
.sk-form button { width: 40px; border: 0; border-radius: 12px; background: var(--neon); color: #0b0620; font-weight: 700; }

.wa-float { position: fixed; left: 1.2rem; bottom: 1.2rem; z-index: 1300; width: 52px; height: 52px; border-radius: 50%; background: #25d366; display: grid; place-items: center; font-size: 1.5rem; box-shadow: 0 8px 24px rgba(37,211,102,.4); transition: transform .2s; }
.wa-float:hover { transform: scale(1.08) rotate(-8deg); }

/* ---------- easter egg: hidden alien ---------- */
.alien-egg { position: absolute; z-index: 50; font-size: 1.6rem; cursor: pointer; opacity: .55; transition: transform .2s, opacity .2s; animation: float 4s ease-in-out infinite; background: none; border: 0; padding: 0; }
.alien-egg:hover { opacity: 1; transform: scale(1.4) rotate(15deg); }
html.god-mode body { animation: hue 4s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

/* cursor trail */
.trail { position: fixed; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; z-index: 1999; background: var(--neon); box-shadow: 0 0 10px var(--neon); transform: translate(-50%, -50%); }

/* ---------- 404 ---------- */
.lost { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.lost h1 { font-size: clamp(5rem, 20vw, 12rem); font-weight: 900; }
.ufo-field { position: relative; height: 220px; width: min(600px, 90vw); margin: 1.5rem auto; border: 1px dashed var(--line); border-radius: 18px; overflow: hidden; }
#ufo { position: absolute; font-size: 2.6rem; background: none; border: 0; cursor: crosshair; transition: left .35s, top .35s; }

/* ---------- low power / reduced motion ---------- */
html.low-power #starfield, html.low-power .grain { display: none; }
html.low-power *, html.low-power *::before, html.low-power *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
html.low-power .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .decks { position: fixed; top: var(--hud-h); left: 0; right: 0; flex-direction: column; background: var(--panel-solid); border-bottom: 1px solid var(--line); padding: 1rem; gap: .3rem; transform: translateY(-120%); transition: transform .35s; margin: 0; z-index: -1; }
  .decks.open { transform: none; }
  .deck-link { flex-direction: row; gap: .8rem; align-items: baseline; padding: .8rem 1rem; font-size: 1.1rem; }
  .menu-btn { display: grid; }
  .hud-right { margin-left: auto; }
  .hero { grid-template-columns: 1fr; text-align: left; padding-top: 1rem; min-height: auto; }
  .planet-wrap { max-width: 380px; order: -1; }
  .arcade-grid, .comms-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .xp-bar, .xp-num { display: none; }
  #btn-power { display: none; }
  .q-opts { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-actions, .traits { justify-content: center; }
  .drop { grid-template-columns: 1fr; }
  .cd-box { min-width: 64px; }
  .cd-box b { font-size: 1.5rem; }
  .foot-grid { grid-template-columns: 1fr; }
  .planet-tag.t1 { left: 0; }
  .planet-tag.t2 { right: 0; }
  .sk-bubble { max-width: 210px; }
  #toasts { top: calc(var(--hud-h) + 8px); bottom: auto; width: 92vw; }
  .toast { font-size: .82rem; padding: .5rem .8rem; }
}
