:root {
  --navy: #1a3a5c;
  --navy-deep: #0a2240;
  --ink: #1a1a2e;
  --amber: #e8a020;
  --amber-deep: #cf8c10;
  --royal: #2f3fa6;
  --paper: #f5f7fb;
  --card: #ffffff;
  --line: #d6dde8;
  --muted: #5b6b80;
  --good: #1f8a4c;
  --bad: #c0392b;
  --team1: #e8a020; --team2: #2f7fd8; --team3: #1f8a4c; --team4: #c0392b; --team5: #8e44ad; --team6: #16a3a3;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(10, 34, 64, .12);
  font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); }
body { font-size: 16px; line-height: 1.45; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: var(--royal); }
.hidden { display: none !important; }

/* ---------- shared bits ---------- */
.btn { border: 0; border-radius: 10px; padding: .7em 1.1em; background: var(--navy); color: #fff; font-weight: 600; }
.btn:hover { background: var(--navy-deep); }
.btn.amber { background: var(--amber); color: var(--ink); }
.btn.amber:hover { background: var(--amber-deep); }
.btn.ghost { background: transparent; color: var(--navy); border: 2px solid var(--line); }
.btn.small { padding: .35em .7em; font-size: .85rem; }
.btn.big { padding: 1em 1.4em; font-size: 1.15rem; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; }
.pill { display: inline-block; padding: .15em .65em; border-radius: 999px; background: #e9eef6; color: var(--navy); font-size: .8rem; font-weight: 600; }
.pill.amber { background: #fdf0d8; color: #7a4e00; }
.muted { color: var(--muted); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: .8rem; }
.field { display: block; width: 100%; padding: .75em .9em; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 1.05rem; }
.field:focus { outline: none; border-color: var(--royal); }
label.lbl { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7em 1.2em; border-radius: 10px; z-index: 99; }

/* ---------- landing ---------- */
.landing { max-width: 920px; margin: 0 auto; padding: 32px 16px 60px; }
.landing header { display: flex; justify-content: center; margin-bottom: 18px; }
.landing header img { height: 64px; }
.landing h1 { text-align: center; color: var(--navy); margin: .2em 0 .1em; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.landing p.lead { text-align: center; color: var(--muted); margin-top: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
.choice-grid .card h2 { margin: 0 0 .3em; color: var(--navy); }

/* ---------- student phone ---------- */
.phone { max-width: 520px; margin: 0 auto; padding: 16px; min-height: 100vh; display: flex; flex-direction: column; }
.phone .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.phone .top img { height: 34px; }
.phone .big-q { font-size: 1.25rem; font-weight: 600; color: var(--navy); }
.answer-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.answer-btn { text-align: left; border: 0; border-radius: 12px; padding: 1em; color: #fff; font-weight: 600; font-size: 1.05rem; display: flex; gap: .7em; align-items: center; }
.answer-btn .letter { background: rgba(255,255,255,.25); border-radius: 8px; padding: .1em .5em; }
.answer-btn.a0 { background: #2f7fd8; } .answer-btn.a1 { background: #e8a020; color: var(--ink); }
.answer-btn.a2 { background: #1f8a4c; } .answer-btn.a3 { background: #c0392b; }
.answer-btn.chosen { outline: 4px solid var(--ink); outline-offset: 2px; }
.answer-btn.dim { opacity: .35; }
.buzz { width: 100%; aspect-ratio: 1; max-width: 320px; margin: 20px auto; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-size: 2.2rem; font-weight: 800; box-shadow: 0 10px 0 #7d241a; }
.buzz:active { transform: translateY(6px); box-shadow: 0 4px 0 #7d241a; }
.team-chip { display: inline-flex; align-items: center; gap: .4em; padding: .3em .7em; border-radius: 999px; color: #fff; font-weight: 700; font-size: .85rem; }
.wait { text-align: center; color: var(--muted); padding: 40px 10px; }
.wait .spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--amber); border-radius: 50%; margin: 0 auto 14px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- projector screen ---------- */
.screen { position: fixed; inset: 0; background: radial-gradient(1200px 700px at 80% -10%, #24507d 0%, var(--navy-deep) 60%); color: #fff; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.screen .bar { display: flex; align-items: center; justify-content: space-between; padding: 1.2vh 2.4vw; gap: 2vw; }
.screen .bar .logo { height: 5vh; background: #fff; padding: .6vh 1vw; border-radius: 8px; }
.screen .bar .seg { font-size: 2.1vh; opacity: .85; }
.screen .timer { font-variant-numeric: tabular-nums; font-size: 4.4vh; font-weight: 800; background: rgba(255,255,255,.1); padding: .2vh 1.2vw; border-radius: 10px; }
.screen .timer.low { color: var(--amber); }
.screen .timer.out { color: #ff7b6b; }
.screen .stage { padding: 2vh 5vw; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.screen h1 { font-size: 6.4vh; margin: 0 0 2vh; line-height: 1.1; }
.screen h2 { font-size: 4.2vh; margin: 0 0 2vh; color: var(--amber); }
.screen .bullets { font-size: 3.6vh; line-height: 1.35; margin: 0; padding-left: 1.2em; }
.screen .bullets li + li { margin-top: 1.2vh; }
.screen .prompt { margin-top: 3vh; font-size: 3.4vh; background: rgba(232,160,32,.16); border-left: 6px solid var(--amber); padding: 1.6vh 1.6vw; border-radius: 8px; }
.screen .foot { display: flex; justify-content: space-between; align-items: center; padding: 1.2vh 2.4vw; font-size: 2.2vh; opacity: .9; gap: 2vw; }
.screen .join { background: #fff; color: var(--navy-deep); padding: .6vh 1.2vw; border-radius: 10px; font-weight: 700; }
.screen .join b { color: var(--royal); letter-spacing: .12em; }
.scoreboard { display: flex; gap: 1vw; flex-wrap: wrap; }
.scoreboard .t { padding: .5vh 1vw; border-radius: 10px; font-weight: 800; color: #fff; font-size: 2.4vh; }
.scr-q { font-size: 5vh; font-weight: 700; line-height: 1.2; margin-bottom: 3vh; }
.scr-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6vh 1.6vw; }
.scr-ans { border-radius: 14px; padding: 2vh 1.6vw; font-size: 3.4vh; font-weight: 600; display: flex; gap: 1vw; align-items: center; position: relative; overflow: hidden; }
.scr-ans .letter { background: rgba(255,255,255,.25); border-radius: 8px; padding: 0 .5em; }
.scr-ans.a0 { background: #2f7fd8; } .scr-ans.a1 { background: #e8a020; color: var(--ink); } .scr-ans.a2 { background: #1f8a4c; } .scr-ans.a3 { background: #c0392b; }
.scr-ans.wrong { opacity: .3; }
.scr-ans.right { outline: 6px solid #fff; }
.scr-ans .count { margin-left: auto; font-weight: 800; }
.scr-meta { margin-top: 2vh; font-size: 2.6vh; opacity: .85; }
.scr-why { margin-top: 2.4vh; font-size: 3vh; background: rgba(255,255,255,.1); padding: 1.4vh 1.4vw; border-radius: 10px; }
.big-center { text-align: center; }
.big-center .huge { font-size: 16vh; font-weight: 800; font-variant-numeric: tabular-nums; }

/* jeopardy board */
.jboard { display: grid; gap: .8vh .6vw; height: 100%; }
.jcat { background: var(--royal); text-align: center; font-weight: 800; font-size: 2.5vh; padding: 1.4vh .4vw; border-radius: 8px; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.jcell { background: #1d4f86; border-radius: 8px; color: var(--amber); font-weight: 800; font-size: 5vh; display: flex; align-items: center; justify-content: center; }
.jcell.used { background: rgba(255,255,255,.06); color: transparent; }
.jcell.active { outline: 5px solid var(--amber); }

/* wheel */
.puzzle { display: flex; flex-wrap: wrap; gap: 1.6vw; justify-content: center; margin: 2vh 0; }
.pword { display: flex; gap: .5vw; }
.ptile { width: 5.6vh; height: 7.4vh; background: #fff; color: var(--ink); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 4.6vh; font-weight: 800; border: 3px solid #b9c6d8; }
.ptile.blank { background: #16a34a00; border-color: #3a6aa0; background: #e8f0fa; color: transparent; }
.ptile.punct { background: transparent; border-color: transparent; color: #fff; }
.wheel-wrap { display: flex; gap: 4vw; align-items: center; justify-content: center; }
.wheel { width: 34vh; height: 34vh; border-radius: 50%; position: relative; transition: transform 3.2s cubic-bezier(.12,.75,.15,1); border: 6px solid #fff; box-shadow: 0 0 0 6px var(--amber); }
.wheel-pointer { position: absolute; top: -3.4vh; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 2vh solid transparent; border-right: 2vh solid transparent; border-top: 4vh solid var(--amber); z-index: 2; }
.wheel-holder { position: relative; }
.used-letters { font-size: 2.6vh; letter-spacing: .3em; opacity: .85; text-align: center; }

/* hunt */
.hunt-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2vh 2vw; font-size: 2.8vh; counter-reset: h; }
.hunt-item { background: rgba(255,255,255,.08); border-radius: 10px; padding: 1.2vh 1.2vw; }
.hunt-item b { color: var(--amber); }
.hunt-item.revealed { background: rgba(31,138,76,.35); }

/* ---------- instructor console ---------- */
.console { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.console aside { background: var(--navy-deep); color: #fff; padding: 16px; overflow-y: auto; max-height: 100vh; position: sticky; top: 0; }
.console aside img { height: 40px; background: #fff; border-radius: 8px; padding: 4px 8px; }
.console aside .seglist { list-style: none; padding: 0; margin: 14px 0; }
.console aside .seglist li { padding: .55em .7em; border-radius: 8px; cursor: pointer; display: flex; gap: .5em; font-size: .92rem; }
.console aside .seglist li:hover { background: rgba(255,255,255,.08); }
.console aside .seglist li.on { background: var(--amber); color: var(--ink); font-weight: 700; }
.console aside .seglist .min { margin-left: auto; opacity: .7; font-variant-numeric: tabular-nums; }
.console main { padding: 18px 22px 80px; min-width: 0; }
.console .toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.console .code { font-weight: 800; letter-spacing: .15em; color: var(--royal); font-size: 1.3rem; }
.notes { background: #fff8e8; border: 1px solid #f1d699; border-radius: 12px; padding: 1rem 1.1rem; }
.notes h3 { margin: 0 0 .4rem; font-size: 1rem; color: #7a4e00; }
.notes ul { margin: .3rem 0; padding-left: 1.2em; }
.key { background: #e9f7ef; border: 1px solid #b6e2c6; border-radius: 10px; padding: .6rem .8rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .45em 0; border-bottom: 1px solid var(--line); }
.teams-edit .t { display: flex; gap: .5rem; align-items: center; margin: .3rem 0; }
.swatch { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.mini-board { display: grid; gap: 4px; }
.mini-board button { border: 0; border-radius: 6px; padding: .5em 0; background: var(--navy); color: var(--amber); font-weight: 800; }
.mini-board button.used { background: #e5e9f0; color: #9aa6b5; }
.mini-board .mcat { font-size: .72rem; font-weight: 700; text-align: center; color: var(--navy); }
.letters { display: flex; flex-wrap: wrap; gap: 4px; }
.letters button { width: 34px; height: 38px; border: 0; border-radius: 6px; background: var(--navy); color: #fff; font-weight: 700; }
.letters button.vowel { background: var(--royal); }
.letters button.used { background: #e5e9f0; color: #9aa6b5; }
.resp-bars .bar-row { display: flex; align-items: center; gap: .5rem; margin: .25rem 0; }
.resp-bars .bar { height: 14px; border-radius: 6px; background: var(--royal); }
.checklist li { display: flex; gap: .5rem; align-items: flex-start; }
table.simple { border-collapse: collapse; width: 100%; }
table.simple td, table.simple th { border-bottom: 1px solid var(--line); padding: .4em .5em; text-align: left; vertical-align: top; }

@media (max-width: 860px) {
  .console { grid-template-columns: 1fr; }
  .console aside { position: static; max-height: none; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- editor ---------- */
.editor { max-width: 1100px; margin: 0 auto; padding: 18px 16px 80px; }
.editor textarea.field { min-height: 90px; font-size: .95rem; }
.editor details { background: #fff; border-radius: 12px; box-shadow: var(--shadow); margin: 10px 0; padding: .6rem 1rem; }
.editor summary { font-weight: 700; color: var(--navy); cursor: pointer; padding: .3rem 0; }
.editor .qrow { border-top: 1px dashed var(--line); padding-top: .6rem; margin-top: .6rem; }

/* ---------- parent page / print ---------- */
.parent { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
.parent img.logo { height: 52px; }
.parent h1 { color: var(--navy); }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
