/* Games: the parts on top of the shared base (style.css). Team colours: the left team uses the theme's accent,
   the right team its second glow colour. */
:root { --t0: var(--accent); --t1: var(--glow-b, #818cf8); --strike: var(--danger, #f87171); }

/* ---- shared bits ---- */
.row.between { justify-content: space-between; align-items: center; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.center { text-align: center; }
.btn.sm { padding: 5px 11px; font-size: 0.82rem; border-radius: 9px; }
.btn.icon { padding: 6px; }
.btn.ghost { border-color: var(--border); }
.btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); background: var(--tile); }
.code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.12em; color: var(--accent); }
textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; resize: vertical; width: 100%; transition: border-color 0.2s, box-shadow 0.2s; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
a.wordmark { color: var(--text); }
a.wordmark:hover { opacity: 1; color: var(--accent); }

.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary.btn { padding: 6px 8px; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; display: grid; gap: 2px; min-width: 220px; padding: 6px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.7); animation: fade 0.15s both;
}
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--tile); }
.menu-item.danger { color: var(--danger); }
.drawer-list.flat { display: grid; gap: 2px; }
.drawer-list.flat .menu-item { padding: 13px 12px; font-size: 1rem; }

dialog.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border-strong); border-radius: 22px;
  background: var(--card); color: var(--text); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
}
dialog.sheet[open] { animation: dock 0.4s var(--ease) both; }
dialog.sheet::backdrop { background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#sheet-body { padding: 20px; display: grid; gap: 14px; }
#sheet-body p { margin: 0; }
.sheet-title { margin: 0; font-size: 1.15rem; }
.start-form { display: grid; gap: 16px; }
.teams-in { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.teams-in input { width: 100%; }
.teams-in .vs { padding-bottom: 10px; color: var(--muted); font-weight: 600; }
.screen-url { font-size: 1.1rem; }

/* ---- dashboard ---- */
.kinds { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.kind {
  display: flex; align-items: center; gap: 16px; padding: 18px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  transition: transform 0.25s var(--ease), border-color 0.2s, box-shadow 0.25s;
}
.kind:not(:disabled):hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 30px -18px var(--accent); }
.kind.soon { opacity: 0.55; cursor: default; }
.kind-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, var(--tile)); color: var(--accent); }
.kind-icon .i { width: 26px; height: 26px; }
.kind-text { display: grid; gap: 3px; flex: 1; min-width: 0; }
.kind-text strong { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.kind-text .muted { font-size: 0.85rem; line-height: 1.4; }
.kind-go { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }

.gcards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.gcard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 18px; transition: border-color 0.2s, transform 0.25s var(--ease); }
.gcard:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.gcard-main { display: grid; gap: 6px; justify-items: start; padding: 16px 18px 10px; color: var(--text); flex: 1; }
.gcard-main:hover { opacity: 1; }
.gcard-main h3 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }
.gcard-main p { margin: 0; font-size: 0.82rem; }
.gcard-actions { display: flex; align-items: center; gap: 6px; padding: 10px 14px 14px; }
.gcard-actions .menu { margin-left: auto; }

.plays { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prow { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; padding: 12px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.prow-main { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.prow-main .muted { font-size: 0.8rem; }
.prow-score { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.pscore { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pscore b { color: var(--text); font-variant-numeric: tabular-nums; }
.pscore.win { color: var(--text); }
.pscore.win .i { color: var(--warn); }

/* ---- editor ---- */
.edit-hero { align-items: center; }
.edit-title { flex: 1 1 320px; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.back:hover { color: var(--text); }
.eyebrow .sep { margin: 0 4px; }
.save-status { margin-left: 8px; font-size: 0.8rem; }
.title-input { width: 100%; font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -0.03em; padding: 4px 10px; margin-left: -11px; background: transparent; border-color: transparent; }
.title-input:hover { border-color: var(--border); }
.how { margin: -12px 0 20px; max-width: 70ch; }
.rounds { display: grid; gap: 14px; }
.round { display: grid; gap: 12px; margin: 0; }
.round-head h2 { margin: 0; font-size: 1rem; }
.answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.arow { display: grid; grid-template-columns: 46px minmax(0, 1fr) 34px auto; align-items: center; gap: 8px; position: relative; border-radius: 12px; }
.grip { display: flex; align-items: center; gap: 2px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--muted); }
.grip .i { width: 14px; height: 14px; opacity: 0.6; transition: opacity 0.15s; }
.arow:hover .grip .i { opacity: 1; }
.arow.shifting { transition: transform 0.18s var(--ease); }
.arow.dragging { z-index: 5; background: linear-gradient(var(--card), var(--card)), var(--bg); box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--accent); }
.arow.dragging, .arow.dragging .grip { cursor: grabbing; }
.arow.dragging .rank, .arow.dropped .rank { background: var(--accent); color: var(--on-accent); }
.arow.dropped { animation: dropped 0.6s var(--ease); }
@keyframes dropped { from { box-shadow: 0 0 0 2px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
.arow input { width: 100%; }
.rank { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--tile); font-size: 0.82rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pts { text-align: center; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.arow-tools { display: flex; gap: 2px; }
.add-answer { justify-self: start; }
.round-foot { margin-top: 14px; }

/* ================= full-screen pages ================= */
body.full { overflow: hidden; }
body.full .aurora i { opacity: 0.1; }
#stage { position: fixed; inset: 0; }

/* ---- the host's phone ---- */
.host { height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
.host-missing { display: grid; place-items: center; align-content: center; gap: 16px; height: 100dvh; }
.host-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chip-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font: inherit; font-size: 0.82rem; cursor: pointer; }
.chip-link b { color: var(--text); letter-spacing: 0.1em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.led.live { background: var(--good); box-shadow: 0 0 8px var(--good); }
.led.closed { background: var(--danger); }
.host-scores { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin: 12px 0 10px; }
.hteam { display: grid; gap: 0; padding: 8px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); transition: border-color 0.2s, box-shadow 0.2s; min-width: 0; }
.hteam:first-child { --tc: var(--t0); } .hteam:nth-child(2) { --tc: var(--t1); order: 3; text-align: right; }
.hteam-name { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hteam b { font-size: 1.6rem; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--tc); }
.hteam.on { border-color: var(--tc); box-shadow: 0 0 0 1px var(--tc), 0 10px 26px -14px var(--tc); }
.hteam.steal { border-color: var(--warn); border-style: dashed; }
.hbank { order: 2; display: grid; place-items: center; align-content: center; padding: 0 6px; }
.hbank span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hbank b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.host-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 4px; }
.hq { padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); }
.hq .eyebrow { margin-bottom: 4px; font-size: 0.78rem; }
.hq-text { margin: 0; font-size: 1.3rem; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; }
.hq.final { text-align: center; padding: 28px 16px; }
.hq.final .hq-text { font-size: 1.8rem; }
.hcard { display: grid; gap: 10px; padding: 14px 16px; border-radius: 16px; border: 1px dashed var(--border-strong); }
.hcard p { margin: 0; }
.btn.huge { padding: 18px; font-size: 1.1rem; border-radius: 16px; width: 100%; }
.btn.huge .i { width: 20px; height: 20px; }
.btn.strike { background: color-mix(in srgb, var(--strike) 18%, var(--card)); color: var(--strike); border-color: color-mix(in srgb, var(--strike) 45%, transparent); font-weight: 650; }
.btn.strike:hover { background: color-mix(in srgb, var(--strike) 26%, var(--card)); color: var(--strike); }
.hstatus { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; }
.hstatus.steal b { color: var(--warn); }
.hstatus.won { justify-content: center; font-size: 1.1rem; }
.hstatus.won .i { color: var(--warn); width: 22px; height: 22px; }
.hstrikes { display: flex; gap: 4px; }
.hstrikes .x { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); color: var(--border-strong); }
.hstrikes .x.on { background: var(--strike); border-color: var(--strike); color: var(--bg); }
.hstrikes .x .i { stroke-width: 3; width: 14px; height: 14px; }
.hanswers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hans { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) 30px 56px; align-items: center; gap: 10px; padding: 10px 10px 10px 8px; border-radius: 13px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.hans:active { transform: scale(0.985); }
.hans .txt { font-weight: 600; overflow-wrap: anywhere; }
.hans .tap { justify-self: end; font-size: 0.78rem; font-weight: 650; padding: 5px 9px; border-radius: 8px; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.hans.shown { opacity: 1; background: color-mix(in srgb, var(--good) 9%, var(--card)); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.hans.shown .tap { background: none; }
.hans:disabled { cursor: default; }

/* the buzzer: two halves along the phone's long side, each label facing its own player */
.buzzer { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); touch-action: none; user-select: none; -webkit-user-select: none; }
.bz { flex: 1; display: grid; place-items: center; border: 0; margin: 0; font: inherit; cursor: pointer; color: var(--bg); -webkit-tap-highlight-color: transparent; transition: filter 0.1s, opacity 0.3s; }
.bz0 { background: var(--t0); }
.bz1 { background: var(--t1); }
.bz:active { filter: brightness(1.2); }
.bz.hit { animation: hit 0.5s var(--ease); }
.bz.miss { opacity: 0.18; }
.bz-label { display: grid; justify-items: center; gap: 4px; }
.bz-team { font-size: 1.4rem; font-weight: 700; opacity: 0.8; }
.bz-word { font-size: clamp(2.6rem, 14vmin, 5.5rem); font-weight: 800; letter-spacing: -0.03em; text-transform: uppercase; line-height: 1; }
/* portrait: top half faces the far player (upside down), bottom half the near one */
.bz0 .bz-label { transform: rotate(180deg); }
.bz-cancel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 0; background: var(--bg); color: var(--text); font: inherit; font-size: 0.85rem; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); cursor: pointer; }
/* landscape (the phone turned sideways): left and right halves, each label turned toward its side */
@media (orientation: landscape) {
  .buzzer { flex-direction: row; }
  .bz0 .bz-label { transform: rotate(90deg); }
  .bz1 .bz-label { transform: rotate(-90deg); }
}
@keyframes hit { 0% { filter: brightness(1.8); } 100% { filter: none; } }

/* ---- the big screen ---- */
.screen { height: 100dvh; display: flex; flex-direction: column; padding: clamp(14px, 2.5vh, 32px) clamp(16px, 3vw, 48px); font-size: clamp(14px, 1.6vmin + 6px, 26px); }
.scr-wait, .scr-title { margin: auto; display: grid; justify-items: center; gap: 1em; text-align: center; }
.scr-wait h1, .scr-title h1 { font-size: clamp(2.4rem, 7vmin, 5.5rem); }
.scr-wait .eyebrow, .scr-title .eyebrow { justify-content: center; font-size: 1em; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(2rem, 6vmin, 3.4rem); letter-spacing: 0.25em; text-align: center; width: 8.5em; text-transform: uppercase; padding: 0.2em 0.3em 0.2em 0.55em; }
.scr-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 11px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font: inherit; font-size: 0.75em; cursor: pointer; }
.scr-btn.ghost { border-color: var(--border); background: none; color: var(--muted); }
.scr-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 0.85em; }
.scr-name { font-weight: 650; color: var(--text); }
.scr-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 4.2fr) minmax(0, 1fr); align-items: center; gap: clamp(12px, 2vw, 36px); }
.steam { display: grid; justify-items: center; gap: 0.2em; padding: 1em 0.6em; border-radius: 1.1em; background: var(--card); border: 2px solid var(--border); transition: border-color 0.3s, box-shadow 0.3s, transform 0.4s var(--ease); text-align: center; min-width: 0; }
.steam.t0 { --tc: var(--t0); } .steam.t1 { --tc: var(--t1); }
.steam-name { font-weight: 650; font-size: 1.05em; overflow-wrap: anywhere; }
.steam-score { font-size: 3em; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--tc); }
.steam-tag { font-size: 0.7em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.25em 0.7em; border-radius: 999px; background: var(--tc); color: var(--bg); }
.steam.on { border-color: var(--tc); box-shadow: 0 0 40px -8px var(--tc); transform: scale(1.04); }
.steam.stealing { border-color: var(--warn); border-style: dashed; }
.steam.stealing .steam-tag { background: var(--warn); }
.scr-vs { display: grid; grid-template-columns: minmax(8em, 14em) auto minmax(8em, 14em); align-items: center; gap: 1.2em; margin: 0.6em 0; }
.scr-vs .vs { color: var(--muted); font-weight: 700; }
.scr-board { display: grid; gap: 0.9em; align-content: center; }
.scr-q { margin: 0; text-align: center; font-size: 1.75em; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.scr-bank { display: flex; align-items: center; justify-content: center; gap: 0.5em; }
.scr-bank > span:first-child { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75em; }
.scr-bank b { font-size: 1.6em; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; padding: 0.05em 0.5em; border-radius: 0.4em; background: var(--card); border: 1px solid var(--border); }
.scr-strikes { display: flex; gap: 0.25em; margin-left: 0.4em; }
.scr-strikes .x { display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 0.35em; background: var(--strike); color: var(--bg); }
.scr-strikes .x .i { width: 1em; height: 1em; stroke-width: 3.5; }
.slots { display: grid; gap: 0.55em; grid-template-rows: repeat(var(--rows), auto); grid-auto-flow: column; grid-template-columns: minmax(0, 1fr); perspective: 900px; }
.slots.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.slot { position: relative; display: flex; align-items: center; justify-content: center; gap: 0.6em; min-height: 2.6em; padding: 0.4em 0.8em; border-radius: 0.6em; background: linear-gradient(180deg, var(--tile), var(--card)); border: 1px solid var(--border-strong); animation: rise 0.5s var(--ease) both; animation-delay: calc(var(--o) * 50ms); }
.slot-num { display: grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); font-weight: 800; }
.slot.open { justify-content: space-between; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--tile)), color-mix(in srgb, var(--accent) 8%, var(--card))); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.slot-text { font-weight: 700; font-size: 1.1em; text-transform: uppercase; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.slot-pts { flex: none; font-weight: 800; font-size: 1.15em; min-width: 1.9em; text-align: center; padding: 0.1em 0.3em; border-radius: 0.35em; background: var(--accent); color: var(--on-accent); font-variant-numeric: tabular-nums; }
.slot.flip { animation: flip 0.6s var(--ease) both; }
@keyframes flip { 0% { transform: rotateX(90deg); filter: brightness(2); } 100% { transform: none; filter: none; } }
.scr-hint { margin: 0; text-align: center; color: var(--muted); }
.scr-hint.live { display: flex; align-items: center; justify-content: center; gap: 0.5em; color: var(--accent); font-weight: 700; font-size: 1.2em; }

.scr-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; place-content: center; gap: 0.3em; pointer-events: none; opacity: 0; transition: opacity 0.25s; font-size: 2em; font-weight: 700; text-align: center; }
.scr-overlay.show { opacity: 1; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(3px); }
.scr-overlay .big { font-size: 2.4em; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.scr-overlay.t0 .big { color: var(--t0); } .scr-overlay.t1 .big { color: var(--t1); }
.scr-overlay.show > * { animation: pop 0.5s var(--ease) both; }
.scr-overlay.strike { grid-auto-flow: column; gap: 0.4em; }
.bigx { display: grid; place-items: center; width: 4.5em; height: 4.5em; border-radius: 0.6em; border: 0.15em solid var(--strike); color: var(--strike); background: color-mix(in srgb, var(--strike) 14%, var(--bg)); }
.bigx .i { width: 3.4em; height: 3.4em; stroke-width: 3.2; }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }

@media (max-aspect-ratio: 1/1) {
  .scr-main { grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; align-items: start; }
  .scr-board { grid-column: 1 / -1; grid-row: 2; }
  .steam { grid-row: 1; padding: 0.5em; }
  .steam-score { font-size: 2em; }
}
@media (max-width: 560px) {
  .teams-in { grid-template-columns: 1fr; }
  .teams-in .vs { display: none; }
  .arow { grid-template-columns: 44px minmax(0, 1fr) 28px; }
  .arow-tools { grid-column: 2 / -1; justify-content: flex-end; margin-top: -2px; }
}
