:root {
  --bg-deep: #0d0e1a;
  --bg-mid: #1a1d2e;
  --bg-surface: #232744;
  --ink: #f4e8d0;
  --ink-dim: #b8a888;
  --red: #d92e3a;
  --red-dark: #8b1a23;
  --red-glow: #ff5a66;
  --gold: #e8b14a;
  --gold-dark: #a87a1f;
  --gold-glow: #ffd57a;
  --jade: #4ec9a6;
  --bamboo: #2d4a2b;
  --shadow: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(ellipse at top, #2d1a3a 0%, var(--bg-deep) 60%),
    var(--bg-deep);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, transparent 0, transparent 80px, rgba(45, 74, 43, 0.08) 80px, rgba(45, 74, 43, 0.08) 84px),
    repeating-linear-gradient(180deg, transparent 0, transparent 60px, rgba(45, 74, 43, 0.05) 60px, rgba(45, 74, 43, 0.05) 62px);
  pointer-events: none;
  z-index: 0;
}

/* Lantern balloons disabled platform-wide (user request 2026-05-25).
   They were visually intrusive on every screen. */
.lantern,
.lantern::before,
.lantern::after { display: none !important; visibility: hidden !important; opacity: 0 !important; }
.lantern--legacy-disabled {
  position: fixed;
  width: 60px;
  height: 80px;
  background: radial-gradient(ellipse at 50% 40%, var(--red-glow), var(--red) 60%, var(--red-dark));
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(255, 90, 102, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 1;
  animation: sway 4s ease-in-out infinite;
}
.lantern::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  width: 1px;
  height: 20px;
  background: var(--ink-dim);
  transform: translateX(-50%);
}
.lantern::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 4px;
  height: 12px;
  background: var(--gold);
  transform: translateX(-50%);
}
.lantern.l1 { top: 40px; left: 6%; animation-delay: 0s; }
.lantern.l2 { top: 80px; right: 8%; animation-delay: 1.2s; background: radial-gradient(ellipse at 50% 40%, var(--gold-glow), var(--gold) 60%, var(--gold-dark)); box-shadow: 0 0 40px rgba(255, 213, 122, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.3); }
.lantern.l3 { top: 200px; left: 4%; animation-delay: 2s; width: 45px; height: 60px; }

@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.container {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.title {
  font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-glow), var(--red-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 60px rgba(255, 213, 122, 0.3);
}

.subtitle {
  text-align: center;
  color: var(--ink-dim);
  font-size: 1rem;
  margin-bottom: 2rem;
  letter-spacing: 0.02em;
}

.card {
  background: rgba(35, 39, 68, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(244, 232, 208, 0.1);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 40px var(--shadow);
}

.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 16px 28px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease, box-shadow 0.2s ease;
  color: white;
  letter-spacing: 0.03em;
}

.btn:hover { filter: brightness(1.1); transform: translateY(-2px); }
.btn:active { transform: translateY(0); filter: brightness(0.95); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-red { background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 8px 24px rgba(217, 46, 58, 0.35); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); box-shadow: 0 8px 24px rgba(232, 177, 74, 0.35); color: #2a1a0a; }
.btn-jade { background: linear-gradient(135deg, var(--jade), #2d8a6b); box-shadow: 0 8px 24px rgba(78, 201, 166, 0.35); }
.btn-ghost { background: rgba(244, 232, 208, 0.08); border: 1px solid rgba(244, 232, 208, 0.2); }

.input {
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px 20px;
  width: 100%;
  background: rgba(13, 14, 26, 0.6);
  border: 2px solid rgba(244, 232, 208, 0.15);
  border-radius: 12px;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.05em;
}
.input:focus { outline: none; border-color: var(--gold); }

.pin-display {
  font-family: 'ZCOOL XiaoWei', monospace;
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-align: center;
  background: linear-gradient(135deg, var(--gold-glow), var(--red-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 213, 122, 0.4);
}

.hidden { display: none !important; }

/* HOST LAYOUT */
.host-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}
@media (max-width: 768px) {
  .host-grid { grid-template-columns: 1fr; }
}

.team-panel {
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.team-red {
  background: linear-gradient(180deg, rgba(217, 46, 58, 0.15), rgba(139, 26, 35, 0.05));
  border: 2px solid var(--red);
  box-shadow: inset 0 0 60px rgba(217, 46, 58, 0.1), 0 0 30px rgba(217, 46, 58, 0.2);
}
.team-gold {
  background: linear-gradient(180deg, rgba(232, 177, 74, 0.15), rgba(168, 122, 31, 0.05));
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 60px rgba(232, 177, 74, 0.1), 0 0 30px rgba(232, 177, 74, 0.2);
}

.team-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.team-mascot { font-size: 4rem; line-height: 1; }
.team-mascot.eating { animation: chomp 0.3s ease-in-out infinite; }
@keyframes chomp {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(-3deg); }
}

.team-name {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.team-red .team-name { color: var(--red-glow); }
.team-gold .team-name { color: var(--gold-glow); }

.team-score {
  font-size: 3.2rem;
  font-weight: 900;
  text-align: center;
  margin: 4px 0 8px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px currentColor;
  letter-spacing: 0.05em;
  transition: transform 0.06s ease-out;
  transform-origin: center;
}
.team-red .team-score { color: var(--red-glow); }
.team-gold .team-score { color: var(--gold-glow); }
.team-score.pop { transform: scale(1.12); }

/* Tap floaters — flying mascots that pop up on each tap burst */
.tap-floater {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  z-index: 40;
  animation: tapFloat 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
  transform-origin: center;
}
@keyframes tapFloat {
  0%   { transform: translate(0, 0) scale(0.4) rotate(0deg); opacity: 0; }
  20%  { transform: translate(0, -10px) scale(1.4) rotate(-8deg); opacity: 1; }
  100% { transform: translate(var(--drift, 0px), -180px) scale(1) rotate(20deg); opacity: 0; }
}

/* Big burst badge — for combo moments */
.tap-burst-badge {
  position: fixed;
  transform: translateX(-50%);
  font-size: 1.6rem;
  font-weight: 900;
  font-family: 'ZCOOL XiaoWei', serif;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 41;
  animation: burstBadge 0.8s ease-out forwards;
  text-shadow: 0 0 16px currentColor, 0 4px 8px rgba(0,0,0,0.6);
}
.tap-burst-badge.red { color: var(--red-glow); }
.tap-burst-badge.gold { color: var(--gold-glow); }
@keyframes burstBadge {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.4); }
  30%  { opacity: 1; transform: translateX(-50%) translateY(-12px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(1); }
}
.team-score-label {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* ZOO FLOOR — the enclosure that holds the population */
.zoo-floor {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(45, 110, 70, 0.25) 0%, transparent 60%),
    linear-gradient(180deg, rgba(13, 14, 26, 0.6) 0%, rgba(20, 30, 22, 0.5) 70%, rgba(45, 80, 50, 0.4) 100%);
  border-radius: 16px;
  padding: 14px 14px 56px;
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid rgba(78, 156, 110, 0.2);
  min-height: 280px;
}

.zoo-bamboo {
  position: absolute;
  font-size: 2.4rem;
  z-index: 1;
  filter: drop-shadow(0 0 6px rgba(76, 175, 80, 0.35));
  transform-origin: bottom center;
  animation: bambooSway 4s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
}
.zoo-bamboo.tl { top: 4px; left: 6px; animation-delay: 0s; }
.zoo-bamboo.tr { top: 4px; right: 6px; animation-delay: 1.5s; transform: scaleX(-1); }
.zoo-bamboo.bl { bottom: 38px; left: 4px; font-size: 1.6rem; animation-delay: 2.5s; opacity: 0.7; }
.zoo-bamboo.br { bottom: 38px; right: 4px; font-size: 1.6rem; animation-delay: 0.5s; opacity: 0.7; transform: scaleX(-1); }

@keyframes bambooSway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.zoo-bamboo.tr, .zoo-bamboo.br {
  animation-name: bambooSwayFlip;
}
@keyframes bambooSwayFlip {
  0%, 100% { transform: scaleX(-1) rotate(-3deg); }
  50% { transform: scaleX(-1) rotate(3deg); }
}

/* TERRITORY GRID — bigger pandas, fewer cells */
.territory {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  position: relative;
  z-index: 2;
  align-content: start;
}
.territory .cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(244, 232, 208, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  line-height: 1;
  position: relative;
  transition: background 0.3s;
}
.team-red .territory .cell.filled {
  background: radial-gradient(circle, rgba(217, 46, 58, 0.45), rgba(217, 46, 58, 0.1));
  box-shadow: 0 0 10px rgba(255, 90, 102, 0.5), inset 0 0 8px rgba(255, 90, 102, 0.3);
}
.team-gold .territory .cell.filled {
  background: radial-gradient(circle, rgba(232, 177, 74, 0.45), rgba(232, 177, 74, 0.1));
  box-shadow: 0 0 10px rgba(255, 213, 122, 0.5), inset 0 0 8px rgba(255, 213, 122, 0.3);
}
.territory .cell.fresh {
  animation: cellPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cellPop {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.5) rotate(20deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.zoo-floor.full {
  animation: territoryGlow 1.5s ease-in-out infinite;
}
@keyframes territoryGlow {
  0%, 100% { box-shadow: inset 0 0 30px rgba(255, 213, 122, 0.3); }
  50% { box-shadow: inset 0 0 60px rgba(255, 213, 122, 0.6); }
}

/* GRASS at the bottom of the zoo */
.zoo-grass {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background:
    linear-gradient(180deg, transparent 0%, rgba(78, 156, 110, 0.3) 30%, rgba(45, 90, 55, 0.8) 100%);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  z-index: 1;
  overflow: hidden;
}
.zoo-grass::before {
  content: '🌿 🌱 🌿 🌱 🌿 🌱 🌿 🌱 🌿 🌱 🌿';
  position: absolute;
  bottom: 2px;
  left: -10px;
  right: -10px;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  opacity: 0.85;
  white-space: nowrap;
}

/* WALKING GUARDIAN — strolls back and forth on the grass */
.zoo-guardian-wrap {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  height: 44px;
  z-index: 4;
  pointer-events: none;
}
.zoo-guardian {
  position: absolute;
  bottom: 0;
  font-size: 2.6rem;
  line-height: 1;
  animation: walkCycle 14s linear infinite;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
  display: inline-block;
  transform-origin: center;
}
.zoo-guardian.gold { animation-duration: 12s; animation-delay: -3s; }
.zoo-guardian .bob {
  display: inline-block;
  animation: guardianBob 0.42s ease-in-out infinite;
}
@keyframes walkCycle {
  0%   { left: 0; }
  48%  { left: calc(100% - 50px); }
  50%  { left: calc(100% - 50px); transform: scaleX(-1); }
  98%  { left: 0; transform: scaleX(-1); }
  99%  { left: 0; transform: scaleX(1); }
  100% { left: 0; transform: scaleX(1); }
}
@keyframes guardianBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 480px) {
  .territory { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .territory .cell { font-size: 1.7rem; }
  .zoo-floor { min-height: 220px; padding-bottom: 50px; }
  .zoo-guardian { font-size: 2.2rem; }
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.player-chip {
  background: rgba(13, 14, 26, 0.5);
  border: 1px solid rgba(244, 232, 208, 0.15);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-chip:hover { background: rgba(244, 232, 208, 0.1); transform: translateY(-1px); }
.player-chip .swap-arrow { opacity: 0.6; font-size: 0.8rem; }

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  /* Sticky on tablet/desktop so the Start Game / End Now button is ALWAYS
     in the viewport, even when the page is taller than the screen. Fixes
     the "I can't find the start/end buttons on tablet" bug. */
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 30;
  background:
    linear-gradient(180deg, transparent 0%, rgba(13, 14, 26, 0.92) 30%, rgba(13, 14, 26, 0.96) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 8px 14px;
  border-radius: 16px;
  border: 1px solid rgba(244, 232, 208, 0.15);
  margin-bottom: max(0px, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

.controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* A "ghost" floating end-now button — used during active rounds so the
   host can ALWAYS terminate the round without scrolling. Pinned to the
   bottom-right corner with safe-area padding. */
.end-now-floating {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 40;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(80, 12, 12, 0.92);
  color: #fff;
  border: 2px solid rgba(255, 138, 145, 0.7);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), 0 0 16px rgba(217, 46, 58, 0.35);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.05em;
}
.end-now-floating:hover { filter: brightness(1.15); }
.end-now-floating:active { transform: translateY(1px); }

.duration-control {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.duration-control input[type=range] {
  flex: 1;
  accent-color: var(--gold);
}
.duration-value {
  min-width: 70px;
  text-align: center;
  background: rgba(13, 14, 26, 0.6);
  padding: 6px 12px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.feed {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feed-item {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  background: rgba(13, 14, 26, 0.5);
  animation: slideIn 0.3s ease;
}
.feed-item.red { border-left: 3px solid var(--red); }
.feed-item.gold { border-left: 3px solid var(--gold); }
@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.timer-bar {
  height: 8px;
  background: rgba(13, 14, 26, 0.6);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0;
}
.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--red));
  transition: width 0.5s linear;
}
.timer-bar.urgent .timer-bar-fill {
  background: var(--red-glow);
  animation: urgentPulse 0.5s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.timer-display {
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.timer-display.urgent {
  color: var(--red-glow);
  animation: urgentPulse 0.5s ease-in-out infinite;
}

/* COUNTDOWN OVERLAY */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 14, 26, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.countdown-num {
  font-size: clamp(8rem, 30vw, 20rem);
  font-family: 'ZCOOL XiaoWei', serif;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-glow), var(--red-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: countdownPop 1s ease-out;
}
@keyframes countdownPop {
  0% { transform: scale(0.3); opacity: 0; }
  30% { transform: scale(1.2); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.5); opacity: 0; }
}

/* PLAYER UI */
.player-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px;
}

/* Question screen: bounded height + scroll fallback so the 4th answer is never trapped */
#screen-question.player-screen {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 800;
}
.player-header.red { background: rgba(217, 46, 58, 0.2); border: 1px solid var(--red); }
.player-header.gold { background: rgba(232, 177, 74, 0.2); border: 1px solid var(--gold); color: var(--gold-glow); }

.question-card {
  background: rgba(35, 39, 68, 0.85);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 2px solid rgba(244, 232, 208, 0.1);
  animation: questionPop 0.4s ease-out;
  flex-shrink: 0;
}
@keyframes questionPop {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.question-text {
  font-size: clamp(1rem, 3.4vw, 1.35rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 0;
  line-height: 1.25;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto; /* push to bottom of the question screen */
}

.answer-btn {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-mid));
  border: 2px solid transparent;
  color: var(--ink);
  padding: 12px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
  text-align: left;
  min-height: 56px;
  word-break: break-word;
}
.answer-btn.ans-long { font-size: .9rem; }
.answer-btn.ans-xlong { font-size: .8rem; line-height: 1.15; }
@media (min-height: 700px) {
  .answer-btn { padding: 16px 14px; font-size: 1rem; min-height: 64px; }
  .answers { gap: 10px; }
}
.answer-btn:hover { transform: translateY(-2px); border-color: var(--gold); }
.answer-btn:active { transform: scale(0.97); }
.answer-btn.correct { background: linear-gradient(135deg, var(--jade), #2d8a6b); border-color: var(--jade); }
.answer-btn.wrong { background: linear-gradient(135deg, var(--red-dark), var(--red)); border-color: var(--red); }

.answer-shape {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.shape-0 { color: #ff6b6b; } .shape-1 { color: #4dabf7; } .shape-2 { color: #ffd43b; } .shape-3 { color: #51cf66; }

/* MASH MODE */
.mash-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
}

.mash-button {
  width: min(90vw, 400px);
  height: min(90vw, 400px);
  border-radius: 50%;
  border: none;
  font-size: 2.5rem;
  font-weight: 900;
  font-family: inherit;
  color: white;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 80px currentColor;
  transition: transform 0.05s;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.mash-button.red {
  background: radial-gradient(circle at 30% 30%, var(--red-glow), var(--red) 60%, var(--red-dark));
  color: white;
}
.mash-button.gold {
  background: radial-gradient(circle at 30% 30%, var(--gold-glow), var(--gold) 60%, var(--gold-dark));
  color: #2a1a0a;
}
.mash-button:active { transform: scale(0.95); }
.mash-button.combo { animation: comboShake 0.15s ease-in-out infinite; box-shadow: 0 0 120px currentColor; }
@keyframes comboShake {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-4px, 2px) scale(1.02); }
  75% { transform: translate(4px, -2px) scale(1.02); }
}

.mash-mascot { font-size: 5rem; line-height: 1; }
.mash-mascot.eating { animation: chomp 0.15s ease-in-out infinite; }

.mash-button.tapped { transform: scale(0.92); transition: transform 0.05s ease-out; }
.mash-button.idle {
  filter: grayscale(0.3) brightness(0.7);
  cursor: default;
}
.mash-button.idle::after {
  content: 'ESPERANDO…';
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
}

/* Big mascot reaction (player screen on correct/wrong) */
.big-mascot {
  font-size: 9rem;
  line-height: 1;
  display: inline-block;
}
.big-mascot.happy { animation: happyBounce 0.5s ease-out; }
.big-mascot.angry { animation: angryShake 0.5s ease-out; }
@keyframes happyBounce {
  0% { transform: scale(0.5) translateY(40px); opacity: 0; }
  40% { transform: scale(1.3) translateY(-10px); opacity: 1; }
  60% { transform: scale(1.1) translateY(0); }
  80% { transform: scale(1.15) translateY(-5px); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes angryShake {
  0% { transform: scale(0.5) rotate(0); opacity: 0; }
  20% { transform: scale(1.2) rotate(-12deg); opacity: 1; }
  40% { transform: scale(1.15) rotate(12deg); }
  60% { transform: scale(1.1) rotate(-8deg); }
  80% { transform: scale(1.05) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

.sparkle {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  z-index: 30;
  animation: sparkleFly 0.9s ease-out forwards;
}
@keyframes sparkleFly {
  0% { transform: translate(0, 0) scale(0.5) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, -100px)) scale(1.2) rotate(var(--rot, 360deg)); opacity: 0; }
}
.mash-counter {
  font-size: 4rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.mash-timer {
  height: 6px;
  width: 80%;
  max-width: 400px;
  background: rgba(13, 14, 26, 0.4);
  border-radius: 999px;
  margin-top: 24px;
  overflow: hidden;
}
.mash-timer-fill { height: 100%; background: white; transition: width 0.05s linear; }

.combo-banner {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  font-weight: 900;
  color: var(--gold-glow);
  text-shadow: 0 0 30px var(--gold-glow);
  pointer-events: none;
  animation: comboBanner 0.6s ease-out forwards;
  z-index: 50;
}
@keyframes comboBanner {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(0); }
  30% { opacity: 1; transform: translateX(-50%) scale(1.2) translateY(-10px); }
  100% { opacity: 0; transform: translateX(-50%) scale(1) translateY(-40px); }
}

/* FLOATING DUMPLINGS */
.dumpling {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  animation: floatUp 0.8s ease-out forwards;
  z-index: 30;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.5) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-200px) scale(1.3) rotate(360deg); opacity: 0; }
}

/* RESULT FEEDBACK */
.result-feedback {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}
.result-feedback .emoji { font-size: 6rem; animation: questionPop 0.4s ease-out; }
.result-feedback h2 { font-size: 2.5rem; font-weight: 900; font-family: 'ZCOOL XiaoWei', serif; }
.result-feedback h2.correct { color: var(--jade); }
.result-feedback h2.wrong { color: var(--red-glow); }

/* WIN SCREEN */
.win-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
}

/* Cinematic narration card that pops in after the winner banner */
.win-narration {
  background: rgba(13, 14, 26, 0.85);
  border: 2px solid rgba(255, 213, 122, 0.4);
  border-radius: 18px;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  max-width: 480px;
  margin: 16px auto;
  animation: narrationIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.4s;
  opacity: 0;
}
.win-narration strong { color: var(--gold-glow); }
.win-narration .red-team { color: var(--red-glow); }
.win-narration .gold-team { color: var(--gold-glow); }

@keyframes narrationIn {
  from { transform: scale(0.7) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* MVP shoutout — special call-out for the top scorer */
.win-mvp {
  background: linear-gradient(135deg, rgba(255, 213, 122, 0.15), rgba(255, 90, 102, 0.1));
  border: 1px solid rgba(255, 213, 122, 0.5);
  border-radius: 14px;
  padding: 12px 20px;
  margin: 8px auto;
  max-width: 380px;
  font-weight: 800;
  font-size: 0.95rem;
  animation: narrationIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 1.2s;
  opacity: 0;
}
.win-mvp .mvp-name { color: var(--gold-glow); font-size: 1.15rem; }

/* Encouragement banner for the losing side / players */
.win-encourage {
  color: var(--ink-dim);
  font-style: italic;
  margin-top: 12px;
  animation: narrationIn 0.5s ease-out both;
  animation-delay: 2s;
  opacity: 0;
}
.winner-banner {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  margin-bottom: 8px;
  animation: questionPop 0.6s ease-out;
}
.winner-banner.red { color: var(--red-glow); text-shadow: 0 0 60px var(--red-glow); }
.winner-banner.gold { color: var(--gold-glow); text-shadow: 0 0 60px var(--gold-glow); }
.winner-banner.tie { color: var(--ink); }

.final-scores {
  display: flex;
  gap: 32px;
  margin: 32px 0;
  font-size: 2rem;
  font-weight: 900;
}
.final-scores .red { color: var(--red-glow); }
.final-scores .gold { color: var(--gold-glow); }

.confetti {
  position: fixed;
  top: -20px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: 200;
  animation: confettiFall 3s linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); }
}

.leaderboard {
  width: 100%;
  max-width: 500px;
  margin-top: 24px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: rgba(35, 39, 68, 0.7);
  border-radius: 10px;
  font-weight: 700;
}
.lb-row.red { border-left: 4px solid var(--red); }
.lb-row.gold { border-left: 4px solid var(--gold); }
.lb-rank { font-size: 1.4rem; min-width: 40px; }
.lb-name { flex: 1; }
.lb-score { font-weight: 900; font-variant-numeric: tabular-nums; }

/* UPLOAD AREA */
.upload-area {
  border: 2px dashed rgba(244, 232, 208, 0.25);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  background: rgba(13, 14, 26, 0.3);
}
.upload-area .label {
  display: inline-block;
  background: var(--bg-surface);
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  margin-top: 10px;
}
.upload-area .label:hover { background: rgba(244, 232, 208, 0.1); }
.upload-status { margin-top: 8px; font-size: 0.9rem; }
.upload-status.ok { color: var(--jade); }
.upload-status.err { color: var(--red-glow); }

.muted-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: rgba(13, 14, 26, 0.8);
  border: 1px solid rgba(244, 232, 208, 0.2);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

/* Reconnecting overlay — friendly, non-scary */
.reconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 14, 26, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 200;
  pointer-events: auto;
  transition: opacity 0.3s;
}
.reconnect-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.reconnect-spinner {
  font-size: 4rem;
  animation: reconnectFloat 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px var(--gold-glow));
}
@keyframes reconnectFloat {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-12px) rotate(3deg); }
}
.reconnect-text {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-glow);
  text-align: center;
  padding: 0 20px;
}

/* Sticky PIN badge — visible during active game so latecomers can join */
.sticky-pin {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 14, 26, 0.85);
  border: 2px solid rgba(255, 213, 122, 0.4);
  border-radius: 12px;
  padding: 8px 16px;
  box-shadow: 0 0 20px rgba(255, 213, 122, 0.15);
  backdrop-filter: blur(6px);
}
.sticky-pin-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  font-weight: 800;
  text-transform: uppercase;
}
.sticky-pin-value {
  font-family: 'ZCOOL XiaoWei', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, var(--gold-glow), var(--red-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

/* === Bulletproof answer "Sending..." overlay ===
   Pinned over the question screen the instant a player taps an answer so they
   always have visual confirmation that their tap registered, even when the
   network is slow. Cleared automatically by the answer-result/answer-stale
   handlers. */
.sending-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.82);
  color: #ffd57a;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: 1.1rem;
  padding: 16px 28px;
  border: 2px solid rgba(255, 213, 122, 0.6);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  pointer-events: none;
  text-align: center;
  min-width: 220px;
  animation: sending-pulse 0.9s ease-in-out infinite alternate;
}
.sending-overlay.hidden { display: none; }
@keyframes sending-pulse {
  from { transform: translate(-50%, -50%) scale(1);    opacity: 0.92; }
  to   { transform: translate(-50%, -50%) scale(1.04); opacity: 1; }
}

/* ============================================================ */
/* === Global Reward Toast — DISABLED (user request 2026-05-25) === */
/* Yellow/red balloon pills were too visually intrusive. JS is now a
   no-op (see rewards.js); CSS hides anything that slips through. */
/* ============================================================ */
.reward-toast-layer,
.reward-toast { display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
.reward-toast-layer--legacy-disabled {
  position: fixed;
  left: 50%;
  bottom: clamp(64px, 12vh, 120px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 9988; /* below zombie ambience (9990+), above gameplay */
  max-width: 92vw;
}
.reward-toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(20, 20, 26, 0.92), rgba(45, 30, 60, 0.92));
  border: 2px solid rgba(255, 213, 122, 0.7);
  border-radius: 999px;
  color: #fff7e0;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: clamp(0.95rem, 2.6vmin, 1.15rem);
  letter-spacing: 0.02em;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(255, 213, 122, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(20px) scale(0.85);
  transition: opacity 0.32s ease-out, transform 0.32s cubic-bezier(.2, 1.4, .3, 1);
  max-width: 100%;
}
.reward-toast.in {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.reward-toast.out {
  opacity: 0;
  transform: translateY(-16px) scale(0.95);
  transition: opacity 0.35s ease-in, transform 0.35s ease-in;
}
.reward-toast-icon {
  font-size: 1.5em;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.reward-toast-text { line-height: 1.1; }

/* Tier flavors — visual weight grows with the moment */
.reward-toast.tier-common {
  border-color: rgba(180, 230, 130, 0.65);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(180, 230, 130, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.reward-toast.tier-great {
  border-color: rgba(255, 213, 122, 0.85);
  background: linear-gradient(135deg, rgba(40, 25, 8, 0.92), rgba(80, 50, 16, 0.92));
}
.reward-toast.tier-epic {
  border-color: #ff5a66;
  background: linear-gradient(135deg, rgba(60, 8, 16, 0.95), rgba(110, 20, 40, 0.95));
  color: #ffe7a0;
  font-size: clamp(1.05rem, 3vmin, 1.4rem);
  padding: 12px 22px;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(255, 90, 102, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: reward-epic-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes reward-epic-pulse {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(0) scale(1.05); }
}
.reward-toast.tier-combo {
  border-color: #ff9a3c;
  background: linear-gradient(135deg, rgba(60, 20, 0, 0.95), rgba(120, 40, 0, 0.95));
  color: #ffd57a;
}
.reward-toast.tier-streak {
  border-color: #ff5a66;
  background: linear-gradient(135deg, rgba(60, 8, 16, 0.92), rgba(110, 20, 40, 0.9));
}
.reward-toast.tier-speed {
  border-color: #9fd5ff;
  background: linear-gradient(135deg, rgba(8, 20, 50, 0.92), rgba(15, 45, 100, 0.92));
  color: #c8e4ff;
}

/* === Avatar chip on host player lists (every host page; moved from the retired zombie.css 2026-10-10) === */
.chip-avatar {
  margin-right: 6px;
  font-size: 1.15rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* === Shared styles rescued 2026-10-11 from CSS files retired on 2026-10-10 (they were used by every game) === */
.market-banner {
  font-family: 'Long Cang', 'ZCOOL XiaoWei', serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ff5a66, #ffd57a, #ff5a66);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(255, 213, 122, 0.4);
}
.music-chip {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 9999;
  background: rgba(8, 22, 36, 0.92);
  border: 2px solid #5be8d1;
  color: #5be8d1;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  box-shadow: 0 0 18px rgba(91, 232, 209, 0.55);
  animation: music-chip-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
  font-family: 'Nunito', sans-serif;
}
.music-chip.hidden { display: none;
}
#timer-display.urgent {
  color: #ff6677; text-shadow: 0 0 20px #ff6677;
  animation: tri-timer-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes music-chip-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(91, 232, 209, 0.55); transform: scale(1); }
  50%      { box-shadow: 0 0 32px rgba(91, 232, 209, 0.95); transform: scale(1.05); }
}
@keyframes tri-timer-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.07); }
}
.avatar-picker {
  margin: 16px 0;
  padding: clamp(10px, 2.5vw, 16px);
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255, 213, 122, 0.45);
  border-radius: 16px;
  max-width: 100%;
  box-sizing: border-box;
}
.avatar-picker-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--gold-glow, #ffd57a);
  text-align: center;
  font-size: clamp(0.9rem, 2.4vw, 1.15rem);
  margin-bottom: 10px;
}
.avatar-grid {
  display: grid;
  
  grid-template-columns: repeat(auto-fit, minmax(clamp(48px, 10vw, 64px), 1fr));
  gap: clamp(6px, 1.4vw, 10px);
  width: 100%;
  box-sizing: border-box;
}
.avatar-cell {
  
  aspect-ratio: 1 / 1;
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 213, 122, 0.22);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, border-color 0.2s ease,
              background 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
}
.avatar-cell:active { transform: scale(0.9);
}
.avatar-cell.selected {
  background: rgba(255, 213, 122, 0.28);
  border-color: var(--gold-glow, #ffd57a);
  box-shadow: 0 0 18px rgba(255, 213, 122, 0.7), inset 0 0 8px rgba(255, 240, 200, 0.4);
  transform: scale(1.08);
}

/* 2026-10-12 — the lobby avatar picker shows the saga pictures (only our roster) */
.avatar-cell.avatar-cell-saga { padding: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.9); }
.avatar-cell.avatar-cell-saga img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; pointer-events: none; }
