/* Write with AI: game-board look. Thick ink outlines, hard shadows, flat bright color. */
:root {
  --paper: #fff3dc;
  --paper-2: #ffe7bd;
  --ink: #17130e;
  --ink-2: #463f35;
  --muted: #7b7264;
  --white: #fffdf7;
  --yellow: #ffd23f;
  --red: #ff5b3a;
  --red-soft: #ffd6cc;
  --green: #17b26a;
  --green-soft: #c8f1da;
  --blue: #2f5bff;
  --blue-soft: #d3ddff;
  --pink: #ff8ac9;
  --purple: #7b5cff;
  --line: 3px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
  --display: "Bricolage Grotesque", "Arial Black", ui-sans-serif, system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Chatbot (deliberately plain, like the real thing) */
  --chat-bg: #ffffff;
  --chat-side: #f7f6f3;
  --chat-ink: #1d1b18;
  --chat-muted: #6e6a63;
  --chat-line: #e7e4de;
  --chat-bubble: #efede8;
  --chat-composer: #f6f5f1;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--body); background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, textarea, select { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Board + stage ---------- */
.board, .stage {
  background-color: var(--paper);
  background-image: radial-gradient(rgba(23, 19, 14, .16) 1.3px, transparent 1.5px);
  background-size: 24px 24px;
}
.stage {
  position: relative; overflow: hidden;
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: 0 16px 56px; text-align: center;
}
.stage-body { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; z-index: 1; }
.stage.top .stage-body { justify-content: flex-start; padding-top: 18px; }
.wrap { width: 100%; max-width: 780px; }
.wrap.wide { max-width: 1120px; }
.stage.blue { background-color: var(--blue); color: var(--white); background-image: radial-gradient(rgba(255,255,255,.2) 1.3px, transparent 1.5px); }
.stage.red { background-color: var(--red); background-image: radial-gradient(rgba(23,19,14,.2) 1.3px, transparent 1.5px); }
.stage.green { background-color: var(--green); background-image: radial-gradient(rgba(23,19,14,.2) 1.3px, transparent 1.5px); }
.stage.yellow { background-color: var(--yellow); background-image: radial-gradient(rgba(23,19,14,.18) 1.3px, transparent 1.5px); }

/* Top bar on game screens */
.gamebar { width: 100%; max-width: 1180px; display: flex; align-items: center; gap: 12px; padding: 18px 0 10px; position: relative; z-index: 2; }
.gamebar .spacer { flex: 1; }
.logo-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 9px;
  background: var(--ink); color: var(--yellow); border-radius: 12px; transform: rotate(-2deg);
  font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 4px 4px 0 var(--yellow);
}
.logo-badge .spark { width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); color: var(--ink); display: grid; place-items: center; font-size: 13px; }
.player-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--white); color: var(--ink); border: var(--line); border-radius: 999px; padding: 4px 14px 4px 4px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow-sm); }
.player-chip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--pink); border: 2.5px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 14px; }

/* Floating decorations */
.deco { position: absolute; z-index: 0; pointer-events: none; animation: bob 6s ease-in-out infinite; }
.deco svg { display: block; }
.deco.d1 { top: 14%; left: 5%; }
.deco.d2 { top: 20%; right: 6%; animation-delay: -2s; }
.deco.d3 { bottom: 12%; left: 8%; animation-delay: -4s; }
.deco.d4 { bottom: 15%; right: 7%; animation-delay: -1s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-14px) rotate(8deg); } }
@media (max-width: 760px) { .deco { opacity: .6; } .deco svg { width: 44px; height: 44px; } .deco.d2, .deco.d3 { display: none; } }

/* ---------- Type ---------- */
.kicker { display: inline-block; font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 16px; padding: 5px 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--white); color: var(--ink); }
.big { font-family: var(--display); font-weight: 800; font-size: clamp(50px, 9.5vw, 116px); line-height: .92; letter-spacing: -.04em; margin: 0 0 22px; }
.mid { font-family: var(--display); font-weight: 800; font-size: clamp(32px, 5.4vw, 56px); line-height: 1; letter-spacing: -.03em; margin: 0 0 16px; }
.hl { display: inline-block; background: var(--yellow); color: var(--ink); border: var(--line); border-radius: 14px; padding: 0 .16em .05em; transform: rotate(-2.5deg); box-shadow: var(--shadow-sm); }
.hl.pink { background: var(--pink); } .hl.green { background: var(--green); } .hl.red { background: var(--red); } .hl.white { background: var(--white); }
.lede { font-size: clamp(18px, 2.2vw, 22px); line-height: 1.5; color: var(--ink-2); margin: 0 auto 28px; max-width: 640px; }
.lede strong { color: var(--ink); }
.stage.blue .lede, .stage.blue .lede strong { color: var(--white); }
.small-print { font-size: 13px; color: var(--muted); }

/* ---------- Buttons ---------- */
.row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: var(--line); border-radius: 16px; padding: 15px 28px;
  background: var(--yellow); color: var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.01em;
  box-shadow: 5px 5px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--ink); }
.btn.white { background: var(--white); }
.btn.blue { background: var(--blue); color: var(--white); }
.btn.green { background: var(--green); }
.btn.pink { background: var(--pink); }
.btn.red { background: var(--red); }
.btn.small { padding: 10px 18px; font-size: 16px; box-shadow: var(--shadow-sm); border-radius: 13px; }
.btn.small:active:not(:disabled) { transform: translate(4px, 4px); }
.btn.huge { font-size: 28px; padding: 18px 42px; }
.link { background: none; border: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 8px; font-size: 16px; font-weight: 700; opacity: .8; }
.link:hover { opacity: 1; }

/* ---------- Forms ---------- */
.form-card { background: var(--white); border: var(--line); border-radius: 22px; box-shadow: 8px 8px 0 var(--ink); padding: 26px; max-width: 460px; margin: 0 auto; text-align: left; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field span small { font-weight: 400; color: var(--muted); }
.field input { width: 100%; padding: 14px 16px; border: var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font-size: 20px; font-weight: 700; outline: none; }
.field input:focus { background: #fff; box-shadow: var(--shadow-sm); }
.error-text { color: #c2260c; font-weight: 700; font-size: 15px; min-height: 22px; margin: 0 0 8px; }
.notice { display: inline-block; background: var(--white); border: var(--line); border-radius: 14px; padding: 10px 16px; font-size: 15px; font-weight: 700; margin: 0 0 20px; box-shadow: var(--shadow-sm); }
.notice.warn { background: var(--yellow); }

/* ---------- Mode picker ---------- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; max-width: 860px; margin: 8px auto 0; text-align: left; }
@media (max-width: 720px) { .modes { grid-template-columns: 1fr; } }
.mode-card { background: var(--white); border: var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 0; overflow: hidden; text-align: left; transition: transform .1s, box-shadow .1s; display: flex; flex-direction: column; }
.mode-card:hover { transform: translate(-3px, -3px) rotate(-.6deg); box-shadow: 9px 9px 0 var(--ink); }
.mode-card:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.mode-art { height: 150px; border-bottom: var(--line); display: grid; place-items: center; font-size: 76px; position: relative; }
.mode-art.solo { background: var(--pink); }
.mode-art.partner { background: var(--blue); }
.mode-art .tag { position: absolute; top: 12px; right: 12px; font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 10px; transform: rotate(4deg); }
.mode-text { padding: 20px 22px 24px; }
.mode-text h2 { font-family: var(--display); font-weight: 800; font-size: 32px; letter-spacing: -.02em; margin: 0 0 6px; }
.mode-text p { margin: 0; color: var(--ink-2); font-size: 17px; line-height: 1.45; }

/* ---------- Round intro ---------- */
.round-badge { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(60px, 12vw, 140px); line-height: .9; letter-spacing: -.05em; margin: 4px 0 30px; }
.round-badge .n { display: inline-block; background: var(--red); color: var(--white); border: var(--line); border-radius: 26px; padding: 0 .22em .04em; margin-left: .12em; box-shadow: var(--shadow); transform: rotate(4deg); }
.topic-card { position: relative; background: var(--white); border: var(--line); border-radius: 22px; padding: 30px 30px 26px; margin: 0 auto 28px; max-width: 640px; text-align: left; box-shadow: 8px 8px 0 var(--ink); transform: rotate(-1.2deg); }
.topic-card .sticker { position: absolute; top: -17px; left: 22px; background: var(--ink); color: var(--yellow); font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; padding: 7px 12px; border-radius: 10px; transform: rotate(-3deg); }
.topic-card .task { font-size: 19px; margin: 0; line-height: 1.4; color: var(--ink-2); }
.topic-card .task strong { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -.02em; line-height: 1.12; margin-top: 8px; color: var(--ink); }
.rules { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--white); border: 2.5px solid var(--ink); border-radius: 999px; padding: 7px 15px; font-weight: 700; font-size: 16px; }
.pill.yellow { background: var(--yellow); }
.waiting { display: inline-flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 800; font-size: 20px; padding: 14px 24px; border-radius: 16px; border: var(--line); background: var(--white); box-shadow: var(--shadow-sm); }
.dot-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(.75); opacity: .5; } 50% { transform: scale(1.1); opacity: 1; } }

/* ---------- Animations ---------- */
.pop { animation: pop .55s cubic-bezier(.2, 1.7, .4, 1) both; }
@keyframes pop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.slam { animation: slam .45s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes slam { from { transform: scale(2.2); opacity: 0; } }
.wobble { animation: wobble .45s; }
@keyframes wobble { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-12px) rotate(-4deg); } 60% { transform: translateX(12px) rotate(4deg); } }
.rise { animation: rise .5s ease both; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Chat: game HUD around a plain chatbot ---------- */
.chat-app { height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; background: var(--chat-bg); text-align: left; }
.hud { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--paper); border-bottom: var(--line); position: relative; z-index: 3; }
.hud .round-tag { font-family: var(--display); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; background: var(--red); color: var(--white); border: 2.5px solid var(--ink); border-radius: 10px; padding: 5px 10px; transform: rotate(-2deg); white-space: nowrap; }
.hud .task { flex: 1; min-width: 0; font-size: 15px; line-height: 1.3; }
.hud .task b { font-family: var(--display); font-weight: 800; }
.hud-btn { border: 2.5px solid var(--ink); background: var(--white); border-radius: 12px; padding: 7px 12px; font-weight: 700; font-size: 15px; box-shadow: 3px 3px 0 var(--ink); white-space: nowrap; }
.hud-btn:active { transform: translate(3px, 3px); box-shadow: none; }
.timer { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 26px; line-height: 1; padding: 8px 14px; border-radius: 12px; background: var(--ink); color: var(--yellow); border: 2.5px solid var(--ink); min-width: 100px; text-align: center; box-shadow: 3px 3px 0 var(--red); }
.timer.low { background: var(--red); color: var(--white); box-shadow: 3px 3px 0 var(--ink); animation: pulse-bg 1s infinite; }
@keyframes pulse-bg { 50% { transform: scale(1.07); } }
.practice-strip { padding: 6px 16px; font-size: 13px; background: #efe9ff; color: #3b2a8a; border-bottom: 1px solid #ddd3ff; }

.chat-body { display: grid; grid-template-columns: 260px 1fr; min-height: 0; }
.sidebar { background: var(--chat-side); border-right: 1px solid var(--chat-line); padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--chat-ink); }
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 14px; font-weight: 700; font-size: 16px; }
.bot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #1d1b18; color: #fff; font-size: 14px; flex: none; }
.side-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent; font-size: 14px; text-align: left; }
.side-label { font-size: 12px; color: var(--chat-muted); font-weight: 700; padding: 14px 12px 4px; }
.side-item { padding: 9px 12px; border-radius: 10px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item.active { background: var(--chat-line); }
.side-item.locked { color: var(--chat-muted); }
.side-foot { margin-top: auto; padding: 10px 12px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #e9822e; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; color: var(--chat-ink); position: relative; }
.chat-top { display: flex; align-items: center; padding: 10px 18px; min-height: 50px; }
.model-name { font-weight: 700; font-size: 17px; color: var(--chat-ink); }
.model-name small { color: var(--chat-muted); font-weight: 400; }
.thread { flex: 1; overflow-y: auto; padding: 12px 16px 8px; }
.thread-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.empty h2 { font-size: clamp(24px, 3.2vw, 30px); font-weight: 400; margin: 0 0 24px; text-align: center; }
.msg { line-height: 1.6; font-size: 16px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 78%; background: var(--chat-bubble); padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; }
.msg.ai { align-self: stretch; display: flex; gap: 14px; }
.msg.ai .bot { margin-top: 2px; }
.msg.ai .body { flex: 1; min-width: 0; }
.msg.ai .body p { margin: 0 0 12px; }
.msg.ai .body p:last-child { margin-bottom: 0; }
.msg.ai .body ul, .msg.ai .body ol { margin: 0 0 12px; padding-left: 22px; }
.msg.ai .body code { background: var(--chat-bubble); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.msg.error .body { color: #c2260c; }
.msg.error .bot { background: #c2260c; }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--chat-muted); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.caret::after { content: "●"; font-size: 12px; margin-left: 4px; color: var(--chat-muted); animation: pulse 1s infinite; }
.composer-wrap { padding: 8px 16px 10px; }
.composer { max-width: 760px; margin: 0 auto; background: var(--chat-composer); border: 1px solid var(--chat-line); border-radius: 26px; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 20px; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.empty .composer { width: 100%; }
.composer textarea { flex: 1; border: 0; outline: none; background: transparent; color: var(--chat-ink); resize: none; font-size: 16px; line-height: 1.5; max-height: 200px; padding: 8px 0; font-family: var(--body); }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--chat-ink); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .25; }
.disclaimer { text-align: center; font-size: 12px; color: var(--chat-muted); padding-top: 8px; }

.icon-btn { border: 0; background: transparent; color: var(--chat-muted); padding: 6px; border-radius: 8px; font-size: 18px; line-height: 1; }
.top-spacer { flex: 1; }
.only-mobile { display: none; }

@media (max-width: 1100px) { .chat-body { grid-template-columns: 220px 1fr; } }
@media (max-width: 860px) {
  .chat-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .only-mobile { display: inline-flex; }
  .msg.user { max-width: 88%; }
  .hide-mobile { display: none; }
  .hud { flex-wrap: wrap; }
  .hud .logo-badge { display: none; }
  .hud .task { order: 5; flex-basis: 100%; font-size: 14px; }
  .timer { font-size: 22px; min-width: 84px; margin-left: auto; }
}

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; text-align: center; }
.overlay.time { background-color: var(--red); background-image: radial-gradient(rgba(23,19,14,.22) 1.3px, transparent 1.5px); background-size: 24px 24px; }
.time-word { font-family: var(--display); font-weight: 800; font-size: clamp(110px, 24vw, 280px); line-height: .85; letter-spacing: -.05em; color: var(--yellow); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 10px 10px 0 var(--ink); margin-bottom: 22px; }
.hands { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 40px); margin: 0 0 30px; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(23,19,14,.55); }
.modal .sheet { background: var(--paper); border: var(--line); box-shadow: 10px 10px 0 var(--ink); border-radius: 24px; max-width: 720px; width: 100%; max-height: 88dvh; overflow: auto; padding: 26px; text-align: left; }

/* ---------- Rubric ---------- */
.rubric { display: grid; gap: 10px; text-align: left; margin: 0 auto 30px; max-width: 700px; }
.rubric-head { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; margin: 12px 0 0; display: flex; align-items: center; gap: 8px; }
.rubric-head::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--ink); }
.rubric-head.plus::before { background: var(--green); } .rubric-head.minus::before { background: var(--red); }
.rubric-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-radius: 16px; background: var(--white); border: var(--line); font-size: 17px; box-shadow: var(--shadow-sm); }
.rubric-row .emoji { font-size: 26px; }
.rubric-row .what { flex: 1; font-weight: 700; }
.rubric-row .what small { display: block; font-weight: 400; color: var(--muted); font-size: 15px; margin-top: 2px; }
.token { flex: none; display: grid; place-items: center; min-width: 66px; height: 44px; padding: 0 10px; border: var(--line); border-radius: 12px; font-family: var(--display); font-weight: 800; font-size: 22px; }
.token.plus { background: var(--green); } .token.minus { background: var(--red); } .token.zero { background: var(--white); }
.rubric.compact .rubric-row { padding: 8px 10px 8px 12px; font-size: 15px; box-shadow: 3px 3px 0 var(--ink); }
.rubric.compact .token { min-width: 52px; height: 36px; font-size: 17px; }

/* Chips used while grading */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-size: 14.5px; font-weight: 700; border: 2.5px solid var(--ink); background: var(--white); box-shadow: 2px 2px 0 var(--ink); transition: transform .06s; }
.chip .p { font-family: var(--display); font-weight: 800; }
.chip:active { transform: translate(2px, 2px); box-shadow: none; }
.chip.plus:not(.on):hover { background: var(--green-soft); }
.chip.minus:not(.on):hover { background: var(--red-soft); }
.chip.plus.on { background: var(--green); }
.chip.minus.on { background: var(--red); }
.chip.on { transform: rotate(-2deg); }
.chip.ai-suggest { position: relative; }
.chip.ai-suggest::after { content: "REF"; position: absolute; top: -9px; right: -6px; font-size: 9px; font-weight: 800; letter-spacing: .05em; background: var(--ink); color: var(--yellow); padding: 1px 5px; border-radius: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 800; border: 2px solid var(--ink); }
.tag.plus { background: var(--green); } .tag.minus { background: var(--red); }

/* ---------- Example conversations ---------- */
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; text-align: left; margin-bottom: 30px; }
@media (max-width: 860px) { .examples { grid-template-columns: 1fr; } }
.convo { background: var(--white); border: var(--line); border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.convo:nth-child(1) { transform: rotate(-.8deg); } .convo:nth-child(2) { transform: rotate(.8deg); }
.convo-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--yellow); border-bottom: var(--line); font-family: var(--display); font-weight: 800; font-size: 20px; }
.convo-head.plus { background: var(--green); } .convo-head.minus { background: var(--red); }
.convo-head .mystery { font-size: 15px; background: var(--white); border: 2.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; }
.convo-head .total { font-size: 26px; background: var(--white); border: 2.5px solid var(--ink); border-radius: 12px; padding: 0 10px; }
.convo-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; font-size: 14.5px; line-height: 1.5; }
.convo .u { align-self: flex-end; max-width: 90%; background: var(--chat-bubble); padding: 9px 13px; border-radius: 16px; }
.convo .a { color: #36322c; display: flex; gap: 10px; }
.convo .a .bot { width: 22px; height: 22px; font-size: 11px; margin-top: 2px; }
.convo .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; justify-content: flex-end; }

/* ---------- Grading ---------- */
.grade-page { min-height: 100dvh; }
.grade-top { position: sticky; top: 0; z-index: 5; background: var(--white); border-bottom: var(--line); padding: 12px 16px; }
.grade-top-inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.grade-top h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.01em; flex: 1; text-align: left; }
.live-score { font-family: var(--display); font-weight: 800; font-size: 32px; min-width: 104px; height: 54px; display: grid; place-items: center; border: var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.live-score.plus { background: var(--green); } .live-score.minus { background: var(--red); } .live-score.zero { background: var(--white); }
.grade-list { max-width: 900px; margin: 0 auto; padding: 22px 16px 130px; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.section-label { font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; margin: 16px 0 0; }
.g-msg { border-radius: 18px; padding: 16px 18px; }
.g-msg.student { background: var(--white); border: var(--line); box-shadow: var(--shadow-sm); }
.g-msg.ai { border: 2.5px dashed rgba(23,19,14,.35); color: var(--ink-2); font-size: 14.5px; background: rgba(255,255,255,.55); }
.g-msg .who { font-family: var(--display); font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.g-msg .text { white-space: pre-wrap; line-height: 1.55; font-size: 16.5px; }
.g-msg.ai .text { font-size: 14.5px; max-height: 7.5em; overflow: hidden; }
.g-msg.ai .text.open { max-height: none; }
.g-msg .text.md { white-space: normal; }
.g-msg .text.md p { margin: 0 0 8px; }
.g-msg .text.md ul, .g-msg .text.md ol { margin: 0 0 8px; padding-left: 20px; }
.g-msg .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sub { font-family: var(--display); font-weight: 800; font-size: 15px; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink); letter-spacing: 0; color: var(--ink); }
.sub.plus { background: var(--green); } .sub.minus { background: var(--red); } .sub.zero { background: var(--white); }
.g-whole { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--white); border: var(--line); cursor: pointer; font-weight: 700; }
.g-whole input { width: 22px; height: 22px; accent-color: var(--red); }
.grade-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--white); border-top: var(--line); z-index: 6; }
.grade-bar-inner { max-width: 900px; margin: 0 auto; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.referee-note { font-size: 14.5px; color: var(--ink-2); text-align: left; flex: 1; min-width: 200px; }

/* Grader choice (solo) */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; max-width: 760px; margin: 0 auto; }
@media (max-width: 680px) { .choice { grid-template-columns: 1fr; } }
.choice .btn { flex-direction: column; gap: 6px; padding: 22px 20px; line-height: 1.1; }
.choice .btn .e { font-size: 40px; }
.choice .btn small { font-family: var(--body); font-weight: 400; font-size: 15px; opacity: .9; }
.spinner { width: 74px; height: 74px; border-radius: 50%; border: 8px solid var(--white); border-top-color: var(--ink); animation: spin .8s linear infinite; margin: 0 auto 26px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Score reveal & results ---------- */
.score-giant { font-family: var(--display); font-weight: 800; font-size: clamp(130px, 30vw, 300px); line-height: .85; letter-spacing: -.05em; margin: 8px 0 22px; font-variant-numeric: tabular-nums; color: var(--white); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 12px 12px 0 var(--ink); }
.score-mid { font-family: var(--display); font-weight: 800; font-size: clamp(80px, 15vw, 150px); line-height: .9; letter-spacing: -.04em; margin: 6px 0 24px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 7px 7px 0 var(--ink); color: var(--white); }
.score-mid.plus { color: var(--green); } .score-mid.minus { color: var(--red); } .score-mid.zero { color: var(--yellow); }
.caption { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 6vw, 64px); letter-spacing: -.03em; margin: 0 0 22px; }
.by-line { display: inline-block; font-weight: 700; background: var(--white); border: 2.5px solid var(--ink); border-radius: 999px; padding: 6px 14px; margin-bottom: 22px; }
.breakdown { max-width: 600px; margin: 0 auto 26px; text-align: left; display: grid; gap: 10px; }
.b-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 16px; background: var(--white); border: var(--line); box-shadow: var(--shadow-sm); font-weight: 700; }
.b-row .e { font-size: 22px; }
.b-row .what { flex: 1; }
.b-row .n { color: var(--muted); font-weight: 400; }
.annotated { max-width: 760px; margin: 0 auto 30px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.annotated .u { background: var(--white); border: var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.annotated .u .t { white-space: pre-wrap; line-height: 1.5; }
.annotated .u .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.annotated .u .none { font-size: 13px; color: var(--muted); margin-top: 6px; }
.reteach { background: var(--white); border: var(--line); border-radius: 26px; box-shadow: 8px 8px 0 var(--ink); padding: 32px 24px; margin: 34px auto 30px; max-width: 980px; }
.moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 0 auto 26px; text-align: left; max-width: 980px; }
@media (max-width: 760px) { .moves { grid-template-columns: 1fr; } }
.move { border: var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-sm); }
.move:nth-child(1) { background: var(--yellow); transform: rotate(-1deg); }
.move:nth-child(2) { background: var(--pink); }
.move:nth-child(3) { background: var(--blue-soft); transform: rotate(1deg); }
.move .e { font-size: 34px; }
.move h3 { font-family: var(--display); font-weight: 800; margin: 8px 0 6px; font-size: 21px; letter-spacing: -.01em; }
.move p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.45; }

.vs { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 4vw, 40px); margin: 6px 0 24px; flex-wrap: wrap; }
.vs .col { min-width: 170px; background: var(--white); border: var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 14px 20px 18px; }
.vs .col:first-child { transform: rotate(-2deg); } .vs .col:last-child { transform: rotate(2deg); }
.vs .label { font-family: var(--display); font-size: 14px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.vs .n { font-family: var(--display); font-weight: 800; font-size: clamp(60px, 11vw, 110px); line-height: 1; letter-spacing: -.04em; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.vs .arrow { font-family: var(--display); font-weight: 800; font-size: 54px; }
.n.plus { color: var(--green); } .n.minus { color: var(--red); } .n.zero { color: var(--yellow); }
.comeback { display: inline-block; background: var(--yellow); border: var(--line); box-shadow: var(--shadow); font-family: var(--display); font-weight: 800; font-size: clamp(24px, 4vw, 36px); padding: 10px 24px; border-radius: 16px; margin-bottom: 30px; transform: rotate(-2deg); }

/* License card */
.license-wrap { margin: 18px auto 30px; display: flex; flex-direction: column; align-items: center; }
.license { position: relative; width: min(600px, 100%); border: var(--line); border-radius: 24px; box-shadow: 10px 10px 0 var(--ink); overflow: hidden; text-align: left; transform: rotate(-1.5deg); background: var(--white); }
.license.lv-passenger { --lc: var(--red-soft); --lc2: var(--red); }
.license.lv-learner { --lc: #fff0b0; --lc2: var(--yellow); }
.license.lv-permit { --lc: var(--blue-soft); --lc2: #7f9bff; }
.license.lv-license { --lc: var(--green-soft); --lc2: var(--green); }
.license-head { background: var(--ink); color: var(--yellow); padding: 10px 18px; font-family: var(--display); font-weight: 800; letter-spacing: .12em; font-size: 13px; text-transform: uppercase; display: flex; justify-content: space-between; gap: 10px; }
.license-body { background: var(--lc); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.4) 0 10px, transparent 10px 22px); display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 20px 18px 24px; position: relative; min-height: 210px; }
@media (max-width: 520px) { .license-body { grid-template-columns: 88px 1fr; } .license-stamp { transform: rotate(-14deg) scale(.75); right: 4px !important; bottom: 2px !important; } }
.license-photo { aspect-ratio: 4 / 5; border: var(--line); border-radius: 14px; background: var(--lc2); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 64px; }
.license-fields { display: grid; gap: 8px; align-content: start; padding-right: 96px; }
.lf small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.lf b { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.lf.level b { font-size: clamp(28px, 5vw, 40px); line-height: 1; }
.license-stamp { position: absolute; right: 16px; bottom: 16px; width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--ink); display: grid; place-items: center; text-align: center; font-family: var(--display); font-weight: 800; font-size: 12.5px; line-height: 1.05; letter-spacing: .04em; text-transform: uppercase; transform: rotate(-14deg); background: var(--white); padding: 8px; }
.license-stamp .e { display: block; font-size: 28px; margin-bottom: 2px; }
.license-foot { border-top: var(--line); padding: 8px 18px; font-size: 12px; color: var(--ink-2); background: var(--white); }
.level-desc { max-width: 640px; margin: 30px auto 0; font-size: 20px; line-height: 1.5; font-weight: 700; }
.level-next { max-width: 640px; margin: 10px auto 0; font-size: 17px; color: var(--ink-2); }

/* Level track */
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 1000px; margin: 0 auto 36px; text-align: left; }
@media (max-width: 760px) { .track { grid-template-columns: 1fr 1fr; } }
.step { position: relative; background: var(--white); border: 3px dashed var(--ink); border-radius: 18px; padding: 16px 14px 14px; opacity: .5; }
.step.reached { opacity: 1; border-style: solid; }
.step.here { opacity: 1; border-style: solid; background: var(--yellow); box-shadow: var(--shadow); transform: translateY(-6px) rotate(-1deg); }
.step .b { font-size: 30px; }
.step h4 { font-family: var(--display); font-weight: 800; font-size: 20px; margin: 6px 0 2px; letter-spacing: -.01em; }
.step .tl { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.step .rule { font-size: 13px; color: var(--ink-2); margin-top: 8px; line-height: 1.35; }
.step .pin { position: absolute; top: -14px; right: 10px; background: var(--ink); color: var(--yellow); font-family: var(--display); font-weight: 800; font-size: 11px; letter-spacing: .1em; padding: 4px 8px; border-radius: 8px; transform: rotate(4deg); }

.crown { font-size: 90px; line-height: 1; margin-bottom: 6px; filter: drop-shadow(4px 4px 0 var(--ink)); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; border: 2px solid var(--ink); animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Teacher ---------- */
.t-page { min-height: 100dvh; text-align: left; }
.t-head { background: var(--ink); color: var(--white); padding: 14px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.t-head h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; flex: 1; letter-spacing: -.01em; }
.t-head .logo-badge { background: var(--yellow); color: var(--ink); box-shadow: none; }
.t-head .logo-badge .spark { background: var(--ink); color: var(--yellow); }
.t-head a { color: var(--yellow); font-weight: 700; }
.t-main { max-width: 1100px; margin: 0 auto; padding: 28px 16px 60px; display: grid; gap: 26px; }
.t-card { background: var(--white); border: var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); }
.t-card h2 { margin: 0 0 12px; font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -.01em; }
.t-card p { line-height: 1.55; margin: 0 0 12px; color: var(--ink-2); }
.t-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .t-grid { grid-template-columns: 1fr; } }
.t-field { display: block; margin-bottom: 14px; }
.t-field > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.t-field input, .t-field select { width: 100%; padding: 11px 13px; border: var(--line); border-radius: 12px; font-size: 16px; background: var(--paper); color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg label { display: flex; gap: 10px; align-items: flex-start; border: var(--line); border-radius: 14px; padding: 12px; cursor: pointer; background: var(--paper); }
.seg label:has(input:checked) { background: var(--yellow); box-shadow: var(--shadow-sm); }
.seg input { margin-top: 3px; accent-color: var(--ink); }
.seg b { display: block; font-family: var(--display); font-weight: 800; font-size: 17px; }
.seg small { color: var(--ink-2); font-size: 13.5px; line-height: 1.35; display: block; }
.t-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.t-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 6px 12px; border-radius: 999px; font-size: 14px; border: 2.5px solid var(--ink); }
.t-status.ok { background: var(--green); } .t-status.warn { background: var(--yellow); } .t-status.bad { background: var(--red); }
.room-code { font-family: var(--display); font-weight: 800; font-size: clamp(60px, 10vw, 110px); letter-spacing: .06em; line-height: 1; margin: 6px 0 12px; display: inline-block; background: var(--yellow); border: var(--line); border-radius: 18px; padding: 4px 18px; box-shadow: var(--shadow); transform: rotate(-1.5deg); }
.join-url { font-family: ui-monospace, Menlo, monospace; font-size: 15px; background: var(--paper); border: 2px solid var(--ink); padding: 8px 12px; border-radius: 10px; word-break: break-all; }
.phases { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 16px; }
.phase { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 2px solid var(--ink); background: var(--white); opacity: .5; }
.phase.done { opacity: 1; background: var(--green-soft); }
.phase.now { opacity: 1; background: var(--ink); color: var(--yellow); }
.roster { width: 100%; border-collapse: collapse; font-size: 15px; }
.roster th { text-align: left; font-family: var(--display); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; padding: 8px; border-bottom: var(--line); }
.roster td { padding: 10px 8px; border-bottom: 1.5px solid #e9dfcc; }
.roster td.num { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 17px; }
.roster .pos { color: #0d8a50; } .roster .neg { color: #d23a1a; }
.script { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.script li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; gap: 10px; line-height: 1.5; color: var(--ink-2); }
.script li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); border: 2.5px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--ink); }
.script q { font-weight: 700; color: var(--ink); }
.podium-wrap { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; overflow: auto; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin: 22px 0 24px; flex-wrap: wrap; }
.podium .spot { width: 210px; }
.podium .medal { font-size: 50px; filter: drop-shadow(3px 3px 0 var(--ink)); }
.podium .first .medal { font-size: 76px; }
.podium .block { border: var(--line); border-radius: 18px 18px 0 0; padding: 16px 10px; box-shadow: var(--shadow); }
.podium .first .block { height: 230px; background: var(--yellow); }
.podium .second .block { height: 170px; background: var(--blue-soft); }
.podium .third .block { height: 130px; background: #ffd9b8; }
.podium .nm { font-family: var(--display); font-weight: 800; font-size: 24px; margin-bottom: 6px; overflow-wrap: anywhere; }
.podium .sc { font-family: var(--display); font-weight: 800; font-size: 40px; }
.podium .lv { font-size: 14px; font-weight: 700; margin-top: 4px; }
.mvp { display: inline-flex; gap: 10px; align-items: center; background: var(--white); border: var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 12px 20px; font-size: 19px; font-weight: 700; margin: 6px; }

/* Atkinson draws slashed zeros; use the display face where numbers matter. */
.step .rule, .step .tl, .pill, .b-row .n, .roster td, .lf b, .small-print { font-family: var(--display); font-weight: 600; }
.step .tl { font-weight: 700; }
.seg input[type="radio"] { width: 18px; height: 18px; padding: 0; border: 0; flex: none; background: none; }

/* Finish early */
.hud-btn.finish { background: var(--green); }
.hud-btn.finish:disabled { opacity: .4; }
.modal .sheet.confirm { max-width: 560px; text-align: center; background: var(--white); }
.confirm-emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(3px 3px 0 var(--ink)); }
.modal .sheet.confirm .mid { font-size: clamp(30px, 4.5vw, 42px); }
.modal .sheet.confirm .lede { font-size: 18px; margin-bottom: 24px; }

/* ---------- Fit-to-screen tightening ---------- */
.stage.top .stage-body { padding-top: 0; }
.stage.top { padding-bottom: 28px; }
.gamebar { padding: 14px 0 8px; }
.mid.tight { font-size: clamp(30px, 4.4vw, 48px); margin-bottom: 8px; }
.lede.tight { font-size: 18px; margin-bottom: 18px; }
.kicker { margin-bottom: 10px; }

/* Rubric: earn | lose side by side */
.rubric { grid-template-columns: 1fr 1fr; gap: 0 22px; max-width: 1060px; margin-bottom: 22px; align-items: start; }
.rcol { display: grid; gap: 9px; }
.rubric-head { margin: 0 0 2px; }
.rubric-row { padding: 9px 12px 9px 14px; font-size: 16px; gap: 12px; }
.rubric-row .emoji { font-size: 22px; }
.rubric-row .what small { font-size: 14px; margin-top: 1px; }
.token { min-width: 56px; height: 38px; font-size: 19px; }
.rubric.compact .rubric-row { padding: 7px 10px 7px 12px; }
@media (max-width: 760px) { .rubric { grid-template-columns: 1fr; gap: 14px; } }
.modal .rubric { max-width: none; }

/* Grader choice: icon beside the text, shorter buttons */
.choice { max-width: 860px; }
.choice .btn { flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px; padding: 14px 18px; }
.choice .btn .e { font-size: 34px; }
.choice .btn .t { display: flex; flex-direction: column; gap: 3px; }

/* Example chats: long AI replies clamp to two lines */
.examples { gap: 22px; margin-bottom: 22px; }
.convo-body { padding: 14px; gap: 10px; font-size: 14px; }
.convo .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.convo .clamp.open { display: block; }
.wrap.xwide { max-width: 1220px; }
.wrap.xwide .rubric { max-width: 1220px; }
.stage.top { padding-bottom: 16px; }
.choice .btn { padding: 12px 18px; }
.gamebar { padding: 12px 0 6px; }
.stage.top { padding-bottom: 12px; }
.rubric { margin-bottom: 14px; }
/* Example chats scroll inside their cards, like chat windows, so the page itself fits. */
@media (min-width: 861px) {
  .convo-body { max-height: max(240px, calc(100dvh - 330px)); overflow-y: auto; }
}
.examples + .btn { margin-top: 0; }
@media (min-width: 861px) {
  .convo-body { max-height: max(200px, calc(100dvh - 400px)); }
}
