/* ═══════════════════ RESET & BASE ═══════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --sky:    #87CEEB;
  --ground: #ded895;
  --grass:  #74bf2e;
  --gold:   #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  background: var(--sky);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ═══════════════════ SCREENS ═══════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
.screen.active { display: flex; }

/* ═══════════════════ SKY BACKGROUND ═══════════════════ */
.sky-bg {
  position: absolute;
  inset: 0;
  background: var(--sky);
  z-index: 0;
}
.bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ═══════════════════ GROUND ═══════════════════ */
.ground-strip {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 112px;
  background: var(--ground);
  z-index: 2;
}
.ground-strip::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 16px;
  background: var(--grass);
  border-top: 3px solid #3d6b15;
}

/* ═══════════════════ CHANNEL LINK ═══════════════════ */
.tg-channel-link {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(230, 126, 34, 0.2);
  border: 1px solid rgba(230, 126, 34, 0.5);
  border-radius: 20px;
  color: #e67e22;
  font-size: 12px;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.tg-channel-link:active {
  background: rgba(230, 126, 34, 0.35);
}

/* ═══════════════════ MAINTENANCE ═══════════════════ */
.maintenance-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 32px;
  text-align: center;
  background: #1a1a2e;
}
.maintenance-icon {
  font-size: 72px;
  margin-bottom: 24px;
  animation: spin-slow 4s linear infinite;
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.maintenance-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #f5c800;
  margin: 0 0 20px;
  line-height: 1.5;
}
.maintenance-text {
  font-size: 14px;
  color: #ccc;
  line-height: 1.6;
  max-width: 300px;
}

/* ═══════════════════ BUTTONS ═══════════════════ */
.btn {
  display: block;
  width: 100%;
  max-width: 260px;
  padding: 11px 0;
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #fff;
  cursor: pointer;
  margin: 8px auto;
  text-shadow: 1px 2px 0 rgba(0,0,0,.35);
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: none !important;
}

.btn-green {
  background: #73bf2e;
  box-shadow: 0 5px 0 #3d6b15, inset 0 2px 0 #a5f050;
  border: 3px solid #2a5a12;
}
.btn-yellow {
  background: #f5d020;
  box-shadow: 0 5px 0 #a07808, inset 0 2px 0 #ffe860;
  border: 3px solid #8a6000;
  color: #543100;
  text-shadow: 1px 1px 0 rgba(255,255,255,.3);
}
.btn-gray {
  background: #8fa4b8;
  box-shadow: 0 5px 0 #3d5a70, inset 0 2px 0 #b8cce0;
  border: 3px solid #3d5a70;
}
.btn-purple {
  background: #a855f7;
  box-shadow: 0 5px 0 #5b21b6, inset 0 2px 0 #cc88ff;
  border: 3px solid #4a1a8a;
}
.music-toggle-wrap { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.btn-music {
  background: #2a2a40;
  box-shadow: 0 5px 0 #111, inset 0 2px 0 #444;
  border: 3px solid #555;
  font-size: 9px;
  padding: 8px 16px;
}
.btn-music.off { opacity: 0.5; }
.btn-red {
  background: #e74c3c;
  box-shadow: 0 5px 0 #8b1a1a, inset 0 2px 0 #ff6b5b;
  border: 3px solid #8b1a1a;
}
.btn-orange {
  background: #e67e22;
  box-shadow: 0 5px 0 #8a4a10, inset 0 2px 0 #f5a623;
  border: 3px solid #8a4a10;
}

/* ═══════════════════ BATTLE — Gradient Cards Style ═══════════════════ */
.battle-screen {
  background: linear-gradient(180deg, #1a0a2e, #0d0d2b);
  align-items: stretch;
  overflow-y: auto;
}
.battle-screen .lb-header {
  background: none; padding: 12px 16px;
}
.battle-screen .lb-header h2 {
  font-size: 12px; letter-spacing: 2px; margin-right: 36px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

/* ── Battle buttons override ── */
.battle-screen .btn {
  border-radius: 12px; font-size: 9px; padding: 13px 0;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}
.battle-screen .btn-orange {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  border: 2px solid #f5c542; box-shadow: 0 4px 0 #8a4a10;
}
.battle-screen .btn-red {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  border: 2px solid #ff6666; box-shadow: 0 4px 0 #880000;
}
.battle-screen .btn-gray {
  background: linear-gradient(135deg, #5a5a7a, #3a3a55);
  border: 2px solid #7a7a9a; box-shadow: 0 4px 0 #2a2a40;
}
.battle-screen .btn:active { transform: translateY(3px); box-shadow: none; }

/* ── Rank colors ── */
.rank-bronze      { background: linear-gradient(135deg, #c97b2a, #8B5E3C); color: #fff; border: 2px solid #e8a84c; box-shadow: 0 3px 0 #6b3a1a; }
.rank-silver      { background: linear-gradient(135deg, #9aa0aa, #7B8794); color: #fff; border: 2px solid #b5bcc5; box-shadow: 0 3px 0 #555; }
.rank-gold        { background: linear-gradient(135deg, #e8c92a, #DAA520); color: #1a1a1a; border: 2px solid #f5e050; box-shadow: 0 3px 0 #8a6a00; }
.rank-platinum    { background: linear-gradient(135deg, #64d8ff, #4FC3F7); color: #1a1a1a; border: 2px solid #90e4ff; box-shadow: 0 3px 0 #2a8ab0; }
.rank-diamond     { background: linear-gradient(135deg, #c9a0ff, #B388FF); color: #1a1a1a; border: 2px solid #dfc0ff; box-shadow: 0 3px 0 #7a50cc; }
.rank-master      { background: linear-gradient(135deg, #ff9060, #FF7043); color: #fff; border: 2px solid #ffb090; box-shadow: 0 3px 0 #b04020; }
.rank-grandmaster { background: linear-gradient(135deg, #ff5252, #E53935); color: #fff; border: 2px solid #ff8a80; box-shadow: 0 3px 0 #8b0000; }
.rank-legend      { background: linear-gradient(135deg, #FFD700, #FF6B35); color: #1a1a1a; border: 2px solid #ffe060; box-shadow: 0 3px 0 #b08000; }

/* ── Profile Card ── */
.b-profile-card {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #2d1b69, #1a1145);
  border: 2px solid #5b3cc4; border-radius: 14px;
  padding: 14px 16px; margin: 12px 16px 0;
  box-shadow: 0 4px 0 #1a0a3e;
}
.b-profile-left { display: flex; align-items: center; gap: 10px; }
.b-rank-badge {
  width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; font-weight: bold;
}
.b-profile-info { display: flex; flex-direction: column; gap: 2px; }
.b-profile-elo { font-size: 14px; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,0.5); }
.b-profile-rank { font-size: 7px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 1px; }
.b-profile-stats { display: flex; gap: 12px; }
.b-stat { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.b-stat-val { font-size: 13px; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,0.4); }
.b-stat-lbl { font-size: 6px; color: rgba(255,255,255,0.5); }

/* ── Find Match Button ── */
.b-find-btn {
  display: block; width: calc(100% - 32px); margin: 14px auto 0;
  padding: 16px; border-radius: 12px;
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: #fff; font-family: inherit; font-size: 11px; cursor: pointer;
  letter-spacing: 2px; text-transform: uppercase; text-align: center;
  border: 2px solid #ff6666;
  box-shadow: 0 5px 0 #880000, 0 5px 20px rgba(255,0,0,0.3);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
  transition: transform 0.08s, box-shadow 0.08s;
  touch-action: manipulation;
}
.b-find-btn:active {
  transform: translateY(4px) scale(0.97);
  box-shadow: 0 1px 0 #880000;
}

/* ── Open Rooms ── */
.b-rooms-header {
  font-size: 7px; color: rgba(255,255,255,0.35); letter-spacing: 2px;
  text-align: center; margin: 16px 16px 8px;
  padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06);
}
.b-room-list {
  padding: 0 16px; display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; max-height: 40vh;
}
.b-empty { font-size: 8px; color: rgba(255,255,255,0.3); text-align: center; padding: 24px 0; }
.b-room-item {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #1e1450, #151040);
  border-radius: 12px; padding: 12px 14px;
  border: 2px solid #3d2b7a;
}
.b-room-info { display: flex; align-items: center; gap: 8px; }
.b-room-badge {
  width: 30px; height: 30px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 10px; font-weight: bold;
}
.b-room-text { display: flex; flex-direction: column; gap: 2px; }
.b-room-name { font-size: 8px; color: rgba(255,255,255,0.9); text-shadow: 1px 1px 0 rgba(0,0,0,0.4); }
.b-room-elo { font-size: 7px; color: rgba(255,255,255,0.45); }
.b-room-fight {
  padding: 8px 16px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  color: #fff; font-family: inherit;
  font-size: 7px; cursor: pointer; letter-spacing: 1px;
  border: 2px solid #6ddc71;
  box-shadow: 0 3px 0 #1b5e20;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
.b-room-fight:active { transform: translateY(2px); box-shadow: none; }

/* ══════════ WAITING SCREEN ══════════ */
.b-wait-body {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px; gap: 16px; min-height: 70vh; justify-content: center;
}
.b-wait-timer-wrap { text-align: center; }
.b-wait-timer-label { font-size: 6px; color: rgba(255,255,255,0.4); letter-spacing: 2px; margin-bottom: 4px; }
.b-wait-timer { font-size: 28px; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,0.5); }
.b-wait-info { text-align: center; }
.b-wait-vs { display: flex; align-items: center; gap: 20px; }
.b-wait-card { text-align: center; width: 90px; }
.b-wait-avatar {
  width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; border: 3px solid transparent;
}
.b-wait-avatar.you-glow {
  background: linear-gradient(135deg, rgba(76,175,80,0.2), rgba(46,125,50,0.15));
  border-color: #6ddc71; box-shadow: 0 0 20px rgba(76,175,80,0.3); color: #6ddc71;
}
.b-wait-avatar.opp-glow {
  background: linear-gradient(135deg, rgba(91,60,196,0.15), rgba(61,43,122,0.1));
  border-color: #5b3cc4; border-style: dashed; color: rgba(255,255,255,0.2);
}
.b-wait-name { font-size: 7px; color: rgba(255,255,255,0.6); }
.b-wait-vs-icon { font-size: 16px; color: rgba(255,255,255,0.2); text-shadow: 1px 1px 0 rgba(0,0,0,0.4); }
.b-wait-dots { display: flex; gap: 6px; }
.b-wait-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: #5b3cc4;
  animation: waitDot 1.4s ease-in-out infinite;
}
.b-wait-dots span:nth-child(2) { animation-delay: 0.2s; }
.b-wait-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes waitDot { 0%,80%,100%{opacity:0.2;transform:scale(1)} 40%{opacity:1;transform:scale(1.4)} }
.b-wait-btns { display: flex; gap: 8px; width: 100%; padding: 0 16px; }
.b-wait-btns .btn { flex: 1; font-size: 8px; }

/* ══════════ RESULT SCREEN ══════════ */
.b-result-body {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px; gap: 16px; min-height: 100vh; justify-content: center;
}
.b-result-title {
  font-size: 24px; text-transform: uppercase; letter-spacing: 4px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}
.b-result-title.win { color: #ffd700; text-shadow: 2px 2px 0 rgba(0,0,0,0.5), 0 0 30px rgba(255,215,0,0.4); }
.b-result-title.lose { color: #ff4444; text-shadow: 2px 2px 0 rgba(0,0,0,0.5), 0 0 20px rgba(255,68,68,0.3); }
.b-result-title.draw { color: #aaa; text-shadow: 2px 2px 0 rgba(0,0,0,0.5); }
.b-result-players { display: flex; align-items: center; gap: 16px; }
.b-result-p { text-align: center; width: 110px; }
.b-result-avatar {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  border: 3px solid transparent;
}
.b-result-avatar.winner {
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.1));
  border-color: #ffd700;
  box-shadow: 0 0 25px rgba(255,215,0,0.35), 0 4px 0 rgba(180,150,0,0.4);
}
.b-result-avatar.loser {
  background: linear-gradient(135deg, rgba(100,100,140,0.15), rgba(60,60,90,0.1));
  border-color: #3d2b7a; opacity: 0.6;
}
.b-result-name { font-size: 7px; color: rgba(255,255,255,0.7); margin-bottom: 4px; }
.b-result-score { font-size: 26px; text-shadow: 2px 2px 0 rgba(0,0,0,0.5); }
.b-result-score.bright { color: #ffd700; }
.b-result-score.dim { color: rgba(255,255,255,0.3); }
.b-result-lbl { font-size: 5px; color: rgba(255,255,255,0.45); margin-top: 3px; letter-spacing: 1px; }
.b-result-vs { font-size: 14px; color: rgba(255,255,255,0.15); align-self: center; }

/* ELO box */
.b-elo-box {
  text-align: center; border-radius: 14px; padding: 14px 24px;
  width: calc(100% - 32px); margin: 0 16px;
}
.b-elo-box.gain {
  background: linear-gradient(135deg, rgba(76,175,80,0.15), rgba(46,125,50,0.1));
  border: 2px solid #4caf50; box-shadow: 0 4px 0 rgba(27,94,32,0.4);
}
.b-elo-box.loss {
  background: linear-gradient(135deg, rgba(255,68,68,0.15), rgba(204,0,0,0.1));
  border: 2px solid #ff4444; box-shadow: 0 4px 0 rgba(136,0,0,0.4);
}
.b-elo-box .battle-prize-label { font-size: 6px; color: rgba(255,255,255,0.45); letter-spacing: 1px; }
.b-elo-delta { font-size: 24px; margin-top: 4px; text-shadow: 2px 2px 0 rgba(0,0,0,0.4); }
.b-elo-box.gain .b-elo-delta { color: #6ddc71; }
.b-elo-box.loss .b-elo-delta { color: #ff6b6b; }
.b-new-rank {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 10px; color: rgba(255,255,255,0.6);
  background: linear-gradient(135deg, rgba(91,60,196,0.15), rgba(61,43,122,0.1));
  border: 1px solid #3d2b7a; border-radius: 10px; padding: 8px 16px;
}
.b-new-rank .b-rank-badge { width: 24px; height: 24px; font-size: 10px; border-radius: 6px; }

.b-result-btns { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 6px; padding: 0 16px; }
.b-result-btns .btn { font-size: 9px; }

/* Battle HUD (in-game) */
.battle-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between;
  background: linear-gradient(180deg, rgba(26,10,62,0.8), rgba(13,13,43,0.6));
  padding: 8px 14px; pointer-events: none;
  border-bottom: 2px solid rgba(91,60,196,0.3);
}
.battle-hud-side { text-align: center; }
.battle-hud-label { font-size: 6px; color: rgba(255,255,255,0.5); margin-bottom: 2px; }
.battle-hud-score { font-size: 20px; text-shadow: 2px 2px 0 rgba(0,0,0,0.5); }
.battle-hud-score.green { color: #6ddc71; }
.battle-hud-score.red { color: #ff6b6b; }
.battle-hud-divider { width: 2px; background: linear-gradient(180deg, #5b3cc4, transparent); align-self: stretch; }
.battle-enemy-banner {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 11;
  background: linear-gradient(135deg, #ff4444, #cc0000); padding: 6px 14px; border-radius: 6px;
  font-size: 7px; color: #fff; white-space: nowrap; display: none; pointer-events: none;
  border: 2px solid #ff6666; box-shadow: 0 3px 0 #880000;
}

@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
.pulse { animation: pulse 1.5s ease-in-out infinite;
}

/* ═══════════════════ COIN BADGE ═══════════════════ */
.lang-switcher {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  gap: 4px;
}
.lang-btn {
  padding: 6px 10px;
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 6px;
  background: rgba(0,0,0,.5);
  color: #fff;
  font: bold 11px 'Press Start 2P', monospace;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lang-btn.active {
  background: #f0c040;
  color: #000;
  border-color: #f0c040;
}

.coin-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(245,208,32,.5);
  border-radius: 20px;
  padding: 6px 12px 6px 8px;
  backdrop-filter: blur(4px);
}
.pixel-coin {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}
#menu-coins {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #f5d020;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* Coin gain animation */
.coin-gain-anim {
  position: absolute;
  top: -4px;
  right: 8px;
  color: #4cff4c;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  animation: coinGainFloat 1.4s ease-out forwards;
  z-index: 20;
}
@keyframes coinGainFloat {
  0%   { transform: translateY(0); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateY(-36px); opacity: 0; }
}

/* ═══════════════════ MENU ═══════════════════ */
.menu-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 44px;
  gap: 8px;
  width: 100%;
  padding: 0 24px;
}

.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}

/* Canvas bird on menu — drawn by MenuBird class in game.js */
#logo-bird-canvas {
  display: block;
  flex-shrink: 0;
}

.game-title { display: none; }
#title-canvas {
  display: block;
  image-rendering: pixelated;
}

.best-score-box {
  background: rgba(255,255,255,.92);
  border-radius: 8px;
  padding: 10px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 4px;
  box-shadow: 0 4px 0 rgba(0,0,0,.2);
}
.best-score-box .label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #888;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.best-score-box span:last-child {
  font-family: 'Press Start 2P', monospace;
  font-size: 26px;
  color: #543100;
}

/* ═══════════════════ GAME CANVAS ═══════════════════ */
#screen-game { background: var(--sky); }

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  will-change: transform;
  -webkit-transform: translateZ(0);  /* promote to GPU layer — eliminates iOS compositing stutter */
}

/* tap hint is now drawn on canvas — hide the HTML element */
.tap-hint { display: none !important; }

/* ═══════════════════ GAME OVER ═══════════════════ */
.gameover-panel {
  position: relative;
  z-index: 3;
  background: #f0e8c8;
  border-radius: 10px;
  padding: 14px 22px 18px;
  width: calc(100% - 40px);
  max-width: 300px;
  margin-top: 68px;
  box-shadow: 0 6px 0 #9e8040, inset 0 0 0 3px rgba(0,0,0,.08);
}

.gameover-banner {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: #fff;
  text-align: center;
  background: #d63b2e;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  box-shadow: 0 4px 0 #8b1a10;
  text-shadow: 2px 2px 0 rgba(0,0,0,.3);
  letter-spacing: 1px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}
.score-row .label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #7a6040;
  letter-spacing: 1px;
}
.score-row span:last-child {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #543100;
}

.divider {
  height: 2px;
  background: rgba(0,0,0,.1);
  margin: 8px 0;
}

.medal {
  width: 58px;
  margin: 10px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.medal.hidden { display: none; }
.medal canvas { image-rendering: pixelated; }
.medal-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

.new-best {
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #f5a623;
  margin-top: 8px;
  animation: pulse 0.5s ease-in-out infinite alternate;
}
.new-best.hidden { display: none; }

.shadow-bonus {
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #a855f7;
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.35);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 8px;
  text-shadow: 0 0 8px rgba(168,85,247,0.6);
}
.shadow-bonus.hidden { display: none; }

.gameover-buttons {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 300px;
  padding: 0 20px;
  margin-top: 14px;
}

@keyframes pulse {
  from { opacity: 1;  transform: scale(1); }
  to   { opacity: .3; transform: scale(.95); }
}

/* ═══════════════════ LEADERBOARD ═══════════════════ */
#screen-leaderboard {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  overflow-y: auto;
  flex-direction: column;
  align-items: stretch;
}
#screen-leaderboard.active { display: flex; }

.lb-header {
  display: flex;
  align-items: center;
  padding: 16px 16px 10px;
  background: rgba(255,255,255,.05);
  flex-shrink: 0;
}
.lb-header h2 {
  flex: 1;
  text-align: center;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  margin-right: 36px;
}
.back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  width: 36px;
  line-height: 1;
  padding: 0;
}

/* Prize banner */
.prize-banner {
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  border: 1px solid rgba(255,215,0,.3);
  border-radius: 10px;
  margin: 10px 14px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.prize-title {
  color: var(--gold);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  text-align: center;
  margin-bottom: 12px;
}
.prize-rows { display: flex; flex-direction: column; gap: 10px; }
.prize-row  { display: flex; justify-content: space-between; align-items: center; }
.prize-rank { font-family: 'Press Start 2P', monospace; font-size: 9px; }
.prize-rank.gold   { color: var(--gold); }
.prize-rank.silver { color: var(--silver); }
.prize-rank.bronze { color: var(--bronze); }
.prize-rank.top4   { color: rgba(255,255,255,.6); }
.prize-amount { color: #fff; font-family: 'Press Start 2P', monospace; font-size: 10px; }
.countdown {
  text-align: center;
  color: rgba(255,255,255,.45);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  margin-top: 10px;
  line-height: 1.8;
}

/* ═══════════════════ MENU SEASON COUNTDOWN ═══════════════════ */
/* Exclusive ghost banner on main menu */
.exclusive-banner {
  width: 100%;
  background: linear-gradient(135deg, #07071a 0%, #0d1030 100%);
  border: 2px solid #0055ff;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  color: #fff;
  animation: ghost-glow 3s ease-in-out infinite, ghost-border 4s linear infinite;
  text-decoration: none;
}
.exclusive-banner:active { transform: scale(0.98); }
.excl-icon { font-size: 22px; filter: drop-shadow(0 0 6px #55eeff); }
.excl-content { flex: 1; text-align: left; }
.excl-title { font-size: 8px; color: #cce8ff; text-shadow: 0 0 8px #55eeff; margin-bottom: 5px; }
.excl-sub   { font-size: 5px; color: #4488aa; line-height: 1.8; }
.excl-arrow { font-size: 20px; color: #aaddff; text-shadow: 0 0 8px #55eeff; }

.menu-season {
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,200,60,.2);
  border-radius: 14px;
  padding: 8px 16px 10px;
  text-align: center;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 2px 16px rgba(0,0,0,.3), 0 0 0 1px rgba(255,200,60,.06) inset;
  margin-top: 4px;
}
.season-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: rgba(255,200,60,.85);
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.season-timer {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.season-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
}
.season-unit > span:first-child {
  font-family: 'Press Start 2P', monospace;
  font-size: 19px;
  color: #fff;
  text-shadow: 0 0 14px rgba(255,200,60,.55), 0 2px 0 rgba(0,0,0,.5);
  line-height: 1.1;
}
.season-unit-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  color: rgba(255,255,255,.35);
  margin-top: 5px;
  letter-spacing: .5px;
}
.season-sep {
  font-family: 'Press Start 2P', monospace;
  font-size: 15px;
  color: rgba(255,200,60,.45);
  padding: 2px 2px 14px;
}

/* Tabs */
.lb-tabs {
  display: flex;
  margin: 0 14px 6px;
  background: rgba(255,255,255,.07);
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.45);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 10px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab-btn.active {
  background: #f5d020;
  color: #543100;
}

/* List */
.lb-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 30px;
}
.lb-loading {
  text-align: center;
  color: rgba(255,255,255,.35);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 40px 0;
  line-height: 2.5;
}

/* Entry card */
.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.07);
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.lb-entry.me     { border-color: rgba(115,191,46,.5); background: rgba(115,191,46,.08); }
.lb-entry.rank-1 { background: rgba(255,215,0,.1);    border-color: rgba(255,215,0,.35); }
.lb-entry.rank-2 { background: rgba(192,192,192,.1);  border-color: rgba(192,192,192,.3); }
.lb-entry.rank-3 { background: rgba(205,127,50,.1);   border-color: rgba(205,127,50,.3); }

.lb-rank-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  flex-shrink: 0;
}
.rank-1 .lb-rank-badge { background: radial-gradient(circle at 38% 32%, #ffe97a, #b8860b); color: #543100; }
.rank-2 .lb-rank-badge { background: radial-gradient(circle at 38% 32%, #e8e8e8, #8c8c8c); color: #333; }
.rank-3 .lb-rank-badge { background: radial-gradient(circle at 38% 32%, #e8a96a, #8c4e10); color: #fff; }
.lb-entry:not(.rank-1):not(.rank-2):not(.rank-3) .lb-rank-badge {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.6);
}

.lb-name {
  flex: 1;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.8;
}
.lb-name small {
  font-size: 7px;
  color: #73bf2e;
  display: block;
}
.lb-score {
  color: #f5d020;
  font-family: 'Press Start 2P', monospace;
  font-size: 15px;
}

/* ═══════════════ PLAYER PROFILE ═══════════════ */
.profile-body {
  padding: 8px 16px 24px;
}
.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.profile-name-wrap { flex: 1; }
.profile-username {
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  word-break: break-all;
}
.profile-rank-label {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  margin-top: 4px;
}
.profile-elo-wrap { text-align: center; }
.profile-elo {
  color: #f5d020;
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
}
.profile-elo-sub {
  color: rgba(255,255,255,0.4);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  margin-top: 2px;
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.profile-stat-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
}
.profile-stat-val {
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  margin-bottom: 4px;
}
.profile-stat-lbl {
  color: rgba(255,255,255,0.35);
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  text-transform: uppercase;
  line-height: 1.3;
}
.profile-section-title {
  color: rgba(255,255,255,0.5);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.profile-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 12px;
  border-left: 3px solid #666;
}
.profile-match.win  { border-left-color: #4cff4c; }
.profile-match.loss { border-left-color: #ff4c4c; }
.profile-match.draw { border-left-color: #f5d020; }
.profile-match-opp {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  flex: 1;
}
.profile-match-scores {
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}
.profile-match-result {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  width: 32px;
  text-align: right;
}
.profile-match-result.win  { color: #4cff4c; }
.profile-match-result.loss { color: #ff4c4c; }
.profile-match-result.draw { color: #f5d020; }

/* clickable leaderboard entries */
.lb-entry { cursor: pointer; }
.lb-entry:active { opacity: 0.7; }

/* ═══════════════════ SHOP ═══════════════════ */
#screen-shop {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  overflow-y: auto;
  flex-direction: column;
  align-items: stretch;
}
#screen-shop.active { display: flex; }

.shop-balance-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(245,208,32,.12);
  border: 1px solid rgba(245,208,32,.3);
  border-radius: 10px;
  margin: 10px 14px;
  padding: 12px 18px;
  flex-shrink: 0;
}
.shop-balance-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: rgba(255,255,255,.6);
}
#shop-points-val {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: #f5d020;
}

.skin-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 14px 30px;
  overflow-y: auto;
}

.skin-card {
  background: rgba(255,255,255,.07);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  transition: border-color .15s;
}
.skin-card.owned    { border-color: rgba(115,191,46,.5); }
.skin-card.selected { border-color: #f5d020; background: rgba(245,208,32,.1); }

/* Mini bird preview drawn with canvas */
.skin-preview {
  width: 64px;
  height: 50px;
  border-radius: 8px;
  background: transparent;
  flex-shrink: 0;
}

/* Middle info column */
.skin-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.skin-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #fff;
}

/* Right actions column */
.skin-card-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.shop-coin-icon {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  vertical-align: middle;
}

.skin-btn {
  width: 86px;
  border: none;
  border-radius: 6px;
  padding: 8px 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  cursor: pointer;
  transition: opacity .1s, transform .06s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.skin-btn:active { transform: translateY(2px); }

.skin-btn.buy-coins  { background: #f5d020; color: #543100; box-shadow: 0 3px 0 #a07808; }
.skin-btn.buy-stars  { background: linear-gradient(135deg,#8b5cf6,#6d28d9); color:#fff; box-shadow: 0 3px 0 #4c1d95; }
.skin-btn.select     { background: #73bf2e; color: #fff;    box-shadow: 0 3px 0 #3d6b15; }
.skin-btn.active-skin { background: #4ec0ca; color: #fff;  box-shadow: 0 3px 0 #2a808a; }
.skin-btn.locked     { background: rgba(255,255,255,.1); color: rgba(255,255,255,.25); cursor: default; font-size: 6px; }
.skin-btn.subscribe-btn { background: #ff8c00; color: #fff; box-shadow: 0 3px 0 #b35e00; text-decoration: none; }
.skin-btn.verify-btn    { background: #00b8d4; color: #fff; box-shadow: 0 3px 0 #007a8a; }
.ghost-action-btn       { width: 100% !important; }

/* ── Ghost featured card ─────────────────────────────────────────── */
@keyframes ghost-glow {
  0%, 100% { box-shadow: 0 0 12px #0055ff55, 0 0 24px #0055ff22, inset 0 0 20px #00aaff11; }
  50%       { box-shadow: 0 0 22px #00aaff99, 0 0 44px #00aaff44, inset 0 0 30px #00aaff22; }
}
@keyframes ghost-border {
  0%   { border-color: #0055ff; }
  33%  { border-color: #00aaff; }
  66%  { border-color: #55eeff; }
  100% { border-color: #0055ff; }
}


/* Multiplier bonus badge */
.skin-bonus {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #a855f7;
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(168,85,247,0.4);
  border-radius: 4px;
  padding: 3px 6px;
  align-self: flex-start;
  text-shadow: 0 0 6px rgba(168,85,247,0.7);
}
