/* ============================================================
   Familiada — display screen (design canvas: 2304 x 768 px)
   Theme is adjustable via the CSS variables below.
   ============================================================ */

:root {
  --bg: #060a16;
  --panel-bg: #0d1530;
  --panel-border: #1d2b5e;
  --board-bg: #0f1b42;
  --row-hidden-bg: #131e44;
  --row-hidden-border: #26376f;
  --row-hidden-num: #2b3f80;
  --row-revealed-top: #1f6fe2;
  --row-revealed-bottom: #1348a6;
  --accent: #ffc21c;
  --accent-dark: #b97e00;
  --text: #ffffff;
  --muted: #93a4d1;
  --team1: #ff5964;
  --team2: #2ec8ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  font-family: "Arial Black", "Segoe UI", Arial, Verdana, sans-serif;
}

[hidden] { display: none !important; }

/* Scaling wrapper: JS applies transform: scale() to #stage */
.stage-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stage {
  width: 2304px;
  height: 768px;
  flex: 0 0 auto;
  transform-origin: center center;
  background: var(--bg);
  position: relative;
}

/* Offline indicator (server unreachable) */
.stage.offline::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 24px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 18px #ff3b30;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.view { width: 100%; height: 100%; }

/* ============================== Intro screen */

.view-intro {
  background:
    radial-gradient(1200px 700px at 50% 30%, #17255c 0%, #0a1230 55%, #060a16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 60px;
  text-align: center;
  max-width: 2100px;
}

.intro-image {
  max-width: 1500px;
  max-height: 440px;
  object-fit: contain;
}

.intro-title {
  margin: 0;
  font-size: 190px;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 6px;
  color: var(--text);
  text-shadow: 0 10px 0 rgba(0, 0, 0, 0.35);
}

.intro-subtitle {
  margin: 0;
  font-size: 52px;
  font-weight: 700;
  color: var(--accent);
}

/* ============================== Question screen (3 panels) */

.view-question {
  display: grid;
  grid-template-columns: 384px 1536px 384px; /* pixel-exact LED seams */
  height: 100%;
}

/* ---------------- side panels */

.panel {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
}

.team-card {
  text-align: center;
  padding: 20px 8px 24px;
  border-bottom: 4px solid var(--row-hidden-border);
}

.team-label {
  font-size: 24px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--muted);
}

.team-name {
  font-size: 46px;
  line-height: 1.15;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.panel-left .team-name  { color: var(--team1); }
.panel-right .team-name { color: var(--team2); }

.team-score {
  font-size: 128px;
  line-height: 1;
  margin-top: 14px;
  color: var(--accent);
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.team-score.bump { animation: score-bump .5s ease; }
@keyframes score-bump {
  30% { transform: scale(1.14); }
}

/* ---------------- center board */

.board-panel {
  background: var(--board-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.question-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 26px 36px;
  border-bottom: 4px solid var(--row-hidden-border);
  background: #0a1435;
}

.q-badge {
  flex: 0 0 auto;
  min-width: 110px;
  padding: 8px 20px;
  border-radius: 14px;
  background: var(--accent);
  color: #201400;
  font-size: 40px;
  text-align: center;
}

.q-badge:empty { visibility: hidden; }

.question-text {
  margin: 0;
  font-size: 54px;
  line-height: 1.15;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* strike marks (X X X) shown after a bad answer */
.strikes {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35em;
}

.strikes .x {
  font-size: 2.2em;
  line-height: 1;
  color: #26356b;
  text-shadow: none;
  transition: color .15s ease;
}

.strikes .x.filled {
  color: #ff3b3b;
  text-shadow: 0 0 22px rgba(255, 59, 59, .55);
}

.strikes .x.pop { animation: strike-pop .35s ease; }
@keyframes strike-pop {
  0%   { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.answer-board {
  list-style: none;
  margin: 0;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  /* base row font size — JS shrinks it when a question has many answers */
  font-size: 48px;
}

.answer-board .answer-row {
  flex: 1;
  min-height: 0;
  gap: 0.45em;
  padding: 0 0.55em;
  border-radius: 0.3em;
  border-width: 3px;
}

/* number chip scales with the row font size */
.answer-board .row-num {
  width: 1.5em;
  height: 1.5em;
  font-size: 0.8em;
  flex: 0 0 auto;
}

.answer-board .row-text {
  font-size: 1em;
}

.answer-board .row-points {
  font-size: 1em;
  min-width: 3.4em;
  padding: 0.08em 0.35em;
}

/* ---------------- answer rows */

.answer-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 26px;
  border-radius: 14px;
  background: var(--row-hidden-bg);
  border: 3px solid var(--row-hidden-border);
  transition: background-color .25s ease, border-color .25s ease;
}

.row-num {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--row-hidden-num);
  color: #7f92c9;
  font-size: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .25s ease, color .25s ease;
}

.row-text {
  flex: 1 1 auto;
  font-size: 48px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-points {
  flex: 0 0 auto;
  min-width: 170px;
  font-size: 48px;
  color: #201400;
  background: var(--accent);
  border-radius: 12px;
  padding: 4px 18px;
  text-align: center;
}

/* hidden (face-down) state: number only */
.answer-row:not(.revealed) .row-points { display: none; }

/* revealed state */
.answer-row.revealed {
  background: linear-gradient(180deg, var(--row-revealed-top), var(--row-revealed-bottom));
  border-color: var(--accent);
}

.answer-row.revealed .row-num {
  background: var(--accent);
  color: #201400;
}

.answer-row.revealed .row-points {
  background: var(--accent);
}

/* pop animation when an answer gets revealed (transform-only, LED safe) */
.answer-row.pop { animation: reveal-pop .35s ease; }
@keyframes reveal-pop {
  0%   { transform: scale(.9); }
  60%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}
