:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #eef2ff;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.page { width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 64px; }
.narrow { width: min(680px, calc(100% - 32px)); }
.hero { margin-bottom: 24px; }
.hero h1 { margin: 4px 0 8px; font-size: clamp(2rem, 5vw, 3.5rem); }
.hero p { margin: 0; color: #4b5563; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 800; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.card { background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 12px 35px rgba(15, 23, 42, .08); }
.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.qr-card { text-align: center; }
.qr-card img { width: min(100%, 320px); border-radius: 10px; }
.qr-card code { display: block; overflow-wrap: anywhere; margin-top: 12px; }
.note { color: #6b7280; font-size: .92rem; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.team-slots { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.team-slot { border: 2px dashed #c7d2fe; border-radius: 12px; padding: 14px; color: #6b7280; background: #f8fafc; }
.team-slot.occupied { border-style: solid; color: #111827; font-weight: 700; background: #eef2ff; }
.primary, .danger { border: 0; border-radius: 12px; padding: 13px 20px; font-weight: 800; }
.primary { background: #1d4ed8; color: white; }
.danger { background: #b91c1c; color: white; }
.status { min-height: 1.4em; color: #b91c1c; }
form { display: grid; gap: 10px; }
label { font-weight: 800; }
input { width: 100%; padding: 13px 14px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 1.1rem; }
.joined-list { display: grid; gap: 10px; margin-bottom: 24px; }
.joined-list li { background: #f1f5f9; border-radius: 10px; padding: 14px 16px; font-weight: 700; }
.team-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #0038a8; }
.team-panel { width: min(520px, 100%); aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; color: white; border: 4px solid rgba(255,255,255,.8); padding: 28px; }
.team-panel h1 { margin: 0; font-size: clamp(2.3rem, 9vw, 4.8rem); overflow-wrap: anywhere; }
.team-status { margin: 0; opacity: .85; }
.points { font-size: clamp(1.5rem, 6vw, 2.6rem); font-weight: 800; }
#buzz-button { min-width: 180px; padding: 16px 24px; border: 0; border-radius: 999px; font-weight: 900; font-size: 1.25rem; }
@media (max-width: 760px) {
  .qr-grid, .team-slots { grid-template-columns: 1fr; }
  .page { padding-top: 24px; }
}

/* ---------------- Host game board ---------------- */
body.clue-open { overflow: hidden; }
.game-page {
  height: 100vh;
  min-height: 0;
  padding: clamp(6px, .8vh, 12px) clamp(8px, 1vw, 20px);
  background: #071a52;
  color: white;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(6px, .7vh, 10px);
  overflow: hidden;
}
.game-toolbar {
  width: min(98vw, 2400px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}
.game-toolbar h1 { margin: 2px 0 0; font-size: clamp(1.8rem, 4vw, 3.2rem); }
.game-toolbar .eyebrow { color: #bfdbfe; margin: 0; }
.round-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.round-nav a {
  color: white;
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-weight: 800;
}
.round-nav a:hover, .round-nav a.active { background: white; color: #071a52; }
.board-shell {
  width: min(98vw, 2400px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
}
.jeopardy-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  height: 100%;
  min-height: 0;
  gap: clamp(3px, .35vmin, 6px);
  background: #050d2b;
  border: 5px solid #050d2b;
  box-shadow: 0 20px 45px rgba(0,0,0,.35);
}
.board-column {
  display: grid;
  grid-template-rows: minmax(0, 1.35fr) repeat(5, minmax(0, 1fr));
  gap: clamp(3px, .35vmin, 6px);
  min-height: 0;
}
.category-tile,
.value-tile {
  border: 0;
  min-width: 0;
  background: #082b91;
  color: white;
  display: grid;
  place-items: center;
  text-align: center;
}
.category-tile {
  padding: 12px 8px;
  font-weight: 950;
  font-size: clamp(.95rem, 2.2vmin, 2rem);
  line-height: 1.08;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
  overflow-wrap: anywhere;
}
.value-tile {
  font-size: clamp(1.65rem, 4.4vmin, 4.25rem);
  font-weight: 950;
  color: #ffd54a;
  text-shadow: 3px 3px 0 #050d2b;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.value-tile:not(:disabled):hover { transform: scale(.98); filter: brightness(1.18); }
.value-tile.used,
.value-tile:disabled {
  opacity: 1;
  color: transparent;
  text-shadow: none;
  background: #061d62;
  cursor: default;
}
.final-board { height: 100%; min-height: 0; display: grid; place-items: center; }
.final-tile {
  width: min(900px, 92vw);
  min-height: 380px;
  border: 8px solid #050d2b;
  background: #082b91;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 40px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}
.final-tile span { color: #ffd54a; font-size: clamp(1.6rem, 4vw, 3.6rem); font-weight: 950; }
.final-tile strong { font-size: clamp(1.5rem, 3vw, 3rem); text-transform: uppercase; text-shadow: 3px 3px 0 #000; }
.final-tile.used { opacity: .45; }

/* Clue display */
.clue-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 5, 25, .86);
  backdrop-filter: blur(4px);
}
.clue-card {
  position: relative;
  width: min(1120px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #082b91;
  color: white;
  border: 6px solid #050d2b;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  padding: clamp(24px, 4vw, 54px);
  text-align: center;
}
.clue-close {
  position: sticky;
  float: right;
  top: 0;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.7);
  background: rgba(0,0,0,.35);
  color: white;
  font-size: 1.7rem;
  line-height: 1;
}
.clue-category {
  margin: 0 auto 22px;
  max-width: 90%;
  color: #bfdbfe;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.clue-prompt [hidden] { display: none !important; }
.clue-prompt h2,
.clue-card > h2 {
  margin: 0 auto 28px;
  max-width: 1000px;
  font-size: clamp(1.75rem, 4vw, 3.65rem);
  line-height: 1.13;
  text-shadow: 3px 3px 0 #050d2b;
}
.daily-double {
  display: inline-block;
  margin: 0 auto 22px;
  padding: 11px 20px;
  background: #ffd54a;
  color: #071a52;
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 1000;
  letter-spacing: .08em;
  transform: skew(-7deg);
  box-shadow: 5px 5px 0 #050d2b;
}
.clue-images {
  width: 100%;
  margin: 24px auto 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  place-items: center;
}
.clue-images.multiple { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.clue-image-frame {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.clue-image-frame img {
  display: block;
  width: min(100%, 900px);
  height: auto;
  max-height: 52vh;
  object-fit: contain;
  border: 3px solid rgba(255,255,255,.22);
  background: #04164d;
}
.clue-images.multiple .clue-image-frame img {
  width: min(100%, 560px);
  max-height: 42vh;
}
.clue-card .primary { font-size: 1.05rem; padding: 15px 24px; background: #ffd54a; color: #071a52; }
.answer-area {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 3px solid rgba(255,255,255,.28);
}
.answer-label { color: #ffd54a; font-weight: 1000; letter-spacing: .16em; font-size: .9rem; }
.answer-area h3 {
  margin: 10px auto 18px;
  max-width: 1000px;
  font-size: clamp(1.6rem, 3.6vw, 3.2rem);
  line-height: 1.13;
}
.missing-image { color: #fecaca; font-weight: 800; }
.board-error { padding: 20px; background: white; color: #991b1b; border-radius: 12px; }

/* Round complete / score screen */
.score-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at top, #123ca4 0%, #071a52 55%, #030b27 100%);
  color: white;
}
.score-card {
  width: min(840px, 100%);
  padding: clamp(28px, 5vw, 56px);
  background: rgba(4, 20, 72, .92);
  border: 4px solid rgba(255,255,255,.18);
  box-shadow: 0 30px 90px rgba(0,0,0,.4);
}
.score-card h1 { margin: 6px 0 8px; font-size: clamp(2.1rem, 6vw, 4.7rem); }
.score-subtitle { margin: 0 0 28px; color: #bfdbfe; }
.score-list { display: grid; gap: 10px; margin: 28px 0 32px; }
.score-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
}
.score-rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffd54a;
  color: #071a52;
  font-weight: 1000;
}
.score-team-name { font-size: clamp(1.05rem, 3vw, 1.45rem); overflow-wrap: anywhere; }
.score-points { color: #ffd54a; font-size: clamp(1.05rem, 3vw, 1.4rem); font-weight: 950; }
.score-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 12px; padding: 13px 20px; font-weight: 800; }
.next-round { background: #ffd54a; color: #071a52; }

@media (max-width: 900px) {
  .game-page { padding: 8px; }
  .game-toolbar { align-items: flex-start; flex-direction: column; }
  .jeopardy-board { gap: 3px; border-width: 3px; height: 100%; min-height: 0; }
  .board-column { gap: 3px; grid-template-rows: minmax(0, 1.2fr) repeat(5, minmax(0, 1fr)); }
  .category-tile { padding: 7px 3px; font-size: clamp(.62rem, 1.8vw, .95rem); }
  .value-tile { font-size: clamp(.9rem, 3.6vw, 1.8rem); }
  .clue-images.multiple { grid-template-columns: 1fr; }
  .clue-images.multiple .clue-image-frame img { max-height: 34vh; }
}

@media (max-width: 560px) {
  .round-nav { width: 100%; }
  .round-nav a { flex: 1; text-align: center; padding-inline: 7px; font-size: .78rem; }
  .category-tile { font-size: .49rem; }
  .value-tile { font-size: .82rem; }
  .board-column { grid-template-rows: minmax(0, 1.2fr) repeat(5, minmax(0, 1fr)); }
  .clue-overlay { padding: 8px; }
  .clue-card { width: 100%; max-height: 96vh; border-width: 3px; }
  .clue-image-frame img { max-height: 46vh; }
  .clue-images.multiple .clue-image-frame img { max-height: 30vh; }
  .score-row { grid-template-columns: 36px 1fr; }
  .score-points { grid-column: 2; }
}

/* ---------------- Buzzer / reading phase ---------------- */
.reading-progress {
  width: 100%;
  height: 10px;
  margin: 8px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.reading-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #ffd54a;
  box-shadow: 0 0 18px rgba(255,213,74,.65);
}
.buzz-host-area {
  margin: 6px 0 22px;
  padding: 16px;
  border: 2px solid rgba(255,255,255,.18);
  background: rgba(1, 12, 51, .42);
}
.buzz-host-status {
  min-height: 1.5em;
  color: #dbeafe;
  font-size: clamp(.95rem, 1.7vw, 1.3rem);
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.judge-row {
  display: grid;
  grid-template-columns: minmax(86px, 120px) minmax(0, 1fr) minmax(86px, 120px);
  align-items: center;
  gap: clamp(14px, 3vw, 34px);
  margin-top: 12px;
}
.judge-row[hidden] { display: none !important; }
.judge-team-name {
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-shadow: 3px 3px 0 #050d2b;
}
.judge-button {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 4px solid rgba(255,255,255,.85);
  border-radius: 18px;
  color: white;
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: 1000;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
}
.judge-wrong { background: #b91c1c; }
.judge-correct { background: #15803d; }
.judge-button:not(:disabled):hover { filter: brightness(1.15); transform: scale(.98); }

.team-status {
  min-height: 2.8em;
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 800;
}
#buzz-button:not(:disabled) {
  background: #ffd54a;
  color: #071a52;
  box-shadow: 0 0 0 4px rgba(255,255,255,.18), 0 10px 28px rgba(0,0,0,.25);
}

@media (max-width: 560px) {
  .judge-row { grid-template-columns: 72px minmax(0, 1fr) 72px; gap: 10px; }
  .judge-button { border-width: 3px; border-radius: 14px; }
}

/* ---------------- Live host scoreboard ---------------- */
.live-scoreboard {
  width: min(98vw, 2400px);
  height: clamp(92px, 14vh, 132px);
  min-height: 0;
  margin: 0 auto;
  padding: clamp(5px, .65vh, 8px) clamp(7px, .7vw, 12px);
  border: clamp(2px, .3vh, 4px) solid #050d2b;
  background: #04164d;
  box-shadow: 0 10px 24px rgba(0,0,0,.24);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.live-scoreboard-heading {
  margin-bottom: clamp(3px, .35vh, 5px);
  color: #bfdbfe;
  font-size: clamp(.68rem, .85vw, .95rem);
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.live-scoreboard-rows {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(3px, .4vh, 6px);
}
.live-score-row {
  display: grid;
  grid-template-columns: repeat(var(--team-count), minmax(0, 1fr));
  gap: clamp(4px, .45vw, 8px);
  width: 100%;
  min-height: 0;
}
.live-score-team {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: clamp(3px, .45vh, 6px) clamp(7px, .65vw, 11px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 2px solid rgba(255,255,255,.18);
  background: #082b91;
}
.live-score-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: white;
  font-size: clamp(.82rem, 1.15vw, 1.25rem);
  line-height: 1.05;
  text-shadow: 2px 2px 0 #050d2b;
}
.live-score-points {
  color: #ffd54a;
  font-size: clamp(1rem, 1.65vw, 1.8rem);
  font-weight: 1000;
  line-height: 1;
  text-shadow: 2px 2px 0 #050d2b;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .live-scoreboard { border-width: 3px; }
  .live-score-team {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .live-score-name { font-size: clamp(.72rem, 2.3vw, 1rem); }
  .live-score-points { font-size: clamp(.95rem, 3.2vw, 1.35rem); }
}

/* ---------------- Special clue intros ---------------- */
.special-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at center, #1646c8 0%, #082b91 45%, #020817 100%);
  color: white;
}
.special-intro-overlay::before,
.special-intro-overlay::after {
  content: "";
  position: absolute;
  width: 75vmin;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 213, 74, .45);
  transform: rotate(45deg);
  animation: special-spin 5s linear forwards;
}
.special-intro-overlay::after { width: 48vmin; animation-direction: reverse; }
.special-intro-card { position: relative; z-index: 2; width: min(1100px, 90vw); text-align: center; }
.special-intro-title {
  font-size: clamp(3rem, 10vw, 9rem);
  line-height: .95;
  font-weight: 1000;
  letter-spacing: .02em;
  text-shadow: 5px 6px 0 #020817;
  animation: special-pulse 1s ease-in-out infinite alternate;
}
.daily-double-intro .special-intro-title { color: #ffd54a; }
.final-jeopardy-intro .special-intro-title { color: white; }
.special-intro-line {
  width: min(900px, 82vw);
  height: 10px;
  margin: clamp(28px, 6vh, 56px) auto 0;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.4);
  background: rgba(0,0,0,.35);
}
.special-intro-line span {
  display: block;
  width: 0;
  height: 100%;
  background: #ffd54a;
  animation: special-line 5s linear forwards;
}
@keyframes special-line { to { width: 100%; } }
@keyframes special-spin { to { transform: rotate(225deg) scale(1.2); opacity: .15; } }
@keyframes special-pulse { from { transform: scale(.98); } to { transform: scale(1.025); } }

/* ---------------- Manual score correction ---------------- */
.score-correction-page {
  min-height: 100vh;
  padding: clamp(20px, 4vw, 56px);
  background: radial-gradient(circle at top, #123ca4 0%, #071a52 58%, #030b27 100%);
  color: white;
}
.score-correction-card {
  width: min(1050px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px);
  background: rgba(4, 20, 72, .94);
  border: 4px solid rgba(255,255,255,.16);
  box-shadow: 0 30px 90px rgba(0,0,0,.4);
}
.score-correction-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.score-correction-header h1 { margin: 4px 0 6px; font-size: clamp(2rem, 5vw, 4rem); }
.score-correction-header p { margin: 0; color: #bfdbfe; }
.score-history-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.score-history-nav .button-link { color: white; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); }
.score-editor { display: grid; gap: 10px; margin: 30px 0 20px; }
.score-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 220px);
  gap: 20px;
  align-items: center;
  padding: 14px 16px;
  background: #082b91;
  border: 2px solid rgba(255,255,255,.16);
}
.score-edit-row strong { font-size: clamp(1rem, 2.3vw, 1.5rem); overflow-wrap: anywhere; }
.score-edit-row input { text-align: right; font-size: clamp(1.15rem, 2.5vw, 1.7rem); font-weight: 900; }
.score-correction-actions { display: flex; align-items: center; gap: 16px; }
.score-save-status { color: #ffd54a; font-weight: 800; }

/* ---------------- Final Jeopardy ---------------- */
.final-host-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(8px, 1.2vw, 18px);
  background: #082b91;
  border: 5px solid #050d2b;
  color: white;
  text-align: center;
}
.final-question-display { max-width: 1500px; margin: 0 auto; }
.final-question-display .clue-category { margin-bottom: clamp(6px, 1vh, 12px); }
.final-question-display h2 {
  margin: 0 auto clamp(10px, 1.4vh, 18px);
  max-width: 1500px;
  font-size: clamp(1.65rem, 3.4vmin, 3.5rem);
  line-height: 1.05;
  text-shadow: 3px 3px 0 #050d2b;
}
.final-host-controls { display: grid; place-items: center; gap: 14px; margin-top: clamp(18px, 3vh, 40px); }
.final-host-controls p { margin: 0; font-size: clamp(1rem, 2vw, 1.4rem); }
.final-unlock-button { font-size: clamp(1.15rem, 2.2vw, 1.7rem); }
.final-writing-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 48px);
  margin: clamp(18px, 3vh, 40px) auto 0;
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 900;
}
#final-host-timer { color: #ffd54a; font-size: clamp(2.5rem, 7vw, 6rem); font-variant-numeric: tabular-nums; }
.final-judge-list { display: grid; gap: clamp(5px, .7vh, 9px); width: min(1500px, 100%); margin: clamp(12px, 1.5vh, 20px) auto 0; }
.final-judge-row {
  display: grid;
  grid-template-columns: clamp(54px, 6vmin, 82px) minmax(0, 1fr) minmax(90px, 150px) clamp(54px, 6vmin, 82px);
  align-items: stretch;
  gap: 8px;
  min-height: clamp(58px, 7vh, 82px);
}
.final-judge-row.judged { opacity: .58; }
.final-judge-button {
  border: 3px solid rgba(255,255,255,.75);
  color: white;
  font-size: clamp(2rem, 4vmin, 3.4rem);
  font-weight: 1000;
  line-height: 1;
}
.final-judge-button.final-wrong { background: #b91c1c; }
.final-judge-button.final-correct { background: #15803d; }
.final-judge-team,
.final-wager {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #04164d;
  border: 2px solid rgba(255,255,255,.16);
}
.final-judge-team { min-width: 0; flex-direction: column; gap: 2px; padding: 5px 12px; text-align: left; align-items: flex-start; }
.final-judge-team strong { font-size: clamp(1rem, 2vmin, 1.45rem); }
.final-written-answer { width: 100%; color: #bfdbfe; font-size: clamp(.82rem, 1.6vmin, 1.1rem); overflow-wrap: anywhere; }
.final-wager { color: #ffd54a; font-size: clamp(1.15rem, 2.5vmin, 1.8rem); font-weight: 1000; font-variant-numeric: tabular-nums; }
.final-official-answer { width: min(1200px, 100%); margin: 18px auto 0; padding-top: 14px; border-top: 3px solid rgba(255,255,255,.25); }
.final-official-answer h3 { margin: 6px 0 10px; font-size: clamp(1.5rem, 3vw, 2.8rem); }
.final-official-answer .clue-images { margin: 10px auto 14px; }
.final-official-answer .clue-image-frame img { max-height: 28vh; }

.final-entry-panel {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
}
.final-entry-panel[hidden] { display: none !important; }
.final-entry-panel label { color: white; font-weight: 900; }
.final-entry-panel input,
.final-entry-panel textarea {
  width: 100%;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 10px;
  padding: 11px 12px;
  background: white;
  color: #111827;
  font: inherit;
  resize: vertical;
}
.final-entry-panel input:disabled,
.final-entry-panel textarea:disabled { background: #cbd5e1; color: #475569; cursor: not-allowed; }
.final-entry-note { margin: 2px 0 0; color: #dbeafe; font-size: .82rem; line-height: 1.25; }

@media (max-width: 700px) {
  .score-correction-header { flex-direction: column; }
  .score-history-nav { justify-content: flex-start; }
  .score-edit-row { grid-template-columns: 1fr; gap: 8px; }
  .final-judge-row { grid-template-columns: 52px minmax(0, 1fr) 76px 52px; }
}
.team-panel.final-mode {
  aspect-ratio: auto;
  min-height: min(86vh, 720px);
  justify-content: center;
  gap: 14px;
}
.team-panel.final-mode h1 { font-size: clamp(2rem, 7vw, 3.8rem); }
.team-panel.final-mode .points { font-size: clamp(1.3rem, 5vw, 2.1rem); }

/* ---------------- Power Clues ---------------- */
.power-won-button {
  display: block;
  margin: clamp(16px, 2vh, 24px) auto 0;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 1000;
}
.power-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 40px);
  background: rgba(2, 6, 23, .92);
}
.power-card {
  width: min(920px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(24px, 4vw, 48px);
  border: 5px solid #ffd54a;
  border-radius: 18px;
  background: radial-gradient(circle at top, #1239a8 0, #082b91 38%, #04164d 100%);
  color: white;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.power-eyebrow {
  margin-bottom: 8px;
  color: #ffd54a;
  font-size: clamp(.85rem, 1.7vw, 1.15rem);
  font-weight: 1000;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.power-card h2 {
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 1;
  text-shadow: 3px 3px 0 #050d2b;
}
.power-card > p {
  margin: 0 auto 22px;
  max-width: 760px;
  color: #dbeafe;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.4;
}
.power-card h3 {
  margin: 8px 0 12px;
  color: #ffd54a;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.power-target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.power-target-button,
.power-activate-button {
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 12px;
  cursor: pointer;
}
.power-target-button {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
  background: #0b3aad;
  color: white;
}
.power-target-button:hover:not(:disabled) { background: #1550d1; transform: translateY(-1px); }
.power-target-button strong { font-size: clamp(1rem, 2vw, 1.3rem); }
.power-target-button span { color: #ffd54a; font-weight: 900; }
.power-target-button:disabled,
.power-activate-button:disabled { opacity: .55; cursor: wait; }

/* ---------------- Pre-game rules ---------------- */
.rules-page {
  padding-top: clamp(1.25rem, 3vh, 2.5rem);
  padding-bottom: clamp(1.25rem, 3vh, 2.5rem);
}

.rules-hero {
  margin-bottom: 1rem;
}

.rules-card {
  padding: clamp(1.1rem, 2.4vw, 2rem);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.rules-grid article {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.045);
}

.rules-grid h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.rules-grid p {
  margin: 0;
  line-height: 1.5;
}

.rules-footer {
  margin-top: 1.1rem;
  text-align: center;
}

.rules-start-button {
  min-width: min(100%, 320px);
  margin-top: 0.65rem;
  font-size: 1.08rem;
}

@media (max-width: 720px) {
  .rules-grid {
    grid-template-columns: 1fr;
  }
}


/* ---------------- Larger host lobby / joined-team presentation ---------------- */
.host-page {
  width: min(1500px, calc(100% - 48px));
}
.host-page .hero h1 {
  font-size: clamp(3.2rem, 5vw, 5.4rem);
  line-height: 1;
}
.host-page .hero > p:not(.eyebrow) {
  font-size: clamp(1.25rem, 1.6vw, 1.6rem);
}
.host-page .eyebrow {
  font-size: clamp(.95rem, 1.1vw, 1.15rem);
}
.host-page .success-box,
.host-page .warning-box {
  font-size: clamp(1.05rem, 1.2vw, 1.25rem);
}
.host-page .qr-card {
  padding: clamp(1.7rem, 2.2vw, 2.4rem);
}
.host-page .qr-card h2 {
  font-size: clamp(1.55rem, 1.8vw, 2rem);
}
.host-page .qr-card code {
  font-size: clamp(1rem, 1.1vw, 1.2rem);
}
.host-page .qr-card .note {
  font-size: clamp(1rem, 1.1vw, 1.2rem);
}
.host-page .section-heading h2 {
  font-size: clamp(1.55rem, 1.8vw, 2rem);
}
.host-page .section-heading span {
  font-size: clamp(1.05rem, 1.2vw, 1.3rem);
}
.host-page .team-slot {
  padding: 17px 18px;
  font-size: clamp(1.05rem, 1.2vw, 1.3rem);
}
.host-page .primary {
  font-size: clamp(1.15rem, 1.25vw, 1.35rem);
  padding: 15px 24px;
}

.joined-page {
  width: min(980px, calc(100% - 40px));
}
.joined-page .hero h1 {
  font-size: clamp(3.2rem, 5vw, 5rem);
  line-height: 1;
}
.joined-page .hero > p:not(.eyebrow) {
  font-size: clamp(1.2rem, 1.6vw, 1.5rem);
}
.joined-page .eyebrow {
  font-size: clamp(.95rem, 1.1vw, 1.1rem);
}
.joined-page .card {
  padding: clamp(1.7rem, 2.5vw, 2.5rem);
}
.joined-page .joined-list {
  gap: 14px;
}
.joined-page .joined-list li {
  padding: 17px 20px;
  font-size: clamp(1.15rem, 1.4vw, 1.45rem);
}
.joined-page .button-row {
  gap: 12px;
}
.joined-page .button-row .button-link,
.joined-page .button-row button {
  font-size: clamp(1.05rem, 1.2vw, 1.25rem);
  padding: 14px 20px;
}
.joined-page .note {
  font-size: clamp(1rem, 1.1vw, 1.15rem);
}

@media (max-width: 760px) {
  .host-page, .joined-page { width: min(100% - 24px, 680px); }
  .host-page .hero h1, .joined-page .hero h1 { font-size: clamp(2.6rem, 12vw, 4rem); }
}

/* ---------------- Larger lobby/rules presentation text ---------------- */
.participant-page {
  width: min(820px, calc(100% - 32px));
}
.participant-page .hero h1 {
  font-size: clamp(3rem, 7vw, 5.25rem);
}
.participant-page .hero p:not(.eyebrow) {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
}
.participant-page .eyebrow {
  font-size: clamp(.9rem, 1.5vw, 1.05rem);
}
.participant-page .card {
  padding: clamp(1.6rem, 3vw, 2.4rem);
}
.participant-page label {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}
.participant-page input {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  padding: 16px 18px;
}
.participant-page .primary {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  padding: 16px 22px;
}
.participant-page .status {
  font-size: 1.08rem;
}

.rules-page {
  width: min(1180px, calc(100% - 40px));
}
.rules-page .rules-hero h1 {
  font-size: clamp(3rem, 5.5vw, 5rem);
  line-height: 1.02;
}
.rules-page .rules-hero > p:not(.eyebrow) {
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
}
.rules-page .eyebrow {
  font-size: clamp(.9rem, 1.25vw, 1.05rem);
}
.rules-grid {
  gap: clamp(1rem, 1.5vw, 1.4rem);
}
.rules-grid article {
  padding: clamp(1.15rem, 1.8vw, 1.5rem);
}
.rules-grid h2 {
  font-size: clamp(1.35rem, 1.8vw, 1.7rem);
}
.rules-grid p {
  font-size: clamp(1.08rem, 1.35vw, 1.3rem);
  line-height: 1.5;
}
.rules-footer p {
  font-size: clamp(1.08rem, 1.35vw, 1.25rem);
}
.rules-start-button {
  min-width: min(100%, 390px);
  font-size: clamp(1.2rem, 1.6vw, 1.4rem);
  padding: 16px 24px;
}

@media (max-width: 720px) {
  .rules-page { width: min(100% - 24px, 680px); }
  .rules-page .rules-hero h1 { font-size: clamp(2.5rem, 12vw, 4rem); }
  .rules-grid p { font-size: 1.08rem; }
}

/* ---------------- Rejoin / recovery controls ---------------- */
.host-recovery-link {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 5000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: #ffffff;
  color: #0b2b86;
  border: 2px solid #0b2b86;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  font-weight: 900;
  text-decoration: none;
  font-size: .95rem;
}
.host-recovery-link:hover { transform: translateY(-1px); }

.rejoin-host-page {
  width: min(1500px, calc(100% - 48px));
  padding-top: clamp(1.25rem, 3vh, 2.5rem);
  padding-bottom: 3rem;
}
.rejoin-host-page .hero h1 { font-size: clamp(2.7rem, 5vw, 4.8rem); }
.rejoin-host-page .hero > p:not(.eyebrow) { font-size: clamp(1.05rem, 1.5vw, 1.35rem); }
.rejoin-host-grid {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(420px, 1.15fr);
  gap: 20px;
  align-items: start;
}
.persistent-lan-card img,
.generated-rejoin img {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto 14px;
  image-rendering: pixelated;
}
.persistent-lan-card code { display: block; overflow-wrap: anywhere; text-align: center; }
.rejoin-team-list,
.rejoin-request-list { display: grid; gap: 10px; margin-top: 16px; }
.rejoin-team-row,
.rejoin-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(11,58,173,.07);
  border: 1px solid rgba(11,58,173,.15);
}
.rejoin-team-row > div,
.rejoin-request-row > div:first-child { display: grid; gap: 2px; }
.rejoin-team-row strong,
.rejoin-request-row strong { font-size: 1.08rem; }
.rejoin-team-row span,
.rejoin-request-row span { opacity: .75; }
.generated-rejoin {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(0,0,0,.12);
  text-align: center;
}
.generated-rejoin h3 { font-size: 1.5rem; margin-top: 0; }
.rejoin-request-card { margin-top: 20px; }
.rejoin-request-actions { display: flex !important; grid-auto-flow: column; gap: 8px !important; }
.rejoin-empty { opacity: .7; margin: .5rem 0; }

.participant-rejoin-panel h2 { margin-top: 0; font-size: clamp(1.45rem, 3vw, 2rem); }
.participant-rejoin-panel > p { font-size: clamp(1.05rem, 2vw, 1.25rem); }
.participant-rejoin-choices { display: grid; gap: 12px; margin-top: 18px; }
.rejoin-choice {
  width: 100%;
  padding: 16px 18px;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 900;
  border-radius: 12px;
  border: 2px solid #2754dc;
  background: #eef3ff;
  color: #10245f;
}
.rejoin-choice:hover:not(:disabled) { background: #dfe8ff; }

@media (max-width: 850px) {
  .rejoin-host-page { width: min(100% - 24px, 720px); }
  .rejoin-host-grid { grid-template-columns: 1fr; }
  .host-recovery-link { top: 8px; right: 8px; font-size: .82rem; padding: 8px 11px; }
  .rejoin-team-row, .rejoin-request-row { align-items: stretch; flex-direction: column; }
  .rejoin-team-row button { width: 100%; }
}

/* Hosted Drewpardy create/upload screen */
.create-game-page .upload-card form { display: grid; gap: 14px; }
.create-game-page .field-label { font-weight: 900; }
.create-game-page input[type="file"],
.create-game-page input[type="password"] { width: 100%; padding: 14px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
.create-game-page hr { width: 100%; border: 0; border-top: 2px solid rgba(0,0,0,.18); margin: 22px 0; }
.create-game-page form + .note { margin-top: 16px; }
