:root {
  --bg: #140f0c;
  --ink: #1c140f;
  --cream: #f6f0e4;
  --cream-ink: #f3eadc;
  --muted: #c8bbae;
  --quiet: #8d7f72;
  --line: rgba(28, 20, 15, 0.18);
  --daub: rgba(196, 42, 36, 0.58);
  --card-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(900px 480px at 50% -12%, var(--glow, #3c2c24) 0%, transparent 55%),
    var(--bg);
  color: var(--cream-ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

body.live-page {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

button, input { font: inherit; }

.board {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 8px 12px 10px;
}

body.live-page .board {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  height: 100%;
  gap: 6px;
  overflow: hidden;
}

.eyebrow {
  margin: 0;
  color: var(--quiet);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pattern {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 0;
}

.top-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.ball {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 -8px 12px rgba(0, 0, 0, 0.25), 0 8px 18px rgba(0, 0, 0, 0.35);
  background: #2a241f;
  color: var(--cream);
}

.ball[data-letter="B"] { background: #1d4e89; color: #fff; }
.ball[data-letter="I"] { background: #b4332a; color: #fff; }
.ball[data-letter="N"] { background: #2c333a; color: #fff; }
.ball[data-letter="G"] { background: #1c7a43; color: #fff; }
.ball[data-letter="O"] { background: #f0b429; color: var(--ink); }

.ball .face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 76%;
  height: 76%;
  border-radius: 50%;
  background: #fff8ee;
  color: #2a2118;
  box-shadow: inset 0 0 0 1px rgba(42, 33, 24, 0.14);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-synthesis: none;
  font-size: 25px;
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.04em;
  line-height: 0.8;
}

.ball .num {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-synthesis: none;
  font-size: 25px;
  font-weight: 700;
  line-height: 0.8;
}

.ball small {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-synthesis: none;
  font-size: 14px; /* Bossman 2026-11-26: 18 too large on phones */
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

.call-meta {
  display: grid;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Both lines share one cell, so the taller wording keeps its space. */
.call-meta > span { grid-area: 1 / 1; }
.call-meta-sizer { visibility: hidden; }

.mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  color: var(--cream-ink);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.mark input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #3d342c;
}

.track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cream);
}

.mark input:checked + .track { background: #1c7a43; }
.mark input:checked + .track::after { transform: translateX(18px); }
.mark input:focus-visible + .track { outline: 3px solid #f0b429; outline-offset: 2px; }
.mark input:disabled + .track { opacity: 0.45; }

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 0 0 auto;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}

/* The row is reserved before the first call so the themed frame does not jump. */
.chips:empty { visibility: hidden; }
.chip-sizer { visibility: hidden; }

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #2a221c;
  color: var(--cream-ink);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.chip:first-child { outline: 1px solid #e0a106; }

.card {
  position: relative;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(80, 50, 20, 0.045) 0.7px, transparent 0.7px);
  background-size: 7px 7px;
  color: var(--ink);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--card-shadow);
}

body.live-page .stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
  container-type: size;
}

body.live-page .card {
  --band: 3.8rem;
  flex: none;
  width: min(100cqw, calc(100cqh - var(--band)));
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.card.dim {
  overflow: hidden;
}

.card.dim .sheet {
  filter: grayscale(1);
  opacity: 0.78;
}

.sash {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 46%;
  width: 155%;
  margin: 0;
  transform: translate(-50%, -50%) rotate(-18deg);
  background: #d01212;
  color: #fff;
  text-align: center;
  font-weight: 900;
  font-size: clamp(0.92rem, 3.6vw, 1.7rem);
  letter-spacing: 0.01em;
  line-height: 1.2;
  padding: 0.38em 0;
}

.card-no {
  margin: 0 2px 4px;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  text-align: right;
  font-weight: 800;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.seat-name {
  margin-right: auto;
  min-width: 0;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: left;
}

.seat-num { flex: 0 0 auto; }

.name-gate {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
}

.name-form {
  width: min(100%, 360px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.name-form label {
  font-size: 1.35rem;
  font-weight: 800;
}

.name-form input {
  border: 1px solid rgba(243, 234, 220, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream-ink);
  padding: 12px 14px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.name-form .join {
  border: 0;
  border-radius: 999px;
  background: #1c7a43;
  color: #fff;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
}

.name-form .join:disabled,
.name-form .join-again:disabled { opacity: 0.4; cursor: default; }

.name-form .join:focus-visible,
.name-form input:focus-visible { outline: 2px solid #f0b429; outline-offset: 2px; }

/* A sideways phone or iPad is covered. A desktop with a mouse is left alone. */
#turn {
  display: none;
  --turn: #f0b429;
}

body[data-theme="thanksgiving"] #turn { --turn: #e2b45a; }
body[data-theme="winter"] #turn { --turn: #d7e6f2; }
body[data-theme="holiday"] #turn { --turn: #f2c14e; }

@media (orientation: landscape) and (pointer: coarse) {
  #turn {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    overflow: auto;
    box-sizing: border-box;
    padding: 24px 28px;
    background:
      radial-gradient(420px 220px at 50% 0%, var(--glow, #3c2c24) 0%, transparent 60%),
      var(--bg);
    color: var(--cream-ink);
    text-align: center;
  }

  #turn p {
    margin: 0;
    max-width: 16em;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.15;
  }

  #turn svg {
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
    color: var(--turn);
  }
}

.heads, .grid-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.heads { flex: 0 0 auto; }

.heads span {
  display: grid;
  place-items: center;
  height: auto;
  min-height: 26px;
  margin: 0 2px 4px;
  border-radius: 7px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.heads span:nth-child(1) { background: #1d4e89; color: #fff; }
.heads span:nth-child(2) { background: #b4332a; color: #fff; }
.heads span:nth-child(3) { background: #2c333a; color: #fff; }
.heads span:nth-child(4) { background: #1c7a43; color: #fff; }
.heads span:nth-child(5) { background: #f0b429; color: var(--ink); }

.grid {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
}

body.live-page .grid {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  container-type: size;
}

.square {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1rem, 4.4vw, 1.45rem);
  font-weight: 800;
  /* Proportional digits: a tabular "1" carries empty space on its left, so "15" sat
     right of the daub's centre while "24" looked centred (Bossman, 2026-11-26). */
  font-variant-numeric: lining-nums proportional-nums;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

body.live-page .square {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: 11cqmin;
}

/* San Francisco at 800 is much heavier than Roboto at the same weight. */
@supports (-webkit-touch-callout: none) {
  .square,
  .card-no {
    font-family: system-ui, sans-serif;
    font-weight: 500;
    font-synthesis: none;
  }
}

.grid-row .square:last-child { border-right: 0; }
.grid-row:last-child .square { border-bottom: 0; }

.square:focus-visible {
  outline: 3px solid #1d4e89;
  outline-offset: -3px;
  z-index: 1;
}

.square.free {
  cursor: default;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

body.live-page .square.free { font-size: 4.6cqmin; letter-spacing: 0.04em; }

.square.free .num {
  width: 72%;
  aspect-ratio: 1;
  height: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(240, 180, 41, 0.45);
}

.square.free.marked .num { background: transparent; }

.num { position: relative; z-index: 1; }

.square.marked::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  aspect-ratio: 1;
  height: auto;
  border-radius: 50%;
  background: var(--daub);
  transform: translate(-50%, -50%);
}

.square.called:not(.marked) {
  box-shadow: inset 0 0 0 2px #14803c;
}

.square.needed {
  background: rgba(28, 122, 67, 0.22);
  box-shadow: inset 0 0 0 3px #14803c;
}

.dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bingo {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #3a322c;
  color: #efe6da;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  touch-action: manipulation;
}

.bingo.lit {
  height: 58px;
  padding: 6px 14px;
  background: #1c7a43;
  color: #f4fff7;
  font-size: 1.05rem;
  line-height: 1.15;
}

.bingo.shout { font-size: 0.98rem; }

/* Wait for the shout wraps onto several lines. The pill grows instead of clipping them. */
.bingo.lit.shout {
  height: auto;
  min-height: 58px;
}

.toast.shout-note {
  position: static;
  z-index: auto;
  left: auto;
  bottom: auto;
  transform: none;
  align-self: center;
  flex-shrink: 0;
  width: min(420px, 100%);
}

.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(28, 20, 15, 0.94);
  color: var(--cream);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.bingo:focus-visible { outline: 3px solid #f0b429; outline-offset: 3px; }

.status {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}

.join-again {
  display: block;
  margin: 16px auto 0;
  border: 1px solid rgba(243, 234, 220, 0.28);
  border-radius: 999px;
  background: transparent;
  color: var(--cream);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.join-again:focus-visible { outline: 2px solid #f0b429; outline-offset: 2px; }
.join-again:disabled { opacity: 0.4; cursor: default; }

.finale.lose {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--cream-ink);
}

.lose-num {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

#fx { pointer-events: none; }
#fx:empty { display: none; }

.finale.win {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  margin: 0;
  pointer-events: none;
}

.finale.win::before {
  content: "";
  position: absolute;
  width: min(92vw, 640px);
  height: min(92vw, 640px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 74, 0.72) 0%, rgba(255, 77, 58, 0.28) 38%, transparent 70%);
}

.finale-title.cheer {
  font-size: clamp(2rem, 9vw, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  padding: 0.22em 0.28em 0.16em;
}

.finale-title {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(4.6rem, 24vw, 9.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #ffe14a;
  background: #1c140f;
  padding: 0.16em 0.18em;
  border-radius: 0.12em;
  text-shadow: none;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bit {
  position: absolute;
  top: 0;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  opacity: 0;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}

.bit.round { border-radius: 50%; }

@keyframes fall {
  0% { transform: translate3d(0, -14vh, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translate3d(var(--drift, 0px), 110vh, 0) rotate(var(--spin, 240deg)); opacity: 0; }
}

.win-line {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.live-page .win-line { grid-row: 1 / span 5; grid-column: 1; }

.win-line .stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.win-line .halo { stroke: #f3fff6; stroke-width: 12px; }
.win-line .ink { stroke: #14803c; stroke-width: 6px; }

@media (prefers-reduced-motion: no-preference) {
  .finale-title { animation: title-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .finale.win::before { animation: burst 0.8s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .win-line .stroke { animation: draw-line 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
  @keyframes title-in {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  @keyframes burst {
    from { transform: scale(0.82); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  @keyframes draw-line { from { opacity: 0; } to { opacity: 1; } }
}

.fixture {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(243, 234, 220, 0.14);
  color: var(--quiet);
  font-size: 0.85rem;
}

.fixture p { margin: 0 0 8px; }

.fixture-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.scripted,
.fixture-actions button {
  border: 1px solid rgba(243, 234, 220, 0.28);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  cursor: pointer;
}

.scripted { margin-top: 6px; }

#fixture-rulings { justify-content: center; }

.sample-note {
  align-self: center;
  color: var(--quiet);
  font-size: 0.85rem;
}

.scripted:disabled,
.fixture-actions button:disabled { opacity: 0.4; cursor: default; }

.scripted:focus-visible,
.fixture-actions button:focus-visible { outline: 2px solid #f0b429; outline-offset: 2px; }

.waiting {
  margin: 28px 0;
  color: var(--muted);
  font-size: 1.15rem;
}

#wait:empty { display: none; }

#wait:not(:empty) {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 24px 16px;
}

.opening {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 420px);
  text-align: center;
}

.bingo-title {
  margin: 0;
  font-size: clamp(3.4rem, 18vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.9;
  background-image: linear-gradient(#ffe56a, #f09020);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}

.opening .eyebrow { min-height: 1em; }

.opening .waiting { margin: 2px 0 0; }

.joined {
  margin: 0;
  color: var(--cream-ink);
  font-size: 1.05rem;
  font-weight: 700;
}

.drum {
  position: relative;
  width: min(78vw, 290px);
  aspect-ratio: 1;
}

.drum-glass {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 3px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.04), inset 0 -24px 40px rgba(0, 0, 0, 0.2);
}

.orbit-squash {
  position: absolute;
  inset: 6% 2%;
}

.orbit {
  position: absolute;
  inset: 0;
  animation: tumble 9s linear infinite;
}

@keyframes tumble { to { transform: rotate(360deg); } }

.drum-ball {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35);
}

.orbit .drum-ball {
  width: 46px;
  height: 46px;
  margin: -23px;
  transform: rotate(var(--a)) translateX(108px) rotate(calc(var(--a) * -1));
}

.drum-ball.b { background: radial-gradient(circle at 36% 30%, #9ec0ff, #1f61db 46%, #0a2a66); }
.drum-ball.i { background: radial-gradient(circle at 36% 30%, #ffb0b4, #db2129 46%, #6a0c12); }
.drum-ball.n { background: radial-gradient(circle at 36% 30%, #ffffff, #ececea 46%, #8d8d89); }
.drum-ball.g { background: radial-gradient(circle at 36% 30%, #9aebc0, #1f9e4d 46%, #0c4a24); }
.drum-ball.o { background: radial-gradient(circle at 36% 30%, #ffe7a4, #fac41a 46%, #8a6804); }

.decal {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 40% 35%, #fff, #e6e6e6);
  color: rgba(20, 16, 12, 0.88);
  font-weight: 900;
  font-size: 0.78rem;
  line-height: 0.85;
}

.decal small {
  font-size: 0.55em;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.drum-ball.hub {
  z-index: 2;
  width: 112px;
  height: 112px;
  margin: -56px;
  animation: breathe 2.6s ease-in-out infinite;
}

.hub .decal { font-size: 1.65rem; }

@keyframes breathe {
  50% { transform: scale(1.05) rotate(6deg); }
}

@media (prefers-reduced-motion: no-preference) {
  .bingo.lit { animation: glow 1.1s ease-in-out infinite; }
  @keyframes glow {
    50% { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(20, 128, 60, 0.45); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .bit { animation: none; display: none; }
  [data-theme="thanksgiving"] .bit,
  [data-theme="winter"] .bit,
  [data-theme="holiday"] .bit { display: block; }
  .finale-title, .finale.win::before, .win-line .stroke { animation: none; }
  .orbit, .drum-ball.hub { animation: none; }
}

body[data-theme="thanksgiving"] .bingo-title { background-image: linear-gradient(#f6d78a, #d4652a); }
body[data-theme="winter"] .bingo-title { background-image: linear-gradient(#f7fbff, #7eb8dc); }
body[data-theme="holiday"] .bingo-title { background-image: linear-gradient(#ffe08a, #e23b45); }

body[data-theme="thanksgiving"] {
  --bg: #2a140c;
  --glow: #6a3418;
  --cream: #fbf3e4;
  --cream-ink: #f8ecd8;
  --ink: #2a160e;
  --muted: #e4c9a4;
  --quiet: #c9a27a;
  --line: rgba(42, 22, 14, 0.16);
  --daub: rgba(168, 42, 32, 0.62);
  --card-shadow: 0 18px 40px rgba(40, 16, 6, 0.45);
}

body[data-theme="thanksgiving"] .card {
  border: 9px solid #e2b45a;
  box-shadow: inset 0 0 0 3px #8c3a12, 0 0 0 3px #f3d59a, var(--card-shadow);
}

body[data-theme="thanksgiving"] .card::before,
body[data-theme="thanksgiving"] .card::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 20px;
  background: #c4492c;
  border-radius: 0 80% 0 80%;
  z-index: 4;
  pointer-events: none;
}

body[data-theme="thanksgiving"] .card::before { top: 8px; left: 12px; transform: rotate(-28deg); }
body[data-theme="thanksgiving"] .card::after { right: 12px; bottom: 8px; transform: rotate(152deg); }

body[data-theme="thanksgiving"] .bit.leaf { border-radius: 2px 80% 2px 80%; }

body[data-theme="thanksgiving"] .finale.win::before {
  background: radial-gradient(circle, rgba(240, 180, 41, 0.72) 0%, rgba(196, 73, 44, 0.34) 40%, transparent 70%);
}

body[data-theme="winter"] {
  --bg: #0e1c2c;
  --glow: #1c4a6e;
  --cream: #f4f8fb;
  --cream-ink: #e7f1f8;
  --ink: #142433;
  --muted: #c5d7e6;
  --quiet: #8eabc2;
  --line: rgba(20, 36, 51, 0.14);
  --daub: rgba(168, 42, 32, 0.62);
  --card-shadow: 0 18px 40px rgba(6, 16, 28, 0.5);
}

body[data-theme="winter"] .card {
  background-color: #f7fbfe;
  border: 8px solid #d7e6f2;
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 4px rgba(186, 214, 232, 0.9), var(--card-shadow);
}

body[data-theme="winter"] .bit.flake { border-radius: 50%; }

body[data-theme="winter"] .finale.win::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.78) 0%, rgba(160, 196, 224, 0.35) 42%, transparent 70%);
}

body[data-theme="holiday"] {
  --bg: #1a0d10;
  --glow: #4a1820;
  --cream: #fbf6ee;
  --cream-ink: #f8efe2;
  --ink: #1c140f;
  --muted: #e7d3a1;
  --quiet: #c4a36a;
  --line: rgba(28, 20, 15, 0.16);
  --daub: rgba(168, 42, 32, 0.62);
  --card-shadow: 0 18px 40px rgba(20, 6, 8, 0.5);
}

body[data-theme="holiday"] .card {
  border: 8px solid #1c7a43;
  box-shadow: inset 0 0 0 3px #f2c14e, 0 0 0 3px #8d1d2c, var(--card-shadow);
}

body[data-theme="holiday"] .card::before,
body[data-theme="holiday"] .card::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(#c4492c, #c4492c) center / 100% 7px no-repeat,
    linear-gradient(#c4492c, #c4492c) center / 7px 100% no-repeat;
}

body[data-theme="holiday"] .card::before { top: 5px; left: 5px; }
body[data-theme="holiday"] .card::after { right: 5px; bottom: 5px; }

body[data-theme="holiday"] .bit.star {
  border-radius: 0;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

body[data-theme="holiday"] .bit.spark {
  border-radius: 50%;
  box-shadow: 0 0 6px #ffe08a;
}

body[data-theme="holiday"] .finale.win::before {
  background: radial-gradient(circle, rgba(242, 193, 78, 0.72) 0%, rgba(141, 29, 44, 0.32) 42%, transparent 70%);
}

/* Themed marking chips (Bossman, 2026-11-26): same centre as the plain daub; the number stays on top.
   A losing card's .sheet grayscale filter turns these gray too. */
body[data-theme="thanksgiving"] .square.marked::before,
body[data-theme="winter"] .square.marked::before,
body[data-theme="holiday"] .square.marked::before {
  width: 86%;
  border-radius: 0;
  background: center / contain no-repeat;
}
body[data-theme="thanksgiving"] .square.marked::before { background-image: url("/art/chip-thanksgiving.svg"); }
body[data-theme="winter"] .square.marked::before { background-image: url("/art/chip-winter.svg"); }
body[data-theme="holiday"] .square.marked::before { background-image: url("/art/chip-holiday.svg"); }
/* Digits sit a touch heavier over the art so 15 and 24 still read at arm's length. */
body[data-theme="thanksgiving"] .square.marked .num,
body[data-theme="winter"] .square.marked .num,
body[data-theme="holiday"] .square.marked .num {
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9), 0 0 1px rgba(255, 255, 255, 1);
}

body[data-theme="thanksgiving"] .card.dim,
body[data-theme="winter"] .card.dim,
body[data-theme="holiday"] .card.dim {
  background-color: #e4e4e4;
  background-image: none;
  border-color: #bdbdbd;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="thanksgiving"] .card.dim .grid,
body[data-theme="winter"] .card.dim .grid,
body[data-theme="holiday"] .card.dim .grid {
  background: #e4e4e4;
}

body[data-theme="thanksgiving"] .card.dim::before,
body[data-theme="thanksgiving"] .card.dim::after,
body[data-theme="holiday"] .card.dim::before,
body[data-theme="holiday"] .card.dim::after {
  content: none;
}

@media (min-width: 700px) {
  body.live-page .board { max-width: none; }
  .ball { width: 84px; height: 84px; min-width: 84px; min-height: 84px; }
  .ball .face,
  .ball .num { font-size: 34px; }
  .ball small { font-size: 26px; }
  .pattern { font-size: 1.8rem; }
  .heads span { height: auto; min-height: 36px; font-size: 1.2rem; }
  body.live-page .card { --band: 5.2rem; }
  .bingo { height: 72px; font-size: 1.6rem; }
  .bingo.lit { height: 72px; font-size: 1.2rem; }
  .bingo.lit.shout { min-height: 72px; }
  .card-no { font-size: 1.25rem; }
}

@media (min-width: 900px) and (orientation: landscape) {
  body.live-page .board {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    grid-template-rows: auto auto 1fr;
    column-gap: 16px;
    align-items: stretch;
  }
  .top { grid-column: 2; grid-row: 1; }
  .chips {
    grid-column: 2;
    grid-row: 2;
    flex-wrap: wrap;
    align-content: flex-start;
    mask-image: none;
  }
  .stage { grid-column: 1; grid-row: 1 / span 3; align-self: stretch; }
  .dock { grid-column: 2; grid-row: 3; justify-content: end; }
  .chip { font-size: 1rem; padding: 6px 10px; }
}

.board { position: relative; z-index: 2; }

#scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

#scene:empty { display: none; }

#scene img {
  position: absolute;
  object-fit: contain;
}

/* A phone fills the open bands. The card covers the middle. A short landscape screen keeps a small picture. */
#scene .cameo { display: none; }

#scene .wide {
  display: block;
  top: 56px;
  left: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 128;
  transform: none;
  object-fit: contain;
  object-position: center center;
}

#scene .foot {
  left: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 102;
  transform: none;
  object-fit: contain;
  object-position: center bottom;
}

@media (max-height: 700px) and (orientation: landscape) {
  #scene .wide { display: none; }
  #scene .cameo {
    display: block;
    top: 16px;
    right: 76px;
    width: 48px;
    height: 36px;
    object-fit: contain;
  }
  #scene .foot {
    left: 50%;
    bottom: 62px;
    width: 148px;
    height: 36px;
    transform: translateX(-50%);
    object-fit: contain;
    object-position: center bottom;
  }
}

/* Tablet: the pictures fill the open bands around the card. The card covers the middle. */
@media (min-width: 700px) and (orientation: portrait) {
  #scene .cameo { display: none; }
  #scene .wide {
    display: block;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 13%;
    transform: none;
    object-fit: cover;
    object-position: center 55%;
  }
  body[data-theme="thanksgiving"] #scene .wide { object-position: center 78%; }
  body[data-theme="winter"] #scene .wide { object-position: center 42%; }
  body[data-theme="holiday"] #scene .wide { object-position: center top; }
  #scene .foot {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 18%;
    transform: none;
    object-fit: cover;
    object-position: center 40%;
  }
}

@media (min-width: 900px) and (orientation: landscape) {
  #scene .cameo { display: none; }
  #scene .wide {
    display: block;
    top: 0;
    left: auto;
    right: 0;
    width: 32%;
    height: 62%;
    transform: none;
    object-fit: cover;
    object-position: 58% 42%;
  }
  #scene .foot {
    left: auto;
    right: 0;
    bottom: 0;
    width: 32%;
    height: 46%;
    transform: none;
    object-fit: cover;
    object-position: center 72%;
  }
}

body[data-theme="thanksgiving"] .top-copy,
body[data-theme="winter"] .top-copy,
body[data-theme="holiday"] .top-copy,
body[data-theme="thanksgiving"] .mark,
body[data-theme="winter"] .mark,
body[data-theme="holiday"] .mark {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.75);
}

/* Large print grows the header. The card keeps its normal size and the page scrolls. */
@media (max-width: 699px) and (orientation: portrait) {
  body.live-page .board {
    overflow-x: hidden;
    overflow-y: auto;
  }
  body.live-page .stage {
    container-type: normal;
    flex-shrink: 0;
  }
  body.live-page .card {
    width: min(100%, calc(100svh - 200px));
    max-height: none;
  }
}

/* The Bingo button stays a tap target and leaves the bottom picture at either side. */
@media (max-width: 699px) {
  body[data-theme="thanksgiving"] .bingo,
  body[data-theme="winter"] .bingo,
  body[data-theme="holiday"] .bingo {
    width: min(220px, 100%);
    align-self: center;
  }
}
