/* /play: the public game playground. Stormy navy and signal yellow, matching the Signal 8 game. */
:root {
  --night: #0d1b2a;
  --storm: #1b263b;
  --cloud: #263751;
  --edge: #3a4f70;
  --signal: #ffd60a;
  --on-signal: #0d1b2a;
  --text: #f4f1e8;
  --muted: #a9b6cc;
  --add: #1f6f4a;
  --add-text: #c9f5dc;
  --del: #7a2734;
  --del-text: #ffd3da;
  --danger: #ff6b6b;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--night); color: var(--text); font: 400 1rem/1.5 var(--body); min-height: 100vh; }
a { color: var(--signal); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; letter-spacing: -0.02em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.bar { background: var(--storm); border-bottom: 2px solid var(--edge); position: sticky; top: 0; z-index: 5; }
.bar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 1.15rem/1 var(--display); text-decoration: none; color: var(--text); }
.brand .badge { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--signal); color: var(--on-signal); font-size: .9rem; }
.bar nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.bar nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: .95rem; }
.bar nav a:hover { color: var(--text); background: var(--cloud); }
.bar nav a[aria-current="page"] { color: var(--on-signal); background: var(--signal); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 12px; border: 2px solid var(--edge); background: var(--cloud); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--signal); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }

/* Hub */
.hero { padding: 48px 0 24px; }
.hero .kicker { font: 700 .85rem/1 var(--mono); letter-spacing: .12em; color: var(--signal); text-transform: uppercase; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 5.4rem); margin: 12px 0 14px; }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 40em; }
.section { padding: 20px 0 8px; }
.section h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin-bottom: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.card { display: grid; gap: 6px; padding: 18px 20px; background: var(--storm); border: 2px solid var(--edge); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--signal); }
.card .icon { font-size: 2rem; line-height: 1; }
.card strong { font: 800 1.3rem/1.15 var(--display); }
.card span { color: var(--muted); }
.card.big { grid-column: span 2; background: linear-gradient(135deg, var(--cloud), var(--storm)); }
.card.big strong { font-size: 1.8rem; }
@media (max-width: 620px) { .card.big { grid-column: auto; } }
.foot { color: var(--muted); font-size: .9rem; padding: 40px 0 48px; }

/* Lab */
.lab { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 20px; padding: 16px 0 40px; align-items: start; }
@media (max-width: 860px) { .lab { grid-template-columns: 1fr; } }
.steps { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 0; align-items: center; }
.steps .label { font: 700 .8rem/1 var(--mono); letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-right: 4px; }
.step { min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--edge); background: var(--storm); cursor: pointer; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.step .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--cloud); font-size: .8rem; }
.step[aria-pressed="true"] { border-color: var(--signal); background: var(--signal); color: var(--on-signal); }
.step[aria-pressed="true"] .n { background: var(--on-signal); color: var(--signal); }
.steps select { min-height: 44px; border-radius: 12px; border: 2px solid var(--edge); background: var(--storm); padding: 0 10px; }
.stage { position: sticky; top: 76px; display: grid; gap: 10px; }
@media (max-width: 860px) { .stage { position: static; } }
.frame-wrap { position: relative; width: 100%; aspect-ratio: 2 / 3; max-height: calc(100vh - 220px); margin: 0 auto; background: #1b263b; border: 2px solid var(--edge); border-radius: var(--radius); overflow: hidden; }
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.panel { background: var(--storm); border: 2px solid var(--edge); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.tabs { display: flex; gap: 4px; padding: 8px; background: var(--cloud); border-bottom: 2px solid var(--edge); flex-wrap: wrap; }
.tab { min-height: 40px; padding: 4px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--night); color: var(--text); }
.tabpanel { padding: 18px; }
.tabpanel[hidden] { display: none; }
.note { color: var(--muted); margin: 0 0 12px; }
.note strong { color: var(--text); }
.predict { display: grid; gap: 8px; padding: 14px; border: 2px dashed var(--edge); border-radius: 12px; margin-bottom: 16px; }
.predict label { font-weight: 700; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.predict input[type="text"] { min-height: 44px; border-radius: 10px; border: 2px solid var(--edge); background: var(--night); padding: 0 12px; }
.predict .said { color: var(--signal); font-weight: 700; margin: 0; }
.tweaks { display: grid; gap: 10px; }
.tweak { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; background: var(--night); border-radius: 12px; align-items: center; }
.tweak .name { font: 700 .95rem/1.2 var(--mono); color: var(--signal); overflow-wrap: anywhere; }
.tweak .what { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; }
.tweak input[type="range"] { grid-column: 1; width: 100%; accent-color: var(--signal); }
.tweak input[type="number"] { width: 96px; min-height: 40px; border-radius: 10px; border: 2px solid var(--edge); background: var(--storm); padding: 0 8px; font-family: var(--mono); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.switch input { width: 22px; height: 22px; accent-color: var(--signal); }
.tweak.special { border: 2px solid var(--signal); }
pre, textarea.code { font: 400 .86rem/1.55 var(--mono); }
pre.prompt { margin: 0; padding: 16px; background: var(--night); border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; }
.diff { margin: 0; padding: 12px 0; background: var(--night); border-radius: 12px; max-height: 65vh; overflow: auto; }
.diff span { display: block; padding: 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.55em; }
.diff .add { background: var(--add); color: var(--add-text); }
.diff .add::before { content: "+ "; }
.diff .del { background: var(--del); color: var(--del-text); text-decoration: line-through; text-decoration-color: rgba(255, 211, 218, .5); }
.diff .del::before { content: "- "; }
.diff .same { color: var(--muted); }
.diff .same::before { content: "  "; }
.diff .fold { color: var(--edge); font-style: italic; }
textarea.code { width: 100%; min-height: 60vh; resize: vertical; border: 0; border-radius: 12px; background: var(--night); color: var(--text); padding: 14px; tab-size: 2; white-space: pre; overflow: auto; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--signal); color: var(--on-signal); padding: 10px 18px; border-radius: 12px; font-weight: 700; opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.toast.show { opacity: 1; }

/* Prompt builder */
.builder { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr); gap: 24px; padding: 8px 0 48px; align-items: start; }
@media (max-width: 900px) { .builder { grid-template-columns: 1fr; } }
.form { display: grid; gap: 14px; background: var(--storm); border: 2px solid var(--edge); border-radius: var(--radius); padding: 20px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; }
.field .help { color: var(--muted); font-size: .88rem; margin: 0; }
.field input, .field textarea { min-height: 44px; border-radius: 10px; border: 2px solid var(--edge); background: var(--night); padding: 10px 12px; }
.field textarea { min-height: 72px; resize: vertical; }
.field.warn input, .field.warn textarea { border-color: var(--signal); }
.field .warning { color: var(--signal); font-size: .9rem; margin: 0; font-weight: 700; }
.loop { display: grid; gap: 8px; }
.loop .part { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.loop .part span { font-weight: 700; color: var(--muted); min-width: 80px; }
.out { display: grid; gap: 16px; position: sticky; top: 76px; }
@media (max-width: 900px) { .out { position: static; } }
.out .block { background: var(--storm); border: 2px solid var(--edge); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.out .block h3 { font-size: 1.2rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.checks { margin: 0; padding: 14px 16px 14px 34px; border-radius: 12px; background: var(--night); color: var(--signal); }
.checks.ok { color: #9fe6b8; list-style: none; padding-left: 16px; }
@media (prefers-reduced-motion: reduce) { .card, .card:hover { transition: none; transform: none; } }
.lesson-head { font-size: 1.4rem; margin: 8px 0 -4px; color: var(--signal); }
