/* styles.css — shared styling for library/editor, host, and TV views.
   Classic game-show feel without any trademarked assets. */

:root {
  --bg: #0a1230;
  --bg-2: #0f1b48;
  --panel: #14224f;
  --panel-2: #1b2d63;
  --ink: #eaf0ff;
  --muted: #93a3d4;
  --gold: #ffd24a;
  --gold-2: #f6b73c;
  --blue: #2b6cff;
  --green: #2bd17e;
  --red: #ff4d4d;
  --line: #2a3c78;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* The HTML hidden attribute must win over display:flex/grid rules below. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg-2), var(--bg));
  color: var(--ink);
  font-family: var(--font);
  min-height: 100%;
}

a { color: var(--gold); }

button {
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s;
}
button:hover { background: #243a82; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1c00; border-color: var(--gold-2); font-weight: 700; }
.btn-blue { background: var(--blue); border-color: #1c4fce; font-weight: 600; }
.btn-green { background: var(--green); color: #062a16; border-color: #1da564; font-weight: 700; }
.btn-red { background: var(--red); border-color: #d63a3a; font-weight: 700; color: #2a0606; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

input, select, textarea {
  font-family: var(--font);
  background: #0d1840;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: 0.5px; }
.topbar .spacer { flex: 1; }
.brand-badge {
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  color: #2a1c00; font-weight: 800; padding: 6px 12px; border-radius: 999px;
  letter-spacing: 1px; font-size: 13px; text-transform: uppercase;
}
.nav-links a { margin-left: 14px; text-decoration: none; font-weight: 600; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* ---- Library ---- */
.board-list { display: grid; gap: 12px; }
.board-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.board-card h3 { margin: 0; font-size: 18px; }
.board-card .meta { color: var(--muted); font-size: 13px; }

/* ---- Editor ---- */
.round-block { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.round-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.answer-row { display: grid; grid-template-columns: 1fr 90px auto auto auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.warn { color: var(--gold); font-size: 13px; }
.field-error { outline: 2px solid var(--red) !important; }

/* ---- Host ---- */
.host-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 820px) { .host-grid { grid-template-columns: 1fr; } }
.answer-pill { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #0d1840; margin-bottom: 8px; cursor: pointer; }
.answer-pill.revealed { background: #15401f; border-color: #1da564; }
.answer-pill .pts { font-weight: 800; color: var(--gold); }
.answer-pill .num { color: var(--muted); width: 22px; }
.score-box { text-align: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.score-box.control { outline: 3px solid var(--gold); }
.score-box .score { font-size: 34px; font-weight: 800; color: var(--gold); }
.strike-dots { display: flex; gap: 8px; }
.strike-dots .x { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); color: var(--red); display: grid; place-items: center; font-weight: 900; font-size: 18px; }
.strike-dots .x.on { background: var(--red); color: #fff; border-color: var(--red); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.conn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.conn.live .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.phase-chip { padding: 4px 10px; border-radius: 999px; background: var(--blue); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.kbd-help { font-size: 12px; color: var(--muted); }
.kbd-help kbd { background: #0d1840; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ============ TV VIEW ============ */
.tv-body { overflow: hidden; }
.tv-stage { height: 100vh; display: flex; flex-direction: column; padding: 2.2vh 3vw; }
.tv-header { display: flex; align-items: center; gap: 2vw; }
.tv-round { font-size: 1.6vw; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.tv-mult { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1c00; font-weight: 900; padding: 0.4vh 1.2vw; border-radius: 999px; font-size: 1.6vw; }
.tv-question { font-size: 3.4vw; font-weight: 800; text-align: center; margin: 1.5vh 0; line-height: 1.1; text-shadow: 0 3px 0 rgba(0,0,0,0.3); }
.tv-board { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1.4vh 2vw; align-content: center; }
.tv-board.one-col { grid-template-columns: 1fr; max-width: 60vw; margin: 0 auto; }

.slot { perspective: 1000px; height: 9vh; }
.slot-inner { position: relative; width: 100%; height: 100%; transition: transform 0.55s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.slot.revealed .slot-inner { transform: rotateX(180deg); }
.slot-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; display: flex; align-items: center; box-shadow: var(--shadow); }
.slot-front { background: linear-gradient(180deg, #1b3aa0, #122a78); border: 3px solid #2b53c9; justify-content: center; }
.slot-front .num { width: 7vh; height: 7vh; border-radius: 50%; background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1c00; display: grid; place-items: center; font-size: 3.4vh; font-weight: 900; }
.slot-back { background: linear-gradient(180deg, #163f72, #0e2e57); border: 3px solid var(--gold); transform: rotateX(180deg); justify-content: space-between; padding: 0 2vw; }
.slot-back .txt { font-size: 2.6vh; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.slot-back .pts { font-size: 3vh; font-weight: 900; color: var(--gold); min-width: 6vh; height: 6vh; border-radius: 10px; background: #0d1840; display: grid; place-items: center; }
.slot.empty { visibility: hidden; }

.tv-footer { display: flex; align-items: center; justify-content: space-between; gap: 2vw; margin-top: 1.5vh; }
.tv-team { flex: 1; text-align: center; padding: 1.2vh; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); }
.tv-team.control { border-color: var(--gold); box-shadow: 0 0 24px rgba(255,210,74,0.4); }
.tv-team .name { font-size: 2vw; font-weight: 700; }
.tv-team .score { font-size: 4vw; font-weight: 900; color: var(--gold); line-height: 1; }
.tv-bank { text-align: center; font-size: 1.8vw; }
.tv-bank .num { font-size: 3.4vw; font-weight: 900; color: var(--gold); }

/* Strike overlay */
.strike-overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; gap: 3vw; background: rgba(120,0,0,0.55); z-index: 50; }
.strike-overlay.show { display: flex; animation: strikeflash 0.9s ease; }
.strike-overlay .big-x { font-size: 26vh; color: var(--red); font-weight: 900; text-shadow: 0 0 40px rgba(255,0,0,0.8); }
@keyframes strikeflash { 0% { transform: scale(0.3); opacity: 0; } 30% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.strike-corner { position: fixed; top: 6.5vh; left: 3vw; display: flex; gap: 1vw; z-index: 20; }
.strike-corner .x { font-size: 5vh; color: var(--red); font-weight: 900; }

/* Game over */
.tv-gameover { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(800px 600px at 50% 30%, var(--bg-2), var(--bg)); z-index: 40; }
.tv-gameover h1 { font-size: 7vw; color: var(--gold); margin: 0; text-shadow: 0 4px 0 rgba(0,0,0,0.4); }
.tv-gameover .sub { font-size: 2.4vw; color: var(--muted); }

.tv-idle { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; }
.tv-idle h1 { font-size: 5vw; color: var(--gold); }
.flash-good { animation: goodpulse 0.6s ease; }
@keyframes goodpulse { 50% { box-shadow: 0 0 40px var(--green); } }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 100; box-shadow: var(--shadow); }
