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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  background: #1a1a2e;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

canvas { display: block; width: 100%; height: 100%; }

/* ── Gamified button system ──────────────────────────────────── */
.game-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 28px;
  font-family: 'Fredoka One', 'Nunito', sans-serif;
  font-size: clamp(1rem, 4vw, 1.2rem);
  letter-spacing: 0.06em;
  color: #fff;
  border: none; border-radius: 50px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.btn-icon { font-size: 0.95em; }

.btn-green {
  background: linear-gradient(180deg, #6edb5f 0%, #4ab53c 100%);
  box-shadow: 0 6px 0 #2e8020, 0 8px 12px rgba(0,0,0,0.25);
}
.btn-green:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #2e8020, 0 4px 8px rgba(0,0,0,0.2);
}

.btn-blue {
  background: linear-gradient(180deg, #4cb8f5 0%, #2190d8 100%);
  box-shadow: 0 6px 0 #1166a8, 0 8px 12px rgba(0,0,0,0.25);
}
.btn-blue:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1166a8, 0 4px 8px rgba(0,0,0,0.2);
}

.btn-red {
  background: linear-gradient(180deg, #ff7b7b 0%, #e84040 100%);
  box-shadow: 0 5px 0 #aa1f1f, 0 7px 10px rgba(0,0,0,0.25);
}
.btn-red:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #aa1f1f;
}

.btn-purple {
  background: linear-gradient(180deg, #be7fef 0%, #9043d4 100%);
  box-shadow: 0 5px 0 #5e1f9e, 0 7px 10px rgba(0,0,0,0.25);
}
.btn-purple:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #5e1f9e;
}

.btn-yellow {
  background: linear-gradient(180deg, #ffe066 0%, #f0b800 100%);
  box-shadow: 0 6px 0 #b08000, 0 8px 12px rgba(0,0,0,0.25);
  color: #5a3800;
  text-shadow: none;
}
.btn-yellow:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #b08000;
}

/* ── Game panel (card) ───────────────────────────────────────── */
.panel {
  background: #fff9ee;
  border-radius: 24px;
  border: 4px solid #d4a24a;
  box-shadow: 0 8px 0 #a06820, 0 14px 28px rgba(0,0,0,0.35);
  overflow: visible;
  position: relative;
  width: min(320px, 88vw);
}

.panel-ribbon {
  position: relative;
  top: -18px; left: 50%; transform: translateX(-50%);
  display: inline-block;
  padding: 8px 32px;
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(1rem, 4vw, 1.2rem);
  letter-spacing: 0.12em;
  color: #fff;
  border-radius: 50px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  white-space: nowrap;
  min-width: 180px;
  text-align: center;
}
.ribbon-red {
  background: linear-gradient(180deg, #ff7b7b, #e84040);
  box-shadow: 0 4px 0 #a01c1c, 0 6px 12px rgba(0,0,0,0.3);
}
.ribbon-blue {
  background: linear-gradient(180deg, #4cb8f5, #2190d8);
  box-shadow: 0 4px 0 #1166a8, 0 6px 12px rgba(0,0,0,0.3);
}
.ribbon-green {
  background: linear-gradient(180deg, #6edb5f, #4ab53c);
  box-shadow: 0 4px 0 #2e8020, 0 6px 12px rgba(0,0,0,0.3);
}
.ribbon-yellow {
  background: linear-gradient(180deg, #ffe066, #f0b800);
  box-shadow: 0 4px 0 #b08000, 0 6px 12px rgba(0,0,0,0.3);
  color: #5a3800;
}

.panel-body {
  padding: 4px 24px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* ── Start menu ────────────────────────────────────────────────── */
#start-menu {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #87ceeb 0%, #b0e080 55%, #5aaa30 100%);
  z-index: 200;
  gap: 0;
  overflow: hidden;
}
#start-menu.hidden { display: none; }

/* BNBINU badge */
.sm-powered {
  position: relative; z-index: 1;
  font-family: 'Nunito', sans-serif;
  font-weight: 900; font-size: clamp(0.55rem, 2vw, 0.7rem);
  letter-spacing: 0.22em;
  color: #fff;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  padding: 4px 14px;
  margin-bottom: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Decorative clouds in start menu */
.sm-bg-clouds { position: absolute; inset: 0; pointer-events: none; }
.sm-cloud {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 0.75;
}
.sm-cloud::before, .sm-cloud::after {
  content: ''; position: absolute; background: #fff; border-radius: 50%;
}
.c1 { width: 120px; height: 50px; top: 10%; left: -20px; }
.c1::before { width: 70px; height: 70px; top: -30px; left: 20px; }
.c1::after  { width: 55px; height: 55px; top: -18px; left: 55px; }
.c2 { width: 90px; height: 40px; top: 18%; right: 5%; }
.c2::before { width: 55px; height: 55px; top: -28px; left: 12px; }
.c2::after  { width: 42px; height: 42px; top: -16px; left: 42px; }
.c3 { width: 70px; height: 30px; top: 7%; left: 40%; }
.c3::before { width: 44px; height: 44px; top: -22px; left: 8px; }
.c3::after  { width: 36px; height: 36px; top: -14px; left: 32px; }

/* ── Player badge on start screen ── */
.sm-player-badge {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 50px;
  padding: 7px 16px 7px 10px;
  margin-bottom: 6px;
}
.sm-player-badge.hidden { display: none; }
.sm-player-avatar { font-size: 1.4rem; line-height: 1; }
.sm-player-info { display: flex; flex-direction: column; gap: 1px; }
.sm-player-name {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.9rem; color: #a8f060; line-height: 1;
}
.sm-player-addr {
  font-family: 'Nunito', sans-serif;
  font-size: 0.65rem; color: rgba(255,255,255,0.45); letter-spacing: 0.04em;
}

.sm-logo-wrap {
  position: relative; z-index: 1;
  text-align: center;
  margin-bottom: 20px;
}
.sm-logo {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(3rem, 14vw, 5.5rem);
  color: #fff;
  -webkit-text-stroke: 3px #2e6e10;
  text-shadow:
    0 4px 0 #2e6e10,
    0 8px 16px rgba(0,0,0,0.3),
    4px 4px 0 #2e6e10,
    -4px 4px 0 #2e6e10;
  letter-spacing: 0.05em;
  line-height: 1;
}
.sm-logo-sub {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  color: #2c6010;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 4px;
}

.sm-card {
  position: relative; z-index: 1;
  background: #fff9ee;
  border: 4px solid #d4a24a;
  border-radius: 24px;
  box-shadow: 0 8px 0 #a06820, 0 14px 28px rgba(0,0,0,0.3);
  padding: 24px 20px;
  width: min(300px, 88vw);
  display: flex; flex-direction: column; gap: 12px;
}

/* Sound toggle row */
.sound-row {
  display: flex; align-items: center; gap: 10px;
  background: #ffe8b0;
  border: 3px solid #e8c060;
  border-radius: 50px;
  padding: 10px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sound-row-icon { font-size: 1.3rem; }
.sound-row-text {
  flex: 1;
  font-family: 'Fredoka One', sans-serif;
  font-size: 1rem; letter-spacing: 0.06em;
  color: #7a4e10;
}

.toggle-pill {
  width: 52px; height: 28px;
  background: #c8b890;
  border-radius: 50px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-pill input { display: none; }
.toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: transform 0.2s, background 0.2s;
}
.sound-row input:checked ~ .toggle-pill,
.toggle-pill:has(input:checked) { background: #4ab53c; }
.sound-row input:checked ~ .toggle-pill .toggle-knob,
.toggle-pill:has(input:checked) .toggle-knob { transform: translateX(24px); }

/* Apply toggle state via JS class on label */
.sound-row.on  .toggle-pill { background: #4ab53c; }
.sound-row.on  .toggle-knob { transform: translateX(24px); }
.sound-row.off .toggle-pill { background: #c8b890; }
.sound-row.off .toggle-knob { transform: translateX(0); }

/* Grass at the bottom of start menu */
.sm-grass {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 48px;
  background: linear-gradient(180deg, #5aaa30 0%, #3d8020 100%);
  border-radius: 60% 60% 0 0 / 30px 30px 0 0;
}

/* ── Loading ───────────────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #87ceeb 0%, #c8e890 100%);
  z-index: 150; gap: 12px;
}
#loading.active { display: flex; }
#loading.hidden { opacity: 0; pointer-events: none; transition: opacity 0.5s; }

.loading-logo {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(2.5rem, 10vw, 4rem);
  color: #fff;
  -webkit-text-stroke: 2px #2e6e10;
  text-shadow: 0 4px 0 #2e6e10, 0 8px 16px rgba(0,0,0,0.25);
  letter-spacing: 0.08em;
}
.loading-car {
  display: flex; align-items: center; justify-content: center;
  animation: bounce-load 0.7s ease-in-out infinite alternate;
}
.loading-car img {
  width: clamp(56px, 14vw, 80px);
  height: clamp(56px, 14vw, 80px);
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(110,216,64,0.7)) drop-shadow(0 0 28px rgba(110,216,64,0.35));
  border-radius: 50%;
}
@keyframes bounce-load {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-12px) scale(1.06); }
}

.load-bar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.load-bar-track {
  position: relative;
  width: min(260px, 75vw); height: 20px;
  background: rgba(0,0,0,0.18);
  border-radius: 50px;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.5);
}
.load-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6edb5f, #f0e050);
  width: 0%;
  border-radius: 50px;
  transition: width 0.3s;
}
.load-bar-shine {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 60%);
  border-radius: 50px; pointer-events: none;
}
#load-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 0.9rem;
  color: #2c6010; letter-spacing: 0.06em;
}

/* ── Navbar (during game) ───────────────────────────────────────── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: none;
  align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 12px 10px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(180deg, #1c5c0c 0%, #144008 100%);
  border-bottom: 3px solid #6ed840;
  box-shadow: 0 4px 0 #0a2806, 0 6px 16px rgba(0,0,0,0.45);
  z-index: 30;
}
#navbar.active { display: flex; }

/* Pill buttons */
.nav-pill {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  min-width: 58px; padding: 6px 10px 8px;
  border: none; border-radius: 14px;
  font-size: 1.3rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.1s;
  user-select: none;
  flex-shrink: 0;
}
.nav-pill:active { transform: translateY(3px); box-shadow: 0 1px 0 !important; }
.nav-pill-label {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.52rem; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.9);
  line-height: 1;
}

.nav-home {
  background: linear-gradient(180deg, #ff8c5a 0%, #e85020 100%);
  box-shadow: 0 4px 0 #a02a00, 0 6px 10px rgba(0,0,0,0.3);
}
.nav-sound {
  background: linear-gradient(180deg, #b87fef 0%, #8430c8 100%);
  box-shadow: 0 4px 0 #4a1880, 0 6px 10px rgba(0,0,0,0.3);
}

/* Score panel */
#score-panel {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, #2a8010 0%, #1a5808 100%);
  border: 3px solid #6ed840;
  border-radius: 16px;
  padding: 4px 16px 6px;
  box-shadow: 0 4px 0 #0a2806, inset 0 1px 0 rgba(255,255,255,0.15);
  min-width: 0;
}
#score-label {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.62rem; letter-spacing: 0.18em;
  color: #a8f060;
  line-height: 1.3;
}
#score {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(1.5rem, 5.5vw, 2.2rem);
  color: #f0e050;
  line-height: 1;
  text-shadow: 0 2px 0 #8a7000, 0 4px 8px rgba(0,0,0,0.4);
  transition: transform 0.12s;
}
#score-panel.bump #score { transform: scale(1.22); }
#high-score {
  font-family: 'Nunito', sans-serif;
  font-size: 0.65rem; font-weight: 800;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.08em;
  min-height: 11px;
}

/* Sound off state */
.nav-sound.off { opacity: 0.65; }
.nav-sound.off::after {
  content: '';
  position: absolute; left: 50%; top: 46%;
  width: 2px; height: 55%;
  background: #ffaaaa;
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 2px;
}

/* ── Game Over ─────────────────────────────────────────────────── */
#game-over {
  position: fixed; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
  z-index: 50;
}
#game-over.active { display: flex; }

.go-stars {
  font-size: clamp(1.6rem, 6vw, 2rem);
  letter-spacing: 4px;
  margin-bottom: 4px;
  animation: star-pop 0.4s ease-out both;
}
@keyframes star-pop {
  from { transform: scale(0); opacity: 0; }
  80%  { transform: scale(1.2); opacity: 1; }
  to   { transform: scale(1); }
}

.go-score-label {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.8rem; letter-spacing: 0.2em;
  color: #b08060;
}
#final-score {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(3rem, 14vw, 4.5rem);
  color: #f0b800;
  line-height: 1;
  text-shadow: 0 3px 0 #a07000, 0 6px 12px rgba(0,0,0,0.25);
}
#best-score {
  font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 0.85rem;
  color: #6ab83c;
  letter-spacing: 0.1em;
}
.go-btns {
  display: flex; gap: 10px; width: 100%;
}
.go-btns .game-btn { padding: 13px 20px; font-size: clamp(0.85rem, 3vw, 1rem); }

/* ── Leaderboard modal ─────────────────────────────────────────── */
#leaderboard-modal {
  position: fixed; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(10,40,10,0.82);
  backdrop-filter: blur(6px);
  z-index: 220;
  padding: 16px;
}
#leaderboard-modal.active { display: flex; }

/* Panel */
.lb-panel {
  width: min(380px, 96vw);
  max-height: 90vh;
  background: linear-gradient(180deg, #1e5c10 0%, #134008 100%);
  border: 4px solid #6ed840;
  border-radius: 28px;
  box-shadow: 0 8px 0 #0a2806, 0 14px 36px rgba(0,0,0,0.55);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: lb-slide-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes lb-slide-in {
  from { transform: scale(0.7) translateY(40px); opacity: 0; }
  to   { transform: scale(1) translateY(0);      opacity: 1; }
}

/* Header */
.lb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 8px;
  background: linear-gradient(180deg, #2a8010 0%, #1e5c10 100%);
  border-bottom: 3px solid #6ed840;
}
.lb-coins { font-size: 1.1rem; letter-spacing: -4px; }
.lb-title-wrap { text-align: center; }
.lb-title {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  color: #f0e050;
  text-shadow: 0 2px 0 #8a7000, 0 4px 8px rgba(0,0,0,0.4);
  letter-spacing: 0.1em;
}
.lb-title-sub {
  font-family: 'Nunito', sans-serif;
  font-size: 0.6rem; font-weight: 800;
  color: #a8f060; letter-spacing: 0.2em;
}

/* ── Tabs ── */
.lb-tabs {
  display: flex; justify-content: center; gap: 6px;
  margin: 0 16px 8px; padding: 4px;
  background: rgba(0,0,0,0.25); border-radius: 50px;
}
.lb-tab {
  flex: 1; padding: 8px 0; border: none; border-radius: 50px;
  font-family: 'Fredoka One', sans-serif; font-size: 0.72rem;
  color: rgba(255,255,255,0.5); background: transparent; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.lb-tab.active {
  background: linear-gradient(135deg, #6ed840 0%, #4caf50 100%);
  color: #fff; box-shadow: 0 2px 10px rgba(110,216,64,0.35);
}
.lb-tab-content { overflow-y: auto; max-height: 56vh; }
.lb-empty {
  text-align: center; padding: 28px 16px;
  font-family: 'Nunito', sans-serif; font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* ── Podium ── */
.lb-podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 6px;
  padding: 16px 12px 0;
  background: linear-gradient(180deg, #1e5c10 0%, #174a0c 100%);
}
.lb-podium-item {
  display: flex; flex-direction: column; align-items: center;
  flex: 1;
}
.lb-crown {
  font-size: 1.3rem;
  animation: crown-bounce 1.2s ease-in-out infinite alternate;
  margin-bottom: 2px;
}
@keyframes crown-bounce {
  from { transform: translateY(0) rotate(-8deg); }
  to   { transform: translateY(-5px) rotate(8deg); }
}
.lb-avatar {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.85rem; letter-spacing: 0.02em;
  color: #fff; font-weight: 700;
  border-radius: 50%;
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  margin-bottom: 4px;
}
.lb-avatar-lg {
  width: 52px; height: 52px; font-size: 1rem;
}
.rank-1 .lb-avatar, .rank-1 .lb-avatar-lg {
  width: 58px; height: 58px; font-size: 1.1rem;
  border-color: #f0e050;
  box-shadow: 0 0 14px rgba(240,224,80,0.6);
}
.lb-podium-name {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(0.65rem, 2vw, 0.75rem);
  color: #c8f080;
  margin-bottom: 4px;
  white-space: nowrap;
}
.lb-podium-block {
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
  border-radius: 10px 10px 0 0;
  padding: 8px 4px 12px;
}
.p1 { background: linear-gradient(180deg, #ffe066, #d4a000); min-height: 80px; }
.p2 { background: linear-gradient(180deg, #d0d8e8, #8090a8); min-height: 60px; }
.p3 { background: linear-gradient(180deg, #e8a060, #c06020); min-height: 46px; }
.lb-medal { font-size: 1.3rem; }
.lb-podium-score {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(0.75rem, 2.5vw, 0.9rem);
  color: rgba(0,0,0,0.65);
  margin-top: 2px;
}
.p1 .lb-podium-score { color: #5a3800; }

/* ── List rows ── */
.lb-rows {
  display: flex; flex-direction: column; gap: 0;
  background: #0e3006;
  flex: 1; overflow-y: auto;
  padding: 4px 0;
}
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(110,216,64,0.12);
  animation: lb-row-in 0.4s ease both;
}
.lb-row:nth-child(1) { animation-delay: 0.05s; }
.lb-row:nth-child(2) { animation-delay: 0.10s; }
.lb-row:nth-child(3) { animation-delay: 0.15s; }
.lb-row:nth-child(4) { animation-delay: 0.20s; }
@keyframes lb-row-in {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.lb-row-you {
  background: linear-gradient(90deg, rgba(240,224,80,0.15), transparent);
  border-top: 2px solid rgba(240,224,80,0.4);
  border-bottom: none;
}
.lb-rank {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.9rem;
  color: #6ed840;
  width: 20px; text-align: center; flex-shrink: 0;
}
.lb-row-you .lb-rank { color: #f0e050; }
.lb-row-avatar {
  flex-shrink: 0;
}
.lb-row-name {
  flex: 1;
  font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 0.9rem;
  color: #c8f080;
}
.lb-row-you .lb-row-name { color: #f0e050; font-size: 0.95rem; }
.lb-row-score {
  font-family: 'Fredoka One', sans-serif;
  font-size: 0.95rem;
  color: #fff;
}
.lb-row-you .lb-row-score { color: #f0e050; font-size: 1rem; }

/* Close button */
.lb-close {
  display: block;
  width: calc(100% - 32px);
  margin: 10px 16px 14px;
  padding: 10px 0;
  font-size: 0.82rem;
  border-radius: 50px;
  align-self: center;
}

/* ── Your rank badge ── */
#lb-your-rank {
  background: #f0e050;
  color: #5a3800;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}

/* ── Mobile d-pad ─────────────────────────────────────────────── */
#controls {
  position: fixed;
  bottom: max(clamp(18px, 5vw, 32px), env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  display: none; flex-direction: column; align-items: center; gap: 6px;
  z-index: 25;
}
#controls.active { display: flex; }

.ctrl-row {
  display: flex; align-items: center; gap: 6px;
}
.ctrl-center {
  width: clamp(52px, 15vw, 66px);
  height: clamp(52px, 15vw, 66px);
}

.ctrl-btn {
  width: clamp(52px, 15vw, 66px);
  height: clamp(52px, 15vw, 66px);
  min-width: 52px; min-height: 52px;
  background: linear-gradient(180deg, #ffe97a 0%, #f0b800 100%);
  border: none;
  border-radius: 18px;
  box-shadow: 0 5px 0 #b08000, 0 7px 10px rgba(0,0,0,0.3);
  color: #5a3800;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, box-shadow 0.08s;
  font-weight: 900;
}
.ctrl-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b08000, 0 3px 6px rgba(0,0,0,0.25);
}

/* ── Keyframe animations ─────────────────────────────────────── */
@keyframes float-cloud {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(12px); }
  100% { transform: translateX(0); }
}
.c1 { animation: float-cloud 7s ease-in-out infinite; }
.c2 { animation: float-cloud 9s ease-in-out infinite reverse; }
.c3 { animation: float-cloud 6s ease-in-out infinite 2s; }

@keyframes logo-wobble {
  0%, 100% { transform: rotate(-1.5deg) scale(1); }
  50%       { transform: rotate(1.5deg) scale(1.03); }
}
.sm-logo { animation: logo-wobble 3s ease-in-out infinite; display: inline-block; }

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 390px) {
  .sm-card { padding: 18px 14px; gap: 10px; }
  .game-btn { padding: 13px 22px; }
  .ctrl-btn { border-radius: 14px; }
}

@media (max-height: 700px) {
  .sm-logo-wrap { margin-bottom: 12px; }
  .sm-logo { font-size: clamp(2.2rem, 10vw, 3.5rem); }
  #start-menu { gap: 0; }
  .sm-grass { height: 32px; }
}
