:root{
  --bg:#0b0e15;
  --panel:#131926;
  --panel-2:#0e1420;
  --line:#232c3d;
  --lime:#9fef00;
  --lime-dim:#5e8a06;
  --lime-glow:rgba(159,239,0,0.18);
  --text:#d3dae4;
  --dim:#6b7b90;
  --red:#ff5d5d;
  --amber:#ffb43c;
  --amber-2:#ff9843;
  --amber-soft-bg:rgba(255,180,60,0.1);
  --violet:#a78bfa;
  --on-accent:#0a0e16;
  --lime-hover:#b3ff17;
  --term-bg:#000000;
  --bg-translucent:rgba(11,14,21,0.85);
  --input-bg:var(--panel-2);
  --input-text:var(--text);
  --red-border-dim:#7a3838;
  --red-hover-bg:rgba(255,93,93,0.06);
  --term-text:var(--lime);
  --term-focus-ring:var(--lime-dim);
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

/* Light mode. The site chrome goes light/neutral; the terminal itself
   becomes the classic Windows PowerShell console -- navy blue, not white,
   because a white "terminal" doesn't read as a terminal to anyone who's
   actually used one. */
[data-theme="light"]{
  --bg:#f4f5f7;
  --panel:#ffffff;
  --panel-2:#eef0f3;
  --line:#d7dbe1;
  --lime:#1a56db;
  --lime-dim:#3b6fc7;
  --lime-glow:rgba(26,86,219,0.16);
  --text:#171a1f;
  --dim:#667085;
  --red:#d92d20;
  --amber:#b45309;
  --amber-2:#c2410c;
  --amber-soft-bg:rgba(180,83,9,0.08);
  --violet:#7c3aed;
  --on-accent:#ffffff;
  --lime-hover:#1445b8;
  --term-bg:#012456;
  --bg-translucent:rgba(244,245,247,0.85);
  --input-bg:#ffffff;
  --input-text:#0a0a0a;
  --red-border-dim:#e8a5a0;
  --red-hover-bg:rgba(217,45,32,0.07);
  --term-text:#eaf0fb;
  --term-focus-ring:#5b8dd9;
}

*{ box-sizing:border-box; }

html, body{
  margin:0;
  padding:0;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(159,239,0,0.05), transparent),
    var(--bg);
  color:var(--text);
  font-family:var(--font-ui);
  -webkit-font-smoothing:antialiased;
}

#app{ min-height:100vh; }

a{ color:var(--lime); }

h1, h2, h3{
  color:var(--text);
  font-weight:650;
  letter-spacing:-.01em;
}

code{ font-family:var(--font-mono); }

.pill{
  display:inline-block;
  font-family:var(--font-ui);
  border:1px solid var(--line);
  border-radius:20px;
  padding:2px 9px;
  font-size:10.5px;
  color:var(--dim);
}

.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
  padding:16px;
  box-shadow:0 1px 2px rgba(0,0,0,0.25), 0 8px 24px -12px rgba(0,0,0,0.35);
}

button, .btn{
  background:var(--panel-2);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:7px;
  padding:10px 18px;
  font-family:var(--font-ui);
  font-size:14px;
  font-weight:550;
  cursor:pointer;
  letter-spacing:.01em;
  text-decoration:none;
  display:inline-block;
  transition:border-color .15s ease, background .15s ease, transform .08s ease;
}
button:hover, .btn:hover{
  border-color:var(--lime-dim);
  background:var(--panel-2);
}
button:active, .btn:active{ transform:translateY(1px); }
button.danger, .btn.danger{ color:var(--red); }
button.danger:hover, .btn.danger:hover{ border-color:var(--red-border-dim); background:var(--red-hover-bg); }

button.primary, .btn.primary{
  background:var(--lime);
  color:var(--on-accent);
  border-color:var(--lime);
  font-weight:650;
}
button.primary:hover, .btn.primary:hover{
  background:var(--lime-hover);
  border-color:var(--lime-hover);
}

/* --- site chrome shared across pages --- */
.shell{ min-height:100vh; display:flex; flex-direction:column; }
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 28px; border-bottom:1px solid var(--line);
  background:var(--bg-translucent); backdrop-filter:blur(6px);
  position:sticky; top:0; z-index:10;
}
.brand{
  font-weight:750; letter-spacing:-.01em;
  font-size:15px; text-decoration:none; color:var(--text);
  display:flex; align-items:center; gap:8px;
}
.brand::before{
  content:''; width:8px; height:8px; border-radius:2px;
  background:var(--lime); display:inline-block;
  box-shadow:0 0 10px var(--lime-glow);
}
.topbar nav{ display:flex; gap:24px; align-items:center; flex-wrap:wrap; row-gap:8px; }
.topbar nav a{ color:var(--dim); text-decoration:none; font-size:13.5px; letter-spacing:.01em; transition:color .15s ease; }
.topbar nav a:hover, .topbar nav a.active{ color:var(--text); }
@media (max-width:640px){
  .topbar{ padding:12px 16px; flex-wrap:wrap; row-gap:10px; }
  .topbar nav{ gap:12px 16px; }
}
.theme-toggle{
  background:var(--panel-2); color:var(--text); border:1px solid var(--line);
  border-radius:20px; padding:6px 14px; font-family:inherit; font-size:12.5px;
  cursor:pointer; letter-spacing:.01em; transition:border-color .15s ease;
}
.theme-toggle:hover{ border-color:var(--lime-dim); }

.xp-badge{
  background:var(--panel-2); color:var(--lime); border:1px solid var(--line);
  border-radius:20px; padding:6px 14px; font-size:12.5px; font-weight:600;
  letter-spacing:.01em; transition:transform .15s ease, border-color .15s ease;
}
.xp-badge.xp-pop{ transform:scale(1.12); border-color:var(--lime-dim); }

.confetti-piece{
  position:fixed; width:7px; height:7px; border-radius:1px; pointer-events:none;
  z-index:999; animation:confetti-burst .8s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes confetti-burst{
  0%{ transform:translate(0,0) rotate(0deg); opacity:1; }
  100%{ transform:translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity:0; }
}

.streak-badge{
  display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:600;
  color:var(--amber); background:var(--amber-soft-bg); border:1px solid var(--amber);
  border-radius:20px; padding:3px 10px; margin-left:8px;
}
main{ flex:1; }

/* --- terminal component --- */
.term-panel{ max-width:100%; display:flex; flex-direction:column; }
.term-titlebar{
  display:flex; align-items:center; gap:10px;
  padding:11px 14px; background:var(--panel-2);
  border:1px solid var(--line); border-bottom:none;
  border-radius:9px 9px 0 0;
}
.term-dots{ display:flex; gap:6px; flex-shrink:0; }
.term-dots i{ width:11px; height:11px; border-radius:50%; display:block; }
.term-dots i:nth-child(1){ background:#ff5f57; }
.term-dots i:nth-child(2){ background:#febc2e; }
.term-dots i:nth-child(3){ background:#28c840; }
.term-titletext{
  flex:1; text-align:center; font-size:12.5px;
  color:var(--dim); letter-spacing:.01em;
}
.term-wrap{
  background:var(--term-bg); border:1px solid var(--line); border-top:none;
  border-radius:0 0 9px 9px; padding:16px; cursor:text; outline:none;
  transition:box-shadow .15s ease;
}
.term-wrap:focus{ box-shadow:inset 0 0 0 1px var(--term-focus-ring); }
.term-out{
  height:420px; overflow-y:auto; white-space:pre-wrap; word-break:break-word;
  color:var(--term-text); line-height:1.6; font-size:15px; font-family:var(--font-mono);
}
.term-cursor{ animation:blink 1s steps(1) infinite; }
@keyframes blink{ 50%{ opacity:0; } }

/* --- mission panel (room.html) --- */
.mission-loading{ color:var(--dim); font-size:13px; padding:24px; }
.mission-missing{ text-align:center; padding:40px 20px; }
.mission-missing h2{ margin-top:0; }
.mission-panel{ padding-right:4px; }
.room-title{ font-size:24px; margin:0 0 14px; }
.type-badge{
  display:inline-block; font-size:11.5px; font-weight:700; letter-spacing:.02em;
  padding:6px 13px; border-radius:20px; margin-bottom:14px;
}
.type-challenge{
  background:rgba(255,93,93,0.13); color:var(--red); border:1px solid rgba(255,93,93,0.35);
}
.type-walkthrough{
  background:rgba(159,239,0,0.1); color:var(--lime-dim); border:1px solid rgba(159,239,0,0.25);
}
[data-theme="light"] .type-walkthrough{ color:var(--lime); }
.type-checkpoint{
  background:rgba(167,139,250,0.13); color:var(--violet); border:1px solid rgba(167,139,250,0.35);
}
.tag-row{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.tag{
  font-size:11px; font-weight:650; letter-spacing:.02em;
  padding:5px 12px; border-radius:20px; border:1px solid transparent;
}
.tag-category{ background:transparent; color:var(--dim); border-color:var(--line); }
.tag-difficulty{ background:transparent; color:var(--dim); border-color:var(--line); }
.tag-xp{ background:rgba(255,180,60,0.12); color:var(--amber); border-color:rgba(255,180,60,0.28); }
.tag-type-challenge{ background:rgba(255,93,93,0.13); color:var(--red); border-color:rgba(255,93,93,0.32); }
.tag-type-walkthrough{ background:rgba(159,239,0,0.1); color:var(--lime-dim); border-color:rgba(159,239,0,0.25); }
[data-theme="light"] .tag-type-walkthrough{ color:var(--lime); }
.tag-type-checkpoint{ background:rgba(167,139,250,0.13); color:var(--violet); border-color:rgba(167,139,250,0.32); }

.progress-label{
  display:flex; justify-content:space-between; font-size:12px; color:var(--dim);
  letter-spacing:.02em; margin-bottom:8px;
}
.progress-label span:last-child{ color:var(--lime); font-weight:650; }
.progress-track{
  height:7px; background:var(--panel-2); border:1px solid var(--line); border-radius:20px;
  overflow:hidden; margin-bottom:24px;
}
.progress-fill{
  height:100%; background:linear-gradient(90deg, var(--lime-dim), var(--lime));
  border-radius:20px; transition:width .4s cubic-bezier(.4,0,.2,1);
  box-shadow:0 0 8px var(--lime-glow);
}

.completion-banner{
  background:linear-gradient(135deg, rgba(159,239,0,0.14), rgba(159,239,0,0.03));
  border:1px solid rgba(159,239,0,0.35);
  border-radius:10px; padding:18px 20px; margin-bottom:20px;
  animation:pop-in .35s cubic-bezier(.34,1.56,.64,1);
}
.completion-banner h3{ margin:0 0 4px; color:var(--lime); font-size:16px; }
.completion-banner p{ margin:0; color:var(--dim); font-size:13px; }
@keyframes pop-in{ from{ opacity:0; transform:scale(.94) translateY(-4px); } to{ opacity:1; transform:scale(1) translateY(0); } }

.trial-modal-backdrop{
  position:fixed; inset:0; z-index:1000;
  background:rgba(0,0,0,0.7);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  animation:trial-fade-in .2s ease;
}
.trial-modal{
  max-width:440px; width:100%; text-align:center; padding:36px 32px;
  animation:pop-in .3s cubic-bezier(.34,1.56,.64,1);
}
.trial-modal-icon{ font-size:42px; line-height:1; margin-bottom:10px; }
.trial-modal h2{ margin:0 0 14px; font-size:22px; color:var(--lime); }
.trial-modal p{ margin:0 0 24px; color:var(--dim); font-size:14px; line-height:1.7; }
.trial-modal-actions{ display:flex; justify-content:center; }
.trial-modal .btn-xl{ padding:13px 32px; font-size:15px; }
@keyframes trial-fade-in{ from{ opacity:0; } to{ opacity:1; } }

.task-list{ display:flex; flex-direction:column; gap:10px; }
.task-card{
  border:1px solid var(--line); border-radius:9px; background:var(--panel);
  overflow:hidden; transition:border-color .15s ease;
}
.task-card.active{ border-color:var(--lime-dim); box-shadow:0 0 0 1px var(--lime-dim), 0 0 20px -8px var(--lime-glow); }
.task-card.done{ border-color:rgba(159,239,0,0.3); }
.task-head{
  width:100%; display:flex; align-items:center; gap:14px;
  background:transparent; border:none; color:var(--text); cursor:pointer;
  padding:16px 20px; font-family:var(--font-ui); font-size:14px; text-align:left;
  transition:background .12s ease;
}
.task-head:hover{ background:rgba(255,255,255,0.02); }
.task-status{
  width:22px; height:22px; border-radius:50%; border:1.5px solid var(--line);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
  font-size:12px; color:var(--lime); transition:all .2s ease;
}
.task-card.done .task-status{ background:var(--lime); color:var(--on-accent); border-color:var(--lime); }
.task-title{ flex:1; display:flex; flex-direction:column; gap:2px; }
.task-num{ font-size:10.5px; color:var(--dim); letter-spacing:.06em; text-transform:uppercase; }
.task-name{ font-size:15.5px; font-weight:600; }
.task-chevron{ color:var(--dim); font-size:10px; }
.task-body{ padding:0 20px 22px; font-size:14.5px; line-height:1.7; color:var(--text); }
.task-body p{ margin:0 0 12px; }
.task-body code{
  background:var(--panel-2); border:1px solid var(--line); border-radius:4px;
  padding:2px 6px; font-size:13px; color:var(--lime);
}

.task-prompt{
  margin-top:16px; background:var(--panel-2); border:1px solid var(--line);
  border-radius:8px; padding:18px;
}
.flag-label{
  font-size:11px; font-weight:700; letter-spacing:.06em; color:var(--lime);
  margin-bottom:10px; display:flex; align-items:center; gap:6px;
}
.task-prompt p{ margin:0 0 14px; color:var(--text); font-size:14.5px; }
.flag-row{ display:flex; gap:8px; flex-wrap:wrap; }
.flag-input{
  flex:1; min-width:140px; background:var(--input-bg); border:1px solid var(--line);
  border-radius:6px; color:var(--input-text); font-family:var(--font-mono); font-size:14.5px;
  padding:11px 14px; transition:border-color .15s ease;
}
.flag-input:focus{ outline:none; border-color:var(--lime-dim); box-shadow:0 0 0 3px var(--lime-glow); }
.flag-input:disabled{ color:var(--dim); }
.hint-btn{
  background:rgba(255,180,60,0.16);
  color:var(--amber);
  border-color:rgba(255,180,60,0.5);
  font-weight:600;
}
.hint-btn:hover{ background:rgba(255,180,60,0.26); border-color:var(--amber); }
.hint-btn:disabled{ opacity:.55; cursor:default; background:rgba(255,180,60,0.08); }
.hint-box{
  margin-top:10px; font-size:13.5px; color:var(--text); line-height:1.6;
}
.hint-box .hint-label{
  font-weight:700; margin-right:6px; color:var(--amber);
}
.hint-box.hint-tier-2 .hint-label{ color:var(--amber-2); }
.hint-box.hint-tier-3 .hint-label{ color:var(--red); }
.feedback{ margin-top:10px; font-size:13px; font-weight:600; }
.feedback.wrong{ color:var(--red); }
.feedback.right{ color:var(--lime); }

/* --- room page shell: narrow task sidebar (with its own header) that
   stops where the terminal begins, terminal column runs the full height
   of the viewport starting at the very top, no topbar above it --- */
.room-shell{
  display:flex; align-items:stretch;
  height:100vh; width:100%;
}
.room-sidebar{
  width:clamp(420px, 30%, 520px); flex-shrink:0;
  display:flex; flex-direction:column;
  height:100vh;
  border-right:1px solid var(--line);
}
.room-sidebar .topbar{ flex-shrink:0; }
.room-mission{
  flex:1; min-height:0; overflow-y:auto;
  padding:20px 20px 24px 28px;
}
.room-terminal-col{
  flex:1; min-width:0; height:100vh;
  display:flex; flex-direction:column;
  padding:24px 32px; box-sizing:border-box;
}
.room-terminal-col #terminalMount{ flex:1; min-height:0; display:flex; flex-direction:column; }
.room-terminal-col .term-panel{ flex:1; min-height:0; display:flex; flex-direction:column; }
.room-terminal-col .term-wrap{ flex:1; display:flex; flex-direction:column; min-height:0; }
.room-terminal-col .term-out{ flex:1; height:auto; min-height:260px; }

@media (max-width:900px){
  .room-shell{ flex-direction:column; height:auto; }
  .room-sidebar{
    width:100%; height:auto;
    border-right:none; border-bottom:1px solid var(--line);
  }
  .room-mission{ flex:none; padding:16px; overflow-y:visible; }
  .room-terminal-col{ height:auto; min-height:480px; padding:16px; }
}
@media (max-width:480px){
  .room-mission{ padding:12px; }
  .room-terminal-col{ padding:12px; }
}

/* --- landing-style pages (index.html, labs.html): shared so the two
   never silently drift apart the way copy-pasted inline <style> would --- */
.landing{ max-width:1180px; margin:0 auto; padding:64px 24px 90px; position:relative; }
.landing::before{
  content:''; position:absolute; top:-120px; left:50%; transform:translateX(-50%);
  width:900px; height:420px; background:radial-gradient(ellipse at center, var(--lime-glow), transparent 70%);
  pointer-events:none; z-index:-1; opacity:.5;
}
.kicker{ color:var(--dim); text-transform:uppercase; letter-spacing:.14em; font-size:11px; margin:0 0 14px; font-weight:600; }
.landing h1{ font-size:clamp(32px, 3.6vw, 48px); line-height:1.12; margin:0 0 20px; letter-spacing:-.01em; }
.lede{ color:var(--text); font-size:15.5px; line-height:1.75; max-width:56ch; margin:0 0 30px; }
.stat-row{ display:flex; gap:28px; flex-wrap:wrap; margin-bottom:34px; }
.stat{ display:flex; flex-direction:column; }
.stat b{ color:var(--lime); font-size:20px; }
.stat span{ color:var(--dim); font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
.cta-row{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:0; }
.cta-row .btn.primary{ background:var(--lime); color:var(--on-accent); border-color:var(--lime); font-weight:600; }
.cta-row .btn.primary:hover{ background:var(--lime-hover); }
.why-row{ display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; margin-top:20px; }
@media (max-width:760px){ .why-row{ grid-template-columns:1fr; } }
.why-row .panel h4{ margin:0 0 8px; color:var(--lime); font-size:13px; }
.why-row .panel p{ margin:0; color:var(--dim); font-size:12.5px; line-height:1.7; }

/* --- room cards (landing / overview) --- */
.room-card{
  display:flex; align-items:center; justify-content:space-between; gap:20px;
  flex-wrap:wrap; text-decoration:none; color:inherit;
  transition:border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.room-card:hover{
  border-color:var(--lime-dim);
  transform:translateY(-2px);
  box-shadow:0 4px 20px -6px var(--lime-glow), 0 1px 2px rgba(0,0,0,0.3);
}
.rooms-section{ margin-top:56px; }
.section-heading{ font-size:12px; text-transform:uppercase; letter-spacing:.1em; color:var(--dim); margin:0 0 16px; font-weight:600; }
.room-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width:700px){ .room-grid{ grid-template-columns:1fr; } }
.room-card h3{ margin:0 0 8px; font-size:16px; color:var(--text); font-weight:600; }
.room-card .arrow{ color:var(--lime); font-size:20px; flex-shrink:0; transition:transform .15s ease; }
.room-card:hover .arrow{ transform:translateX(4px); }

/* --- shared site footer, sits at the bottom of .shell via main{flex:1} --- */
.site-footer{
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap;
  gap:10px 20px; padding:20px 28px; border-top:1px solid var(--line);
  color:var(--dim); font-size:12.5px;
}
.site-footer nav{ display:flex; gap:18px; flex-wrap:wrap; }
.site-footer a{ color:var(--dim); text-decoration:none; }
.site-footer a:hover, .site-footer a.active{ color:var(--text); }
@media (max-width:640px){ .site-footer{ padding:16px; justify-content:center; text-align:center; } }

/* --- long-form legal pages: privacy, terms, refund --- */
.legal{ max-width:720px; margin:0 auto; padding:48px 24px 80px; }
.legal h1{ font-size:26px; margin:0 0 6px; letter-spacing:-.01em; }
.legal .updated{ color:var(--dim); font-size:12.5px; margin:0 0 36px; }
.legal h2{ font-size:16px; margin:34px 0 12px; }
.legal p, .legal li{ color:var(--text); font-size:14px; line-height:1.75; }
.legal p{ margin:0 0 14px; }
.legal ul{ margin:0 0 14px; padding-left:20px; }
.legal .placeholder{ color:var(--amber); }

/* --- simple centered message pages: 404, etc --- */
.message-wrap{
  min-height:calc(100vh - 66px); display:flex; align-items:center;
  justify-content:center; padding:24px; text-align:center;
}
.message-card{ max-width:460px; }
.message-card .code{ font-family:var(--font-mono); color:var(--lime-dim); font-size:14px; letter-spacing:.04em; margin:0 0 14px; }
[data-theme="light"] .message-card .code{ color:var(--lime); }
.message-card h1{ font-size:26px; margin:0 0 12px; letter-spacing:-.01em; }
.message-card p{ color:var(--dim); font-size:14.5px; line-height:1.7; margin:0 0 26px; }
.message-card .cta-row{ justify-content:center; }
