/* Sunrise look: white ground, Sunrise red, warm sand neutrals, Figtree, pill buttons.
   Single light theme on purpose (brand + booth screens). Brand values live in :root only. */
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2-variations"), url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2-variations"), url("/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --red: #DA291C;
  --red-dark: #B02016;
  --red-soft: #FBE9E7;
  --ink: #1A1A1A;
  --muted: #625D58;
  --sand: #E6E3DF;
  --sand-soft: #F5F3F0;
  --line: #DAD5CF;
  --white: #FFFFFF;
  --ok: #1E7A3B;
  --ok-soft: #E3F2E7;
  --font: "Figtree", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 16px;
  --pill: 32px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--white); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-head { border-bottom: 1px solid var(--line); background: var(--white); position: sticky; top: 0; z-index: 5; }
.site-head .inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.wordmark { color: var(--red); font-weight: 800; font-size: 1.6rem; letter-spacing: -.02em; line-height: 1; text-decoration: none; }
.wordmark img { height: 34px; display: block; }
.event-tag { font-size: .8rem; font-weight: 600; color: var(--muted); border-left: 1px solid var(--line); padding-left: 14px; line-height: 1.2; }
.site-head .spacer { flex: 1; }
.head-link { font-size: .9rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.head-link:hover { color: var(--red); }

.page { max-width: 1180px; margin: 0 auto; padding-inline: 20px; padding-block: 24px 48px; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 520px) { .page { padding-inline: 16px; padding-block: 16px 32px; gap: 16px; } .site-head .inner { padding-inline: 16px; } .event-tag { display: none; } .lede { display: none; } .case { padding: 18px; } }

/* ---------- Type ---------- */
.eyebrow { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.title { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.02; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 60ch; font-size: 1.05rem; }
.small { margin: 0; font-size: .82rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { border: 0; border-radius: var(--pill); padding: 11px 22px; font-weight: 600; cursor: pointer; background: var(--red); color: var(--white); white-space: nowrap; transition: background .15s; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.ghost { background: var(--sand); color: var(--ink); }
.btn.ghost:hover { background: var(--line); }
.btn.sm { padding: 7px 14px; font-size: .86rem; }
.linkish { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--red); }
input.field, textarea.field { width: 100%; min-width: 0; padding: 11px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--white); }
input.field:focus, textarea.field:focus { border-color: var(--ink); outline: none; }

.banner { padding: 12px 16px; border-radius: 12px; background: var(--sand-soft); border: 1px solid var(--line); font-size: .92rem; }
.banner.alert { background: var(--red-soft); border-color: #F2C4BF; }

/* ---------- Signal bars ---------- */
.signal { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 46px; padding-bottom: 18px; box-sizing: content-box; }
.bar { width: 24px; border: 0; padding: 0; border-radius: 4px 4px 2px 2px; background: var(--sand); cursor: pointer; position: relative; }
.bar:disabled { cursor: not-allowed; }
.bar.done { background: var(--red); }
.bar.current { background: var(--ink); }
.bar.viewing::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: -8px; height: 3px; border-radius: 2px; background: var(--ink); }
.bar span { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
.signal-meta { font-size: .9rem; color: var(--muted); padding-bottom: 18px; display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.signal-meta b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Play layout ---------- */
.play { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 880px) { .play { grid-template-columns: minmax(0, 1fr); } }

.case { background: var(--sand-soft); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lvl-name { margin: 2px 0 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; text-wrap: balance; }
.case p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; font-weight: 600; padding: 5px 11px; border-radius: var(--pill); background: var(--white); border: 1px solid var(--line); }
.chip.none { color: var(--muted); }
.goal { background: var(--white); border-radius: 12px; padding: 12px 14px; font-size: .92rem; border-left: 4px solid var(--red); }
details.record { font-size: .88rem; }
details.record summary { cursor: pointer; font-weight: 600; }
.record dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0 0; }
.record dt { color: var(--muted); }
.record dd { margin: 0; }
.redacted { background: var(--ink); color: transparent; border-radius: 3px; user-select: none; }
.join { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.join-row { display: flex; gap: 8px; }
.join .error { color: var(--red-dark); font-size: .84rem; margin: 0; }

/* ---------- Call panel ---------- */
.call { border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-width: 0; background: var(--white); overflow: hidden; }
.call-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: var(--white); display: grid; place-items: center; font-weight: 800; flex: none; }
.call-head .who strong { display: block; line-height: 1.2; }
.call-head .who span { font-size: .8rem; color: var(--muted); }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.clock { margin-left: auto; font-family: var(--mono); font-size: .86rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.log { padding: 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 320px; max-height: 58vh; }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 84%; min-width: 0; }
.msg .meta { font-size: .72rem; color: var(--muted); font-weight: 600; }
.msg .text { padding: 11px 15px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.agent .text { background: var(--sand); border-top-left-radius: 4px; }
.msg.caller { align-self: flex-end; align-items: flex-end; }
.msg.caller .text { background: var(--ink); color: var(--white); border-top-right-radius: 4px; }
.sys { align-self: center; max-width: 94%; display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; padding: 9px 14px; border-radius: 12px; background: var(--red-soft); }
.sys.info { background: var(--sand-soft); }
.sys .tag { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--red-dark); white-space: nowrap; padding-top: 2px; }
.sys.info .tag { color: var(--muted); }
.typing { align-self: flex-start; font-size: .84rem; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { resize: none; min-height: 46px; max-height: 140px; line-height: 1.4; }
.unlock { border-top: 1px solid var(--line); padding: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--sand-soft); }
.unlock label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.unlock input { flex: 1; min-width: 150px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.unlock .hint { width: 100%; margin: 0; font-size: .82rem; color: var(--muted); }
.unlock .hint.bad { color: var(--red-dark); font-weight: 600; }

/* ---------- Win overlay ---------- */
.overlay { position: fixed; inset: 0; background: rgba(26, 26, 26, .6); display: grid; place-items: center; padding: 16px; z-index: 20; }
.win { background: var(--white); max-width: 560px; width: 100%; border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow-y: auto; }
.stamp { align-self: flex-start; background: var(--red); color: var(--white); font-weight: 800; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; padding: 6px 14px; border-radius: var(--pill); }
.win h2 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; text-wrap: balance; }
.win h3 { margin: 0 0 2px; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.win p { margin: 0; }
.win .stat { color: var(--muted); font-size: .9rem; }
.win-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tables (board + admin) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--ink); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
tr.me td { background: var(--red-soft); }
.mini-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; vertical-align: middle; margin-right: 6px; }
.mini-bars i { width: 6px; background: var(--sand); border-radius: 1px; }
.mini-bars i.on { background: var(--red); }

@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .7; } .btn { transition: none; } }

/* ---------- Utilities ---------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 8px; }
.label { margin: 0; font-size: .82rem; font-weight: 700; }

/* ---------- Sign-in ---------- */
.login-card { max-width: 480px; display: flex; flex-direction: column; gap: 14px; padding-block: 24px; }
.error-line { margin: 0; min-height: 1.5em; color: var(--red-dark); font-weight: 600; font-size: .9rem; }
