@font-face {
  font-family: "Barlow Condensed";
  src: url("../assets/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../assets/source-sans-3-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../assets/source-sans-3-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #0b1c2c;
  --navy-2: #12283c;
  --ink: #07141f;
  --amber: #f5a623;
  --amber-2: #ffd27a;
  --white: #f4f7fb;
  --sage: #8fbf9f;
  --blue: #4c9aff;
  --danger: #e15a4a;
  --line: rgba(244, 247, 251, 0.16);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--navy); color: var(--white); }
body {
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.35;
}
body.host { font-size: 28px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.sky {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(245, 166, 35, 0.18), transparent 55%),
    radial-gradient(900px 400px at 0% 100%, rgba(76, 154, 255, 0.12), transparent 50%),
    linear-gradient(180deg, #07141f 0%, var(--navy) 40%, #0e2436 100%);
  position: relative;
}
.sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../assets/img/ramp.svg");
  background-size: cover;
  background-position: center bottom;
  opacity: 0.45;
  pointer-events: none;
}
.sky > * { position: relative; z-index: 1; }

.hazard {
  height: 10px;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 12px, #111 12px 24px);
}

.topbar, .scorestrip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
}
.topbar { flex-wrap: wrap; }
body.host .topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  background: rgba(7, 20, 31, 0.94);
}
.brand {
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 34px;
  line-height: 1;
}
.brand span { color: var(--amber); }
.top-actions, .roompill { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.roompill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--display);
  letter-spacing: 0.14em;
}
.mode-switch { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}
.mode-toggle button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 1em;
  line-height: 1;
  padding: 6px 18px;
  white-space: nowrap;
}
.mode-toggle button[aria-pressed="true"] {
  background: var(--amber);
  color: #1a1203;
}
.icon-btn, .btn, .choice {
  border: 0;
  border-radius: 14px;
  background: var(--navy-2);
  color: var(--white);
}
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
}
.icon-btn img { width: 22px; height: 22px; }
.btn {
  min-height: 52px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: #16324a;
}
.btn.amber { background: var(--amber); color: #1a1203; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { background: #6e2a24; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { min-height: 44px; font-size: 18px; }

.stage {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  padding: 8px 22px 18px;
  min-height: calc(100vh - 180px);
}
.chief-col { display: flex; flex-direction: column; gap: 12px; }
.chief {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.45));
}
.bubble {
  background: rgba(7, 20, 31, 0.82);
  border: 1px solid var(--line);
  border-left: 6px solid var(--amber);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 22px;
  min-height: 96px;
}
.panel {
  background: rgba(8, 22, 36, 0.78);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.kicker {
  font-family: var(--display);
  letter-spacing: 0.16em;
  color: var(--amber);
  font-size: 22px;
  text-transform: uppercase;
}
h1, h2, .prompt {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 0.95;
}
h1 { font-size: clamp(56px, 7vw, 104px); }
h2 { font-size: clamp(36px, 4vw, 64px); }
.prompt { font-size: clamp(28px, 3vw, 48px); line-height: 1.15; }
.disclaimer, .fine {
  font-size: 16px;
  color: rgba(244, 247, 251, 0.78);
  max-width: 70ch;
}
body.host .disclaimer { font-size: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.setup-fields, .setup-actions { align-items: flex-start; }
.setup-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.setup-fields > .field { min-width: 0; }
.setup-fields select { width: 100%; }
.mode-picks { display: flex; flex-direction: column; gap: 8px; }
.mode-pick {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  min-width: 0;
}
.mode-pick .fine, label.field > .fine { margin: 0; font-size: 15px; line-height: 1.25; max-width: none; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 18px; min-width: 140px; }
select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="datetime-local"], textarea {
  background: #07141f;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 48px;
}
textarea { min-height: 120px; width: 100%; resize: vertical; }
.qr {
  background: white;
  color: #111;
  border-radius: 16px;
  padding: 10px;
  width: min(240px, 100%);
}
.qr svg { width: 100%; height: auto; display: block; }
.roster { display: flex; flex-direction: column; gap: 8px; }
.chip, .player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.chip img, .player-chip img, .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #123;
}
.scorestrip { border-top: 1px solid var(--line); overflow-x: auto; }
.player-chip strong { font-family: var(--display); font-size: 28px; letter-spacing: 0.04em; }
.player-chip .meta { font-size: 16px; opacity: 0.8; }
.timer {
  height: 14px;
  background: #07141f;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.timer > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--sage), var(--amber));
}
.choices { display: grid; gap: 10px; }
.choices.reveal-lines { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  min-height: 64px;
  border: 2px solid transparent;
}
.choice .mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 22px;
}
.mark.square { background: var(--blue); clip-path: none; border-radius: 4px; }
.mark.triangle { background: var(--amber); color: #1a1203; clip-path: polygon(50% 8%, 94% 88%, 6% 88%); border-radius: 0; }
.mark.circle { background: var(--sage); color: #102117; border-radius: 50%; }
.mark.diamond { background: var(--white); color: #102033; transform: rotate(45deg); border-radius: 4px; }
.mark.diamond span { transform: rotate(-45deg); }
.mark.diamond span { transform: rotate(-45deg); }
.choice.right { border-color: var(--sage); }
.choice.wrong { border-color: var(--danger); opacity: 0.85; }
.cite {
  font-size: 18px;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
}
.source {
  font-size: 20px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.stamp {
  align-self: flex-start;
  font-family: var(--display);
  letter-spacing: 0.12em;
  border: 4px solid var(--amber);
  color: var(--amber);
  padding: 4px 10px;
  transform: rotate(-8deg);
  font-size: 32px;
}
.stamp.retrain { border-color: var(--danger); color: var(--danger); }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.heat div {
  background: #10283a;
  border-radius: 12px;
  padding: 8px;
  font-size: 16px;
}
.heat b { font-family: var(--display); font-size: 28px; display: block; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick button { padding: 6px; border-radius: 12px; border: 2px solid transparent; background: transparent; min-width: 64px; min-height: 64px; }
.avatar-pick button.on { border-color: var(--amber); }
.avatar-pick img { width: 52px; height: 52px; }

body.player { background: var(--ink); }
body.player .wrap { max-width: 520px; margin: 0 auto; padding: 16px 14px 32px; display: flex; flex-direction: column; gap: 14px; }
body.player h1 { font-size: 42px; }
body.player .choice { min-height: 64px; font-size: 18px; width: 100%; }
body.player .big-title { font-family: var(--display); font-size: 28px; letter-spacing: 0.06em; }
.locked {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  font-family: var(--display);
  font-size: 36px;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.warn { color: var(--amber-2); font-size: 16px; }

@media (max-width: 980px) {
  body.host { font-size: 22px; }
  .stage { grid-template-columns: 1fr; }
  .chief { max-height: 180px; }
  .grid-2 { grid-template-columns: 1fr; }
  .setup-fields { grid-template-columns: 1fr 1fr; }
  .choices.reveal-lines { grid-template-columns: 1fr; }
  .bubble { font-size: 18px; }
}
@media (max-width: 420px) {
  body.player { font-size: 18px; }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Host v1: 16:9 safe area, wager, flights, rollup, toasts. */
body.host .sky.tv-safe {
  width: min(100vw, calc(100vh * 16 / 9));
  min-height: 100vh;
  margin: 0 auto;
  padding: 3.2vh 4.6vw 2vh;
  box-sizing: border-box;
}
body.host .topbar,
body.host .scorestrip,
body.host .stage { padding-left: 0; padding-right: 0; }
body.host .stage { width: min(1440px, 100%); margin: 0 auto; }
.room-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.room-code {
  font-family: var(--display);
  font-size: clamp(72px, 9vw, 132px);
  letter-spacing: 0.14em;
  line-height: 0.9;
  margin: 0;
}
.qr-lg { width: min(420px, 100%); padding: 16px; }
.join-url { word-break: break-all; font-size: 18px; }
.wager {
  border: 1px solid rgba(245, 166, 35, 0.45);
  border-radius: 18px;
  padding: 14px;
  background: rgba(245, 166, 35, 0.08);
}
.streak-ribbon, .combo-badge, .steal-banner {
  font-family: var(--display);
  letter-spacing: 0.08em;
  align-self: flex-start;
}
.streak-ribbon, .combo-badge {
  background: var(--amber);
  color: #1a1203;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 28px;
}
.combo-badge { font-size: clamp(40px, 5vw, 72px); line-height: 1; }
.steal-banner {
  background: var(--danger);
  color: white;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: clamp(28px, 3vw, 42px);
  animation: stealIn 240ms ease-out;
}
.timer { height: 22px; }
.timer.urgent { animation: pulse 0.7s steps(2, end) infinite; }
.timer.urgent > span { background: var(--danger); }
.flights { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.flight {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.2);
  min-height: 160px;
}
.flight.on { border-color: var(--amber); box-shadow: inset 0 0 0 2px rgba(245, 166, 35, 0.35); }
.flight h2 { font-size: clamp(32px, 3vw, 48px); }
.sjt-board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sjt-board > div { border-top: 4px solid var(--amber); padding-top: 8px; }
.choice.picked { border-color: var(--amber); }
.slots { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; }
.slots i { display: block; height: 12px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); }
.slots i.now { background: var(--amber); }
.slots i.good { background: var(--sage); }
.slots i.bad { background: var(--danger); }
.heat-cell.hot { outline: 1px solid var(--danger); }
.heat-cell.warm { outline: 1px solid var(--amber); }
.heat-cell.ok { outline: 1px solid var(--sage); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.totals div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 8px 10px;
}
.totals b { display: block; font-family: var(--display); font-size: 36px; line-height: 1; }
.totals span, .miss-panel, .rollup h3 { font-size: 16px; }
.rollup h3, .miss-panel h3 { font-family: var(--display); letter-spacing: 0.08em; font-size: 26px; margin: 8px 0 0; }
.miss-panel {
  border: 1px solid var(--line);
  border-left: 6px solid var(--danger);
  border-radius: 16px;
  padding: 12px 14px;
}
.toasts {
  position: fixed;
  top: 8vh;
  right: 4vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
  width: min(420px, 86vw);
}
.toast {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #10283a;
  border: 1px solid var(--amber);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  animation: toastIn 220ms ease-out;
}
.toast img { width: 36px; height: 36px; filter: invert(1); }
.toast strong { font-family: var(--display); font-size: 28px; letter-spacing: 0.04em; }
.toast p { margin: 0; font-size: 16px; }
.stamp.motion-stamp { animation: stampIn 280ms ease-out; }
.player-chip.bump .score-num { animation: scorePop 240ms ease-out; }
.score-num { font-family: var(--display); font-size: 32px; }
@keyframes stampIn {
  from { transform: rotate(-8deg) scale(1.35); opacity: 0; }
  to { transform: rotate(-8deg) scale(1); opacity: 1; }
}
@keyframes toastIn {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes scorePop {
  from { transform: scale(1.2); }
  to { transform: none; }
}
@keyframes stealIn {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes pulse { 50% { opacity: 0.55; } }
@media (max-width: 980px) {
  body.host .sky.tv-safe { width: 100%; padding: 12px; }
  .sjt-board, .flights { grid-template-columns: 1fr; }
  .room-code { letter-spacing: 0.08em; }
}

.auth-wrap { min-height: 100vh; font-size: 18px; }
.auth-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 22px 48px;
}
.auth-card h2 { font-size: clamp(36px, 6vw, 64px); }
.feature-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.saas-panel { font-size: 18px; gap: 12px; }
.saas-panel h2 { font-size: clamp(32px, 4vw, 48px); }
.saas-panel h3 { margin: 8px 0 0; font-family: var(--display); letter-spacing: 0.04em; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.code-card, .danger-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.danger-box { border-left: 6px solid var(--danger); }
.top-actions { justify-content: flex-end; }
.who {
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-size: 22px;
  line-height: 1;
}
