/*
 * Casual-arcade skin matching the CrazyGames reference: saturated gradients,
 * chunky extruded buttons, heavy rounded type and springy pop animations.
 * Everything is drawn with CSS — the game ships with zero image assets.
 */

:root {
  --ink: #ffffff;
  --muted: #b9cdf2;
  --deep: #0f1e3d;

  --accent: #ffb020;
  --accent-lo: #ff8a09;
  --accent-shadow: #c25c00;

  --blue: #38a8ff;
  --blue-lo: #1f78e8;
  --blue-shadow: #14509c;

  --green: #35d67a;
  --green-shadow: #14914a;
  --red: #ff5d6c;

  --card: linear-gradient(180deg, rgba(20, 28, 45, 0.95), rgba(12, 18, 30, 0.98));
  --line: rgba(150, 190, 255, 0.12);
  color-scheme: dark;
}

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

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #081128;
  font-family: ui-rounded, 'Segoe UI Variable Display', 'Segoe UI', Nunito,
    system-ui, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  position: relative;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  /* The bat is solved to sit under the pointer, so it doubles as the cursor —
     but showing the normal arrow on top makes it clear where you're aiming. */
  cursor: default;
}

/* Warm arena vignette. Transparent over the table (centred slightly high, where
   the table sits) and ramping to near-black at the corners — the reference's
   surroundings fade into shadow rather than showing lit walls to the edges.
   pointer-events:none so it never eats input; no z-index so DOM order keeps it
   above the canvas but under the HUD/overlay. */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    125% 105% at 50% 43%,
    rgba(0, 0, 0, 0) 36%,
    rgba(14, 16, 20, 0.26) 60%,
    rgba(8, 9, 12, 0.6) 82%,
    rgba(0, 0, 0, 0.85) 100%
  );
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- animation */

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  60% {
    transform: translateY(0) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6) rotate(-4deg);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12) rotate(1.5deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes score-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: translateX(-50%) scale(0.98);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.04);
  }
}

@keyframes shine {
  0% {
    transform: translateX(-120%) skewX(-18deg);
  }
  100% {
    transform: translateX(320%) skewX(-18deg);
  }
}

@keyframes float-in {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(-8deg);
  }
  70% {
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* --------------------------------------------------------------------- HUD */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scoreboard {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  animation: pop-in 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Flag plates either side of the score, as in the reference. */
.scoreboard .flag,
.scoreboard img.flag {
  display: block;
  width: 54px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  background: rgba(20, 12, 6, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

/*
 * Score digits as flip-clock cards: a white tile with a dark seam across the
 * middle. The seam is what makes it read as a mechanical scoreboard rather
 * than as plain text on a box.
 */
.scoreboard .digit {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 44px;
  padding: 0 4px;
  font-size: 30px;
  font-weight: 900;
  color: #241a12;
  background: linear-gradient(180deg, #ffffff 0%, #e8e2d8 49%, #f6f2ec 51%, #d9d2c6 100%);
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.scoreboard .digit::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.28);
}

.scoreboard .digit.bump {
  animation: score-bump 0.36s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.game-score {
  position: absolute;
  top: max(58px, calc(env(safe-area-inset-top) + 48px));
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(220, 233, 255, 0.7);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(10, 22, 46, 0.45);
  border: 1px solid rgba(150, 190, 255, 0.15);
  white-space: nowrap;
}

.hud-buttons {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(30, 18, 10, 0.42);
  backdrop-filter: blur(4px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  color: #fff;
  pointer-events: auto;
  cursor: pointer;
  overflow: visible;
}

.icon-btn::after {
  display: none;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.icon-btn:active {
  transform: scale(0.93);
}

/* The slash only shows when muted; the wave only when not. */
.icon-btn .slash {
  opacity: 0;
}

.icon-btn.muted .slash {
  opacity: 1;
}

.icon-btn.muted .wave {
  opacity: 0;
}

.serve-indicator {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #dce9ff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(10, 22, 46, 0.5);
  border: 1px solid var(--line);
}

/* Before the first serve the element exists but has no text, and its padding
   and background still drew a stray pill at the bottom of the screen. */
.serve-indicator:empty {
  display: none;
}

.serve-indicator.prompt {
  color: #08101f;
  background: linear-gradient(180deg, #ffd463, var(--accent-lo));
  border-color: rgba(255, 255, 255, 0.5);
  animation: breathe 1.2s ease-in-out infinite;
}

.toast {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: clamp(20px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  -webkit-text-stroke: 3px rgba(6, 14, 32, 0.75);
  paint-order: stroke fill;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  text-align: center;
}

.toast.show {
  animation: toast-pop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
}

.toast.win {
  color: #7bf0ab;
}
.toast.lose {
  color: #ff8b8b;
}

/* ----------------------------------------------------------- overlay/menus */

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at top, rgba(30, 60, 110, 0.3) 0%, transparent 60%),
    radial-gradient(circle at center, transparent 0%, rgba(5, 10, 20, 0.8) 100%),
    rgba(10, 16, 32, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  overflow-y: auto;
}

#overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 40px 70px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 50px 160px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 40px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 130px 80px, #ffffff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.15;
  pointer-events: none;
}



#overlay.hidden {
  display: none !important;
}

.panel {
  position: relative;
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  animation: pop-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1) both;
  margin: auto;
}

.panel h1 {
  font-size: clamp(24px, 6.5vw, 36px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6d8 30%, var(--accent) 75%, var(--accent-lo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(6, 14, 32, 0.55));
  margin-bottom: 4px;
}

.panel h2 {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 900;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 3px 0 rgba(6, 14, 32, 0.45);
}

.panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.panel .kicker {
  display: inline-block;
  color: #08101f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd463, var(--accent-lo));
  box-shadow: 0 3px 0 var(--accent-shadow);
  margin-bottom: 14px;
}

/* ------------------------------------------------ title hero (new design) */

.title-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  animation: float-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.logo-img {
  width: 110px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.title-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.title-main {
  display: block;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.title-sub {
  display: block;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
}

.globe-icon {
  margin-top: 2px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.record {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Play button — big yellow pill matching the reference's rounded play btn. */
/* Progress/Stats Box */
.stats-box {
  background: rgba(10, 18, 34, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  margin: 20px 0;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.stat-row.top {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.02em;
}

.stat-value-sm {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.stat-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-bar-container:last-child {
  margin-bottom: 0;
}

.stat-bar-label {
  flex: 1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-bar-track {
  width: 140px;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.stat-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
}

.stat-bar-value {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  width: 30px;
  text-align: right;
}

/* Hints Grid */
.hints {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.hint-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hint-icon {
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  color: #fff;
}

.hint-icon svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
}

.hint-text {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
}

.play-btn {
  background: var(--accent);
  color: #111;
  border: 0;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 176, 32, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: transform 0.1s;
}

.play-btn svg {
  width: 20px;
  height: 20px;
  fill: #111;
}

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

/* ------------------------------------------------ VS / opponent screen */

.vs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.vs-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  color: var(--muted);
}

.vs-progress .trophy-svg {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.vs-level {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(9, 20, 42, 0.5);
  border: 1px solid var(--line);
}

.vs-paddles {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 8px 0 12px;
  animation: float-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.vs-number {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  -webkit-text-stroke: 2px rgba(180, 30, 30, 0.6);
  paint-order: stroke fill;
}

.vs-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 4px 0 12px;
}

.vs-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 120px;
}

img.vs-flag,
.vs-flag {
  display: block;
  width: 90px;
  height: 60px;
  max-width: 90px;
  max-height: 60px;
  min-width: 90px;
  min-height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 2.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.vs-text {
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(6, 14, 32, 0.6);
}

.vs-opponent-name {
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------ result screen */

.result-trophy {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 8px;
  animation: float-in 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.result-trophy .trophy-svg {
  filter: drop-shadow(0 6px 14px rgba(255, 176, 32, 0.5));
}

.result-score {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 16px;
}

button {
  background: var(--accent);
  color: #111;
  border: 0;
  border-radius: 12px;
  padding: 15px 32px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 176, 32, 0.3);
  transition: transform 0.1s;
}

button:active {
  transform: translateY(2px);
}

button.ghost {
  background: rgba(255,255,255,0.05);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: none;
  border-radius: 12px;
  font-size: 14px;
  padding: 15px 24px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.actions button {
  width: 100%;
}

.reset-link {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 24px;
  cursor: pointer;
  text-decoration: none;
}

.reset-link:hover {
  color: rgba(255,255,255,0.6);
}

/* ------------------------------------------------------------ country grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin: 16px 0 20px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 10px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(72, 118, 195, 0.35), rgba(24, 47, 92, 0.5));
  box-shadow: 0 4px 0 rgba(6, 14, 32, 0.45);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
  overflow: visible;
}

.chip::after {
  display: none;
}

.chip:hover {
  filter: brightness(1.15);
}

.chip:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(6, 14, 32, 0.45);
}

.chip.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 212, 99, 0.35), rgba(255, 138, 9, 0.3));
  box-shadow: 0 4px 0 var(--accent-shadow), 0 0 18px rgba(255, 176, 32, 0.45);
}

img.big {
  display: block;
  width: 46px;
  height: 31px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
  margin: 0 auto;
}

.fighter img.big {
  width: 74px;
  height: 50px;
  border-radius: 6px;
  border-width: 2px;
}

.chip .big {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

/* ------------------------------------------------------------- versus card */

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 8px 0 16px;
}

.fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border-radius: 20px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(72, 118, 195, 0.3), rgba(20, 40, 80, 0.45));
}

.fighter.you {
  border-color: rgba(255, 190, 90, 0.5);
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.28), rgba(150, 82, 0, 0.28));
}

.fighter .big {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}

.fighter .who {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.fighter .title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.versus .clash {
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(6, 14, 32, 0.6);
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.bar {
  height: 12px;
  flex: 0 1 220px;
  border-radius: 999px;
  background: rgba(4, 12, 28, 0.6);
  border: 2px solid rgba(150, 190, 255, 0.2);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--accent) 60%, var(--red));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------------------- how-to-play list removed */

/* -------------------------------------------------------------- tour meter */

.tourbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 12px;
  max-width: 340px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.tourbar .trophy-svg {
  vertical-align: middle;
  margin-left: 2px;
}

.trophy {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 6px 10px rgba(255, 176, 32, 0.45));
  animation: pop-in 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@media (max-width: 600px) {
  .panel {
    padding: 20px 16px 18px;
    border-radius: 22px;
  }
  .title-main {
    font-size: 24px;
  }
  .title-sub {
    font-size: 20px;
  }
  .vs-number {
    font-size: 28px;
  }
  img.vs-flag {
    width: 56px;
    height: 38px;
  }
  .play-btn {
    padding: 14px 32px;
    font-size: 16px;
  }
  .scoreboard {
    transform: scale(0.85);
    transform-origin: top left;
    left: max(10px, env(safe-area-inset-left));
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .icon-btn svg {
    width: 20px;
    height: 20px;
  }
  .hud-buttons {
    gap: 6px;
  }
}

/* --------------------------------------------------------------------------
   Mobile landscape (short viewport). The menu panels — the title with the
   World Tour / Cup buttons, the VS/opponent screen, country select, results —
   are tall enough to overflow a phone's short landscape height, so the player
   has to scroll to reach the buttons. Shrink the whole panel with `zoom` (a
   real layout shrink that also reduces the scroll height, unlike a transform)
   plus trim the tallest title-screen bits, so everything fits without
   scrolling. Keyed to a short HEIGHT, so tablets (tall in landscape) and the
   3D game/HUD are untouched — this only compacts the menu overlay.
   -------------------------------------------------------------------------- */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay {
    padding: 8px;
    /* if a panel is still taller than the screen, scroll from the top rather
       than clip it (a centred grid item can't be scrolled up to) */
    place-items: safe center;
  }
  .panel {
    zoom: 0.8; /* the "zoom out" so the menus fit the short landscape height */
    padding: 16px 20px;
    margin: auto;
  }
  /* the title screen is the tallest — trim its biggest space users further */
  .title-hero { gap: 4px; }
  .logo-img { width: 60px; }
  .record { margin-bottom: 6px; }
  .stats-box { margin: 10px 0; padding: 12px; }
  .stat-row { margin-bottom: 6px; }
  .stat-row.top { padding-bottom: 8px; margin-bottom: 10px; }
  .stat-bar-container { margin-bottom: 6px; }
  .hints { margin-bottom: 10px; }
  .hint-box { padding: 10px 6px; gap: 8px; }
  .play-btn { padding: 12px 24px; }
  /* VS / opponent ("continue to cup") screen */
  .vs-paddles { margin: 4px 0 8px; }
  .vs-matchup { margin: 4px 0 8px; }
}

/* Small inline flag shown beside the opponent number on the VS and result
   screens, now that the opponent's (fictional) person-name is hidden. */
.kicker-flag,
.name-flag {
  height: 0.95em;
  width: auto;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
