/* ARTIS Quiz — white ground, ARTIS greens. Shared by all three views. */

:root {
  /* Palette derived from the ARTIS mark: deep green wordmark, light green chip */
  --brand: #2f6b23;
  --brand-deep: #093300;
  --brand-wash: #eef4e9;
  --brand-light: #92d068;
  --sky: #69cff9;

  --ink: #1b2419;
  --ink-soft: #5f6f57;
  --page: #ffffff;
  --panel: #f7f9f5;
  --line: #e4eade;
  --warn: #a8621a;
  --bad: #9a3b3b;

  --a0: #2f6b23;
  --a1: #1f4e79;
  --a2: #b06a1f;
  --a3: #6f3f63;

  --r: 14px;
  --shadow: 0 1px 2px rgba(27, 36, 25, 0.06), 0 8px 24px rgba(27, 36, 25, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.wrap.wide { max-width: 1100px; }

/* ---- type ---- */

h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 10px; letter-spacing: -0.005em; }
p { line-height: 1.55; margin: 0 0 12px; }

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 10px;
}

.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
}

/* ---- shell ---- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 22px;
}

.brand { font-weight: 700; letter-spacing: 0.02em; }
.brand span { color: var(--brand); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 16px;
}

.card.plain { background: var(--page); }
.card.accent { background: var(--brand-wash); border-color: #c9e0d9; }

/* ---- controls ---- */

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid rgba(14, 122, 99, 0.35);
  outline-offset: 2px;
}

input.code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

button {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.ghost { background: #fff; color: var(--brand); }
button.ghost:hover { background: var(--brand-wash); }
button.quiet { background: #fff; color: var(--ink-soft); border-color: var(--line); }
button.quiet:hover { background: var(--panel); color: var(--ink); }
button.danger { background: #fff; color: var(--bad); border-color: #e3cccc; }
button.danger:hover { background: #fbf2f2; }
button.block { width: 100%; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 6px; }
.grow { flex: 1 1 160px; }
.stack > * + * { margin-top: 14px; }
.spacer { flex: 1; }

/* ---- answer tiles ---- */

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.answers.one-col { grid-template-columns: 1fr; }

.tile {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-height: 84px;
  padding: 16px;
  border-radius: 12px;
  color: #fff;
  border: none;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
}

.tile[data-i="0"] { background: var(--a0); }
.tile[data-i="1"] { background: var(--a1); }
.tile[data-i="2"] { background: var(--a2); }
.tile[data-i="3"] { background: var(--a3); }
.tile:hover { filter: brightness(1.08); background-color: inherit; }
.tile .glyph {
  flex: 0 0 30px;
  font-size: 1.1rem;
  text-align: center;
  opacity: 0.9;
}
.tile.dim { opacity: 0.32; }
.tile.picked { box-shadow: 0 0 0 3px var(--ink); }

/* ---- timer ---- */

.timer {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin: 14px 0 4px;
}
.timer > i {
  display: block;
  height: 100%;
  background: var(--brand);
  width: 100%;
  transition: width 0.25s linear;
}
.timer.low > i { background: var(--warn); }

/* ---- results ---- */

.bars { display: grid; gap: 10px; margin-top: 18px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.bar {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  opacity: 0.2;
  transition: width 0.5s ease;
}
.bar[data-i="0"] > i { background: var(--a0); }
.bar[data-i="1"] > i { background: var(--a1); }
.bar[data-i="2"] > i { background: var(--a2); }
.bar[data-i="3"] > i { background: var(--a3); }
.bar span { position: relative; font-weight: 600; }
.bar.right { border-color: var(--brand); border-width: 2px; }

.board { display: grid; gap: 8px; margin-top: 8px; }
.board-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.board-row.podium { background: var(--brand-wash); border-color: #c9e0d9; }
.board-row .pos { font-weight: 700; color: var(--brand); }
.board-row .pts { font-variant-numeric: tabular-nums; font-weight: 700; }

.verdict {
  border-radius: var(--r);
  padding: 28px 20px;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--panel);
}
.verdict.good { background: var(--brand-wash); border-color: #c9e0d9; }
.verdict h1 { color: var(--brand-deep); }
.verdict.miss h1 { color: var(--bad); }

.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--brand-wash);
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.pill.grey { background: var(--panel); color: var(--ink-soft); }

.notice {
  border-left: 3px solid var(--brand);
  padding: 10px 14px;
  background: var(--brand-wash);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
}
.notice.bad { border-color: var(--bad); background: #fbf2f2; color: var(--bad); }

.hidden { display: none !important; }

/* ---- projector view ---- */

body.stage {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.pres-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 48px 18px;
  border-bottom: 1px solid var(--line);
}

.pres-logo { height: 46px; width: auto; display: block; }

.pres-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.pres-meta .sep { width: 1px; height: 18px; background: var(--line); }
.pres-meta strong { color: var(--ink); font-weight: 600; }

.pres-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 48px;
}

.pres-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 48px 20px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* lobby: instructions left, QR right */

.join {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}

.join-url {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(1.1rem, 1.9vw, 1.6rem);
  color: var(--ink);
  letter-spacing: 0.01em;
}

.join-code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.16em;
  color: var(--brand-deep);
  margin: 6px 0 0;
}

.join-note { color: var(--ink-soft); margin-top: 22px; max-width: 30ch; }

.qr-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.qr-card svg { display: block; width: clamp(180px, 22vw, 260px); height: auto; color: var(--brand-deep); }
.qr-cap { text-align: center; font-size: 0.78rem; color: var(--ink-soft); margin-top: 10px; }

/* a small persistent join affordance during questions */
.qr-mini { display: flex; align-items: center; gap: 10px; }
.qr-mini svg { display: block; width: 56px; height: 56px; color: var(--ink-soft); }
.qr-mini .mono { font-size: 0.95rem; color: var(--ink); }

/* question */

.pres-q {
  font-size: clamp(1.7rem, 3.4vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
  max-width: 26ch;
}

.stage .answers { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.stage .tile {
  min-height: clamp(76px, 11vh, 118px);
  font-size: clamp(0.95rem, 1.5vw, 1.35rem);
  pointer-events: none;
}

.pres-timer {
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 22px;
}
.pres-timer > i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--brand);
  transition: width 0.25s linear;
}
.pres-timer.low > i { background: var(--warn); }

/* reveal */

.stage .bars { gap: 12px; }
.stage .bar { font-size: clamp(0.95rem, 1.5vw, 1.3rem); padding: 16px 18px; }
.stage .bar-row { grid-template-columns: 1fr 96px; }
.stage .bar-row .tally { font-variant-numeric: tabular-nums; text-align: right; }

/* leaderboard */

.stage .board { gap: 10px; max-width: 900px; margin: 0 auto; width: 100%; }
.stage .board-row {
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  padding: 14px 20px;
  grid-template-columns: 48px 1fr auto;
}

.count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

/* ---- admin ---- */

.qitem {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  margin-bottom: 10px;
}
.qitem .head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.qitem .num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--brand);
  font-weight: 600;
}
.opts { display: grid; gap: 8px; margin-top: 8px; }
.opt { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.opt input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand); }

table.rooms { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.rooms th, table.rooms td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.rooms th { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }

@media (max-width: 560px) {
  .answers { grid-template-columns: 1fr; }
  .wrap { padding: 20px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- utilities (admin console runs under a strict CSP: no inline styles) ---- */

.u-m0 { margin: 0; }
.u-mt4 { margin-top: 4px; }
.u-mt10 { margin-top: 10px; }
.u-mt14 { margin-top: 14px; }
.u-mt16 { margin-top: 16px; }
.u-mt18 { margin-top: 18px; }
.u-my10 { margin: 10px 0 16px; }
.u-right { text-align: right; }
.u-w90 { width: 90px; }
.u-top { align-items: flex-start; }

.roomcode {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--brand-deep);
}

a { color: var(--brand); }
.u-center { text-align: center; }

/* logo lockup in the compact (phone) header */
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup img { height: 26px; width: auto; display: block; }
.brand-lockup span { color: var(--ink-soft); font-size: 0.9rem; }

/* question-type tag — same wording on the projector and in the hand */
.kind {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.kind .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kind.scored { color: var(--brand); }
.kind.scored .dot { background: var(--brand); }
.kind.poll { color: var(--ink-soft); }
.kind.poll .dot { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }