/* Studyville tokens (Night campus). Source of truth: the Studyville design system. */
:root {
  --surface-ground: #15121f;
  --surface-panel: #211c30;
  --surface-raised: #2b2540;
  --line: #3a3352;
  --ink: #f4ecd8;
  --ink-muted: #b8b0c8;
  --gold: #efb94f;
  --gold-text: #efb94f;
  --ink-on-gold: #1a1420;
  --plum: #7a4a8c;
  --plum-deep: #4a2c55;
  --teal: #3d7a80;
  --focus: #e8955a;
  --strong: #7fc786;
  --paper: #f4ecd8;
  --paper-ink-muted: #5a4f45;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-pill: 999px;
  --shadow-press: inset 0 -3px 0 #1a1420;
  --shadow-frame: 0 0 0 3px #1a1420;
  --font-display: "DM Serif Display", Georgia, serif;
  --font-pixel: "Pixelify Sans", ui-monospace, monospace;
  --font-sans: "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-ground); color: var(--ink); font-family: var(--font-sans); font-size: 15px; line-height: 1.47; -webkit-font-smoothing: antialiased; }
a { color: var(--gold-text); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.app { max-width: 720px; margin: 0 auto; min-height: 100dvh; padding: var(--space-3) var(--space-3) 96px; display: flex; flex-direction: column; gap: var(--space-4); }
.hud { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 52px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 40px; height: 40px; image-rendering: pixelated; }
.wordmark { font-family: var(--font-display); font-size: 26px; line-height: 1; }
.wordmark span { color: var(--gold-text); }
.academy { font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-raised); padding: 7px 12px; border-radius: var(--radius-pill); }
.pill b { font-family: var(--font-pixel); color: var(--gold-text); font-size: 15px; font-weight: 600; }
.pill small { color: var(--ink-muted); font-size: 11px; }

h1, h2, h3 { margin: 0; }
.h-title { font-family: var(--font-pixel); font-size: 22px; line-height: 28px; font-weight: 700; }
.h-section { font-size: 12px; font-weight: 800; letter-spacing: .4px; color: var(--ink-muted); text-transform: uppercase; }
.muted { color: var(--ink-muted); }
.small { font-size: 12px; }

.panel { background: var(--surface-panel); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); box-shadow: inset 0 0 0 1px var(--line); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 420px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.hall { text-align: left; border: 0; cursor: pointer; background: var(--surface-panel); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--ink); }
.hall:hover { box-shadow: inset 0 0 0 1px var(--gold); }
.roof { height: 8px; border-radius: var(--radius-sm); }
.hall-name { font-family: var(--font-pixel); font-size: 16px; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow-press); text-decoration: none; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--gold); color: var(--ink-on-gold); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn.block { width: 100%; }
.row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); }
.bar.focus > i { background: var(--focus); }
.bar.strong > i { background: var(--strong); }
.tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: var(--radius-sm); }
.tag.focus { background: rgba(232,149,90,.16); color: var(--focus); }
.tag.strong { background: rgba(127,199,134,.16); color: var(--strong); }
.tag.new { background: var(--surface-raised); color: var(--ink-muted); }

.paper { background: var(--paper); color: var(--ink-on-gold); border-radius: var(--radius-lg); padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-frame); }
.paper .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--paper-ink-muted); font-weight: 700; }
.stem { font-size: 17px; line-height: 25px; font-weight: 600; margin: 0; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 12px; border-radius: var(--radius-md); border: 2px solid #d8ccb0; background: #fbf6ea; color: var(--ink-on-gold); font-weight: 600; font-size: 15px; text-align: left; cursor: pointer; }
.opt:hover { border-color: #b9862a; }
.opt .l { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-pixel); font-weight: 700; background: #ece2cb; }
.opt.on { border-color: var(--ink-on-gold); background: #f6e3b4; }
.opt.on .l { background: var(--ink-on-gold); color: var(--gold); }
.opt.right { border-color: #2f7a3a; background: #e3f1dc; }
.opt.right .l { background: #2f7a3a; color: #fff; }
.opt.wrong { border-color: #a4511c; background: #f8e2d3; }
.opt.wrong .l { background: #a4511c; color: #fff; }
.opt[disabled] { cursor: default; }
.explain { background: #fff9ec; border-radius: var(--radius-md); padding: 12px; font-size: 14px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.explain .src { font-size: 12px; color: var(--paper-ink-muted); }

.timer { font-family: var(--font-pixel); color: var(--gold-text); font-size: 17px; font-weight: 600; }
.qgrid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.qcell { min-height: 32px; border-radius: var(--radius-sm); border: 0; background: var(--surface-raised); color: var(--ink); font-family: var(--font-pixel); font-size: 12px; cursor: pointer; }
.qcell.done { background: var(--plum); }
.qcell.flag { background: var(--focus); color: var(--ink-on-gold); }
.qcell.cur { box-shadow: 0 0 0 2px var(--gold); }

.score { font-family: var(--font-pixel); font-size: 56px; line-height: 1; color: var(--gold-text); font-weight: 700; }
.card-focus { box-shadow: inset 0 0 0 2px var(--focus); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface-panel); box-shadow: 0 -1px 0 var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { max-width: 720px; margin: 0 auto; display: flex; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; min-height: 56px; color: var(--ink-muted); text-decoration: none; font-size: 11px; font-weight: 800; }
.nav a.on { color: var(--gold-text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }
.field input, .field select { min-height: 44px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-raised); color: var(--ink); padding: 0 12px; font: inherit; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
