/*
 * Lemon Damon - global styles ("Azulejo Lemon")
 * Colours come only from the design tokens in src/theme.css. The phone screens sit on
 * cobalt ("night"), the TV on warm ceramic white ("day"); --text / --text-muted /
 * --text-accent switch automatically between the two (see .on-light in theme.css).
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Design rule for every screen: it is exactly as big as the visible screen, never bigger (so a page
   without content can't scroll) and never narrower. dvh excludes the phone's collapsing address bar. */
:root {
  --screen-height: 100vh;
}
@supports (height: 100dvh) {
  :root {
    --screen-height: 100dvh;
  }
}

html, body {
  width: 100%;
  height: 100%;
  overscroll-behavior: none;
  font-family: var(--font-body);
  background: var(--cobalt);
  color: var(--text);
  overflow-x: hidden;
}

#root {
  width: 100%;
  min-height: var(--screen-height);
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* A page taller than the screen must grow, not shrink to the screen: a shrunk, centred page
   pushes its top out of reach above the screen */
#root > * {
  flex-shrink: 0;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: var(--tile-radius);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  gap: 8px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Primary actions: lemon tile with ink text */
.btn-primary,
.btn-accent {
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  color: var(--ink);
  border-color: var(--lemon-deep);
  box-shadow: 0 3px 0 var(--lemon-deep);
}

.btn-primary:hover:not(:disabled),
.btn-accent:hover:not(:disabled) {
  background-color: var(--lemon-deep);
}

.btn-primary:active:not(:disabled),
.btn-accent:active:not(:disabled) {
  background-color: var(--lemon-deep);
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--lemon-deep);
}

/* Secondary: white tile on cobalt, cobalt tile on white */
.btn-secondary {
  background-color: var(--btn-secondary-bg);
  background-image: var(--tile-glaze);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--lemon-deep);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--shadow-ink);
}

/* Quiet: outline in the current text colour */
.btn-light {
  background: var(--white-wash);
  color: var(--text);
  border-color: currentColor;
}

.btn-light:hover:not(:disabled) {
  border-color: var(--lemon);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
}

.btn-block {
  width: 100%;
}

/* ===================== Inputs: white tiles ===================== */
.input,
.player-input,
.join-input {
  width: 100%;
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  color: var(--cobalt);
  border: 2px solid var(--lemon-deep);
  border-radius: var(--tile-radius);
  font-family: inherit;
  font-weight: 600;
  box-shadow: inset 0 2px 0 var(--cobalt-wash);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.input {
  padding: 12px 16px;
  font-size: 16px;
}

.input:focus,
.player-input:focus,
.join-input:focus {
  outline: none;
  border-color: var(--lemon);
  box-shadow: var(--lemon-glow);
}

.input::placeholder,
.player-input::placeholder,
.join-input::placeholder {
  color: var(--cobalt-soft);
  opacity: 0.75;
}

/* ===================== Cards: glazed tiles ===================== */
.card {
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  color: var(--text);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
  padding: 20px;
}

/* Smaller tile for list rows */
.card-light {
  background-color: var(--azulejo-white);
  color: var(--text);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }

/* Text utilities (contextual: correct on cobalt and on white) */
.text-center { text-align: center; }
.text-primary { color: var(--text-accent); }
.text-secondary { color: var(--text-muted); }
.text-accent { color: var(--text-accent); }
.text-light { color: var(--text-muted); }
.text-dark { color: var(--ink); }

.h1, h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.h2, h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.h3, h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.p, p {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.small {
  font-size: 0.875rem;
  opacity: 0.85;
}

/* Spacing */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

/* ===================== Animations ===================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out both;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ===================== Page layout ===================== */
.page {
  min-height: var(--screen-height);
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.page-center {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ===================== Brand ===================== */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.brand-row {
  flex-direction: row;
  justify-content: center;
  gap: 18px;
}

.lemon-logo {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 0 var(--shadow-ink));
}

/* Mascot idle animations: an occasional wave and blink */
.lemon-logo .lemon-wave {
  transform-origin: 51.5px 28.5px;
  animation: lemon-wave 7s ease-in-out 1.5s infinite;
}

.lemon-logo .lemon-blink {
  transform-origin: 32px 22px;
  animation: lemon-blink 5s ease-in-out infinite;
}

/* The arm hangs at rest, lifts out and up, waves a few times, then lowers */
@keyframes lemon-wave {
  0%, 30%, 100% { transform: rotate(0deg); }
  6% { transform: rotate(-140deg); }
  10% { transform: rotate(-158deg); }
  14% { transform: rotate(-125deg); }
  18% { transform: rotate(-158deg); }
  22% { transform: rotate(-125deg); }
}

@keyframes lemon-blink {
  0%, 90%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.08); }
}

/* ===================== Fruit characters (player avatars) ===================== */
/* Every fruit blinks now and then, at its own pace; each also has an idle move of its own */
.fruit {
  display: block;
  flex-shrink: 0;
}


.lemon-logo.fruit-lemon {
  filter: none;
}

.fruit .fruit-blink,
.fruit .orange-wink {
  animation: fruit-blink 5s ease-in-out infinite;
}

.fruit .orange-wink {
  animation-name: fruit-wink;
  animation-duration: 4.2s;
}

.fruit-banana .fruit-blink { animation-delay: -1.2s; }
.fruit-apple .fruit-blink { animation-delay: -2.6s; }
.fruit-strawberry .fruit-blink { animation-delay: -0.4s; }
.fruit-watermelon .fruit-blink { animation-delay: -3.3s; }
.fruit-grapes .fruit-blink { animation-delay: -1.9s; }
.fruit-pineapple .fruit-blink { animation-delay: -4.1s; }

@keyframes fruit-blink {
  0%, 90%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.08); }
}

@keyframes fruit-wink {
  0%, 80%, 100% { transform: scaleY(1); }
  84% { transform: scaleY(0.08); }
  88% { transform: scaleY(1); }
  92% { transform: scaleY(0.08); }
}

/* Happy: a player who just won points jumps for joy among twinkling stars */
.fruit-happy {
  animation: fruit-cheer 0.7s ease-in-out infinite;
  transform-origin: 50% 95%;
}

@keyframes fruit-cheer {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  45% { transform: translateY(-9%) scale(0.97, 1.05); }
  75% { transform: translateY(0) scale(1.04, 0.96); }
}

.fruit-sparkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: fruit-sparkle 1.2s ease-in-out infinite;
}

.fruit-sparkle-b { animation-delay: -0.4s; }
.fruit-sparkle-c { animation-delay: -0.8s; }

@keyframes fruit-sparkle {
  0%, 100% { transform: scale(0.4); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* Banana: the head tilts to one side, then the other */
.fruit .banana-tilt {
  animation: banana-tilt 6s ease-in-out infinite;
}

@keyframes banana-tilt {
  0%, 100% { transform: rotate(0deg); }
  15%, 38% { transform: rotate(-9deg); }
  55%, 80% { transform: rotate(7deg); }
}

/* Apple: shy. The cheeks glow, the eyes glance away and the body turns a little */
.fruit .apple-blush circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: apple-blush 6s ease-in-out infinite;
}

.fruit .apple-glance {
  animation: apple-glance 6s ease-in-out infinite;
}

.fruit .apple-shy {
  animation: apple-shy 6s ease-in-out infinite;
}

@keyframes apple-blush {
  0%, 40%, 100% { transform: scale(1); opacity: 0.75; }
  55%, 85% { transform: scale(1.7); opacity: 1; }
}

@keyframes apple-glance {
  0%, 40%, 100% { transform: translate(0, 0); }
  55%, 85% { transform: translate(-1.6px, 1.2px); }
}

@keyframes apple-shy {
  0%, 40%, 100% { transform: rotate(0deg); }
  55%, 85% { transform: rotate(3deg); }
}

/* Strawberry: squashes, jumps and lands, with a wiggling leaf crown */
.fruit .berry-bounce {
  animation: berry-bounce 3.2s ease-in-out infinite;
}

.fruit .berry-leaf {
  animation: berry-leaf 2.4s ease-in-out infinite alternate;
}

@keyframes berry-bounce {
  0%, 60%, 100% { transform: translateY(0) scale(1, 1); }
  66% { transform: translateY(0) scale(1.08, 0.9); }
  78% { transform: translateY(-6px) scale(0.96, 1.05); }
  90% { transform: translateY(0) scale(1.06, 0.93); }
}

@keyframes berry-leaf {
  from { transform: rotate(-6deg); }
  to { transform: rotate(6deg); }
}

/* Orange: rocks from side to side */
.fruit .orange-rock {
  animation: orange-rock 3.4s ease-in-out infinite alternate;
}

@keyframes orange-rock {
  from { transform: rotate(-4deg); }
  to { transform: rotate(4deg); }
}

/* Watermelon: chews in bursts and bobs a little */
.fruit .melon-chomp {
  animation: melon-chomp 3s ease-in-out infinite;
}

.fruit .melon-bob {
  animation: melon-bob 2s ease-in-out infinite alternate;
}

@keyframes melon-chomp {
  0%, 48%, 100% { transform: scaleY(1); }
  8%, 24%, 40% { transform: scaleY(0.4); }
  16%, 32% { transform: scaleY(1); }
}

@keyframes melon-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-1.5px); }
}

/* Grapes: the whole bunch jiggles */
.fruit .grape-jiggle {
  animation: grape-jiggle 2.6s ease-in-out infinite;
}

@keyframes grape-jiggle {
  0%, 60%, 100% { transform: scale(1, 1); }
  65% { transform: scale(1.04, 0.96); }
  72% { transform: scale(0.97, 1.03); }
  79% { transform: scale(1.03, 0.97); }
  86% { transform: scale(0.99, 1.01); }
}

/* Pineapple: the crown sways, the body bobs */
.fruit .pine-crown {
  animation: pine-crown 2.8s ease-in-out infinite alternate;
}

.fruit .pine-bob {
  animation: melon-bob 3.2s ease-in-out infinite alternate;
}

@keyframes pine-crown {
  from { transform: rotate(-7deg); }
  to { transform: rotate(7deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lemon-logo .lemon-wave,
  .lemon-logo .lemon-blink,
  .fruit *,
  .fruit,
  .fruit-happy,
  .fruit-sparkle {
    animation: none !important;
  }
}

/* ===================== TV (light, tiled wall) ===================== */
.tv-view {
  background-color: var(--azulejo-white);
  color: var(--text);
  min-height: var(--screen-height);
  padding: 40px;
}

/* While a game is played it gets the whole screen: no header, no scores (see TVPage). --tv-play-height is the height a
   game's play area can have, --tv-reserve what is left for its own bars. */
.tv-immersive {
  --tv-play-height: calc(var(--screen-height) - 28px);
  --tv-reserve: 40px;
}
.tv-view.tv-immersive { padding: 14px 22px; }
.tv-immersive .tv-split { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
.tv-immersive .tv-sketchy-art { max-width: min(1320px, calc((var(--screen-height) - var(--tv-reserve)) * 4 / 3)); }
.tv-immersive .skyscrapers-stage { max-width: min(1880px, calc((var(--screen-height) - var(--tv-reserve)) * 16 / 9)); }
.tv-immersive .dash-tv { max-width: 1880px; }
.tv-immersive.tv-immersive-chips {
  --tv-play-height: calc(var(--screen-height) - 130px);
  --tv-reserve: 150px;
}
.tv-immersive .tv-competitors { margin-top: 10px; }
/* The sound button stays out of the way while a game is on */
.tv-fit.tv-immersive + .tv-audio-btn { opacity: 0.3; }
.tv-fit.tv-immersive + .tv-audio-btn:hover { opacity: 1; }
.tv-immersive.tv-immersive-chips .tv-competitor-info { gap: 0; }

/* The TV never scrolls: FitToScreen shrinks the content to the screen height */
.tv-fit {
  height: var(--screen-height);
  overflow: hidden;
}

.tv-fit-content {
  display: flow-root;
  transform-origin: top center;
}

.tv-audio-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border: 3px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
  cursor: pointer;
  opacity: 0.85;
}

.tv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
}

.tv-topbar .tv-header {
  font-size: 2.2rem;
}

.tv-topbar-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tv-topbar .tv-code {
  font-size: 2rem;
  margin: 0;
}

.tv-topbar-round {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--cobalt-soft);
}

.tv-header {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--cobalt);
  margin-bottom: 0;
}

.tv-brand {
  margin-bottom: 32px;
}

/* Room code: lemon tile, cobalt frame */
.tv-code {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  padding: 4px 8px 4px calc(8px + 0.2em);
  color: var(--cobalt);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

div.tv-code {
  display: block;
  width: fit-content;
  margin: 0 auto 32px;
}

/* The big room-code panel on the lobby screen */
.tv-code-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 24px auto;
  padding: 24px 48px 32px;
  color: var(--cobalt);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: 8px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 3px var(--lemon-deep), inset 0 10px 8px -6px var(--glaze), 0 8px 0 var(--shadow-ink);
}

.tv-code-label {
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tv-code-giant {
  font-family: var(--font-display);
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.15em;
  margin-right: -0.15em;
}

.tv-join-hint {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}

.tv-join-hint strong {
  color: var(--cobalt);
  font-weight: 900;
}

.tv-subtitle {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.tv-lobby {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Tile-framed panels on the TV */
.tv-player-card,
.tv-answer-card,
.tv-leaderboard-item,
.tv-instructions {
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  color: var(--ink);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.tv-player-card {
  padding: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.tv-player-card:hover {
  transform: scale(1.05);
}

.tv-player-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
}

.tv-player-score {
  font-size: 1.2rem;
  color: var(--cobalt-soft);
  font-weight: 700;
}

.tv-instructions {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin: 40px 0;
  padding: 40px;
}

.tv-prompt {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  color: var(--cobalt);
  margin: 40px 0;
}

.tv-answers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.tv-answer-card {
  padding: 30px;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

/* Winning/true answer: lemon tile */
.tv-answer-card.highlight {
  background-color: var(--lemon);
  transform: translateY(-4px);
}

.tv-answer-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
}

.tv-answer-author {
  display: flex;
  justify-content: flex-end;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cobalt-soft);
  text-align: right;
  margin-top: 10px;
}

.tv-player-card .fruit,
.tv-player-card .lemon-logo {
  margin: 0 auto 6px;
}

.tv-answer-card.highlight .tv-answer-author {
  color: var(--cobalt);
}

.tv-votes {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 20px 0;
  color: var(--ink);
  font-weight: 600;
}

/* Small cobalt chip */
.tv-vote-count {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--azulejo-white);
  padding: 8px 18px;
  background-color: var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--cobalt-soft);
}

.tv-scoring {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 900;
  text-align: center;
  color: var(--cobalt);
  margin: 40px 0;
}

.tv-points {
  font-size: 3rem;
  font-weight: 900;
  color: var(--cobalt);
  animation: pulse 1s ease;
}

/* Timer: lemon tile; terracotta when time is nearly up */
.tv-timer {
  width: fit-content;
  margin: 24px auto;
  padding: 10px 28px;
  font-size: 2rem;
  font-weight: 900;
  color: var(--cobalt);
  text-align: center;
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

/* On a phone the timer is a small chip, so the game gets the room */
.player-content > .tv-timer {
  flex-shrink: 0;
  margin: 0 auto 6px;
  padding: 2px 16px;
  font-size: 1.2rem;
}

.tv-timer.warning {
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  animation: pulse 0.5s ease;
}

/* ===================== Sketchy on the TV: drawing left, content right ===================== */
.tv-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.tv-sketchy-art {
  width: 100%;
  /* The drawing gets the height the screen has, in its 4:3 shape */
  max-width: min(1040px, calc((var(--screen-height) - var(--tv-reserve, 330px)) * 4 / 3));
  justify-self: center;
}

.tv-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

/* Tighter spacing for text and panels that share the screen */
.tv-compact {
  margin: 0;
}

.tv-instructions.tv-compact {
  padding: 20px 24px;
  font-size: 1.6rem;
}

.tv-subtitle.tv-compact {
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.tv-side .tv-timer {
  margin: 0 auto;
}

.tv-lobby-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: none;
  width: 100%;
  margin: 0;
}

.tv-lobby-compact .tv-player-card {
  padding: 12px;
}

.tv-split-top {
  align-items: start;
}

/* Smaller gaps where several blocks share a screen */
.tv-answers.tv-answers-compact {
  margin: 16px 0;
  gap: 16px;
}

.tv-answers-compact .tv-answer-card {
  padding: 18px 24px;
}

.tv-answers-compact > div[style] {
  gap: 20px !important;
}

.tv-timer.tv-timer-compact {
  margin: 12px auto 0;
  padding: 6px 22px;
  font-size: 1.6rem;
}

.tv-prompt.tv-prompt-compact {
  margin: 0;
  font-size: 1.8rem;
}

/* Result pairs: two columns of face-offs */
.tv-answers.tv-pairs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 16px 0;
}

.tv-pair {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.tv-pair .tv-answer-card {
  flex: 1;
  padding: 14px 16px;
}

.tv-pair .tv-answer-text {
  font-size: 1.2rem;
}

.tv-leaderboard.tv-leaderboard-compact {
  max-width: none;
  width: 100%;
  gap: 10px;
}

.tv-leaderboard-compact .tv-leaderboard-item {
  padding: 10px 18px;
}

.tv-leaderboard-compact .tv-leaderboard-rank {
  font-size: 1.5rem;
  min-width: 44px;
}

.tv-leaderboard-compact .tv-leaderboard-name,
.tv-leaderboard-compact .tv-leaderboard-score {
  font-size: 1.3rem;
}

/* The big room code shares the screen with the player list */
.tv-split .tv-code-giant {
  font-size: 6.5rem;
}

.tv-split .tv-code-panel {
  margin: 0 auto;
  padding: 20px 32px 28px;
}

/* Answers stacked in the narrow side column */
.tv-answers.tv-answers-stack {
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
}

.tv-answers-stack .tv-answer-card {
  padding: 12px 18px;
}

.tv-answers-stack .tv-answer-text {
  font-size: 1.3rem;
}

.tv-answers-stack .tv-answer-author {
  margin-top: 4px;
  font-size: 0.95rem;
}

.tv-answers-stack .tv-votes {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.tv-answers-stack .tv-vote-count {
  padding: 4px 12px;
  font-size: 1rem;
}

/* ===================== Leaderboard ===================== */
.tv-leaderboard {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  gap: 15px;
}

.tv-leaderboard-item {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s ease;
}

.tv-leaderboard-item:hover {
  transform: translateX(10px);
}

.tv-leaderboard-rank {
  font-size: 2rem;
  font-weight: 900;
  color: var(--cobalt);
  min-width: 60px;
}

.tv-leaderboard-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
}

.tv-leaderboard-score {
  font-size: 1.5rem;
  color: var(--cobalt);
  font-weight: 900;
}

/* ===================== Game tiles (lobby) ===================== */
.game-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* The tiles in pages that scroll sideways and snap into place */
.game-pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.game-pages::-webkit-scrollbar {
  display: none;
}

.game-page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  align-content: start;
  /* Room for the tile shadows and the selected frame, which would be cut off at the edge of the scroller */
  padding: 3px 4px 5px;
  box-sizing: border-box;
}

.game-pager-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.game-pager-arrow {
  width: 34px;
  height: 34px;
  padding: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border: 2px solid var(--cobalt);
  border-radius: var(--tile-radius);
  cursor: pointer;
}

.game-pager-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.game-pager-dots {
  display: flex;
  gap: 8px;
}

.game-pager-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  background-color: var(--cobalt-wash);
  border: 2px solid var(--cobalt);
  border-radius: 50%;
  cursor: pointer;
}

.game-pager-dot.active {
  background-color: var(--lemon);
}

/* An odd tile out on the last row gets the whole width */
.game-tiles .game-tile:last-child:nth-child(odd) {
  grid-column: span 2;
}

.game-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 0 0 6px;
  overflow: hidden;
  font-family: inherit;
  text-align: center;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 4px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.game-tile:hover:not(:disabled) {
  transform: translateY(-2px);
}

.game-tile.selected {
  border-color: var(--lemon-deep);
  background-color: var(--lemon);
  box-shadow: 0 0 0 3px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.game-tile:disabled {
  opacity: 0.5;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.game-tile-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  background-color: var(--cobalt-wash);
  border-bottom: 3px solid var(--cobalt-soft);
}

.game-tile.selected .game-tile-thumb {
  border-bottom-color: var(--lemon-deep);
}

.game-tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border: 2px solid var(--azulejo-white);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--shadow-ink);
}

.game-tile-name {
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--cobalt);
}

.game-tile-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
}

.game-tile-chip {
  padding: 0 7px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--cobalt);
  background-color: var(--cobalt-wash);
  border-radius: 999px;
}

.game-tile-chip-tv {
  color: var(--azulejo-white);
  background-color: var(--cobalt-soft);
}

.game-tile-note {
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--terracotta);
}

/* ===================== Full screen button ===================== */
.fullscreen-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border: 2px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: 0 2px 0 var(--shadow-ink);
  opacity: 0.85;
  cursor: pointer;
}

.fullscreen-btn:active {
  transform: translateY(2px);
}

/* In the game header it sits beside the room code */
.fullscreen-btn.fullscreen-btn-inline {
  position: static;
  width: 34px;
  height: 34px;
  box-shadow: none;
}

/* ===================== Instructions (phone) ===================== */
.instructions {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Centred with auto margins (not justify-content): a screen too tall must overflow at the bottom, where it can be measured */
.instructions > :first-child { margin-top: auto; }
.instructions > :last-child { margin-bottom: auto; }

.instructions-title {
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--lemon);
  text-shadow: 0 4px 0 var(--ink);
}

.instructions-card {
  padding: 20px 18px 16px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.instructions-description {
  margin-bottom: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--cobalt);
}

.instructions-card .game-demo {
  max-width: 100%;
  box-shadow: none;
  border-width: 3px;
}

.instructions-tips {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.instructions-tips li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 28px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

/* A small lemon tile as the bullet */
.instructions-tips li::before {
  content: '';
  position: absolute;
  top: 0.4em;
  left: 4px;
  width: 12px;
  height: 12px;
  background-color: var(--lemon);
  border: 2px solid var(--cobalt);
  transform: rotate(45deg);
}

.instructions-ready {
  margin-top: 14px;
}

.instructions-ready-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--lemon);
  text-shadow: 0 3px 0 var(--ink);
}

.instructions-ready-count {
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* ===================== TV lobby ===================== */
.tv-view-lobby { padding: 24px 40px; }

.tv-lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.tv-lobby-header .tv-header {
  font-size: 3.2rem;
}

.tv-lobby-header .lemon-logo { width: 84px; height: 84px; }

/* How to join: a big panel, readable from the couch */
.tv-lobby-join {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.tv-lobby-join-text,
.tv-lobby-join-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tv-lobby-join-url {
  font-size: 2rem;
  font-weight: 900;
  color: var(--cobalt);
}

.tv-lobby-join-label {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cobalt-soft);
}

.tv-lobby-join .tv-code {
  margin: 0;
  font-size: 5rem;
  line-height: 1.1;
}

.tv-lobby-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.7fr);
  gap: 48px;
  align-items: start;
  width: 100%;
  max-width: none;
}

.tv-lobby-layout .tv-lobby-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tv-lobby-layout .tv-player-name { font-size: 1.9rem; }
.tv-lobby-layout .tv-lobby-heading { font-size: 2.1rem; }
.tv-lobby-layout .tv-party-mode-name { font-size: 2.6rem; }
.tv-lobby-layout .tv-party-mode-tagline { font-size: 1.4rem; }
.tv-lobby-layout .tv-party-mode-icon { width: 96px; height: 96px; }
.tv-lobby-games .tv-lobby-game-check { width: 40px; height: 40px; line-height: 40px; font-size: 1.6rem; }

.tv-lobby-heading {
  margin-bottom: 14px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cobalt-soft);
}

.tv-lobby-games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.tv-lobby-game {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0.4;
  filter: grayscale(0.7);
  transition: opacity 0.2s ease, filter 0.2s ease;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.tv-lobby-game.selected {
  opacity: 1;
  filter: none;
  background-color: var(--lemon);
  box-shadow: 0 0 0 4px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.tv-lobby-game-note {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--terracotta);
}

.tv-lobby-game-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border: 2px solid var(--azulejo-white);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--shadow-ink);
}

.tv-lobby-game .game-tile-thumb {
  border-bottom: 3px solid var(--cobalt);
}

.tv-lobby-game-name {
  padding: 8px 8px 10px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.15;
  color: var(--cobalt);
}

/* ===================== Ready button and game demos ===================== */
.game-demo {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto 16px;
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
  background-color: var(--azulejo-white);
}

.game-demo.game-demo-tv {
  max-width: none;
  margin: 0;
}

.tv-ready-count {
  margin: 4px 0 12px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cobalt);
}

.tv-ready-wait {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cobalt-soft);
}

.tv-competitor.ready {
  background-color: var(--lemon);
}

/* ===================== Fruit Dash ===================== */
.dash-tv {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
}

.dash-lanes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 380px; /* the real height is set from the number of players */
}

.dash-lanes-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 6px;
}

.dash-lane {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  /* A sunny morning: the sun, clouds and two layers of hills over a sky that warms towards the horizon */
  background-color: #bfe6ff;
  background-image:
    url('/dash/clouds.svg'),
    url('/dash/hills.svg'),
    radial-gradient(circle at 92% 22%, #fff6c2 0 7%, rgba(255, 226, 120, 0.55) 7.5% 12%, rgba(255, 226, 120, 0) 13%),
    linear-gradient(180deg, #7cc4f2 0%, #bfe6ff 55%, #fff1c9 100%);
  background-repeat: repeat-x, repeat-x, no-repeat, no-repeat;
  background-size: 720px auto, 640px 42%, auto, auto;
}

.dash-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 9%;
  background-color: #4aa860;
  background-image: repeating-linear-gradient(90deg, #4aa860 0 36px, #3f9654 36px 72px);
  border-top: 4px solid #2f7d44;
}

.dash-runner {
  position: absolute;
  bottom: 9%;
  margin-left: -28px;
  transform-origin: bottom center;
  line-height: 0;
  will-change: transform;
}

.dash-obstacle {
  position: absolute;
  left: 0;
  bottom: 9%;
  border: 3px solid var(--ink);
  box-sizing: border-box;
}

/* A low hurdle: a striped block you jump over (0.4 of the runner's height) */
.dash-obstacle-low {
  height: calc(var(--rh) * 0.4);
  background: repeating-linear-gradient(135deg, var(--terracotta) 0 8px, #f4a58f 8px 16px);
  border-radius: 6px 6px 2px 2px;
}

/* A high bar: hangs above the ground from the sky, its lower edge at 0.72 of the runner's height, so
   you crouch under it (a crouched runner is 0.55 of its height) */
.dash-obstacle-high {
  bottom: calc(9% + var(--rh) * 0.72);
  height: calc(var(--rh) * 0.45);
  background: repeating-linear-gradient(135deg, var(--lemon) 0 8px, #fff1a8 8px 16px);
  border-radius: 12px;
}

.dash-lane-name {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--cobalt);
}

.dash-hud {
  display: flex;
  justify-content: center;
  gap: 32px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--cobalt);
}

.dash-countdown {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 9rem;
  font-weight: 900;
  color: var(--cobalt);
  text-shadow: 0 4px 0 var(--azulejo-white);
  pointer-events: none;
}

.dash-countdown-small {
  font-size: 4rem;
  white-space: nowrap;
}

.dash-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
}

.dash-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 46vh;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--azulejo-white);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 6px 0 var(--shadow-ink);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dash-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--shadow-ink);
}

.dash-button small {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.85;
}

.dash-button-icon {
  font-size: 3rem;
}

.dash-button-jump {
  background-color: var(--terracotta);
}

.dash-button-crouch {
  background-color: var(--cobalt);
}

/* ===================== Fake Artist ===================== */
.fakeartist-role {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding: 8px 12px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.fakeartist-role strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--cobalt);
}

.fakeartist-role-fake {
  background-color: var(--terracotta);
  background-image: var(--tile-glaze-dark);
  color: var(--azulejo-white);
}

.fakeartist-role-fake strong {
  color: var(--lemon);
}

.fakeartist-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid var(--azulejo-white);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--ink);
}

.fakeartist-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fakeartist-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
}

.fakeartist-legend-item.current {
  background-color: var(--lemon);
  border-color: var(--cobalt);
}

.fakeartist-legend-item.fake {
  background-color: var(--terracotta);
  color: var(--azulejo-white);
}

.fakeartist-legend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.15rem;
  font-weight: 800;
}

.fakeartist-legend-status {
  font-size: 0.95rem;
  font-weight: 800;
}

/* ===================== Tile Match ===================== */
.tm-board {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.tm-tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  background: none;
  border: none;
  perspective: 600px;
  cursor: pointer;
}

.tm-tile:disabled {
  cursor: default;
}

.tm-back,
.tm-front {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: var(--tile-radius);
}

/* Face down: a cobalt tile with a lemon pattern */
.tm-back {
  background-color: var(--cobalt);
  border: 3px solid var(--tile-line);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.tm-back::before {
  content: '';
  position: absolute;
  inset: 6%;
  background-color: var(--lemon);
  opacity: 0.55;
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.tm-tile:not(:disabled):hover .tm-back,
.tm-tile:not(:disabled):active .tm-back {
  background-color: var(--cobalt-soft);
}

.tm-front {
  animation: tm-flip 0.35s ease-out;
  box-shadow: 0 3px 0 var(--shadow-ink);
}

@keyframes tm-flip {
  from { transform: rotateY(90deg); }
  to { transform: rotateY(0deg); }
}

.tm-front .tile-face {
  display: block;
  width: 100%;
  height: 100%;
}

.tm-tile-flipped .tm-front {
  outline: 4px solid var(--lemon);
  outline-offset: -2px;
}

.tm-tile-matched .tm-front {
  opacity: 0.85;
}

.tm-owner {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: block;
  line-height: 0;
  background-color: var(--azulejo-white);
  border: 2px solid var(--cobalt);
  border-radius: 50%;
}

.tm-tv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 960px;
  margin: 0 auto 14px;
}

.tm-tv-turn {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tm-tv-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.05;
  color: var(--cobalt);
}

.tm-tv-sub {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cobalt-soft);
}

.tm-tv-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 16px;
  color: var(--cobalt);
  background-color: var(--lemon);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.tm-tv-left-count {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.tm-tv-left-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tm-phone-turn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

/* ===================== Most Likely To ===================== */
.mostlikely-question {
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  color: var(--text);
}

.mostlikely-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.mostlikely-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  font-family: inherit;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 4px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
  cursor: pointer;
}

.mostlikely-choice:active:not(:disabled) {
  transform: translateY(2px);
}

.mostlikely-choice.selected {
  background-color: var(--lemon);
  border-color: var(--lemon-deep);
  box-shadow: 0 0 0 3px var(--lemon-deep);
}

.mostlikely-choice:disabled:not(.selected) {
  opacity: 0.55;
}

.mostlikely-choice-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.1rem;
  font-weight: 800;
}

.mostlikely-winners {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 4px;
}

.mostlikely-winner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--lemon);
  text-shadow: 0 2px 0 var(--ink);
}

.mostlikely-tv-question {
  font-size: 2.2rem;
}

.mostlikely-tv-candidates,
.mostlikely-tv-results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 20px;
  margin: 8px 0;
}

.mostlikely-tv-candidate,
.mostlikely-tv-result {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 130px;
  padding: 10px 14px 8px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.mostlikely-tv-result.winner {
  background-color: var(--lemon);
  box-shadow: 0 0 0 4px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.mostlikely-tv-crown {
  position: absolute;
  top: -22px;
  font-size: 2rem;
}

.mostlikely-tv-name {
  font-size: 1.3rem;
  font-weight: 900;
}

.mostlikely-tv-votes {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--cobalt);
}

.mostlikely-tv-voters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  min-height: 30px;
  max-width: 150px;
}

.mostlikely-tv-points {
  padding: 1px 12px;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border-radius: var(--tile-radius);
}

/* ===================== Draw & Guess ===================== */
.drawguess-word {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  text-align: center;
  color: var(--lemon);
  text-shadow: 0 3px 0 var(--ink);
  text-transform: uppercase;
}

.drawguess-artist {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.drawguess-hint {
  margin: 4px 0 12px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--lemon);
  white-space: pre-wrap;
}

.drawguess-got-it {
  margin: 12px 0;
  padding: 14px;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--lemon);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.drawguess-tv-artist {
  display: flex;
  align-items: center;
  gap: 14px;
}

.drawguess-tv-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.05;
  color: var(--cobalt);
}

.drawguess-tv-sub {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cobalt-soft);
}

.drawguess-tv-hint {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--cobalt);
  white-space: pre-wrap;
}

.drawguess-tv-guesses {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
}

.drawguess-tv-guess {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
}

.drawguess-tv-guess-text {
  font-weight: 800;
  color: var(--terracotta);
}

/* ===================== Skyscrapers (phone) ===================== */
.player-waiting .fruit,
.player-waiting .lemon-logo {
  margin: 0 auto 8px;
}

.skyscrapers-drop-button {
  display: block;
  width: 100%;
  min-height: 42vh;
  margin: 16px 0;
  font-family: var(--font-display);
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--cobalt);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: 6px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 3px var(--lemon-deep), 0 8px 0 var(--shadow-ink);
  cursor: pointer;
  touch-action: manipulation;
}

.skyscrapers-drop-button:active {
  transform: translateY(4px);
  box-shadow: inset 0 0 0 3px var(--lemon-deep), 0 4px 0 var(--shadow-ink);
}

/* ===================== Skyscrapers (TV) ===================== */
.skyscrapers-stage {
  position: relative;
  width: 100%;
  /* As big as the screen allows, in a 16:9 picture */
  max-width: min(1700px, calc((var(--screen-height) - var(--tv-reserve, 330px)) * 16 / 9));
  margin: 0 auto;
  overflow: hidden;
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.skyscrapers-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.skyscrapers-turn,
.skyscrapers-floors,
.skyscrapers-timer {
  position: absolute;
  z-index: 1;
}

.skyscrapers-turn {
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 8px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.skyscrapers-turn-name {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.1;
}

.skyscrapers-turn-hint {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cobalt-soft);
}

.skyscrapers-floors {
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 18px;
  color: var(--cobalt);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.skyscrapers-floors-count {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}

.skyscrapers-floors-label {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.skyscrapers-timer {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 64px;
  padding: 4px 16px;
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--lemon);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}

.skyscrapers-timer.warning {
  color: var(--azulejo-white);
  background-color: var(--terracotta);
}

/* Players who are out sit greyed in the competitor strip; whose turn it is stands out */
.tv-competitor.eliminated {
  opacity: 0.45;
  filter: grayscale(0.8);
}

.tv-competitor.current {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta), 0 3px 0 var(--shadow-ink);
}

/* ===================== Game over: tiles ===================== */
/* A row of azulejo tiles, in the colour of the text around it */
.gameover-band {
  height: 40px;
  margin: 0 auto 14px;
  background-color: var(--cobalt-soft);
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 40px 40px;
  mask-size: 40px 40px;
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  -webkit-mask-position: center;
  mask-position: center;
}

.gameover-layout + .gameover-band {
  margin-top: 18px;
}

.gameover-phone {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

/* On the blue phone screen the band is lemon */
.gameover-phone .gameover-band {
  background-color: var(--lemon);
}

.gameover-phone-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--lemon);
  text-shadow: 0 4px 0 var(--ink);
}

/* The player's fruit on a white tile, like the logo */
.gameover-me {
  display: flex;
  justify-content: center;
  width: 160px;
  margin: 14px auto 8px;
  padding: 12px 0 6px;
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 3px var(--lemon-deep), 0 6px 0 var(--shadow-ink);
}

.gameover-win {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 22px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--lemon);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.gameover-phone-subtitle {
  margin: 22px 0 10px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gameover-scores {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gameover-score {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 10px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

/* The same colours as the podium on the TV */
.gameover-score-1 {
  color: var(--cobalt);
  background-color: var(--lemon);
  border-color: var(--cobalt);
}

.gameover-score-2 {
  color: var(--azulejo-white);
  background-color: var(--cobalt-soft);
  background-image: var(--tile-glaze-dark);
  border-color: var(--cobalt);
}

.gameover-score-3 {
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  background-image: var(--tile-glaze-dark);
  border-color: var(--cobalt);
}

/* You: a lemon frame around your row */
.gameover-score-me {
  box-shadow: 0 0 0 3px var(--lemon), 0 3px 0 var(--shadow-ink);
}

.gameover-score-rank {
  min-width: 26px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
}

.gameover-score-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 800;
}

.gameover-score-points {
  font-size: 1.05rem;
  font-weight: 800;
}

/* ===================== Game over: the podium ===================== */
.gameover {
  text-align: center;
}

.gameover-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--cobalt);
  margin-bottom: 2px;
}

.gameover-winner {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--cobalt-soft);
  margin-bottom: 20px;
}

.gameover-layout {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 56px;
}

.gameover-layout-split {
  align-items: center;
}

.podium {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.podium-place {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 220px;
}

.podium-place-1 {
  width: 260px;
}

/* A warm spotlight behind the winner */
.podium-place-1::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  z-index: -1;
  width: 340px;
  height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(245, 197, 24, 0.5) 0%, rgba(245, 197, 24, 0) 68%);
  pointer-events: none;
}

.podium-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.podium-crown {
  display: block;
  margin-bottom: 4px;
}

/* The step itself: tile-framed, with a faint azulejo pattern */
.podium-block {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 12px 10px;
  overflow: hidden;
  text-align: center;
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.podium-block::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: currentColor;
  opacity: 0.12;
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 40px;
  mask-size: 40px;
}

.podium-place-1 .podium-block {
  height: 230px;
  color: var(--cobalt);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
}

.podium-place-2 .podium-block {
  height: 190px;
  color: var(--azulejo-white);
  background-color: var(--cobalt-soft);
  background-image: var(--tile-glaze-dark);
}

.podium-place-3 .podium-block {
  height: 158px;
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  background-image: var(--tile-glaze-dark);
}

.podium-place-empty {
  opacity: 0.45;
}

.podium-rank {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
}

.podium-place-1 .podium-rank {
  font-size: 3.6rem;
}

.podium-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.5rem;
  font-weight: 800;
}

.podium-score {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Everyone beyond the podium */
.podium-rest {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 340px;
}

.podium-rest-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cobalt-soft);
}

.podium-rest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 12px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.podium-rest-rank {
  min-width: 24px;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--cobalt);
}

.podium-rest-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 1.2rem;
  font-weight: 800;
}

.podium-rest-score {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--cobalt);
}

.gameover-thanks {
  margin-top: 20px;
  font-size: 1.1rem;
  color: var(--cobalt-soft);
}

/* ===================== Competitors (characters during a game) ===================== */
.tv-competitors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.tv-competitor {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 6px 10px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.tv-competitor.celebrating {
  background-color: var(--lemon);
}

.tv-competitor-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}

.tv-competitor-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.15rem;
  font-weight: 800;
}

.tv-competitor-score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cobalt-soft);
}

.tv-competitor.celebrating .tv-competitor-score {
  color: var(--cobalt);
}

.tv-competitor-gain {
  padding: 1px 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border-radius: var(--tile-radius);
}

/* A player's character next to their name */
.player-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===================== Drawing canvas ===================== */
.canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

/* While picking a title the options matter more than the drawing: keep it small so they fit on screen */
.canvas-container-compact {
  margin: 8px 0;
}

.canvas-container-compact .drawing-canvas {
  max-width: 220px !important;
}

/* A phone screen does not scroll: the root of an input takes the height that is left, the drawing takes what the
   other things (prompt, buttons) leave and keeps its shape */
.fit-root {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fit-root > * { flex-shrink: 0; }
.fit-root > .canvas-box,
.fit-root > .drawing-pad { flex-shrink: 1; }
.fit-root .player-prompt,
.fit-root .drawguess-word { margin: 2px 0; font-size: 1.25rem; }
.fit-root .doodle-step { margin: 0; }
.fit-root .small { font-size: 0.85rem; line-height: 1.25; }
.fit-root > .canvas-container:not(.drawing-pad) { margin: 6px 0 0; }

.canvas-box {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawing-pad {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  margin: 4px 0;
  gap: 8px;
}

.drawing-pad .canvas-toolbar { flex-shrink: 0; gap: 6px; }
.drawing-pad .canvas-color { width: 30px; height: 30px; border-width: 2px; }
.drawing-pad .btn { padding: 6px 14px; }

.drawing-canvas {
  background: var(--azulejo-white);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
  cursor: crosshair;
  touch-action: none;
}

.canvas-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Colour and brush swatches: small tiles */
.canvas-color {
  width: 40px;
  height: 40px;
  border-radius: var(--tile-radius);
  border: 3px solid var(--azulejo-white);
  box-shadow: 0 2px 0 var(--shadow-ink);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.canvas-color:hover {
  transform: scale(1.12);
}

.canvas-color.selected {
  border-color: var(--lemon);
  box-shadow: var(--lemon-glow);
}

/* ===================== Phone (cobalt "night") ===================== */
/* A phone screen is exactly as high as the screen and never scrolls: every game fits in the space below the header */
.player-view {
  height: var(--screen-height);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-header {
  padding: 8px 16px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background-color: var(--ink);
  border-bottom: 4px solid var(--lemon);
}

.player-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--azulejo-white);
}

/* Room code chip: small lemon tile */
.player-room-code {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--ink);
  background-color: var(--lemon);
  padding: 4px 10px;
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep);
}

.player-content {
  flex: 1;
  min-height: 0;
  padding: 12px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-input {
  padding: 16px;
  font-size: 18px;
}

/* Big lemon tap target */
.player-submit-btn,
.join-submit {
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  color: var(--ink);
  border: 2px solid var(--lemon-deep);
  border-radius: var(--tile-radius);
  padding: 16px;
  min-height: 56px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--lemon-deep);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.player-submit-btn:hover:not(:disabled),
.player-submit-btn:active:not(:disabled),
.join-submit:hover,
.join-submit:active {
  background-color: var(--lemon-deep);
}

.player-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* "Waiting for players": a white tile */
.player-waiting {
  text-align: center;
  padding: 32px 24px;
  margin: 20px auto;
  max-width: 520px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
  --text: var(--ink);
  --text-muted: var(--cobalt-soft);
  --text-accent: var(--cobalt);
}

.player-waiting-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}

.player-waiting-count {
  font-size: 1.6rem;
  color: var(--cobalt);
  font-weight: 900;
}

.player-prompt {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--text);
  text-align: center;
  margin: 20px 0;
}

.player-answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

/* Two options side by side (head-to-head votes) */
.player-answers-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Answer options: white tiles */
.player-answer-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  color: var(--ink);
  border: 4px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
  padding: 16px;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  text-align: left;
}

.player-answer-btn:hover:not(:disabled) {
  border-color: var(--lemon-deep);
}

.player-answer-btn.selected {
  border-color: var(--lemon);
  box-shadow: var(--lemon-glow);
  transform: translateY(-2px);
}

.player-answer-btn:disabled:not(.selected) {
  opacity: 0.7;
  cursor: default;
}

.player-answer-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cobalt-soft);
}

.player-vote-count {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.player-score {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--lemon);
}

/* ===================== Lobby (phone) ===================== */
.lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: var(--screen-height);
  padding: 12px 16px 16px;
  text-align: center;
}

/* A slim header: title and hint on the left, the room code on the right */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 500px;
  margin-bottom: 8px;
  text-align: left;
}

.lobby-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--lemon);
  text-shadow: 0 3px 0 var(--ink);
}

.lobby-instructions {
  margin-top: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lobby-code {
  padding: 3px 10px 3px calc(10px + 0.12em);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.15;
  color: var(--cobalt);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: 3px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
  white-space: nowrap;
}

/* The players: compact chips, two to a row */
.lobby-players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  max-width: 500px;
  margin: 2px 0 8px;
  padding: 2px;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 8px 2px 4px;
  background-color: var(--azulejo-white);
  color: var(--ink);
  border: 3px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep);
}

.lobby-player-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.lobby-player-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cobalt-soft);
}

.lobby-host-badge {
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--ink);
  background-color: var(--lemon);
  border-radius: 3px;
  vertical-align: middle;
}

.lobby-footer {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 500px;
  margin-top: 8px;
}

.lobby-footer .btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 0.95rem;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  width: 100%;
  max-width: 500px;
}

/* ===================== Join / create forms ===================== */
.join-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.join-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-accent);
  text-align: center;
}

.join-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.join-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.join-input {
  padding: 16px;
  font-size: 1.1rem;
}

/* ===================== Home ===================== */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--screen-height);
  padding: 20px;
  text-align: center;
  position: relative;
}

.home-about-link {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  padding: 6px 16px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  text-decoration: none;
}

.home-about-link:hover,
.home-about-link:focus-visible { background-color: var(--lemon); }

/* Subtle azulejo wall: lemon-coloured tiles that fade out behind the content.
   Add `tile-wall` to a page's root element (home, lobby). */
.tile-wall {
  position: relative;
  isolation: isolate;
}

.tile-wall::before,
.tile-wall::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.tile-wall::before {
  background-color: var(--lemon);
  opacity: 0.16;
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 72px;
  mask-size: 72px;
  -webkit-mask-position: center;
  mask-position: center;
}

.tile-wall::after {
  background: radial-gradient(ellipse at center, var(--cobalt) 0%, rgba(31, 58, 147, 0.8) 35%, rgba(31, 58, 147, 0) 75%);
}

.home-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--lemon);
  text-shadow: 0 4px 0 var(--ink);
  margin-bottom: 12px;
  animation: fadeIn 1s ease;
}

.home-subtitle {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.home-logo {
  animation: home-float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 0 var(--shadow-ink));
}

/* Big arcade title: two stacked words with a hard shadow */
.home .home-title {
  display: flex;
  flex-direction: column;
  line-height: 0.92;
  font-size: 3.6rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 14px 0 14px;
  text-shadow: 0 5px 0 var(--lemon-deep), 0 10px 0 var(--ink);
}

.home .home-title span:last-child {
  color: var(--azulejo-white);
  text-shadow: 0 5px 0 var(--cobalt-soft), 0 10px 0 var(--ink);
}

.home-ribbon {
  padding: 6px 18px;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background-color: var(--lemon);
  border: 2px solid var(--lemon-deep);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
  transform: rotate(-2deg);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 420px;
}

/* Menu buttons: chunky tiles that press down */
.home-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px 20px;
  min-height: 60px;
  border-radius: var(--tile-radius);
  font-family: inherit;
  border: 4px solid var(--cobalt);
  background-image: var(--tile-glaze);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.home-action-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--shadow-ink), inset 0 0 0 2px var(--lemon-deep);
}

.home-action-label {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home-action-hint {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.home-action-btn-create {
  min-height: 84px;
  background-color: var(--lemon);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 6px 0 var(--ink);
}

.home-action-btn-create .home-action-label {
  font-size: 1.7rem;
}

.home-action-btn-join {
  background-color: var(--azulejo-white);
  color: var(--cobalt);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 5px 0 var(--ink);
}

.home-action-btn-tv {
  min-height: 48px;
  padding: 8px 20px;
  background-color: var(--cobalt-soft);
  background-image: var(--tile-glaze-dark);
  color: var(--azulejo-white);
  border-color: var(--azulejo-white);
  box-shadow: 0 4px 0 var(--ink);
}

.home-action-btn-tv .home-action-label {
  font-size: 1rem;
}

.home-action-btn:hover {
  filter: brightness(1.05);
}

/* The fruit crew hops along the bottom */
.home-crew {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 30px;
}

.home-crew-member {
  display: block;
  animation: home-hop 1.6s ease-in-out infinite;
}

.home-info {
  margin-top: 18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

@keyframes home-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes home-hop {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-14px); }
}

@media (prefers-reduced-motion: reduce) {
  .home-logo,
  .home-crew-member {
    animation: none;
  }
}

/* ===================== Fruit picker (lobby) ===================== */
.fruit-picker {
  width: 100%;
  max-width: 500px;
  margin: 0 0 20px;
}

.fruit-picker-title {
  margin-bottom: 10px;
  color: var(--text);
}

.fruit-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.fruit-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  font-family: inherit;
  color: var(--ink);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt-soft);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.fruit-option:hover:not(:disabled) {
  border-color: var(--lemon);
  transform: translateY(-2px);
}

.fruit-option.selected {
  border-color: var(--lemon-deep);
  background-color: var(--lemon);
  box-shadow: 0 0 0 3px var(--lemon-deep);
}

/* Taken by another player */
.fruit-option:disabled {
  opacity: 0.45;
  filter: grayscale(0.7);
  cursor: not-allowed;
}

/* ===================== Characters gallery ===================== */
.characters-page {
  align-items: center;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1000px;
}

.characters-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px 14px;
  text-align: center;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.characters-stage {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 150px;
}

.characters-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--cobalt);
}

.characters-trait {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cobalt-soft);
}

.characters-host {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--cobalt);
  background-color: var(--lemon);
  border-radius: var(--tile-radius);
}

/* ===================== Loading ===================== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--screen-height);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--white-wash);
  border-top-color: var(--lemon);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.on-light .spinner,
.tv-view .spinner {
  border-color: var(--cobalt-wash);
  border-top-color: var(--cobalt);
}

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

/* ===================== Toasts ===================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--tile-radius);
  font-size: 0.9rem;
  font-weight: 700;
  animation: fadeIn 0.3s ease;
}

.toast-success {
  background-color: var(--lemon);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--lemon-deep);
}

.toast-error {
  background-color: var(--terracotta);
  color: var(--azulejo-white);
}

.toast-info {
  background-color: var(--azulejo-white);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--cobalt-soft);
}

/* ===================== Cast button ===================== */
.cast-btn {
  background-color: var(--cobalt-soft);
  color: var(--azulejo-white);
  border: 2px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.cast-btn:hover {
  border-color: var(--lemon);
}

.cast-icon {
  width: 20px;
  height: 20px;
}

/* ===================== Result rows (scoring lists) ===================== */
.result-row {
  padding: 8px;
  margin: 4px 0;
  border-radius: var(--tile-radius);
  background-color: var(--cobalt-wash);
}

.result-row.winner,
.result-row.correct {
  background-color: var(--lemon-wash);
  box-shadow: inset 3px 0 0 var(--lemon-deep);
}

.result-points {
  color: var(--cobalt);
  margin-left: 10px;
  font-weight: 900;
}

/* ===================== Responsive ===================== */
@media (min-width: 768px) {
  .home-title {
    font-size: 4rem;
  }

  .tv-code-giant {
    font-size: 12rem;
  }

  .tv-view {
    padding: 30px 40px;
  }

  .player-form {
    max-width: 600px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .home-title {
    font-size: 2.4rem;
  }

  .tv-code-giant {
    font-size: 5rem;
  }

  .btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
  }

  .player-answers-pair {
    grid-template-columns: 1fr;
  }
}

/* ===================== Confetti (lemon and cobalt) ===================== */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1000;
}

.confetti {
  position: absolute;
  top: 0;
  width: 10px;
  height: 10px;
  background: var(--lemon);
  border-radius: 2px;
  animation: confetti 3s ease-out forwards;
}

@keyframes confetti {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-container {
    display: none;
  }

  .animate-pulse,
  .animate-bounce,
  .tv-timer.warning {
    animation: none;
  }
}

/* ===================== Confirm modal ===================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: rgba(22, 48, 92, 0.78);
}

.modal {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cobalt);
  margin-bottom: 8px;
}

.modal-text {
  color: var(--text);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===================== Host settings ===================== */
.setting-row {
  margin-bottom: 20px;
  text-align: left;
}

.setting-label {
  font-weight: 900;
  color: var(--cobalt);
}

.setting-hint {
  margin: 2px 0 10px;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.8;
}

.setting-choices {
  display: flex;
  gap: 6px;
}

.setting-choice {
  flex: 1;
  min-height: 44px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
  cursor: pointer;
}

.setting-choice.selected {
  color: var(--ink);
  background-color: var(--lemon);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.setting-choice:active {
  transform: translateY(2px);
}

/* ===================== Bowling ===================== */
.bowl-phone {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* The lane takes the height that is left and keeps its shape, so the page never scrolls */
.bowl-lane-box {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bowl-lane {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  border: 5px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 4px 0 var(--shadow-ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.bowl-lane.live {
  cursor: grab;
  box-shadow: inset 0 0 0 2px var(--lemon), var(--lemon-glow);
}

.bowl-lane-wood { fill: #d8a45b; }
.bowl-lane-board { stroke: rgba(90, 50, 15, 0.22); stroke-width: 1; }
.bowl-lane-foul { stroke: var(--lemon-deep); stroke-width: 3; }

.bowl-lane-label {
  font-size: 12px;
  font-weight: 800;
  fill: rgba(60, 30, 10, 0.75);
}

.bowl-pin { fill: var(--azulejo-white); stroke: #8a3a22; stroke-width: 2; }
.bowl-pin.down { fill: none; stroke: rgba(90, 50, 15, 0.3); stroke-dasharray: 2 3; stroke-width: 1.5; }

.bowl-ball { fill: var(--cobalt); stroke: var(--azulejo-white); stroke-width: 2; }
.bowl-ball.idle { opacity: 0.6; }

.bowl-aim {
  fill: none;
  stroke: var(--cobalt);
  stroke-width: 3;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
}

.bowl-aim.thrown { opacity: 0.45; }

.bowl-swipe {
  stroke: var(--lemon-deep);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.8;
}

.bowl-hint {
  flex-shrink: 0;
  min-height: 2.6em;
  margin: 6px 0 0;
  font-weight: 800;
  color: var(--lemon);
}

/* The score sheet: a row per player, a box per frame */
.bowl-sheet {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px auto 0;
  max-width: 1000px;
}

.bowl-sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}

.bowl-sheet-row.active {
  background-color: var(--lemon);
  box-shadow: inset 0 0 0 2px var(--lemon-deep);
}

.bowl-sheet-name {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 36%;
  min-width: 0;
  font-weight: 900;
  text-align: left;
}

.bowl-sheet-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bowl-sheet-frames {
  display: flex;
  flex: 1;
  gap: 4px;
  justify-content: flex-end;
  overflow: hidden;
}

.bowl-frame {
  display: flex;
  justify-content: space-between;
  min-width: 44px;
  padding: 1px 4px;
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--cobalt);
  border: 2px solid var(--cobalt-soft);
  border-radius: 2px;
}

.bowl-frame.current { border-color: var(--lemon-deep); box-shadow: 0 0 0 1px var(--lemon-deep); }
.bowl-frame span { min-width: 1ch; }

.bowl-sheet-points {
  min-width: 3.4em;
  font-weight: 900;
  text-align: right;
}

.bowl-sheet-compact .bowl-sheet-row { padding: 1px 8px; }
.bowl-sheet-compact .bowl-frame { min-width: 36px; font-size: 0.8rem; }

/* On the TV the score card is small and in two columns, so the play area gets the room */
.bowl-tv .bowl-sheet {
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  width: 100%;
  max-width: none;
  margin: 0;
}
.bowl-tv .bowl-sheet-row { gap: 8px; padding: 0 8px; border-width: 2px; }
.bowl-tv .bowl-sheet-name { width: 30%; font-size: 0.85rem; }
.bowl-tv .bowl-frame { min-width: 26px; padding: 0 3px; font-size: 0.7rem; border-width: 1px; }
.bowl-tv .bowl-sheet-points { min-width: 2.6em; font-size: 0.85rem; }

/* TV */
.bowl-tv {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1840px;
  /* The whole screen, less the TV header and padding: the play area takes what the bar and score card leave */
  height: var(--tv-play-height, calc(var(--screen-height) - 140px));
  min-height: 460px;
  margin: 0 auto;
}

.bowl-tv-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 10px;
}

.bowl-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 0 10px;
  overflow: hidden;
  background-color: #10224a;
  border: 6px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 5px 0 var(--shadow-ink);
  box-sizing: content-box;
}

.bowl-canvas { display: block; width: 100%; height: 100%; }

.bowl-stage-note {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-weight: 800;
  color: var(--azulejo-white);
  text-align: center;
}

.bowl-result {
  position: absolute;
  left: 50%;
  top: 14%;
  padding: 6px 24px;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background-color: var(--lemon);
  border: 4px solid var(--lemon-deep);
  border-radius: var(--tile-radius);
  box-shadow: 0 5px 0 var(--ink);
  white-space: nowrap;
  transform: translateX(-50%);
  animation: bowl-pop 0.4s ease-out;
}

.bowl-result.big {
  font-size: 3.6rem;
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  border-color: var(--azulejo-white);
}

@keyframes bowl-pop {
  0% { transform: translateX(-50%) scale(0.4); opacity: 0; }
  70% { transform: translateX(-50%) scale(1.12); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); }
}

/* ===================== Mini Golf ===================== */
.golf-grass { fill: #8fdc7d; }
.golf-felt { fill: #35b35a; stroke: #c9803d; stroke-width: 7; stroke-linejoin: round; paint-order: stroke; }
.golf-sand { fill: #f1d68a; }
.golf-wall { stroke: #c9803d; stroke-width: 5; stroke-linecap: round; }
.golf-bumper { fill: #e8523c; stroke: var(--ink); stroke-width: 2.5; }
.golf-tee { fill: var(--lemon); opacity: 0.9; }
.golf-cup { fill: #0b1226; stroke: var(--lemon); stroke-width: 2.5; }
.golf-flag-pole { stroke: var(--azulejo-white); stroke-width: 2; }
.golf-flag { fill: #e8523c; }
.golf-pull { stroke-width: 5; stroke-linecap: round; opacity: 0.9; }
.golf-pull-handle { stroke: var(--ink); stroke-width: 2.5; }
.golf-ball { stroke: var(--ink); stroke-width: 2; }
.golf-ball.mine { stroke: var(--azulejo-white); stroke-width: 3; }
.golf-ball.current { filter: drop-shadow(0 0 4px var(--lemon)); }
.golf-ball-dot { flex: none; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; }
.bowl-frame.golf-hole { justify-content: center; min-width: 30px; }

/* ===================== Speed Bingo ===================== */
/* Phone: the card */
.bingo-phone {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.bingo-status {
  padding: 4px 22px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--lemon);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.bingo-status-locked {
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  animation: bingo-shake 0.35s;
}

.bingo-progress { margin: 8px 0; }

.bingo-card {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: min(100%, 380px, calc(var(--screen-height) - 330px));
  padding: 8px;
  background-color: var(--azulejo-white);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 5px 0 var(--shadow-ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.bingo-card-locked { opacity: 0.55; filter: grayscale(0.6); }

.bingo-letter {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
  color: var(--cobalt);
}

.bingo-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: #fff;
  border: 3px solid var(--cobalt-soft);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bingo-cell:active:not(.done) { transform: scale(0.92); background-color: var(--lemon); }

.bingo-cell.done {
  color: var(--cobalt);
  background-color: var(--lemon);
  border-color: var(--lemon-deep);
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.0) 0 55%, rgba(31, 58, 147, 0.18) 56% 62%, transparent 63%);
}

.bingo-hint { margin-top: 10px; text-align: center; font-weight: 800; color: var(--text-muted); font-size: 0.9rem; }

@keyframes bingo-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* TV: the number that was just called, the ones before it, the board and how everybody does */
.bingo-tv {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 1840px;
  height: var(--tv-play-height, calc(var(--screen-height) - 140px));
  min-height: 460px;
  margin: 0 auto;
}

.bingo-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 28px;
  align-items: stretch;
}

.bingo-ball-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 0;
}

.bingo-ball {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, calc(var(--screen-height) - 520px));
  min-width: 260px;
  aspect-ratio: 1;
  color: var(--cobalt);
  background: radial-gradient(ellipse 14% 9% at 24% 20%, rgba(255, 255, 255, 0.9) 0 70%, transparent 100%), var(--lemon);
  border: 8px solid var(--cobalt);
  border-radius: 50%;
  box-shadow: 0 8px 0 var(--shadow-ink), inset 0 -14px 0 rgba(0, 0, 0, 0.08);
  animation: bingo-ball-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.bingo-ball-wait { background: var(--azulejo-white); }

.bingo-ball-letter {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
}

.bingo-ball-number {
  font-family: var(--font-display);
  font-size: 9.5rem;
  font-weight: 900;
  line-height: 1;
}

.bingo-ball-wait .bingo-ball-number { font-size: 3.4rem; text-align: center; }

.bingo-over {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--cobalt);
}

.bingo-recent {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 52px;
}

.bingo-mini {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: 999px;
}

.bingo-mini small { font-size: 0.85rem; color: var(--cobalt-soft); }

.bingo-count { font-size: 1.3rem; font-weight: 800; color: var(--cobalt-soft); }

.bingo-line-banner {
  position: absolute;
  top: 0;
  left: 50%;
  padding: 6px 26px;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  border: 4px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: 0 5px 0 var(--shadow-ink);
  white-space: nowrap;
  transform: translateX(-50%);
  animation: bowl-pop 0.4s ease-out;
}

.bingo-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background-color: var(--azulejo-white);
  border: 6px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 5px 0 var(--shadow-ink);
}

.bingo-board-row {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 2.2em repeat(15, minmax(0, 1fr));
  gap: 5px;
  align-items: center;
}

.bingo-board-letter {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  color: var(--cobalt);
}

.bingo-board-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 1.3rem;
  font-weight: 800;
  color: #b7bfd6;
  background-color: #f0f2f8;
  border-radius: 6px;
}

.bingo-board-cell.called { color: var(--cobalt); background-color: var(--lemon); border: 2px solid var(--lemon-deep); }
.bingo-board-cell.latest { color: var(--azulejo-white); background-color: var(--terracotta); border-color: var(--cobalt); transform: scale(1.12); }

.bingo-players {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 14px;
}

.bingo-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}

.bingo-player.locked { opacity: 0.55; background-color: #f3d9d0; }

.bingo-player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bingo-player-name { font-size: 0.95rem; font-weight: 800; color: var(--cobalt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bingo-bar { display: block; height: 8px; background-color: #e3e7f3; border-radius: 4px; overflow: hidden; }
.bingo-bar span { display: block; height: 100%; background-color: var(--cobalt); transition: width 0.2s; }

.bingo-player-lines {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  color: var(--cobalt);
}
.bingo-player-lines small { font-family: inherit; font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; }

@keyframes bingo-ball-in {
  0% { transform: scale(0.3) translateY(-40px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===================== Fruit Kart ===================== */
/* Phone: the special and two big pedals */
.race-phone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.race-phone-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 18px;
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.race-phone-kart { width: 22px; height: 22px; border: 3px solid var(--ink); border-radius: 6px; }
.race-phone-place { font-size: 2rem; line-height: 1; }
.race-phone-lap { font-size: 1.1rem; }

.race-phone-status {
  padding: 2px 18px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--lemon);
  border-radius: var(--tile-radius);
}

.race-special {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: min(100%, 340px);
  min-height: 92px;
  padding: 8px 14px;
  font-family: var(--font-display);
  color: #fff;
  background-color: #6b7aa8;
  border: 4px solid var(--cobalt);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--shadow-ink);
  -webkit-tap-highlight-color: transparent;
}

.race-special-name { font-size: 1.9rem; font-weight: 900; letter-spacing: 0.04em; }
.race-special small { font-size: 0.8rem; font-weight: 700; opacity: 0.9; }
.race-special:disabled { opacity: 0.55; }
.race-special-1 { background-color: #e8523c; }
.race-special-2 { background-color: #2d9fe0; }
.race-special-3 { background-color: #f08a2c; }
.race-special-4 { background-color: #6b3fa0; }
.race-special:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 var(--shadow-ink); }
.race-special:not(:disabled) { animation: race-special-pulse 0.9s infinite; }

@keyframes race-special-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.race-layout {
  display: grid;
  grid-template-areas: "special" "steer" "brake";
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  /* Portrait: the special on top, the two pedals, the brake below them */
  height: clamp(280px, calc(var(--screen-height) - 360px), 600px);
}
.race-layout-off { opacity: 0.5; }

.race-layout .race-special { grid-area: special; justify-self: center; }
.race-layout .race-brake { grid-area: brake; }

.race-steer {
  grid-area: steer;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  gap: 12px;
  min-height: 0;
}

.race-brake {
  min-height: 64px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fff;
  background-color: #c0392b;
  border: 4px solid var(--cobalt);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--shadow-ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.race-brake.down { background-color: #8e2a20; transform: translateY(3px); box-shadow: 0 2px 0 var(--shadow-ink); }
.race-brake:disabled { opacity: 0.55; }

.race-phone-warning {
  padding: 2px 18px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  border-radius: var(--tile-radius);
  animation: race-warning 0.7s infinite;
}
.race-phone-warning-1 { background-color: #e8a317; }
.race-phone-warning-2 { background-color: #e8661c; }
.race-phone-warning-3 { background-color: #d92b2b; animation-duration: 0.35s; }

@keyframes race-warning {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

.race-phone-tip { margin: 2px 0 0; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }

/* Held sideways: the pedals on the left, the special and the brake on the right, the bars out of the way */
@media (orientation: landscape) and (max-height: 620px) {
  .player-view.game-racing .player-header,
  .player-view.game-racing .race-phone-tip { display: none; }

  .player-view.game-racing .player-content { padding: 6px 10px; }
  .game-racing .page-center { justify-content: flex-start; }

  .race-phone { gap: 6px; }
  .race-phone-top { padding: 2px 14px; }
  .race-phone-place { font-size: 1.5rem; }
  .race-phone-status { font-size: 1.1rem; }
  .race-phone-warning { font-size: 1.1rem; }

  .race-layout {
    grid-template-areas: "steer special" "steer brake";
    grid-template-columns: 1.7fr 1fr;
    grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr);
    height: calc(var(--screen-height) - 90px);
    gap: 10px;
  }
  .race-layout .race-special { width: 100%; min-height: 0; height: 100%; }
  .race-layout .race-steer { height: 100%; }
  .race-brake { min-height: 0; height: 100%; font-size: 1.6rem; }
  .race-arrow { font-size: 3.2rem; }
}

.race-pedal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  border: 4px solid var(--cobalt);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--shadow-ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.race-pedal.down { background-color: var(--lemon); transform: translateY(4px); box-shadow: 0 2px 0 var(--shadow-ink); }
.race-arrow { font-size: 4.4rem; line-height: 1; }
.race-pedal small { font-size: 1rem; font-weight: 900; letter-spacing: 0.12em; }

/* TV */
.race-tv {
  width: 100%;
  max-width: 1840px;
  height: var(--tv-play-height, calc(var(--screen-height) - 140px));
  min-height: 460px;
  margin: 0 auto;
}

.race-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #8fd8ff;
  border: 6px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 5px 0 var(--shadow-ink);
  box-sizing: border-box;
}

.race-canvas { display: block; width: 100%; height: 100%; }

.race-note {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--cobalt);
}

.race-top {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.race-country,
.race-lap {
  padding: 4px 16px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}

.race-lap { background-color: var(--lemon); }
.race-lap b { font-size: 2rem; }

.race-standings {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 300px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.race-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 2px 6px;
  color: var(--cobalt);
  background-color: rgba(253, 248, 238, 0.92);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  transition: transform 0.2s;
}

.race-row.done { background-color: rgba(245, 197, 24, 0.95); }
.race-row.out { opacity: 0.45; background-color: rgba(190, 195, 210, 0.9); }
.race-row.fading { border-color: #d92b2b; animation: race-warning 0.8s infinite; }
.race-place { width: 1.2em; font-family: var(--font-display); font-size: 1.3rem; font-weight: 900; text-align: center; }
.race-dot { flex: none; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 3px; }
.race-name { flex: 1; min-width: 0; overflow: hidden; font-size: 1rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.race-item { padding: 0 8px; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.06em; color: #fff; border-radius: 999px; }
.race-item-1 { background-color: #e8523c; }
.race-item-2 { background-color: #2d9fe0; }
.race-item-3 { background-color: #f08a2c; }
.race-item-4 { background-color: #6b3fa0; }
.race-flag { font-size: 0.7rem; font-weight: 900; }
.race-flag-warn { color: #d92b2b; }

.race-minimap {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 260px;
  height: 200px;
  background-color: rgba(253, 248, 238, 0.8);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}

.race-count {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: var(--font-display);
  font-size: 14rem;
  font-weight: 900;
  line-height: 1;
  color: var(--lemon);
  -webkit-text-stroke: 10px var(--cobalt);
  paint-order: stroke fill;
  transform: translate(-50%, -50%);
  animation: race-count-pop 1s ease-out;
}

.race-count-ready { font-size: 6rem; }
.race-count-go { color: #6fe06f; animation: race-count-pop 1.4s ease-out; }

@keyframes race-count-pop {
  0% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.9; }
}

.race-banner {
  position: absolute;
  top: 14%;
  left: 50%;
  padding: 6px 26px;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--azulejo-white);
  background-color: var(--terracotta);
  border: 4px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: 0 5px 0 var(--shadow-ink);
  white-space: nowrap;
  transform: translateX(-50%);
  animation: bowl-pop 0.4s ease-out;
}

/* ===================== Party modes (lobby) ===================== */
.party-card {
  padding: 12px;
}

.party-heading {
  margin-bottom: 10px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--cobalt);
}

.party-modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.party-mode {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  text-align: left;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  background-image: var(--tile-glaze-dark);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.party-mode:hover {
  transform: translateY(-2px);
}

.party-mode:active {
  transform: translateY(1px);
}

.party-mode.selected {
  color: var(--ink);
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border-color: var(--lemon-deep);
  box-shadow: 0 0 0 3px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.party-mode-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: var(--lemon);
  background-color: var(--white-wash);
  border-radius: var(--tile-radius);
}

.party-mode.selected .party-mode-icon {
  color: var(--cobalt);
  background-color: var(--glaze);
}

.party-mode-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.party-mode-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.1;
}

.party-mode-tagline {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0.85;
}

.party-lengths {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.party-length {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 6px;
  font-family: inherit;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
  cursor: pointer;
}

.party-length.selected {
  color: var(--ink);
  background-color: var(--lemon);
  border-color: var(--lemon-deep);
  box-shadow: 0 0 0 3px var(--lemon-deep), 0 3px 0 var(--shadow-ink);
}

.party-length:active {
  transform: translateY(2px);
}

.party-length-number {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
}

.party-length-unit {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.party-rounds {
  display: flex;
  gap: 6px;
}

.party-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: center;
  color: var(--text);
  opacity: 0.8;
}

/* The mode on the TV lobby */
.tv-party-mode {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 12px 20px;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  background-image: var(--tile-glaze-dark);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 1px var(--lemon-deep), 0 4px 0 var(--shadow-ink);
}

.tv-party-mode-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  color: var(--lemon);
  background-color: var(--white-wash);
  border-radius: var(--tile-radius);
}

.tv-party-mode-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tv-party-mode-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--lemon);
}

.tv-party-mode-tagline {
  font-size: 1.05rem;
  font-weight: 700;
  opacity: 0.9;
}

/* ===================== Vote & Play ===================== */
.ballot {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.ballot-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--cobalt);
}

.ballot-sub {
  margin: 2px 0 8px;
  font-weight: 800;
  color: var(--ink);
}

.ballot-clock {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--ink);
  background-color: var(--lemon);
  border: 4px solid var(--lemon-deep);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--shadow-ink);
}

.ballot-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ballot-option.ballot-lost {
  opacity: 0.4;
  filter: grayscale(0.7);
}

.ballot-tv {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  padding: 10px 20px;
}

.ballot-tv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.ballot-tv-round {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cobalt-soft);
}

.ballot-tv-title {
  font-family: var(--font-display);
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1.05;
  color: var(--cobalt);
}

.ballot-tv-sub {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

.ballot-clock-tv {
  width: 110px;
  height: 110px;
  margin: 0;
  font-size: 3.6rem;
  border-width: 6px;
}

.ballot-tv-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.ballot-tv-option {
  transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}

.ballot-tv-option:not(.selected) {
  opacity: 0.3;
}

.ballot-tv-option.ballot-won {
  transform: scale(1.06);
  animation: ballot-pop 0.6s ease;
}

@keyframes ballot-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1.06); }
}

.ballot-voters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 50px;
  padding: 0 8px 10px;
}

.ballot-voters-none {
  align-self: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--cobalt-soft);
  opacity: 0.5;
}

/* ===================== Emma's Revenge ===================== */
.emma-alive {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 300px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.emma-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 2px 8px;
  color: var(--cobalt);
  background-color: rgba(253, 248, 238, 0.92);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}

.emma-chip.out { opacity: 0.45; background-color: rgba(190, 195, 210, 0.9); }
.emma-pushes { font-size: 0.7rem; font-weight: 900; color: var(--terracotta); white-space: nowrap; }

.emma-phone {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  height: 100%;
  margin: 0 auto;
  text-align: center;
}

.emma-phone-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--cobalt);
}

.emma-phone-status { min-height: 2.2em; }
.emma-phone-status.empty { background-color: transparent; }
.emma-phone-count { font-size: 1.6rem; }
.emma-phone-pushes { font-size: 0.9rem; color: var(--terracotta); }

.emma-pad {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 320px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background-color: var(--azulejo-white);
  background-image: radial-gradient(circle at 50% 50%, var(--lemon-wash), transparent 70%);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 4px 0 var(--shadow-ink);
}

.emma-pad::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--cobalt);
  opacity: 0.07;
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 72px;
  mask-size: 72px;
  pointer-events: none;
}

.emma-pad:not(.live) { opacity: 0.5; }

.emma-pad-hint {
  margin: 0;
  padding: 0 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.8;
  pointer-events: none;
}

/* The joystick: a base plate with arrows, a well, a shaft and a ball on top; it stays in the middle of the pad */
.emma-joystick {
  position: relative;
  width: min(64vw, 250px);
  aspect-ratio: 1;
  flex: none;
  pointer-events: none;
}

/* The base plate is a big round azulejo tile: warm ceramic white with the star pattern in cobalt, a cobalt frame with a lemon
   edge inside it, and the glaze on top, like the tiles on the walls of the rest of the game */
.emma-joystick-plate {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 6px solid var(--cobalt);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--lemon-deep), inset 0 10px 8px -6px var(--glaze), 0 6px 0 var(--shadow-ink);
}

.emma-joystick-plate::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--cobalt);
  opacity: 0.3;
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 54px;
  mask-size: 54px;
  -webkit-mask-position: center;
  mask-position: center;
}

/* The four directions are small lemon tiles set on the diagonal, like the bullets of the instructions */
.emma-joystick-arrow {
  position: absolute;
  width: 9%;
  height: 9%;
  background-color: var(--lemon);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  box-shadow: 0 2px 0 var(--lemon-deep);
  transform: rotate(45deg);
}
.emma-joystick-arrow.up { top: 7%; left: 45.5%; }
.emma-joystick-arrow.down { bottom: 7%; left: 45.5%; }
.emma-joystick-arrow.left { left: 7%; top: 45.5%; }
.emma-joystick-arrow.right { right: 7%; top: 45.5%; }

.emma-joystick-well {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  height: 26%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 50% 40%, var(--ink), var(--cobalt));
  border: 3px solid var(--lemon-deep);
  border-radius: 50%;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.5);
}

/* The stick is lemon yellow */
.emma-joystick-shaft {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9%;
  height: 32%;
  margin-top: -32%;
  transform-origin: 50% 100%;
  background: linear-gradient(90deg, var(--lemon-deep), #ffe27a, var(--lemon-deep));
  border: 2px solid var(--ink);
  border-radius: 6px;
}

/* The knob is the player's colour like their ball on the TV, glazed like the buttons, with a lemon leaf on top */
.emma-joystick-ball {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  height: 40%;
  border: 5px solid var(--cobalt);
  border-radius: 50%;
  background-image: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 45%);
  box-shadow: inset 0 0 0 3px var(--lemon), 0 8px 0 var(--shadow-ink);
  transition: transform 0.12s ease-out;
}

.emma-joystick-ball::after {
  content: '';
  position: absolute;
  top: -22%;
  left: 52%;
  width: 36%;
  height: 24%;
  background-color: var(--pen-leaf);
  border: 3px solid var(--cobalt);
  border-radius: 0 100% 0 100%;
  transform: rotate(-12deg);
}

.emma-joystick-ball.held { transition: none; }

.emma-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 6px 22px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: rgba(253, 248, 238, 0.94);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 4px 0 var(--shadow-ink);
  white-space: nowrap;
}

@media (orientation: landscape) and (max-height: 520px) {
  .player-view.game-emma .player-header,
  .player-view.game-emma_drop .player-header { display: none; }
  .player-view.game-emma .player-content,
  .player-view.game-emma_drop .player-content { padding: 6px 10px; }
  .game-emma .page-center,
  .game-emma_drop .page-center { justify-content: flex-start; }
  .emma-pad { min-height: 200px; flex-direction: row; }
  .emma-joystick { width: min(48vh, 220px); }
}

/* ===================== Cast menu (the host's gear button) ===================== */
.cast-menu {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 40;
}

.cast-menu-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--azulejo-white);
  background-color: var(--cobalt);
  border: 2px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
  box-shadow: 0 2px 0 var(--shadow-ink);
  opacity: 0.85;
  cursor: pointer;
}

.cast-menu-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background-color: var(--terracotta);
  border: 2px solid var(--azulejo-white);
  border-radius: 50%;
}

.cast-menu-btn.on .cast-menu-dot { background-color: #3c8d3f; }

.cast-menu-panel {
  position: absolute;
  top: 50px;
  left: 0;
  width: min(280px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background-color: var(--azulejo-white);
  border: var(--tile-frame-border);
  border-radius: var(--tile-radius);
  box-shadow: var(--tile-frame-shadow);
}

.cast-menu-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--cobalt);
}

/* ===================== Chinese Doodling ===================== */
.doodle-step { margin-bottom: 4px; }
.doodle-word {
  display: inline-block;
  padding: 0 10px;
  color: var(--cobalt);
  background-color: var(--lemon);
  border-radius: var(--tile-radius);
}

.doodle-tv { width: 100%; text-align: center; }

.doodle-tv-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--cobalt);
}
.doodle-tv-title small { font-size: 1.3rem; font-weight: 800; color: var(--cobalt-soft); }

.doodle-tv-sub { margin-bottom: 8px; font-size: 1.4rem; font-weight: 700; color: var(--cobalt-soft); }
.doodle-tv-rule { margin-top: 20px; font-size: 1.1rem; font-weight: 700; color: var(--cobalt-soft); }
.doodle-tv-players { max-width: 1100px; margin: 0 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* The replay: the book so far, a card per page */
.doodle-chain {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}

.doodle-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  color: var(--ink);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
}
.doodle-card-word { background-color: var(--lemon); }
.doodle-card.right { border-color: #3c8d3f; }
.doodle-card.wrong { border-color: var(--terracotta); }
.doodle-card-new { animation: doodle-pop 0.45s ease-out; box-shadow: 0 0 0 5px var(--lemon-deep), 0 3px 0 var(--shadow-ink); }

.doodle-card-who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--cobalt-soft);
}

.doodle-card-text {
  display: grid;
  place-items: center;
  min-height: 120px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--cobalt);
  overflow-wrap: anywhere;
}

.doodle-card-badge {
  font-size: 1.1rem;
  font-weight: 900;
  color: #3c8d3f;
}
.doodle-card-badge-wrong { color: var(--terracotta); }

.doodle-tv-verdict {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--cobalt);
}

@keyframes doodle-pop {
  0% { transform: scale(0.7) rotate(-3deg); opacity: 0; }
  70% { transform: scale(1.06) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .doodle-card-new { animation: none; }
}

/* ===================== Fruit Fight ===================== */
/* TV: the world is 16:9 and the fruits sit on top of the canvas */
.ff-tv {
  width: 100%;
  max-width: 1840px;
  height: var(--tv-play-height, calc(var(--screen-height) - 140px));
  min-height: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ff-stage {
  position: relative;
  width: min(calc(100% - 16px), calc(var(--tv-play-height, calc(var(--screen-height) - 140px)) * 16 / 9));
  overflow: hidden;
  background-color: #8fd8ff;
  box-shadow: 0 0 0 6px var(--cobalt), 0 0 0 8px var(--lemon-deep), 0 10px 0 8px var(--shadow-ink);
}

.ff-canvas { display: block; width: 100%; height: 100%; }
.ff-fruits { position: absolute; inset: 0; pointer-events: none; }
.ff-fruit { position: absolute; left: 0; top: 0; will-change: transform; }
.ff-sprite { width: 100%; height: 100%; }
.ff-sprite > * { display: block; }
.ff-name, .ff-hp, .ff-arrow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 900;
  line-height: 1;
}
.ff-name { top: -1.5em; padding: 1px 6px; color: var(--cobalt); background: rgba(253, 248, 238, 0.92); border: 2px solid var(--cobalt); border-radius: var(--tile-radius); }
.ff-hp { top: -3.3em; padding: 0 5px; color: #fff; background: var(--terracotta); border-radius: var(--tile-radius); }
.ff-arrow { top: -4.8em; color: var(--lemon); -webkit-text-stroke: 2px var(--cobalt); animation: ff-bob 0.7s ease-in-out infinite alternate; }
@keyframes ff-bob { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 8px); } }

.ff-turn { max-width: 56vw; }
.ff-chips {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 270px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ff-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  color: var(--cobalt);
  background-color: rgba(253, 248, 238, 0.92);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}
.ff-chip.turn { background-color: var(--lemon); }
.ff-chip.out { opacity: 0.45; background-color: rgba(190, 195, 210, 0.9); }
.ff-bar { flex: 1; height: 10px; min-width: 40px; background: rgba(22, 48, 92, 0.25); border-radius: 5px; overflow: hidden; }
.ff-bar b { display: block; height: 100%; background: #3cb35a; }
.ff-lives { color: var(--terracotta); font-size: 0.9rem; letter-spacing: -1px; }

/* Phone */
.ff-phone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
}
.ff-phone-top { display: flex; align-items: center; gap: 10px; }
.ff-phone-hp {
  position: relative;
  flex: 1;
  height: 26px;
  overflow: hidden;
  background: rgba(22, 48, 92, 0.55);
  border: 3px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
}
.ff-phone-hp b { position: absolute; inset: 0 auto 0 0; background: #3cb35a; }
.ff-phone-hp i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }
.ff-phone-lives { color: #ff6b6b; font-size: 1.4rem; letter-spacing: -2px; min-width: 2.4em; text-align: right; }
.ff-phone-status.mine { background-color: #7ee08a; }

.ff-weapons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ff-weapon {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 0;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: 0 3px 0 var(--shadow-ink);
  line-height: 1.1;
}
.ff-weapon-icon { font-size: 1.5rem; }
.ff-weapon small { font-size: 0.75rem; font-weight: 900; }
.ff-weapon.selected { background-color: var(--lemon); border-color: var(--ink); box-shadow: var(--lemon-glow); }
.ff-weapon.empty { opacity: 0.35; }
.ff-weapon:disabled:not(.empty):not(.selected) { opacity: 0.7; }
.ff-help { margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--azulejo-white); min-height: 2.4em; }

.ff-controls {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  opacity: 0.55;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ff-controls.live { opacity: 1; }
.ff-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--cobalt);
  background-color: var(--azulejo-white);
  background-image: var(--tile-glaze);
  border: 4px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 4px 0 var(--shadow-ink);
  touch-action: none;
}
.ff-btn small { font-size: 0.7rem; letter-spacing: 0.1em; }
.ff-btn.down { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 1px 0 var(--shadow-ink); background-color: var(--lemon); }
.ff-btn.jump { grid-column: 1 / 3; font-size: 1.4rem; }
.ff-btn.fire { grid-column: 3 / 5; font-size: 1.3rem; background-color: var(--lemon); }
.ff-power { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ffb02e, #e8321c); opacity: 0.9; }
.ff-fire-text { position: relative; }

@media (orientation: landscape) and (max-height: 520px) {
  .player-view.game-fruit_fight .player-header { display: none; }
  .player-view.game-fruit_fight .player-content { padding: 6px 10px; }
  .ff-phone { max-width: none; }
}

/* ===================== Blender Panic (phone) ===================== */
.bp-phone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
}
.bp-phone-top { display: flex; align-items: center; gap: 10px; }
.bp-progress {
  position: relative;
  flex: 1;
  height: 28px;
  overflow: hidden;
  background: rgba(22, 48, 92, 0.55);
  border: 3px solid var(--azulejo-white);
  border-radius: var(--tile-radius);
}
.bp-progress b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #f5c518, #ff8a1f); transition: width 0.3s; }
.bp-progress i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }
.bp-lane-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.bp-lane {
  display: block;
  border: 5px solid var(--cobalt);
  border-radius: var(--tile-radius);
  box-shadow: inset 0 0 0 2px var(--lemon-deep), 0 4px 0 var(--shadow-ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.6;
}
.bp-lane.live { opacity: 1; box-shadow: inset 0 0 0 2px var(--lemon), var(--lemon-glow); }

/* ===================== Blender Panic (TV) ===================== */
.bpt-tv {
  width: 100%;
  max-width: 1840px;
  height: var(--tv-play-height, calc(var(--screen-height) - 140px));
  min-height: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bpt-stage {
  position: relative;
  width: min(calc(100% - 16px), calc(var(--tv-play-height, calc(var(--screen-height) - 140px)) * 16 / 9));
  overflow: hidden;
  box-shadow: 0 0 0 6px var(--cobalt), 0 0 0 8px var(--lemon-deep), 0 10px 0 8px var(--shadow-ink);
}
/* The kitchen wall: azulejo tiles */
.bpt-wall {
  position: absolute;
  inset: 0;
  background-color: var(--azulejo-white);
  background-image: radial-gradient(ellipse at 50% 30%, rgba(245, 197, 24, 0.28), transparent 70%);
}
.bpt-wall::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--cobalt);
  opacity: 0.2;
  -webkit-mask-image: var(--azulejo-pattern);
  mask-image: var(--azulejo-pattern);
  -webkit-mask-size: 90px;
  mask-size: 90px;
}
.bpt-beam { position: absolute; left: 0; right: 0; top: 0; height: 2.4%; background: linear-gradient(#6a3b1b, #8a5a2a); border-bottom: 4px solid #16305c; z-index: 3; }
.bpt-safe { position: absolute; left: 0; right: 0; top: 11%; border-top: 4px dashed rgba(60, 179, 90, 0.8); }
.bpt-safe span { position: absolute; right: 12px; top: 2px; font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; color: #2e9c4e; letter-spacing: 0.15em; }
.bpt-strings { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; }
.bpt-string { stroke: #6b4a2a; stroke-width: 0.5; vector-effect: non-scaling-stroke; stroke-width: 4px; }
.bpt-snap { stroke: #6b4a2a; vector-effect: non-scaling-stroke; stroke-width: 4px; stroke-dasharray: 3 2; animation: bpt-snap 0.5s ease-out forwards; }
.bpt-snap.tail { animation: bpt-tail 0.8s ease-in forwards; }
@keyframes bpt-snap { from { opacity: 1; } to { opacity: 0.9; transform: translateY(-4px); } }
@keyframes bpt-tail { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }

.bpt-fruit {
  position: absolute;
  z-index: 2;
  transition: top 0.7s cubic-bezier(0.3, 0.9, 0.3, 1);
}
.bpt-fruit.fell { transition: top 0.6s cubic-bezier(0.6, 0, 0.9, 0.6), left 0.6s ease-in, opacity 0.4s; z-index: 1; }
.bpt-sprite { width: 100%; height: 100%; transform-origin: 50% 0; }
.bpt-fruit.scared .bpt-sprite { animation: bpt-shake 0.18s linear infinite, bpt-sway 2.6s ease-in-out infinite; }
.bpt-fruit.saved .bpt-sprite { animation: bpt-sway 3.4s ease-in-out infinite; }
@keyframes bpt-shake { 0%, 100% { translate: 0 0; } 25% { translate: var(--shake) 0; } 75% { translate: calc(var(--shake) * -1) 1px; } }
@keyframes bpt-sway { 0%, 100% { rotate: -2.5deg; } 50% { rotate: 2.5deg; } }
.bpt-sweat { position: absolute; left: -0.1em; top: -0.2em; animation: bpt-drip 0.9s ease-in infinite; }
@keyframes bpt-drip { from { transform: translateY(0); opacity: 1; } to { transform: translateY(0.5em); opacity: 0; } }
.bpt-label {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  white-space: nowrap;
  font-weight: 900;
  color: var(--cobalt);
  background: rgba(253, 248, 238, 0.95);
  border: 3px solid var(--cobalt);
  border-radius: var(--tile-radius);
}
.bpt-label b { color: var(--terracotta); }
.bpt-pop { position: absolute; left: 50%; top: -0.4em; transform: translateX(-50%); font-weight: 900; color: #1f8a3a; -webkit-text-stroke: 3px #fff; paint-order: stroke fill; animation: bpt-pop 1s ease-out forwards; pointer-events: none; }
@keyframes bpt-pop { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -2.2em); } }
.bpt-fruit.fell .bpt-label { opacity: 0; }
/* In the blender it spins down and is gone */
.bpt-fruit.blended .bpt-sprite { animation: bpt-whirl 0.5s linear infinite; }
@keyframes bpt-whirl { from { rotate: 0deg; scale: 1; } to { rotate: 360deg; scale: 0.85; } }
.bpt-fruit.gone { opacity: 0; transition: opacity 0.8s; }

.bpt-blender { position: absolute; left: 0; bottom: 0; width: 100%; height: 36%; z-index: 2; overflow: visible; }
.bpt-juice { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 5s ease-in-out; }
.bpt-stage.blending .bpt-blender { animation: bpt-rumble 0.12s linear infinite; }
.bpt-stage.done .bpt-blender { animation: none; }
.bpt-blades { animation: bpt-spin 0.18s linear infinite paused; }
.bpt-stage.blending:not(.done) .bpt-blades { animation-play-state: running; }
@keyframes bpt-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes bpt-rumble { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(3px, 2px); } 66% { transform: translate(-3px, -2px); } }
.bpt-eyes { animation: bpt-bob 2.4s ease-in-out infinite; }
@keyframes bpt-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 6px; } }
.bpt-eye { transform-box: fill-box; transform-origin: 50% 50%; animation: bpt-blink 3.1s infinite; }
@keyframes bpt-blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.1); } }
.bpt-pupil { animation: bpt-look 3.7s ease-in-out infinite; }
@keyframes bpt-look { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 70% { transform: translateX(5px); } }
.bpt-paw { background-color: #f29aa6; }
.bpt-winner { background-color: #2e9c4e; top: 44%; }
.bpt-blend { background-color: var(--cobalt); top: 44%; }

/* The players in the TV lobby: small horizontal cards, so the whole lobby fits at full size and uses the full width */
.tv-lobby-layout .tv-player-card { display: flex; align-items: center; gap: 12px; padding: 8px 16px; text-align: left; }
.tv-lobby-layout .tv-player-card .tv-player-name { margin: 0; font-size: 1.8rem; }
.tv-lobby-layout .tv-player-card .tv-player-score { margin-left: auto; }
.tv-lobby-layout .tv-lobby-compact { gap: 12px; }
.tv-lobby-layout { grid-template-columns: minmax(0, 0.75fr) minmax(0, 2fr); gap: 36px; }
.tv-lobby-games { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tv-lobby-layout .tv-player-card .tv-player-name { font-size: 1.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-lobby-layout .tv-lobby-heading { margin-bottom: 10px; }
.tv-lobby-layout .tv-party-mode { margin-bottom: 12px; padding: 8px 18px; }
.tv-lobby-header { margin-bottom: 14px; }
.tv-lobby-games .tv-lobby-game-name { font-size: 1.25rem; }
.tv-lobby-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr); gap: 32px; }
.tv-lobby-layout .tv-lobby-heading { font-size: 1.7rem; }
.tv-lobby-layout .tv-player-card { padding: 6px 12px; gap: 10px; }
.tv-lobby-layout .tv-party-mode-icon { width: 72px; height: 72px; }
.tv-lobby-layout .tv-party-mode-name { font-size: 2.2rem; }
.tv-lobby-layout .tv-party-mode-tagline { font-size: 1.2rem; }
.tv-lobby-header .lemon-logo { width: 64px; height: 64px; }
.tv-lobby-join .tv-code { font-size: 4.2rem; }
.tv-lobby-layout .tv-player-card { justify-content: flex-start; }
.tv-lobby-layout .tv-player-card .tv-player-name { flex: 1; min-width: 0; text-align: left; font-size: 1.45rem; }

.tv-lobby-layout .tv-player-card { position: relative; }
.tv-player-crown { position: absolute; top: -14px; right: -8px; font-size: 1.6rem; transform: rotate(12deg); }
