/*
 * One look for three screens: a laptop, a smart board, and the teacher's page.
 * Dark, large, and slow-moving, because everything here has to be readable
 * from the back of a room.
 */

:root {
  --ink: #08080a;
  --ink-2: #101015;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.18);
  --paper: #f4f3f1;
  --muted: rgba(244, 243, 241, 0.58);
  --faint: rgba(244, 243, 241, 0.34);
  --amber: #ff7a29;
  --amber-soft: rgba(255, 122, 41, 0.14);
  --stop: #6aa6ff;
  --stop-soft: rgba(106, 166, 255, 0.16);
  --green: #5fd39b;
  --red: #ff6b6b;
  --r: 16px;
  --pad: clamp(18px, 3.4vw, 54px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--paper); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }

.glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(58vw 58vw at 10% -12%, rgba(255, 122, 41, 0.16), transparent 60%),
    radial-gradient(48vw 48vw at 100% 112%, rgba(106, 166, 255, 0.12), transparent 60%);
}

main, header { position: relative; z-index: 2; }

h1, h2, h3 { margin: 0; font-weight: 560; letter-spacing: -0.026em; line-height: 1.06; }
h1 { font-size: clamp(34px, 6vw, 88px); }
h2 { font-size: clamp(22px, 2.8vw, 44px); }
h3 { font-size: clamp(17px, 1.5vw, 25px); }
p { margin: 0; line-height: 1.5; }

.kicker { font-family: var(--mono); font-size: clamp(11px, 0.85vw, 13px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber); }
.lead { font-size: clamp(15px, 1.35vw, 22px); line-height: 1.45; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.big { font-size: clamp(19px, 1.9vw, 32px); }
.huge { font-size: clamp(28px, 3.4vw, 60px); font-weight: 560; letter-spacing: -0.02em; }
.mono { font-family: var(--mono); }

.wrap { padding: var(--pad); max-width: 1560px; margin: 0 auto; }
.stack { display: grid; gap: clamp(10px, 1.2vw, 20px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.grow { flex: 1; }
.hero { min-height: calc(100vh - 210px); display: flex; flex-direction: column; justify-content: center; }

.bar { display: flex; align-items: center; gap: 14px; padding: 12px var(--pad); border-bottom: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.dot.off { background: var(--red); }
.rail { height: 2px; background: var(--line); position: relative; }
.rail i { position: absolute; inset: 0 auto 0 0; background: var(--amber); transition: width 0.5s var(--ease); }

.card { background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02)); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(12px, 1.3vw, 22px); }
.card.on { border-color: var(--amber); background: linear-gradient(180deg, var(--amber-soft), rgba(255,255,255,0.02)); }

.chip { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; color: var(--amber); border: 1px solid rgba(255,122,41,0.38); background: rgba(255,122,41,0.07); }
.chip.plain { color: var(--muted); border-color: var(--line-2); background: none; }

.btn { font: inherit; font-size: 15px; font-weight: 500; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.05); color: var(--paper); cursor: pointer; text-decoration: none; display: inline-block; transition: transform 0.18s var(--ease), background 0.18s var(--ease); }
.btn:hover { background: rgba(255,255,255,0.1); }
.btn:active { transform: scale(0.97); }
.btn.go { background: var(--amber); border-color: var(--amber); color: #fff; font-weight: 600; }
.btn.ghost { background: none; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: 0.45; cursor: default; }

input, textarea { font: inherit; color: var(--paper); width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: none; }
input:focus, textarea:focus { border-color: var(--amber); }
::placeholder { color: var(--faint); }

/* ---- the answer buttons a student presses ---- */
.choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.choice { font: inherit; font-size: clamp(15px, 1.4vw, 21px); padding: clamp(14px, 1.7vw, 24px); border-radius: 14px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.05); color: var(--paper); cursor: pointer; text-align: left; transition: all 0.2s var(--ease); }
.choice:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.choice.picked { border-color: var(--amber); background: var(--amber-soft); }
.choice.answer { border-color: rgba(95,211,155,0.6); background: rgba(95,211,155,0.14); }
.choice:disabled { cursor: default; }
.choice .chip { display: block; margin: 8px auto 0; width: fit-content; font-size: 10px; }
/* Buttons only as wide as their words, centred under the question. */
.choices.compact { grid-template-columns: repeat(auto-fit, minmax(0, max-content)); justify-content: center; gap: 14px; }
.choices.compact .choice { text-align: center; padding: 12px 34px; }
.choices.stack-one { grid-template-columns: 1fr; }

/* ---- the table of members ---- */
.sheet { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: clamp(11px, 0.9vw, 14px); }
.sheet th, .sheet td { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
/* Long headings wrap rather than pushing the table off the side. */
.sheet th { color: var(--amber); font-weight: 500; position: sticky; top: 0; background: var(--ink-2); white-space: normal; line-height: 1.15; vertical-align: bottom; }
.sheet td.stop { color: var(--stop); }
.sheet tr.is-stop td { background: var(--stop-soft); }
.scroll { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.scroll.short { max-height: 40vh; }

/* ---- one group, and its count ---- */
.groupline { display: flex; align-items: center; justify-content: space-between; gap: clamp(12px, 2vw, 30px); flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r); padding: clamp(10px, 1.1vw, 16px) clamp(14px, 1.4vw, 22px); background: rgba(255,255,255,0.03); }
.groupline .big, .groupline .huge { font-family: var(--mono); }
.numname { display: grid; gap: 3px; }
.numname b { font-size: clamp(15px, 1.4vw, 22px); font-weight: 560; }
.means { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* ---- the answer sheet: which group, then the two numbers ---- */
.numrow { display: grid; gap: clamp(10px, 1.4vw, 20px); align-items: end; grid-template-columns: 1fr auto auto 1.4em; border: 1px solid var(--line); border-radius: var(--r); padding: clamp(10px, 1.1vw, 16px) clamp(12px, 1.3vw, 20px); background: rgba(255,255,255,0.03); }
.num { display: grid; gap: 4px; }
.num input { width: clamp(72px, 7vw, 104px); text-align: center; font-family: var(--mono); font-size: clamp(16px, 1.6vw, 24px); padding: 8px 6px; }
.tick { color: var(--green); font-size: clamp(16px, 1.6vw, 24px); opacity: 0; transition: opacity 0.25s var(--ease); }
.tick.on { opacity: 1; }

/* ---- the four boxes, and the rules table ---- */
.grid { border-collapse: collapse; width: 100%; max-width: 900px; }
.grid th, .grid td { border: 1px solid var(--line-2); padding: clamp(10px, 1.3vw, 20px); text-align: center; }
.grid thead th { color: var(--amber); font-family: var(--mono); font-size: clamp(12px, 1vw, 16px); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; }
.grid tbody th { color: var(--amber); font-family: var(--mono); font-size: clamp(12px, 1vw, 16px); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; text-align: left; }
.grid td b { display: block; font-family: var(--mono); font-size: clamp(18px, 2.2vw, 36px); font-weight: 560; }
.grid td span { font-family: var(--mono); font-size: clamp(12px, 1.1vw, 18px); color: var(--muted); }
.grid td.worst { border-color: var(--amber); background: var(--amber-soft); }
.grid tr.worst th, .grid tr.worst td { border-color: var(--amber); background: var(--amber-soft); }
.grid.rules th { text-align: left; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: clamp(14px, 1.3vw, 20px); color: var(--paper); }
.grid.rules td b { font-size: clamp(16px, 1.8vw, 28px); }

/* ---- every filter makes the group smaller ---- */
.chain { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.link { border: 1px solid var(--line-2); border-radius: var(--r); padding: clamp(12px, 1.3vw, 20px); background: rgba(255,255,255,0.03); }
.link b { display: block; margin-top: 8px; font-family: var(--mono); font-size: clamp(22px, 2.6vw, 44px); font-weight: 560; }
.link.thin { border-style: dashed; border-color: var(--red); }
.link.thin b { color: var(--red); }

/* ---- the work on the left, the table on the right ---- */
.round { display: grid; gap: clamp(14px, 2.2vw, 36px); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) {
  .round { grid-template-columns: 1fr 1.2fr; }
  .round > :last-child { border-left: 1px solid var(--line); padding-left: clamp(14px, 2.2vw, 36px); }
}

/* The two blanks and their options have to sit on one screen together. */
.pair .choice { padding: clamp(9px, 1.1vw, 15px) clamp(14px, 1.4vw, 20px); }

/* Two sets of options, side by side. */
.pair { display: grid; gap: clamp(14px, 2vw, 34px); grid-template-columns: 1fr; }
@media (min-width: 900px) { .pair { grid-template-columns: 1fr 1fr; } }

/* The filters over the table: click a value, the table follows. */
.filters { display: grid; gap: 8px; }
.filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter .kicker { min-width: 9em; }
.pill {
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: rgba(255,255,255,0.04); color: var(--muted);
}
.pill:hover { color: var(--paper); }
.pill.on { border-color: var(--amber); background: var(--amber-soft); color: var(--paper); }

/* ---- scores ---- */
.scores { display: grid; gap: 8px; }
.score { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.score b { font-family: var(--mono); font-size: clamp(16px, 1.6vw, 24px); }
.score.top { border-color: var(--amber); background: var(--amber-soft); }

.in { animation: rise 0.55s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .in { animation: none; } * { transition-duration: 0.01ms !important; } }

/* ---- the smart board is a projector ---- */
body.board { font-size: 18px; }
body.board .wrap { max-width: 1800px; }
body.board .btn, body.board .choice, body.board .pill, body.board input { pointer-events: none; }

/* ---- the teacher's page ---- */
body.admin .wrap { max-width: 1700px; }
.panel { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .panel { grid-template-columns: 1.35fr 1fr; align-items: start; } }
.screen { border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: #000; position: relative; }
.screen iframe { width: 1600px; height: 900px; border: 0; transform-origin: top left; display: block; }
.note { border-left: 2px solid var(--amber); padding-left: 12px; color: var(--muted); font-size: 14px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- a 768-high laptop is the smallest screen in the room ----
   Everything gets a little tighter so that a screen still holds one question
   and its answer without anybody scrolling. */
@media (max-height: 820px) {
  :root { --pad: clamp(14px, 2.4vw, 34px); }
  .stack { gap: clamp(8px, 1vw, 15px); }
  .card { padding: clamp(10px, 1.1vw, 16px); }
  .choice { padding: clamp(10px, 1.3vw, 17px); }
  .choices.compact .choice { padding: 10px 28px; }
  .grid th, .grid td { padding: clamp(8px, 1vw, 14px); }
  .groupline, .numrow { padding: clamp(8px, 0.9vw, 13px) clamp(12px, 1.2vw, 18px); }
  .scroll { max-height: 50vh; }
  .scroll.short { max-height: 32vh; }
  .hero { min-height: calc(100vh - 170px); }
}
