/* /host — the control panel.
 *
 * Deliberately not themed. A venue's Halloween pack can make the player and screen
 * views as dark and atmospheric as it likes; the host still has to read this on a
 * phone, one-handed, under a stage light, while a room waits. So: flat surfaces,
 * strong contrast, big hit areas, no decoration.
 */

:root {
  --bg: #0B0A14;
  --surface: #16142440;
  --panel: #171528;
  --panel-2: #1F1C33;
  --line: #2C2844;
  --text: #F2F0FA;
  --muted: #9A94B8;
  --primary: #FFE500;
  --accent: #00E5FF;
  --danger: #FF3B6B;
  --ok: #3DDC84;
  --radius: 14px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0 0 12px; font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.4rem; }

a { color: var(--accent); }

.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.pane { padding: 16px; max-width: 1280px; margin: 0 auto; }
.pane[hidden] { display: none; }
.centred { min-height: 100dvh; display: grid; place-items: center; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---------------- forms ---------------- */
label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-top: 14px; }
label.check input { width: 20px; height: 20px; accent-color: var(--primary); }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .14s var(--ease), background-color .16s var(--ease), border-color .16s var(--ease);
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .42; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #0B0A14; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #0B0A14; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #0B0A14; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-block { width: 100%; margin-top: 18px; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 14px; }

.err {
  margin: 14px 0 0; padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 59, 107, .14);
  color: var(--danger);
  font-size: 14px; font-weight: 600;
}
.err[hidden] { display: none; }

/* ---------------- auth ---------------- */
.auth-card { width: min(420px, 92vw); text-align: left; }
.auth-card .mark { display: block; margin: 0 auto 12px; }
.auth-card h1 { text-align: center; margin-bottom: 18px; }
.auth-card .muted { text-align: center; margin: 14px 0 0; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0 14px;
  margin-bottom: 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar strong { font-size: 16px; }

.pill {
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--panel-2);
  font-size: 12px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
}
.pill-quiet { color: var(--muted); }
.pill[data-status="live"] { background: rgba(61, 220, 132, .18); color: var(--ok); }
.pill[data-status="paused"] { background: rgba(255, 229, 0, .16); color: var(--primary); }
.pill[data-status="ended"] { background: rgba(255, 59, 107, .16); color: var(--danger); }

.joincode {
  font-family: "Righteous", system-ui, sans-serif;
  font-size: 22px; letter-spacing: .16em;
  color: var(--primary);
}

/* ---------------- setup ---------------- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; align-items: start; }

.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.session-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.session-list .s-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-list .s-code { font-family: "Righteous", system-ui, sans-serif; color: var(--primary); letter-spacing: .1em; }

/* ---------------- control bar ---------------- */
.controlbar {
  position: sticky; top: 58px; z-index: 25;
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.ctrl-group { display: flex; gap: 8px; flex-wrap: wrap; }
.controlbar .btn { min-width: 84px; }

.modes { margin-left: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.mode-btn {
  min-height: 38px;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.mode-btn.is-on { background: var(--accent); color: #0B0A14; }

/* ---------------- deck strip ---------------- */
.deckstrip {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
}
.deck-item {
  flex: none;
  min-width: 130px; max-width: 190px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  transition: border-color .16s var(--ease), background-color .16s var(--ease);
}
.deck-item:hover { border-color: var(--muted); }
.deck-item.is-current { border-color: var(--accent); background: rgba(0, 229, 255, .1); }
.deck-item.is-past { opacity: .5; }
.deck-type { display: block; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.deck-title { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.deck-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

/* ---------------- live grid ---------------- */
.live-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 16px; align-items: start; }

.lq-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lq-timer { font-family: "Righteous", system-ui, sans-serif; font-size: 26px; font-variant-numeric: tabular-nums; }
.lq-timer.is-urgent { color: var(--danger); }
.live-question h2 { font-size: 1.3rem; line-height: 1.25; margin-bottom: 14px; }

.lq-answer {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(61, 220, 132, .12);
  border: 1px solid rgba(61, 220, 132, .4);
  margin-bottom: 10px;
}
.lq-answer[hidden] { display: none; }
.lq-answer-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ok); }
.lq-answer strong { font-size: 17px; }
.lq-expl { margin: 0 0 12px; font-size: 14px; }
.lq-expl[hidden] { display: none; }

.lq-progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.lq-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.lq-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width .3s var(--ease); }

/* ---------------- teams ---------------- */
.teams-head { display: flex; align-items: baseline; gap: 10px; }
.teams-head h2 { margin-bottom: 12px; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 62vh; overflow-y: auto; }

.team-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px 12px;
}
.team-top { display: flex; align-items: center; gap: 10px; }
.team-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-score { font-family: "Righteous", system-ui, sans-serif; color: var(--primary); font-size: 17px; }
.team-answered { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.team-answered.is-in { background: var(--ok); }

.team-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.member-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--panel);
  font-size: 12px;
}
.member-chip.is-captain::before { content: "★"; color: var(--primary); }
.member-chip .flag { color: var(--primary); font-weight: 700; }
.member-chip button {
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px;
}
.member-chip button:hover { color: var(--danger); }

.team-actions { display: flex; gap: 6px; margin-top: 8px; }
.team-actions .btn { min-height: 32px; padding: 4px 10px; font-size: 13px; }

/* ---------------- dialogs / toast ---------------- */
.dlg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 20px;
  width: min(460px, 92vw);
}
.dlg::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.lb-choices { display: grid; gap: 8px; }
.lb-choices .btn { margin-top: 0; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 100;
  padding: 11px 20px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.toast[hidden] { display: none; }

/* ---------------- big screen / cast ---------------- */
.dlg-screen { width: min(600px, 94vw); }
.screen-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.screen-actions .btn { flex: 1 1 auto; min-width: 140px; }

.cast-note {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  min-height: 1.4em;
}
.cast-note.is-live { color: var(--ok); font-weight: 600; }
.cast-note.is-warn { color: var(--primary); }

.screen-share {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.screen-share img { border-radius: 10px; background: #fff; display: block; }
.screen-url {
  display: block;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--accent);
  font-size: 11px;
  word-break: break-all;
  max-height: 76px;
  overflow-y: auto;
}

@media (max-width: 620px) {
  .screen-share { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .setup-grid, .live-grid { grid-template-columns: 1fr; }
  .modes { margin-left: 0; width: 100%; justify-content: space-between; }
  .mode-btn { flex: 1; }
  .controlbar { position: static; }
  .controlbar .btn { flex: 1; min-width: 0; }
  .ctrl-group { width: 100%; }
  .team-list { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
