/* Ultra Jeopardy — shared styles (MCM IV "Option A": dark, red-orange, white). */
:root {
  --bg: #0a0a0a; --ink: #f5f5f5; --ink-dim: #b8b8b8; --ink-faint: #6e6e6e;
  --accent: #e3513a; --accent-dim: rgba(227, 81, 58, 0.35);
  --card: #141414; --card-hi: #1b1b1b; --line: #2a2a2a;
  --cell: #10204a; --cell-hi: #16307a; --gold: #f2c14e;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font); color: var(--ink); background-color: var(--bg);
  background-image: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}
button, input { font: inherit; }
.label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); }
.err { color: #ff8a78; font-weight: 600; min-height: 1.2em; }
.hidden { display: none !important; }

/* ================= PLAYER (phone) ================= */
body.player { overflow-x: hidden; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.p-top { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.p-title { font-family: var(--display); font-weight: 800; letter-spacing: 0.08em; font-size: 0.9rem; color: var(--accent); }
.p-team { font-family: var(--display); font-weight: 800; font-size: 1.8rem; line-height: 1.1; margin-top: 4px; word-break: break-word; }
.p-score { font-size: 1.2rem; color: var(--ink-dim); margin-top: 2px; }
.p-score b { color: var(--ink); font-size: 1.5rem; }
.p-rename { display: flex; gap: 8px; margin-top: 10px; }
.p-rename input { flex: 1; min-width: 0; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.p-rename button { background: var(--card-hi); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.p-mid { padding: 12px 16px; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 120px; }
.p-clue { font-size: 1.15rem; line-height: 1.35; }
.p-status { font-size: 1.3rem; font-weight: 700; text-align: center; }
.p-buzz-wrap { flex: 0 0 50vh; flex: 0 0 50dvh; padding: 0 16px 16px; display: flex; }
.buzz {
  flex: 1; border: none; border-radius: 28px; font-family: var(--display); font-weight: 900;
  font-size: 4.5rem; letter-spacing: 0.06em; color: #fff; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.08) inset, 0 10px 40px var(--accent-dim);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.buzz:active { transform: scale(0.98); }
.buzz:disabled { background: #2a2a2a; color: #555; box-shadow: none; font-size: 3rem; }

/* ================= BOARD (projector) ================= */
body.board { height: 100vh; overflow: hidden; }
.b-root { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; gap: 1.2vh; padding: 1.5vh 1.5vw; }
.b-head { display: flex; align-items: center; justify-content: space-between; gap: 2vw; border-bottom: 1px solid var(--line); padding-bottom: 1vh; position: relative; }
.b-head::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 90px; height: 3px; background: var(--accent); }
.b-logo { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; font-family: var(--display); font-weight: 900; font-size: 4.2vh; letter-spacing: 0.06em; }
.b-logo span { color: #fff; }
.b-logo span.red { color: var(--accent); }
.b-round { font-family: var(--display); font-weight: 800; font-size: 3.4vh; color: var(--gold); letter-spacing: 0.04em; }
.b-round.dj { color: var(--accent); }
.b-timer { text-align: right; font-variant-numeric: tabular-nums; }
.b-timer .big { font-family: var(--display); font-weight: 800; font-size: 4.6vh; }
.b-timer .sub { font-size: 2vh; color: var(--ink-dim); }
.b-main { position: relative; min-height: 0; }
/* rows have floors so cells can never collapse to slivers, even if the
   container's height resolves oddly (scaled/odd projector displays) */
.b-grid { height: 100%; min-height: 60vh; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: minmax(7vh, 1.15fr) repeat(5, minmax(9vh, 1fr)); gap: 0.8vh; }
.b-cat, .b-cell { display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 6px; }
  .b-cat { overflow-wrap: anywhere; }
.b-cat { background: var(--card-hi); border: 1px solid var(--line); border-bottom: 3px solid var(--accent); font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 2.4vh; line-height: 1.15; padding: 0.6vh 0.6vw; }
.b-cell { background: var(--cell); border: 1px solid #1f3a80; font-family: var(--display); font-weight: 900; font-size: 5.4vh; color: var(--gold); text-shadow: 0 2px 0 #000; }
.b-cell.used { background: #0d0d10; border-color: #181818; color: transparent; text-shadow: none; }
.b-cell.open { outline: 3px solid var(--accent); }
.b-panel { position: absolute; inset: 0; background: linear-gradient(160deg, #0f1c44, #0a0a0a 75%); border: 2px solid #1f3a80; border-radius: 10px; display: flex; flex-direction: column; padding: 3vh 3vw; gap: 2vh; }
.b-panel .meta { display: flex; justify-content: space-between; font-size: 2.6vh; color: var(--ink-dim); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.b-panel .meta .val { color: var(--gold); }
.b-clue { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--display); font-weight: 700; font-size: 7vh; line-height: 1.22; text-transform: uppercase; min-height: 0; overflow: hidden; }
.b-clue.long { font-size: 5.6vh; }
.b-clue.xlong { font-size: 4.4vh; }
.b-answer { text-align: center; font-family: var(--display); font-weight: 900; font-size: 5.2vh; color: var(--gold); }
.b-banner { text-align: center; font-family: var(--display); font-weight: 900; font-size: 3.4vh; color: var(--accent); letter-spacing: 0.06em; }
.b-queue { display: flex; gap: 1vw; justify-content: center; flex-wrap: wrap; min-height: 6vh; align-items: center; }
.q-item { padding: 1vh 1.4vw; border-radius: 8px; border: 2px solid var(--line); font-weight: 800; font-size: 2.6vh; background: var(--card); opacity: 0.8; }
.q-item.active { opacity: 1; transform: scale(1.12); box-shadow: 0 0 24px currentColor; background: #1d1d1d; }
.q-item.wrong { opacity: 0.35; text-decoration: line-through; }
.q-item.correct { opacity: 1; background: #13361f; }
.q-hint { color: var(--ink-faint); font-size: 2.4vh; letter-spacing: 0.1em; text-transform: uppercase; }
.b-splash { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2vh; background: radial-gradient(circle, #3a1008, #0a0a0a 70%); border-radius: 10px; border: 2px solid var(--accent); animation: splash 0.6s ease-out; }
.b-splash .t { font-family: var(--display); font-weight: 900; font-size: 13vh; line-height: 1; color: var(--accent); text-shadow: 0 0 40px var(--accent-dim); letter-spacing: 0.04em; }
.b-splash .s { font-size: 4vh; font-weight: 700; max-width: 80%; }
@keyframes splash { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.b-scores { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 1vw; align-items: stretch; }
.b-team { background: var(--card); border: 1px solid var(--line); border-top: 6px solid; border-radius: 8px; padding: 0.8vh 1vw; min-width: 0; }
.b-team.ctl { box-shadow: 0 0 0 2px var(--ink-dim) inset; }
.b-team .n { font-weight: 800; font-size: 2.6vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-team .row { display: flex; justify-content: space-between; align-items: baseline; }
.b-team .sc { font-family: var(--display); font-weight: 900; font-size: 4.4vh; font-variant-numeric: tabular-nums; }
.b-team .sc.neg { color: #ff6b5a; }
.b-team .pc { color: var(--ink-dim); font-size: 1.9vh; }
.b-qr-mini { background: #fff; border-radius: 6px; padding: 0.4vh; height: 12vh; width: 12vh; display: flex; flex-direction: column; align-items: center; }
.b-qr-mini img { width: 100%; height: 100%; display: block; }
.b-lobby, .b-ended { height: 100%; display: grid; grid-template-columns: auto 1fr; gap: 4vw; align-items: center; padding: 0 2vw; }
.b-qr-big { background: #fff; padding: 1.5vh; border-radius: 12px; height: 60vh; width: 60vh; }
.b-qr-big img { width: 100%; height: 100%; display: block; }
.b-lobby h2, .b-ended h2 { font-family: var(--display); font-weight: 900; font-size: 6vh; line-height: 1.05; }
.b-lobby .url { color: var(--ink-dim); font-size: 2.2vh; margin: 1vh 0 3vh; word-break: break-all; }
.roster { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5vh 1.5vw; }
.roster .r { background: var(--card); border: 1px solid var(--line); border-left: 8px solid; border-radius: 8px; padding: 1.4vh 1.2vw; }
.roster .r .n { font-weight: 800; font-size: 3.2vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster .r .pc { color: var(--ink-dim); font-size: 2.2vh; }
.b-ended { grid-template-columns: 1fr; justify-items: center; text-align: center; }
.winner { font-family: var(--display); font-weight: 900; font-size: 10vh; line-height: 1.05; }
.stand { width: min(70vw, 1100px); margin-top: 3vh; }
.stand .s { display: grid; grid-template-columns: 6vh 1fr auto; align-items: center; gap: 1.5vw; padding: 1.2vh 1.5vw; border-radius: 8px; background: var(--card); border-left: 10px solid; margin-bottom: 1vh; font-size: 3.6vh; font-weight: 800; text-align: left; }
.stand .s .sc { font-family: var(--display); font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; top: 11vh; transform: translateX(-50%); background: var(--accent); color: #fff; font-family: var(--display); font-weight: 900; font-size: 4.4vh; padding: 1.2vh 3vw; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); z-index: 20; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
.toast.go { animation: toast 3.2s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -30px) scale(0.8); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, 0) scale(1); } }
.flash { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, #5a1206, #000 75%); font-family: var(--display); font-weight: 900; font-size: 15vh; color: var(--gold); text-align: center; text-shadow: 0 0 60px var(--accent); animation: flash 3.5s ease-out forwards; pointer-events: none; }
@keyframes flash { 0% { opacity: 0; transform: scale(0.5); } 15% { opacity: 1; transform: scale(1.08); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
.b-net { position: fixed; right: 1vw; bottom: 0.5vh; font-size: 1.6vh; color: #ff8a78; }

/* ================= HOST ================= */
body.host { padding: 12px; max-width: 1200px; margin: 0 auto; }
.h-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.h-bar h1 { font-family: var(--display); font-weight: 900; font-size: 1.3rem; letter-spacing: 0.05em; }
.h-bar h1 span { color: var(--accent); }
.h-info { color: var(--ink-dim); font-size: 0.95rem; }
.h-sec { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.h-sec > .label { margin-bottom: 8px; display: block; }
.btn { background: var(--card-hi); color: var(--ink); border: 1px solid #3a3a3a; border-radius: 8px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.big { font-size: 1.6rem; padding: 18px; flex: 1; }
.btn.ok { background: #1f8a45; border-color: #1f8a45; color: #fff; }
.btn.no { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn.danger { border-color: #b3261e; color: #ff8a78; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.h-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.h-grid .cat { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; text-align: center; padding: 4px 2px; color: var(--ink-dim); display: flex; align-items: center; justify-content: center; line-height: 1.1; overflow-wrap: anywhere; hyphens: auto; }
.h-grid button { position: relative; background: var(--cell); color: var(--gold); border: 1px solid #1f3a80; border-radius: 6px; padding: 12px 2px; font-weight: 900; font-size: 1.1rem; cursor: pointer; }
.h-grid button:disabled { background: #111; color: #333; border-color: #1a1a1a; cursor: default; }
.h-grid button .sp { position: absolute; top: 2px; right: 3px; font-size: 0.6rem; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 3px; }
.h-grid button.cur { outline: 3px solid var(--accent); }
.h-clue { font-size: 1.4rem; line-height: 1.35; margin: 6px 0; }
.h-ans { font-size: 1.8rem; font-weight: 900; color: var(--gold); margin: 6px 0 10px; }
.h-type { font-weight: 800; color: var(--accent); letter-spacing: 0.08em; }
.h-queue { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.h-queue .q { border: 2px solid var(--line); border-radius: 6px; padding: 6px 10px; font-weight: 800; }
.h-queue .q.active { background: #262626; box-shadow: 0 0 0 2px var(--ink) inset; }
.h-queue .q.wrong { opacity: 0.4; text-decoration: line-through; }
.h-queue .q.correct { background: #13361f; }
.h-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px; }
.h-team { border: 1px solid var(--line); border-left: 8px solid; border-radius: 8px; padding: 8px; }
.h-team .top { display: flex; justify-content: space-between; font-weight: 800; }
.h-team .sc { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.h-team .adj { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.h-team .adj .btn { padding: 6px 8px; font-size: 0.85rem; }
.inp { background: #0d0d0d; color: var(--ink); border: 1px solid #3a3a3a; border-radius: 8px; padding: 9px 10px; min-width: 0; }
.inline { display: flex; gap: 6px; }
.inline .inp { flex: 1; }
