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

:root {
  --bg: #263f22;
  --surface: #fffdf7;
  --surface-subtle: #f1ede2;
  --border: rgba(74, 42, 16, 0.16);
  --ink: #2a1a0e;
  --ink-muted: #5c4632;
  --accent: #2d9d78;
  --accent-strong: #1f7a5c;
  --boost: #e07a32;
  --diamond: #7c3aed;
  --gold: #b45309;
  --wood-light: #945224;
  --wood-mid: #6e3715;
  --wood-dark: #48220b;
  --wood-rim: #e5a93c;
  --wood-rim-dark: #8a4f13;
  --gold-bright: #fde047;
  --gold-mid: #f59e0b;
  --gold-deep: #b45309;
  --radius-outer: 20px;
  --radius-control: 10px;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', 'Nunito', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.label-short {
  display: none;
}

/* ===== FULL-BLEED 3D ARENA SHELL ===== */
.app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  padding: 0;
  gap: 0;
}

.arena-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.board-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #2c5227;
  border: none;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.lobby-river-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 68% 58% at 50% 48%, rgba(255, 255, 255, 0) 44%, rgba(11, 29, 15, 0.30) 100%),
    url('/src/assets/images/lobby_meadow_wide_stone_1796547868799.jpg') center 48% / cover no-repeat;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.lobby-river-backdrop.hidden {
  display: none;
}

canvas#game3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 2;
  background: transparent;
}

canvas#game3d.hidden {
  display: none;
}

canvas#game {
  position: relative;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

canvas#game:active {
  cursor: grabbing;
}

/* ===== FLOATING CARVED-WOOD ARCADE HUD ===== */
.arcade-hud {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(10px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.hud-top-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
}

.hud-left-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}

.hud-center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hud-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  min-width: 0;
}

/* Carved Wood Plaque Base (Zero backdrop-filter for 60fps WebGL!) */
.wood-plaque {
  position: relative;
  pointer-events: auto;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 210, 145, 0.06) 0px,
      rgba(255, 210, 145, 0.06) 2px,
      transparent 2px,
      transparent 9px
    ),
    linear-gradient(180deg, #985527 0%, #733b17 46%, #4e250b 100%);
  border: 2.5px solid #e6a83c;
  border-radius: 15px;
  box-shadow:
    inset 0 2px 1px rgba(255, 232, 168, 0.38),
    inset 0 -3px 6px rgba(26, 10, 2, 0.62),
    0 0 0 1.5px rgba(58, 26, 6, 0.82),
    0 7px 18px rgba(14, 10, 4, 0.45);
  color: #fffbeb;
  font-variant-numeric: tabular-nums;
}

/* Decorative Meadow Leaves tucked onto Wood Corners */
.wood-leaf {
  position: absolute;
  width: 16px;
  height: 11px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #a3e635 0%, #22c55e 52%, #15803d 100%);
  border: 1.5px solid #14532d;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}

.wood-leaf.leaf-tl {
  top: -6px;
  left: -5px;
  transform: rotate(-22deg);
}

.wood-leaf.leaf-tr {
  top: -6px;
  right: -5px;
  transform: scaleX(-1) rotate(-22deg);
}

.wood-leaf.leaf-bl {
  bottom: -5px;
  left: -4px;
  transform: rotate(155deg);
}

/* ===== TOP-LEFT: PLAYER PROFILE PLAQUE ===== */
.profile-plaque {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 7px;
  min-width: 244px;
  max-width: 310px;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.profile-plaque:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.profile-plaque:active {
  transform: scale(0.98);
}

.profile-avatar-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 2.5px;
  background: linear-gradient(180deg, #fef08a 0%, #f59e0b 52%, #92400e 100%);
  box-shadow: 0 3px 9px rgba(15, 8, 2, 0.55), inset 0 1px 2px rgba(255, 255, 255, 0.7);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 72% 38%;
  background: #dcfce7;
  display: block;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.profile-name {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(32, 12, 2, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-prey-wrap {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.profile-level-bar-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.profile-star-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fef08a;
  text-shadow: 0 1px 2px rgba(32, 12, 2, 0.9);
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-star-badge strong {
  color: #ffffff;
  font-weight: 800;
}

.star-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.profile-xp-track {
  position: relative;
  flex: 1;
  min-width: 96px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2b1305 0%, #3f1d09 100%);
  border: 1.5px solid #b46d24;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-xp-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(180deg, #a3f75f 0%, #22c55e 52%, #15803d 100%);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.45);
  transition: width 180ms ease;
}

.profile-xp-text {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.92);
  white-space: nowrap;
  padding: 0 6px;
}

.profile-xp-text strong {
  color: #ffffff;
}

.profile-xp-text .target-inline {
  color: #fef9c3;
  font-weight: 700;
}

.profile-xp-text .target-inline.met {
  color: #bbf7d0;
}

/* ===== MID-LEFT: LIVE TOP PLAYERS LEADERBOARD ===== */
.leaderboard-plaque {
  width: 214px;
  padding: 7px 8px 8px;
  border-radius: 14px;
  pointer-events: none;
}

.leaderboard-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  color: #fffbeb;
  text-shadow: 0 2px 2px rgba(26, 10, 2, 0.85);
  padding-bottom: 5px;
  margin-bottom: 5px;
  border-bottom: 1.5px solid rgba(245, 179, 66, 0.35);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  padding: 3.5px 7px;
  border-radius: 8px;
  background: rgba(34, 15, 4, 0.46);
  border: 1px solid rgba(255, 214, 138, 0.14);
  font-size: 0.76rem;
  font-weight: 800;
  color: #fef3c7;
  text-shadow: 0 1px 1px rgba(20, 8, 2, 0.75);
}

.lb-row.is-player {
  background: linear-gradient(180deg, #fef08a 0%, #facc15 48%, #eab308 100%);
  border-color: #fef9c3;
  color: #3d1c05;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 8px rgba(250, 204, 21, 0.42);
}

.lb-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}

.lb-crown {
  width: 17px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lb-crown svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lb-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding-left: 4px;
}

/* ===== TOP-CENTER: GOLD / DIAMOND / ENERGY CAPSULES ===== */
.hud-resources-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
}

.wood-capsule {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 3px 5px 3px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4b240c 0%, #341706 100%);
  border: 2px solid #d99732;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    0 0 0 1.5px rgba(45, 18, 4, 0.8),
    0 5px 12px rgba(10, 6, 2, 0.42);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.capsule-icon {
  width: 30px;
  height: 30px;
  margin-left: -10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.48));
}

.capsule-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.capsule-val {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(24, 10, 2, 0.85);
  min-width: 32px;
  text-align: center;
  padding: 0 2px;
}

.capsule-plus-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.8px solid #bbf7d0;
  background: linear-gradient(180deg, #86efac 0%, #22c55e 45%, #15803d 100%);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.55);
  transition: transform 120ms ease, filter 120ms ease;
}

.capsule-plus-btn:hover {
  filter: brightness(1.12);
  transform: scale(1.07);
}

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

.energy-capsule {
  padding-right: 5px;
}

.energy-bar-track {
  position: relative;
  width: 82px;
  height: 20px;
  border-radius: 999px;
  background: #230d04;
  border: 1.2px solid rgba(251, 191, 36, 0.45);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.energy-bar-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  background: linear-gradient(90deg, #ec4899 0%, #d946ef 48%, #f59e0b 100%);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.45);
  transition: width 90ms linear;
}

.energy-bar-fill.depleted {
  background: linear-gradient(90deg, #991b1b, #dc2626);
}

.energy-bar-text {
  position: relative;
  z-index: 1;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* ===== TOP-CENTER: CARVED WOOD HOURGLASS TIMER BANNER ===== */
.timer-plaque {
  padding: 5px 18px 8px;
  min-width: 196px;
  border-radius: 16px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer-plaque-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.hourglass-icon {
  width: 24px;
  height: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.hourglass-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.timer-readout-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
}

.timer-digits {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(24, 10, 2, 0.9);
}

.timer-subtitle {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  color: #fde047;
  text-shadow: 0 1px 2px rgba(24, 10, 2, 0.9);
  white-space: nowrap;
}

.timer-subtitle.ahead {
  color: #86efac;
}

.timer-subtitle.urgent {
  color: #fca5a5;
}

.time-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(24, 10, 2, 0.65);
  overflow: hidden;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.time-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4ade80, #facc15);
  transform-origin: left center;
  transform: scaleX(1);
  transition: background-color 200ms ease;
}

.time-bar-fill.low {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

/* ===== TOP-RIGHT: CIRCULAR GOLD UTILITY BUTTONS + MINI-MAP + GLOW POWER ===== */
.hud-utility-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: auto;
}

.gold-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid #fef08a;
  background: linear-gradient(180deg, #f59e0b 0%, #c26a0c 55%, #8a3f07 100%);
  color: #ffffff;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    inset 0 2px 2px rgba(255, 250, 205, 0.62),
    inset 0 -3px 4px rgba(68, 26, 4, 0.55),
    0 0 0 1.5px rgba(58, 24, 5, 0.8),
    0 4px 10px rgba(10, 6, 2, 0.45);
  transition: transform 130ms ease, filter 130ms ease;
}

.gold-circle-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(45, 18, 4, 0.75));
}

.gold-circle-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

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

.gold-circle-btn.is-muted {
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 55%, #475569 100%);
  border-color: #e2e8f0;
}

.gold-circle-btn.is-paused {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 55%, #15803d 100%);
  border-color: #dcfce7;
}

.wood-view-switch,
.wood-steer-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5c2c10 0%, #3d1b07 100%);
  border: 2px solid #d99732;
  box-shadow: 0 4px 10px rgba(10, 6, 2, 0.42), inset 0 1px 3px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.wood-seg-btn {
  border: none;
  background: transparent;
  color: #fde68a;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 9px;
  min-height: 28px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.wood-seg-btn.active {
  background: linear-gradient(180deg, #fef08a 0%, #f59e0b 100%);
  color: #3d1c05;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.hud-right-widgets {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

/* Glowing Purple Active Power-Up Banner (Matching Screenshot's Speed Boost Card!) */
.power-hud {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.power-readout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px 6px 9px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.94) 0%, rgba(168, 85, 247, 0.94) 100%);
  border: 2px solid #f5d0fe;
  box-shadow:
    0 0 16px rgba(192, 132, 252, 0.78),
    inset 0 1px 2px rgba(255, 255, 255, 0.5);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.power-readout.speed-power {
  background: linear-gradient(135deg, rgba(162, 28, 175, 0.96), rgba(217, 70, 239, 0.96));
  border-color: #f5d0fe;
  box-shadow: 0 0 18px rgba(232, 121, 249, 0.85);
}

.power-readout.shield-power {
  background: linear-gradient(135deg, rgba(3, 105, 161, 0.94), rgba(14, 165, 233, 0.94));
  border-color: #bae6fd;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.72);
}

.power-readout.phase {
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.94), rgba(6, 182, 212, 0.94));
  border-color: #a5f3fc;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.72);
}

.power-readout.terrain {
  background: linear-gradient(135deg, rgba(146, 64, 14, 0.92), rgba(180, 83, 9, 0.92));
  border-color: #fde68a;
  box-shadow: 0 4px 12px rgba(120, 53, 15, 0.45);
}

.pow-ico {
  font-size: 1.15rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}

.pow-body {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.pow-body strong {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.65);
}

.pow-body small {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fef08a;
}

/* Wood-Framed Live Mini-Map */
.minimap-wood-frame {
  pointer-events: none;
  padding: 4px;
  border-radius: 13px;
  background: linear-gradient(180deg, #8b4c22 0%, #5c2b0e 100%);
  border: 2.5px solid #e6a83c;
  box-shadow:
    inset 0 1px 2px rgba(255, 232, 168, 0.4),
    0 0 0 1.5px rgba(46, 20, 4, 0.82),
    0 7px 16px rgba(10, 6, 2, 0.48);
  flex-shrink: 0;
}

#hudMinimapCanvas {
  display: block;
  width: 146px;
  height: 114px;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 50%, #2d4c25 0%, #1c3117 100%);
}

/* Combo Streak & Golden Frenzy HUD */
.combo-hud {
  min-width: 152px;
  padding: 6px 11px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(46, 21, 7, 0.94), rgba(29, 13, 4, 0.95));
  border: 2px solid #38bdf8;
  color: #f8fafc;
  pointer-events: none;
  box-shadow: 0 5px 14px rgba(10, 6, 2, 0.45);
}

.combo-hud.frenzy {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.96), rgba(217, 119, 6, 0.96));
  border-color: #fde047;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.62);
}

.combo-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.combo-mult {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  color: #7dd3fc;
}

.combo-hud.frenzy .combo-mult {
  color: #fef08a;
}

.combo-count {
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(248, 250, 252, 0.88);
  font-variant-numeric: tabular-nums;
}

.combo-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.combo-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  transition: width 90ms linear;
}

.combo-hud.frenzy .combo-bar-fill {
  background: linear-gradient(90deg, #fef08a, #f97316);
}

/* Live Arena Event Toast Banner */
.arena-event-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4b230c, #2f1405);
  border: 2px solid #fbbf24;
  color: #fef3c7;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(15, 10, 4, 0.45);
}

.rivalry-hud-compat {
  display: none !important;
}

/* ===== BOTTOM ROW: STEER SWITCH · CIRCULAR GOLD ABILITY ORBS · LEVEL/ENDLESS PLAQUE ===== */
.hud-bottom-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(175px, 1fr);
  align-items: end;
  gap: 10px;
  width: 100%;
}

.hud-bottom-left {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

/* Bottom-Center Circular Gold-Rimmed Ability Dock */
.hud-ability-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  pointer-events: auto;
}

.arcade-orb-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3.5px solid #fbbf24;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #ffffff;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    inset 0 3px 5px rgba(255, 255, 255, 0.42),
    inset 0 -4px 7px rgba(0, 0, 0, 0.42),
    0 0 0 2px rgba(68, 30, 6, 0.86),
    0 7px 16px rgba(12, 8, 3, 0.52);
  transition: transform 130ms cubic-bezier(0.16, 1, 0.3, 1), filter 130ms ease, box-shadow 130ms ease;
}

.arcade-orb-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.08);
}

.arcade-orb-btn:active:not(:disabled) {
  transform: scale(0.93);
}

.arcade-orb-btn:disabled {
  filter: saturate(0.38) brightness(0.75);
  cursor: not-allowed;
}

.orb-skill {
  background: radial-gradient(circle at 35% 28%, #a78bfa 0%, #7c3aed 55%, #4c1d95 100%);
}

.orb-skill.skill-ready:not(:disabled) {
  box-shadow:
    inset 0 3px 5px rgba(255, 255, 255, 0.45),
    0 0 0 2px rgba(68, 30, 6, 0.85),
    0 0 18px rgba(167, 139, 250, 0.72),
    0 7px 16px rgba(12, 8, 3, 0.5);
}

.orb-shield {
  background: radial-gradient(circle at 35% 28%, #7dd3fc 0%, #0284c7 55%, #075985 100%);
}

.orb-speed {
  background: radial-gradient(circle at 35% 28%, #f0abfc 0%, #d946ef 55%, #701a75 100%);
  border-color: #f5d0fe;
}

.orb-ghost {
  background: radial-gradient(circle at 35% 28%, #67e8f9 0%, #0891b2 55%, #155e75 100%);
}

.orb-boost {
  width: 68px;
  height: 68px;
  border-color: #fde047;
  background: radial-gradient(circle at 35% 28%, #86efac 0%, #16a34a 55%, #14532d 100%);
  touch-action: none;
}

.orb-boost-mobile-ico {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.orb-boost-mobile-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

.orb-boost.boosting {
  background: radial-gradient(circle at 35% 28%, #fef08a 0%, #f97316 55%, #c2410c 100%);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.55),
    0 0 22px rgba(251, 146, 60, 0.9),
    0 6px 14px rgba(12, 8, 3, 0.5);
  transform: scale(1.06);
}

.orb-boost.depleted {
  opacity: 0.62;
  filter: saturate(0.4);
}

.arcade-orb-btn.active {
  border-color: #ffffff;
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.58),
    0 0 20px rgba(254, 240, 138, 0.92),
    0 6px 14px rgba(12, 8, 3, 0.5);
}

.orb-icon {
  font-size: 1.48rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(15, 10, 4, 0.55));
}

.orb-sub {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fffbeb;
  text-shadow: 0 1px 2px rgba(15, 10, 4, 0.92);
  line-height: 1;
}

.orb-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b1c08 0%, #1d0c02 100%);
  border: 2px solid #fef08a;
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
}

/* Bottom-Right Carved Wood Level / Endless Mode Plaque */
.level-mode-plaque {
  justify-self: end;
  padding: 7px 11px 8px;
  min-width: 174px;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.level-plaque-top {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(24, 10, 2, 0.85);
  white-space: nowrap;
}

.level-plaque-top strong {
  color: #fde047;
}

.level-plaque-top .level-total {
  color: #fef3c7;
  font-weight: 600;
}

.level-plaque-modes {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(24, 10, 2, 0.52);
  border: 1px solid rgba(251, 191, 36, 0.32);
}

.plaque-mode-btn {
  border: none;
  background: transparent;
  color: #fde68a;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3.5px 8px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.plaque-mode-btn.active {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  color: #3d1c05;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* ===== SHARED PREY ICONS ===== */
.prey-icons {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  vertical-align: middle;
}

.prey-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.09);
  padding: 2px;
  flex-shrink: 0;
}

.prey-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.prey-icons-hud .prey-icon {
  width: 18px;
  height: 18px;
  padding: 1.5px;
  border-radius: 5px;
  background: rgba(255, 251, 235, 0.9);
  border: 1px solid rgba(217, 151, 50, 0.7);
}

/* ===== SHARED BUTTONS & TOKENS FOR DASHBOARD / STORE MODALS ===== */
.currency-diamond,
.currency-diamond strong {
  color: #7c3aed;
}

.currency-gold,
.currency-gold strong {
  color: #b45309;
}

.sep {
  color: rgba(74, 42, 16, 0.3);
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  border-radius: var(--radius-control);
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 10px;
  min-height: 34px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 150ms cubic-bezier(0.16, 1, 0.3, 1), color 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(22, 48, 43, 0.1);
}

.icon-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 12px;
  min-height: 38px;
  border-radius: var(--radius-control);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1), background-color 140ms ease, border-color 140ms ease;
}

.icon-btn.compact-sq {
  min-height: 34px;
  min-width: 34px;
  padding: 0 9px;
}

.icon-btn:hover {
  background: #fef9ec;
  border-color: rgba(180, 83, 9, 0.38);
}

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

.icon-btn:active:not(:disabled) {
  transform: scale(0.97);
}

button:focus-visible {
  outline: 2px solid #fde047;
  outline-offset: 2px;
}

/* ===== STATE OVERLAYS (WARM ADVENTURE WOOD-GOLD FRAME) ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: rgba(20, 14, 6, 0.56);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 12px;
  overflow: hidden;
  transition: opacity 180ms ease;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  position: relative;
  width: min(100%, 450px);
  max-width: 100%;
  min-width: 0;
  max-height: calc(100% - 4px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse at top, #fffef8 0%, #f8eed9 68%, #efdec0 100%);
  border: 4px solid #e6a83c;
  border-radius: 22px;
  padding: 20px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 0 0 2px rgba(139, 76, 34, 0.25),
    0 0 0 4px #5b2b0e,
    0 0 0 6px rgba(32, 13, 3, 0.72),
    0 24px 56px rgba(10, 6, 2, 0.56);
  text-align: center;
}

.overlay-card.dashboard-card {
  width: min(100%, 760px);
  text-align: left;
  padding: 14px 16px 16px;
}

.pause-modal-card {
  padding: 22px 22px 20px;
}

.pause-emblem {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fde047 0%, #d97706 100%);
  border: 3px solid #fef9c3;
  box-shadow: 0 4px 12px rgba(120, 53, 15, 0.35), 0 0 0 2px #5b2b0e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
}

/* Carved Wood Modal Top Header Bar */
.player-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 214, 148, 0.06) 0px,
      rgba(255, 214, 148, 0.06) 2px,
      transparent 2px,
      transparent 9px
    ),
    linear-gradient(180deg, #8b4c22 0%, #683313 52%, #4a220a 100%);
  border: 2.5px solid #e6a83c;
  box-shadow:
    inset 0 2px 1px rgba(255, 232, 168, 0.32),
    inset 0 -3px 5px rgba(24, 9, 2, 0.58),
    0 4px 12px rgba(28, 12, 3, 0.32);
  color: #fffbeb;
}

.player-name-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fde68a;
}

.player-name-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: #fde047;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(28, 11, 2, 0.85);
}

.player-name-input {
  border: 2px solid #d99732;
  background: linear-gradient(180deg, #fffdf7 0%, #fef3c7 100%);
  color: #361906;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9px;
  width: 152px;
  min-height: 32px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(92, 43, 12, 0.16);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.player-name-input:focus {
  border-color: #fde047;
  box-shadow: 0 0 0 2.5px rgba(253, 224, 71, 0.38);
}

.dash-wallet-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fffbeb;
}

.modal-wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: rgba(29, 12, 3, 0.62);
  border: 1.5px solid rgba(230, 168, 60, 0.72);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-wallet-pill.pill-diamond .mw-ico {
  color: #d8b4fe;
  font-size: 0.92rem;
}

.modal-wallet-pill.pill-gold .mw-ico {
  color: #fde047;
  font-size: 0.96rem;
}

.dash-current-level-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  border: 1.5px solid #fef9c3;
  color: #3d1c05;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}

/* Main Dashboard Hero Banner */
.dashboard-hero-banner {
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.96) 0%, rgba(254, 243, 199, 0.75) 100%);
  border: 2px solid rgba(217, 151, 50, 0.48);
  border-radius: 15px;
  padding: 11px 14px 10px;
  margin-bottom: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 3px 10px rgba(92, 43, 12, 0.08);
}

.dashboard-hero-banner .overlay-sub {
  margin: 4px 0 0;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 2px;
}

.dash-hero-copy {
  min-width: 0;
}

.overlay-kicker {
  display: inline-block;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #92400e;
  margin-bottom: 2px;
}

.overlay-card h2 {
  margin: 0 0 4px 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #2f1606;
  text-wrap: balance;
}

.overlay-sub {
  margin: 0 0 12px 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #5c3d24;
  font-weight: 600;
}

/* Carved Wood Level Picker */
.level-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 12px;
  background: linear-gradient(180deg, #683313 0%, #482008 100%);
  border: 2px solid #d99732;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45), 0 3px 8px rgba(45, 20, 4, 0.22);
  font-variant-numeric: tabular-nums;
}

.level-picker-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fffbeb;
  text-shadow: 0 1px 2px rgba(24, 10, 2, 0.85);
  min-width: 132px;
  text-align: center;
  padding: 0 4px;
}

.wood-arrow-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.8px solid #fef08a;
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #3b1904;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 0 #78350f, inset 0 1px 1px rgba(255, 255, 255, 0.65);
  transition: transform 120ms ease, filter 120ms ease;
}

.wood-arrow-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.wood-arrow-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #78350f;
}

.wood-arrow-btn:disabled {
  opacity: 0.42;
  filter: grayscale(0.45);
  cursor: not-allowed;
}

/* ===== GAME OVER / LEVEL RESULT HERO SECTION ===== */
.end-result-head {
  text-align: center;
  padding: 13px 14px 12px;
  margin-bottom: 11px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.92) 0%, rgba(254, 226, 226, 0.46) 100%);
  border: 2px solid rgba(220, 38, 38, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.end-dashboard-card.is-victory .end-result-head {
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.96) 0%, rgba(220, 252, 231, 0.62) 100%);
  border-color: rgba(34, 197, 94, 0.38);
}

.end-ribbon-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 5px;
}

.end-result-emblem {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: linear-gradient(180deg, #fca5a5 0%, #dc2626 100%);
  border: 2px solid #fef2f2;
  box-shadow: 0 3px 8px rgba(185, 28, 28, 0.32);
}

.end-dashboard-card.is-victory .end-result-emblem {
  background: linear-gradient(180deg, #fde047 0%, #eab308 100%);
  border-color: #fefce8;
  box-shadow: 0 3px 10px rgba(202, 138, 4, 0.42);
}

.end-kicker-pill {
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(153, 27, 27, 0.28);
}

.end-dashboard-card.is-victory .end-kicker-pill {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.28);
}

.end-result-head h2 {
  font-size: 1.66rem;
  margin-bottom: 10px;
  color: #3b1407;
}

.end-dashboard-card.is-victory .end-result-head h2 {
  color: #14532d;
}

/* 4-Tile Balanced Stat Grid */
.final-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.final-stats.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.final-stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.94);
  border: 1.5px solid rgba(180, 118, 42, 0.28);
  box-shadow: 0 2px 6px rgba(58, 28, 8, 0.08), inset 0 1px 0 #ffffff;
  min-width: 0;
}

.final-stat-tile.tile-score {
  border-color: rgba(34, 197, 94, 0.35);
}

.final-stat-tile.tile-boss {
  border-color: rgba(239, 68, 68, 0.3);
}

.final-stat-tile.tile-gold {
  border-color: rgba(245, 158, 11, 0.42);
  background: linear-gradient(180deg, #fffef5 0%, #fef9e0 100%);
}

.final-stat-tile.tile-diamond {
  border-color: rgba(139, 92, 246, 0.34);
  background: linear-gradient(180deg, #fdfbff 0%, #f5f0ff 100%);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #7c5636;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.final-stats strong {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.38rem;
  font-weight: 700;
  line-height: 1.15;
  color: #2f1606;
}

.final-stat-tile.tile-score strong {
  color: #15803d;
}

.final-stat-tile.tile-boss strong {
  color: #b91c1c;
}

/* Treasure Collect Gold Banner — Prominent Hero CTA */
.collect-gold-banner {
  margin: 10px auto 0 auto;
  padding: 10px 12px;
  border-radius: 15px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef08a 45%, #fde047 100%);
  border: 2.5px solid #d97706;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.88),
    0 6px 18px rgba(217, 119, 6, 0.34);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.collect-gold-banner.is-ready {
  animation: collectBannerAura 1.8s ease-in-out infinite;
}

@keyframes collectBannerAura {
  0%, 100% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.9),
      0 0 0 0 rgba(245, 158, 11, 0.45),
      0 6px 18px rgba(217, 119, 6, 0.36);
  }
  50% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.95),
      0 0 0 6px rgba(250, 204, 21, 0),
      0 8px 24px rgba(245, 158, 11, 0.52);
  }
}

.collect-gold-banner.collected {
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: rgba(22, 163, 74, 0.45);
  box-shadow: none;
  animation: none;
}

.collect-gold-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 180px;
}

.collect-gold-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.collect-coin-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef08a, #f59e0b 65%, #b45309 100%);
  border: 2px solid #fffbeb;
  color: #fffbeb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(146, 64, 14, 0.4);
  flex-shrink: 0;
}

.collect-coin-badge svg {
  width: 28px;
  height: 28px;
  display: block;
}

.collect-gold-banner.is-ready .collect-coin-badge {
  animation: collectCoinBounce 1.4s ease-in-out infinite;
}

@keyframes collectCoinBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(-6deg); }
}

.collect-gold-banner.collected .collect-coin-badge {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  animation: none;
}

.collect-gold-status {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: #78350f;
  text-align: left;
  line-height: 1.15;
}

.collect-gold-hint {
  font-size: 0.7rem;
  font-weight: 700;
  color: #92400e;
  opacity: 0.88;
  text-align: left;
  line-height: 1.15;
}

.collect-gold-banner.collected .collect-gold-status,
.collect-gold-banner.collected .collect-gold-hint {
  color: #166534;
}

.collect-gold-btn {
  position: relative;
  overflow: hidden;
  border: 2.5px solid #fef9c3;
  border-bottom: 5px solid #92400e;
  border-radius: 14px;
  padding: 10px 22px;
  min-height: 44px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.04rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(120, 53, 15, 0.9);
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 48%, #d97706 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.65),
    0 6px 18px rgba(217, 119, 6, 0.48);
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.collect-gold-banner.is-ready .collect-gold-btn {
  animation: collectBtnPulse 1.5s ease-in-out infinite;
}

.collect-gold-banner.is-ready .collect-gold-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.55) 48%, transparent 74%);
  transform: translateX(-130%);
  animation: collectBtnShine 2.4s ease-in-out infinite;
  pointer-events: none;
}

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

@keyframes collectBtnShine {
  0%, 58% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

.collect-gold-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    0 8px 22px rgba(217, 119, 6, 0.58);
}

.collect-gold-btn:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
  border-bottom-width: 2px;
}

.collect-gold-btn:disabled {
  border: 1.5px solid rgba(22, 163, 74, 0.35);
  border-bottom-width: 1.5px;
  background: rgba(22, 163, 74, 0.16);
  color: #166534;
  text-shadow: none;
  box-shadow: none;
  cursor: default;
  animation: none;
}

.collect-gold-btn:disabled::after {
  display: none;
}

/* ===== 2-COLUMN ADVENTURE PARCHMENT PANELS ===== */
.dashboard-grid,
.end-dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 11px 0;
  font-variant-numeric: tabular-nums;
}

.dash-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  border: 2px solid rgba(202, 138, 42, 0.36);
  border-radius: 14px;
  padding: 10px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  box-shadow: 0 3px 10px rgba(72, 34, 11, 0.08), inset 0 1px 0 #ffffff;
}

.dash-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  color: #7c350a;
  letter-spacing: 0.01em;
  padding-bottom: 5px;
  margin-bottom: 1px;
  border-bottom: 1.5px dashed rgba(202, 138, 42, 0.32);
}

.panel-ico {
  font-size: 0.95rem;
  line-height: 1;
}

.end-snake-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.end-snake-thumb {
  width: 104px;
  flex-shrink: 0;
  aspect-ratio: 3 / 2;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e6a83c;
  background: radial-gradient(circle at 50% 45%, #ecfdf5 0%, #d1fae5 100%);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 4px rgba(21, 128, 61, 0.12);
}

.end-snake-meta,
.end-level-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.end-snake-meta strong,
.end-level-main strong {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  color: #2f1606;
  line-height: 1.2;
}

.end-meta-sub {
  font-size: 0.74rem;
  color: #6b4c30;
  font-weight: 700;
  line-height: 1.3;
}

.end-stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 7px;
  background: #fef3c7;
  border: 1px solid rgba(217, 119, 6, 0.34);
  color: #78350f;
  font-size: 0.69rem;
  font-weight: 800;
  white-space: nowrap;
}

.stat-chip.chip-shield {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.3);
  color: #075985;
}

.stat-chip.chip-boost {
  background: #dcfce7;
  border-color: rgba(22, 163, 74, 0.32);
  color: #166534;
}

.end-prey-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.end-prey-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #7c5636;
  white-space: nowrap;
}

.end-level-panel {
  justify-content: space-between;
}

.end-level-picker {
  align-self: flex-start;
  margin-top: 6px;
}

.end-level-picker .level-picker-label {
  min-width: 92px;
}

.end-tip-line {
  text-align: center;
  margin: 0 auto 12px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(255, 251, 235, 0.85);
  border: 1px solid rgba(202, 138, 42, 0.25);
  font-size: 0.8rem;
  color: #5c3d24;
}

.dash-snake-showcase {
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 142px;
  border-radius: 11px;
  overflow: hidden;
  border: 2px solid #e6a83c;
  background: radial-gradient(circle at 50% 45%, #ecfdf5 0%, #d1fae5 100%);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(21, 128, 61, 0.12);
}

.dash-ref-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

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

.dash-identity-line {
  font-size: 0.73rem;
  font-weight: 700;
  color: #15803d;
  line-height: 1.3;
  margin-bottom: 1px;
}

.dash-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.77rem;
  color: #6b4c30;
  font-weight: 600;
  min-width: 0;
}

.dash-stat-row > span {
  flex-shrink: 0;
}

.dash-stat-row strong {
  color: #2f1606;
  font-weight: 800;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.dash-goal-box {
  margin-top: auto;
  padding: 7px 9px;
  border-radius: 10px;
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
  border: 1.5px solid rgba(139, 92, 246, 0.28);
}

.dash-view-pills {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.biome-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 2px 0 4px 0;
}

.biome-pill {
  appearance: none;
  border: 1.5px solid rgba(146, 64, 14, 0.24);
  background: #fffdf7;
  color: #6b4c30;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.14s ease, border-color 0.14s ease;
}

.biome-pill:hover {
  border-color: #d97706;
  color: #2f1606;
  transform: translateY(-1px);
}

.biome-pill.active {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  border-color: #15803d;
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(5, 46, 22, 0.6);
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.28);
}

.biome-pill[data-biome="desert"].active {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  border-color: #b45309;
}

.biome-pill[data-biome="glacier"].active {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border-color: #0369a1;
}

.biome-pill[data-biome="volcano"].active {
  background: linear-gradient(180deg, #fb7185 0%, #dc2626 100%);
  border-color: #991b1b;
}

.dash-progress-track {
  height: 7px;
  width: 100%;
  background: rgba(124, 58, 237, 0.16);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 5px;
}

.dash-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #c084fc);
  transition: width 220ms ease;
}

/* Daily Quests & Achievement Trophies Panel */
.missions-panel {
  margin-top: 6px;
  margin-bottom: 12px;
  padding: 9px 11px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid rgba(217, 151, 50, 0.44);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

.missions-tabs {
  display: inline-flex;
  gap: 4px;
  background: rgba(92, 43, 12, 0.12);
  padding: 3px;
  border-radius: 9px;
}

.mission-tab {
  border: none;
  background: transparent;
  color: #6b4c30;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 7px;
  cursor: pointer;
}

.mission-tab.active {
  background: linear-gradient(180deg, #7c3f19 0%, #56290e 100%);
  color: #fef08a;
  box-shadow: 0 2px 5px rgba(58, 24, 5, 0.28);
}

.missions-hint {
  font-size: 0.72rem;
  font-weight: 800;
  color: #92400e;
}

.missions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#achievementsList.missions-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 9px;
  border-radius: 10px;
  background: #ffffff;
  border: 1.5px solid rgba(180, 118, 42, 0.22);
  min-width: 0;
}

.mission-card.ready {
  border-color: #f59e0b;
  background: #fefce8;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.mission-card.claimed {
  opacity: 0.72;
  background: #f5f3ee;
}

.mission-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.mission-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.mission-reward {
  color: #b45309;
  white-space: nowrap;
}

.mission-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(74, 42, 16, 0.12);
  overflow: hidden;
}

.mission-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  border-radius: 99px;
}

.mission-claim-btn {
  margin-top: 2px;
  border: 1.5px solid #fef08a;
  border-bottom: 3px solid #92400e;
  border-radius: 8px;
  padding: 4px 8px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  background: linear-gradient(180deg, #fbbf24, #d97706);
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(120, 53, 15, 0.75);
  cursor: pointer;
}

.mission-claim-btn:disabled {
  border: 1px solid rgba(74, 42, 16, 0.12);
  border-bottom-width: 1px;
  background: #ece7dc;
  color: #786552;
  text-shadow: none;
  cursor: default;
}

.asset-credits {
  margin: 10px 0 0;
  font-size: 0.7rem;
  color: #786552;
  text-align: center;
}

.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.upgrade-bar-row {
  display: flex;
  gap: 4px;
  margin: 2px 0;
}

.upgrade-pip {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(74, 42, 16, 0.12);
}

.upgrade-pip.filled {
  background: #22c55e;
}

.gate-notice {
  margin: 0 0 10px 0;
  padding: 9px 12px;
  border-radius: 11px;
  background: linear-gradient(180deg, #fef3c7, #fde68a);
  border: 1.5px solid #f59e0b;
  color: #78350f;
  font-size: 0.81rem;
  font-weight: 700;
  line-height: 1.4;
}

/* ===== TACTILE 3D BEVELED ARCADE ACTION BUTTONS ===== */
.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
}

.primary-btn,
.arcade-gold-btn,
.reward-btn,
.secondary-btn,
.reset-danger-btn {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 9px 18px;
  min-height: 44px;
  border-radius: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1), filter 120ms ease, box-shadow 120ms ease;
}

/* Emerald Primary CTA (Play / Retry / Next Level / Resume) */
.primary-btn {
  border: 2px solid #bbf7d0;
  border-bottom: 4px solid #14532d;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 52%, #16a34a 100%);
  color: #ffffff;
  font-size: 0.98rem;
  padding: 9px 24px;
  text-shadow: 0 1.5px 2px rgba(5, 46, 22, 0.72);
  box-shadow: 0 5px 14px rgba(21, 128, 61, 0.34), inset 0 2px 2px rgba(255, 255, 255, 0.35);
}

/* Warm Amber Gold CTA (Store & Upgrades / Restart) */
.arcade-gold-btn {
  border: 2px solid #fef08a;
  border-bottom: 4px solid #92400e;
  background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 52%, #d97706 100%);
  color: #ffffff;
  text-shadow: 0 1.5px 2px rgba(120, 53, 15, 0.75);
  box-shadow: 0 5px 14px rgba(217, 119, 6, 0.32), inset 0 2px 2px rgba(255, 255, 255, 0.42);
}

/* Royal Amethyst CTA (Watch Ad +3 Diamonds) */
.reward-btn {
  border: 2px solid #e9d5ff;
  border-bottom: 4px solid #4c1d95;
  background: linear-gradient(180deg, #c084fc 0%, #9333ea 52%, #7e22ce 100%);
  color: #ffffff;
  text-shadow: 0 1.5px 2px rgba(59, 7, 100, 0.72);
  box-shadow: 0 5px 14px rgba(126, 34, 206, 0.32), inset 0 2px 2px rgba(255, 255, 255, 0.35);
}

/* Carved Wood Secondary CTA (Dashboard / Replay) */
.secondary-btn {
  border: 2px solid #e6a83c;
  border-bottom: 4px solid #361806;
  background: linear-gradient(180deg, #8b4c22 0%, #683313 54%, #4f250b 100%);
  color: #fffbeb;
  text-shadow: 0 1.5px 2px rgba(24, 10, 2, 0.8);
  box-shadow: 0 4px 12px rgba(45, 20, 4, 0.3), inset 0 1.5px 1px rgba(255, 232, 168, 0.32);
}

/* Terracotta Danger Action (Reset Game) */
.reset-danger-btn {
  border: 2px solid #fecaca;
  border-bottom: 4px solid #7f1d1d;
  background: linear-gradient(180deg, #f87171 0%, #dc2626 55%, #b91c1c 100%);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(127, 29, 29, 0.72);
  box-shadow: 0 4px 10px rgba(185, 28, 28, 0.28);
}

.reset-danger-btn.confirming {
  border-color: #fef08a;
  background: linear-gradient(180deg, #ef4444 0%, #991b1b 100%);
}

.primary-btn:hover:not(:disabled),
.arcade-gold-btn:hover:not(:disabled),
.reward-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled),
.reset-danger-btn:hover:not(:disabled) {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.primary-btn:active:not(:disabled),
.arcade-gold-btn:active:not(:disabled),
.reward-btn:active:not(:disabled),
.secondary-btn:active:not(:disabled),
.reset-danger-btn:active:not(:disabled) {
  transform: translateY(2px);
}

.icon-btn.reward-outline {
  border: 1.5px solid #c084fc;
  background: linear-gradient(180deg, #a855f7, #7e22ce);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
}

.icon-btn.reward-outline:hover {
  filter: brightness(1.08);
  border-color: #e9d5ff;
}

/* ===== FULL-SCREEN KID-FRIENDLY GAME LOBBY DASHBOARD (LIVE 3D TERRAIN BEHIND!) ===== */
.overlay.lobby-fullscreen {
  padding: 0;
  z-index: 26;
  background: transparent;
  backdrop-filter: none;
  display: block;
}

.lobby-bg-layer {
  position: absolute;
  inset: 0;
  /* Keep center crystal clear so the Waterfall Meadow backdrop & sculpted 3D Hero Serpent on the Center Stone shine vividly! */
  background:
    linear-gradient(180deg, rgba(10, 26, 14, 0.24) 0%, rgba(10, 26, 14, 0) 18%, rgba(10, 26, 14, 0) 80%, rgba(10, 26, 14, 0.42) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Full 3D Terrain Peek Mode — lets kids admire the 100% unobstructed 3D world! */
.overlay.lobby-fullscreen.lobby-3d-peek .lobby-left-rail,
.overlay.lobby-fullscreen.lobby-3d-peek .lobby-hero-stage,
.overlay.lobby-fullscreen.lobby-3d-peek .big-quest-hub-btn,
.overlay.lobby-fullscreen.lobby-3d-peek .lobby-profile-card,
.overlay.lobby-fullscreen.lobby-3d-peek .lobby-brand-crest,
.overlay.lobby-fullscreen.lobby-3d-peek .lobby-currency-bar .wood-capsule,
.overlay.lobby-fullscreen.lobby-3d-peek .lobby-reset-pill {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: opacity 220ms ease, transform 220ms ease;
}

.overlay.lobby-fullscreen .lobby-left-rail,
.overlay.lobby-fullscreen .lobby-hero-stage,
.overlay.lobby-fullscreen .big-quest-hub-btn,
.overlay.lobby-fullscreen .lobby-profile-card,
.overlay.lobby-fullscreen .lobby-brand-crest {
  transition: opacity 220ms ease, transform 220ms ease;
}

.lobby-peek-btn {
  appearance: none;
  border: 2px solid #bae6fd;
  border-bottom: 3px solid #0369a1;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.36);
}

.lobby-peek-btn.active {
  border-color: #fef08a;
  border-bottom-color: #92400e;
  background: linear-gradient(180deg, #fbbf24, #d97706);
}

.lobby-firefly {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fef08a 45%, rgba(250, 204, 21, 0) 100%);
  box-shadow: 0 0 12px 3px rgba(254, 240, 138, 0.8);
  animation: lobbyFireflyFloat 7s ease-in-out infinite;
  opacity: 0.82;
}

.lobby-firefly.f1 { left: 16%; top: 28%; animation-delay: 0s; }
.lobby-firefly.f2 { left: 32%; top: 64%; animation-delay: -1.6s; width: 7px; height: 7px; }
.lobby-firefly.f3 { left: 48%; top: 20%; animation-delay: -3.1s; width: 11px; height: 11px; }
.lobby-firefly.f4 { left: 66%; top: 34%; animation-delay: -2.2s; }
.lobby-firefly.f5 { left: 78%; top: 58%; animation-delay: -4.4s; width: 8px; height: 8px; }
.lobby-firefly.f6 { left: 24%; top: 48%; animation-delay: -5.2s; width: 6px; height: 6px; }

@keyframes lobbyFireflyFloat {
  0%, 100% { transform: translate(0, 0) scale(0.85); opacity: 0.45; }
  40% { transform: translate(18px, -24px) scale(1.25); opacity: 0.96; }
  75% { transform: translate(-12px, -10px) scale(0.95); opacity: 0.65; }
}

.lobby-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow: hidden;
}

/* TOP BAR */
.lobby-top-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 12px;
}

.lobby-profile-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  justify-self: start;
  max-width: 100%;
}

.lobby-avatar-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid #fde047;
  box-shadow: 0 0 0 2px #5c2a0c, 0 4px 10px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle, #ecfdf5, #bbf7d0);
  overflow: hidden;
  flex-shrink: 0;
}

.lobby-avatar-btn {
  position: relative;
  padding: 0;
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 150ms ease;
}

.lobby-avatar-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px #fde047, 0 6px 14px rgba(0, 0, 0, 0.45);
}

.avatar-edit-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fde047, #f59e0b);
  border: 2px solid #5c2a0c;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.lobby-avatar-link {
  border: 1.5px solid #fde047;
  background: linear-gradient(180deg, #f59e0b, #b45309);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 4px;
}

.lobby-avatar-link:hover {
  filter: brightness(1.1);
}

.lobby-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lobby-profile-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lobby-name-input {
  border: 2px solid rgba(253, 224, 71, 0.72);
  background: rgba(255, 253, 244, 0.94);
  color: #361906;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9px;
  width: 146px;
  max-width: 100%;
  outline: none;
}

.lobby-name-input:focus {
  border-color: #fde047;
  box-shadow: 0 0 0 2.5px rgba(253, 224, 71, 0.45);
}

.lobby-brand-crest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.92) 0%, rgba(69, 26, 3, 0.94) 100%);
  border: 3px solid #fde047;
  box-shadow:
    inset 0 2px 2px rgba(255, 245, 200, 0.4),
    0 6px 18px rgba(14, 34, 18, 0.46);
  justify-self: center;
}

.brand-crown {
  font-size: 1.45rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}

.brand-logo-text {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1.22rem, 2.2vw, 1.72rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffffff 0%, #fef08a 52%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #5b2507);
  white-space: nowrap;
}

.lobby-currency-bar {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: end;
}

.lobby-cap {
  height: 40px;
  padding: 3px 6px 3px 9px;
}

.lobby-reset-pill {
  appearance: none;
  border: 2px solid rgba(254, 202, 202, 0.72);
  border-bottom: 3px solid #7f1d1d;
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.9), rgba(153, 27, 27, 0.94));
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
}

.lobby-reset-pill.confirming {
  border-color: #fde047;
  background: linear-gradient(180deg, #ef4444, #991b1b);
}

/* GOLD TREASURE CHEST ICON & POP-OPEN ANIMATION */
.treasure-chest-target {
  position: relative;
  overflow: visible;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 150ms ease;
}

.treasure-chest-icon {
  width: 34px;
  height: 30px;
  margin-left: -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.42));
}

.treasure-chest-icon.end-chest-icon {
  width: 28px;
  height: 24px;
  margin-left: -2px;
}

.chest-box-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fde68a;
  font-weight: 700;
}

.treasure-chest-icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.treasure-chest-icon .chest-lid {
  transform-origin: 18px 13px;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.treasure-chest-icon .chest-coins-pile {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 180ms ease;
}

.treasure-chest-target.chest-collecting {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.72), 0 0 24px rgba(250, 204, 21, 0.85) !important;
}

.treasure-chest-target.chest-collecting .chest-lid {
  transform: translateY(-4.5px) rotate(-14deg);
}

.treasure-chest-target.chest-collecting .chest-coins-pile {
  opacity: 1;
  transform: translateY(-1px);
}

.treasure-chest-target.chest-hit {
  animation: chestHitBounce 190ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes chestHitBounce {
  0% { transform: scale(1.12); }
  50% { transform: scale(1.22) rotate(-2deg); }
  100% { transform: scale(1.1); }
}

/* GLOBAL FLYING GOLD COINS LAYER */
.coin-flight-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  overflow: hidden;
}

.flying-gold-coin {
  position: fixed;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef9c3 0%, #facc15 48%, #d97706 88%, #92400e 100%);
  border: 2px solid #fffbeb;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.9), 0 3px 6px rgba(69, 26, 3, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fffbeb;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  will-change: transform, opacity;
}

.flying-diamond-gem {
  position: fixed;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e0f2fe 0%, #38bdf8 46%, #0284c7 82%, #1d4ed8 100%);
  border: 2px solid #f0f9ff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.95), 0 3px 8px rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 900;
  will-change: transform, opacity;
}

.chest-sparkle-pop.is-diamond {
  color: #7dd3fc;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.95);
}

.chest-sparkle-pop {
  position: fixed;
  font-size: 1.05rem;
  pointer-events: none;
  will-change: transform, opacity;
  animation: chestSparkleFly 540ms ease-out forwards;
}

@keyframes chestSparkleFly {
  0% { transform: translate(0, 0) scale(0.4) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--sx, 0px), var(--sy, -34px)) scale(1.2) rotate(45deg); opacity: 0; }
}

/* CENTER 3-COLUMN LOBBY STAGE */
.lobby-stage-grid {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 312px;
  gap: 14px;
  min-height: 0;
  align-items: center;
}

/* LEFT ACTION RAIL (CHUNKY KIDS GAME BUTTONS) */
.lobby-left-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
}

.rail-tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 10px;
  border-radius: 18px;
  cursor: pointer;
  text-align: center;
  color: #ffffff;
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1), filter 140ms ease;
}

.rail-tile:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.07);
}

.rail-tile:active {
  transform: translateY(2px) scale(0.97);
}

.rail-tile.tile-store {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 55%, #d97706 100%);
  border: 3px solid #fef9c3;
  border-bottom: 6px solid #92400e;
  box-shadow: 0 8px 20px rgba(120, 53, 15, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.55);
}

.rail-tile.tile-upgrades {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 58%, #0369a1 100%);
  border: 3px solid #bae6fd;
  border-bottom: 6px solid #0c4a6e;
  box-shadow: 0 8px 18px rgba(12, 74, 110, 0.42), inset 0 2px 3px rgba(255, 255, 255, 0.45);
}

.rail-tile.tile-gift {
  background: linear-gradient(180deg, #c084fc 0%, #9333ea 58%, #6b21a8 100%);
  border: 3px solid #f3e8ff;
  border-bottom: 6px solid #4c1d95;
  box-shadow: 0 8px 18px rgba(76, 29, 149, 0.42), inset 0 2px 3px rgba(255, 255, 255, 0.45);
}

.rail-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.42) 48%, transparent 72%);
  transform: translateX(-140%);
  animation: glossySweep 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glossySweep {
  0%, 62% { transform: translateX(-140%); }
  100% { transform: translateX(140%); }
}

.rail-icon {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.32));
}

.rail-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.45);
}

.rail-sub {
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
}

.lobby-next-snake-card {
  padding: 9px 10px;
  border-radius: 15px;
  background: rgba(45, 20, 6, 0.84);
  border: 2.5px solid #e6a83c;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  color: #fffbeb;
}

.next-snake-top {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.next-snake-kicker {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fde047;
}

.next-snake-top strong {
  font-size: 0.74rem;
  line-height: 1.25;
  color: #ffffff;
}

.lobby-goal-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(253, 224, 71, 0.45);
  margin-top: 6px;
}

/* CENTER HERO SNAKE PEDESTAL STAGE */
.lobby-hero-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  height: 100%;
}

.hero-sunbeam-halo {
  position: absolute;
  width: min(420px, 68vw);
  height: min(420px, 68vw);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(254, 240, 138, 0.24) 0deg 14deg,
    transparent 14deg 30deg
  );
  border-radius: 50%;
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.95) 18%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.95) 18%, transparent 72%);
  animation: sunbeamSpin 26s linear infinite;
  pointer-events: none;
}

@keyframes sunbeamSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-pedestal-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

.hero-snake-stage {
  position: relative;
  width: min(390px, 100%);
  height: clamp(168px, 28vh, 250px);
  padding: 10px;
  border-radius: 26px;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.96) 0%, rgba(236, 253, 245, 0.92) 72%, rgba(187, 247, 208, 0.85) 100%);
  border: 4px solid #fde047;
  box-shadow:
    0 0 0 4px rgba(91, 43, 14, 0.88),
    0 14px 34px rgba(10, 42, 20, 0.45),
    inset 0 0 24px rgba(74, 222, 128, 0.24);
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
  overflow: visible;
}

.hero-snake-stage:hover {
  transform: translateY(-4px) scale(1.02);
}

.hero-snake-stage.hero-bounce {
  animation: heroCheerJump 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes heroCheerJump {
  0% { transform: scale(1, 1) translateY(0); }
  25% { transform: scale(1.08, 0.92) translateY(4px); }
  55% { transform: scale(0.95, 1.09) translateY(-18px); }
  80% { transform: scale(1.04, 0.97) translateY(2px); }
  100% { transform: scale(1, 1) translateY(0); }
}

.hero-snake-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: heroIdleFloat 3.4s ease-in-out infinite;
}

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

.hero-tap-hint {
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border: 2px solid #fef9c3;
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(5, 46, 22, 0.4);
}

.hero-pedestal-glow {
  width: 240px;
  height: 22px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(254, 240, 138, 0.72) 0%, rgba(74, 222, 128, 0.34) 55%, transparent 78%);
  pointer-events: none;
}

.hero-tap-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.cheer-star {
  position: absolute;
  left: 50%;
  top: 46%;
  font-size: 1.35rem;
  animation: cheerStarBurst 650ms ease-out forwards;
}

@keyframes cheerStarBurst {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.25) rotate(40deg); opacity: 0; }
}

/* HERO NAMEPLATE & STAT STRIP */
.hero-info-dock {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(48, 22, 7, 0.86);
  border: 2.5px solid #e6a83c;
  box-shadow: 0 10px 26px rgba(10, 18, 8, 0.42), inset 0 1.5px 1px rgba(255, 232, 168, 0.34);
  text-align: center;
  color: #fffbeb;
}

.hero-name-ribbon {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.12rem;
  color: #fef08a;
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.6);
}

.hero-skin-dot,
.hero-skin-name {
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde68a;
}

.hero-flavor-line {
  margin: 2px 0 8px 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: #ecfdf5;
  opacity: 0.92;
}

.hero-power-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.hero-power-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 6px;
  border-radius: 11px;
  background: rgba(255, 253, 245, 0.95);
  border: 1.5px solid rgba(230, 168, 60, 0.65);
  color: #361906;
  min-width: 0;
}

.hpc-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #92400e;
}

.hero-power-cell strong {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  color: #2f1606;
  text-align: center;
}

/* RIGHT HUB: ILLUSTRATED WORLDS & QUESTS */
.lobby-right-hub {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: 100%;
}

.lobby-wood-card {
  padding: 10px 11px;
  border-radius: 17px;
  background: rgba(255, 251, 240, 0.94);
  border: 3px solid #e6a83c;
  box-shadow: 0 0 0 2px #5b2b0e, 0 10px 24px rgba(10, 18, 8, 0.36);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
}

.lobby-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.lobby-card-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  color: #6b300c;
}

.world-active-name {
  font-size: 0.76rem;
  font-weight: 800;
  color: #15803d;
}

.biome-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.biome-thumb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px 3px 4px;
  border-radius: 11px;
  border: 2px solid rgba(146, 64, 14, 0.25);
  background: #ffffff;
  color: #4a220a;
  cursor: pointer;
  overflow: hidden;
  transition: transform 120ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.biome-thumb-btn:hover {
  transform: translateY(-2px);
  border-color: #f59e0b;
}

.biome-thumb-btn.active {
  border-color: #16a34a;
  background: linear-gradient(180deg, #dcfce7, #bbf7d0);
  color: #14532d;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.32);
}

.bt-img,
.bt-swatch {
  width: 100%;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swatch-auto {
  background: linear-gradient(135deg, #4ade80 0%, #38bdf8 50%, #fbbf24 100%);
  font-size: 1.15rem;
}

.bt-name {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1;
}

.world-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.cam-pill {
  appearance: none;
  border: 1.5px solid rgba(146, 64, 14, 0.28);
  background: #fffbeb;
  color: #6b4c30;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
  cursor: pointer;
}

.cam-pill.active {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border-color: #15803d;
  color: #ffffff;
}

.world-rec-inline {
  font-size: 0.7rem;
  font-weight: 800;
}

.world-challenge-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  font-size: 0.69rem;
  font-weight: 800;
  color: #6b4c30;
  padding-top: 4px;
  border-top: 1px solid rgba(180, 118, 42, 0.2);
}

.lobby-missions-card {
  flex: 1 1 auto;
  overflow: hidden;
}

.lobby-missions-list {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 210px;
  padding-right: 2px;
}

/* BOTTOM PLAY STAGE DOCK */
.lobby-bottom-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.dock-level-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(180deg, rgba(255, 214, 148, 0.05) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #8b4c22 0%, #683313 55%, #4a220a 100%);
  border: 3px solid #e6a83c;
  box-shadow: 0 0 0 2px #361806, 0 10px 24px rgba(10, 18, 8, 0.45);
  color: #fffbeb;
  min-width: 0;
}

.dock-mode-switch {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(24, 9, 2, 0.55);
  padding: 4px;
  border-radius: 11px;
  border: 1.5px solid rgba(230, 168, 60, 0.45);
  flex-shrink: 0;
}

.dock-mode-btn {
  border: none;
  background: transparent;
  color: #fde68a;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.dock-mode-btn.active {
  background: linear-gradient(180deg, #fde047, #d97706);
  color: #361906;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}

.dock-mission-copy {
  min-width: 0;
  flex: 1;
}

.dock-kicker {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fde047;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-boss-title {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.16rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(20, 8, 2, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-boss-desc {
  margin: 1px 0 0;
  font-size: 0.74rem;
  color: #fef3c7;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dock-level-picker {
  flex-shrink: 0;
  background: rgba(24, 9, 2, 0.48);
  border-color: rgba(253, 224, 71, 0.55);
}

.dock-level-picker .level-picker-label {
  color: #ffffff;
  min-width: 150px;
}

/* GIANT PULSING EMERALD PLAY BUTTON */
.mega-play-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 248px;
  min-height: 68px;
  padding: 12px 32px;
  border-radius: 22px;
  border: 4px solid #fef08a;
  border-bottom: 8px solid #14532d;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 48%, #16a34a 100%);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.48rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 2.5px 2px rgba(5, 46, 22, 0.78);
  box-shadow:
    0 0 0 3px #14532d,
    0 12px 28px rgba(5, 46, 22, 0.54),
    0 0 26px rgba(74, 222, 128, 0.55),
    inset 0 3px 3px rgba(255, 255, 255, 0.48);
  cursor: pointer;
  white-space: nowrap;
  animation: megaPlayPulse 2.2s ease-in-out infinite;
  transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1), filter 120ms ease;
}

.mega-play-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px) scale(1.03);
}

.mega-play-btn:active {
  transform: translateY(3px) scale(0.97);
}

.mega-play-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.45) 48%, transparent 72%);
  transform: translateX(-140%);
  animation: glossySweep 2.6s ease-in-out infinite;
  pointer-events: none;
}

.mega-play-icon {
  font-size: 1.38rem;
  filter: drop-shadow(0 2px 1px rgba(5, 46, 22, 0.7));
}

@keyframes megaPlayPulse {
  0%, 100% { box-shadow: 0 0 0 3px #14532d, 0 12px 28px rgba(5, 46, 22, 0.54), 0 0 20px rgba(74, 222, 128, 0.45), inset 0 3px 3px rgba(255, 255, 255, 0.48); }
  50% { box-shadow: 0 0 0 3px #14532d, 0 14px 32px rgba(5, 46, 22, 0.58), 0 0 34px rgba(253, 224, 71, 0.75), inset 0 3px 3px rgba(255, 255, 255, 0.58); }
}

/* ===== FULL-SCREEN TOY-STORE & SNAKE GARAGE ===== */
.overlay.shop-fullscreen {
  padding: 0;
  z-index: 32;
  background: #2b1608;
  backdrop-filter: none;
  display: block;
}

.shop-bg-layer {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(28, 12, 3, 0.54) 0%, rgba(28, 12, 3, 0.34) 48%, rgba(20, 10, 4, 0.64) 100%),
    url('/src/assets/images/store_workshop_stage_1796490327314.jpg') center center / cover no-repeat;
  pointer-events: none;
  z-index: 0;
}

.shop-full-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow: hidden;
}

.shop-top-bar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(180deg, rgba(255, 214, 148, 0.05) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #8b4c22 0%, #683313 55%, #4a220a 100%);
  border: 3px solid #e6a83c;
  box-shadow: 0 0 0 2px #361806, 0 8px 20px rgba(0, 0, 0, 0.42);
  flex-shrink: 0;
}

.shop-top-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.shop-back-btn {
  appearance: none;
  border: 2px solid #fef08a;
  border-bottom: 4px solid #92400e;
  background: linear-gradient(180deg, #fcd34d, #d97706);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 12px;
  cursor: pointer;
  text-shadow: 0 1.5px 2px rgba(92, 43, 12, 0.78);
  white-space: nowrap;
}

.shop-title-lockup {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.shop-title-lockup h2 {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.28rem;
  font-weight: 700;
  color: #fef08a;
  text-shadow: 0 2px 2px rgba(24, 9, 2, 0.8);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.shop-best-inline {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fde68a;
}

.shop-top-tabs {
  display: inline-flex;
  gap: 6px;
  background: rgba(24, 9, 2, 0.56);
  padding: 4px;
  border-radius: 14px;
  border: 2px solid rgba(230, 168, 60, 0.52);
  justify-self: center;
}

.shop-cat-tab {
  appearance: none;
  border: 2px solid transparent;
  background: transparent;
  color: #fde68a;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 7px 15px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 140ms ease, transform 120ms ease;
}

.shop-cat-tab:hover {
  color: #ffffff;
}

.shop-cat-tab.active {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  border-color: #fef08a;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(5, 46, 22, 0.72);
  box-shadow: 0 3px 10px rgba(21, 128, 61, 0.42);
}

.shop-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.shop-free-btn {
  padding: 6px 13px;
  min-height: 38px;
  font-size: 0.82rem;
}

.shop-full-body {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.shop-preview-stage {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 253, 244, 0.96) 0%, rgba(247, 236, 210, 0.96) 100%);
  border: 3px solid #e6a83c;
  box-shadow: 0 0 0 2px #5b2b0e, 0 12px 28px rgba(0, 0, 0, 0.42);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.shop-stage-spotlight {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 28%, rgba(253, 224, 71, 0.24), transparent 64%);
  pointer-events: none;
  border-radius: 17px;
}

.shop-stage-split {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-stage-split.single-stage {
  display: flex;
  flex-direction: column;
}

.shop-ref-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid #86efac;
  background: radial-gradient(circle, #ffffff 0%, #ecfdf5 80%, #d1fae5 100%);
  padding: 6px;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 215px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-ref-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.ref-badge {
  display: none;
}

.shop-live-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#shopPreviewCanvas {
  width: 100%;
  height: 142px;
  display: block;
  border-radius: 12px;
  border: 2px solid rgba(180, 118, 42, 0.34);
  background: #f0fdf4;
}

.preview-view-switch {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid rgba(180, 118, 42, 0.32);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.view-pill {
  border: none;
  background: transparent;
  color: #6b4c30;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.view-pill.active {
  background: #16a34a;
  color: #ffffff;
}

.shop-preview-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.88);
  border: 1.5px solid rgba(180, 118, 42, 0.28);
  font-variant-numeric: tabular-nums;
}

.shop-preview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.06rem;
  color: #2f1606;
}

.shop-preview-skin-line {
  font-size: 0.78rem;
  font-weight: 700;
  color: #7c5636;
}

.preview-skin-label {
  color: #15803d;
  font-weight: 800;
}

.shop-preview-stats {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #4a2c14;
  font-weight: 700;
}

.shop-catalog-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  border-radius: 20px;
  background: rgba(48, 22, 7, 0.72);
  border: 3px solid rgba(230, 168, 60, 0.78);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

.shop-catalog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.shop-gate-banner {
  padding: 7px 12px;
  border-radius: 11px;
  background: linear-gradient(180deg, #fef9c3 0%, #fde68a 100%);
  border: 1.5px solid #f59e0b;
  color: #78350f;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  flex: 1 1 240px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(222px, 1fr));
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 6px 8px 4px;
  min-height: 0;
  flex: 1;
  align-content: start;
}

.item-card {
  border: 3px solid #e6a83c;
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(10, 8, 3, 0.32);
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1), border-color 140ms ease, box-shadow 140ms ease;
}

.item-card:hover {
  transform: translateY(-3px);
  border-color: #fde047;
  box-shadow: 0 10px 22px rgba(10, 8, 3, 0.4);
}

.item-card.equipped {
  border-color: #22c55e;
  background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4), 0 8px 20px rgba(10, 8, 3, 0.34);
}

.item-card.previewing {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.42), 0 10px 24px rgba(10, 8, 3, 0.38);
}

.item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.item-name {
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--ink);
}

.item-tier {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

.item-tier.tier-legendary { color: #b45309; }
.item-tier.tier-mythic { color: #7c3aed; }
.item-tier.tier-epic { color: #2563eb; }
.item-tier.tier-rare { color: #0f766e; }

.card-preview-canvas {
  width: 100%;
  height: 68px;
  display: block;
  border-radius: 10px;
  background: #f4fbf7;
  border: 1px solid rgba(74, 42, 16, 0.1);
}

.card-ref-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(74, 42, 16, 0.12);
  background: #f4fbf8;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-ref-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.card-ref-tag {
  display: none;
}

.card-identity-note {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-strong);
  line-height: 1.28;
}

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.79rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.stat-row strong {
  color: var(--ink);
  font-weight: 700;
}

.item-btn {
  margin-top: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms ease, background-color 140ms ease;
}

.item-btn.buy-diamond {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #ffffff;
}

.item-btn.buy-gold {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
}

.item-btn.equip-btn {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.item-btn.active-btn {
  background: #e3f5ea;
  border-color: transparent;
  color: #15803d;
  cursor: default;
}

.item-card.locked-order {
  background: #f5f3ee;
  border-style: dashed;
  border-color: rgba(74, 42, 16, 0.24);
}

.item-card.locked-order .card-ref-img,
.item-card.locked-order .card-preview-canvas {
  filter: grayscale(0.45) opacity(0.76);
}

.item-btn.locked-btn {
  background: #ebe6dc;
  border-color: rgba(74, 42, 16, 0.16);
  color: var(--ink-muted);
  font-size: 0.75rem;
  white-space: normal;
  line-height: 1.2;
  padding: 4px 8px;
  cursor: not-allowed;
}

.item-btn:disabled:not(.active-btn) {
  opacity: 0.62;
  cursor: not-allowed;
}

.item-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.hidden {
  display: none !important;
}

/* ===== RESPONSIVE TABLET & MOBILE HUD SCALING ===== */
@media (max-width: 1024px) {
  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .hud-top-row {
    grid-template-columns: minmax(175px, 1fr) auto minmax(175px, 1fr);
    gap: 7px;
  }

  .profile-plaque {
    min-width: 196px;
    padding: 5px 9px 5px 6px;
    gap: 7px;
  }

  .profile-avatar-ring {
    width: 42px;
    height: 42px;
  }

  .profile-name {
    font-size: 0.88rem;
  }

  .leaderboard-plaque {
    width: 176px;
    padding: 6px;
  }

  .hud-resources-row {
    gap: 7px;
  }

  .wood-capsule {
    height: 32px;
    gap: 5px;
  }

  .capsule-icon {
    width: 26px;
    height: 26px;
    margin-left: -8px;
  }

  .capsule-val {
    font-size: 0.88rem;
    min-width: 24px;
  }

  .energy-bar-track {
    width: 66px;
    height: 18px;
  }

  .timer-plaque {
    min-width: 162px;
    padding: 4px 13px 6px;
  }

  .timer-digits {
    font-size: 1.28rem;
  }

  .gold-circle-btn {
    width: 35px;
    height: 35px;
  }

  .gold-circle-btn svg {
    width: 17px;
    height: 17px;
  }

  #hudMinimapCanvas {
    width: 122px;
    height: 96px;
  }

  .arcade-orb-btn {
    width: 54px;
    height: 54px;
  }

  .orb-boost {
    width: 60px;
    height: 60px;
  }

  .orb-icon {
    font-size: 1.3rem;
  }

  .shop-full-body {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 10px;
  }

  .lobby-stage-grid {
    grid-template-columns: 138px minmax(0, 1fr) 268px;
    gap: 10px;
  }

  .mega-play-btn {
    min-width: 204px;
    font-size: 1.28rem;
    padding: 10px 22px;
  }

  .shop-grid {
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 9px;
  }
}

@media (max-width: 900px) {
  .lobby-shell {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    grid-template-rows: auto auto auto;
    gap: 10px;
  }

  .lobby-top-bar {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .lobby-brand-crest {
    display: none;
  }

  .lobby-stage-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .lobby-left-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .lobby-next-snake-card {
    grid-column: 1 / -1;
  }

  .hero-power-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lobby-bottom-dock {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dock-level-console {
    flex-wrap: wrap;
    gap: 8px;
  }

  .mega-play-btn {
    width: 100%;
    min-width: 0;
  }

  .shop-top-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 10px;
  }

  .shop-top-left,
  .shop-top-right {
    justify-content: space-between;
  }

  .shop-full-shell {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shop-full-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
    flex: none;
  }

  .shop-preview-stage {
    overflow: visible;
    flex-shrink: 0;
  }

  .shop-stage-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
  }

  .shop-ref-wrap {
    aspect-ratio: 3 / 2;
    max-height: 145px;
  }

  #shopPreviewCanvas {
    height: 100%;
    min-height: 100px;
  }

  .shop-catalog-col {
    overflow: visible;
    flex: none;
  }

  .shop-grid {
    overflow: visible;
    flex: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile Portrait Layout (Phones) */
@media (max-width: 680px) {
  .arcade-hud {
    padding:
      max(6px, env(safe-area-inset-top))
      max(7px, env(safe-area-inset-right))
      max(7px, env(safe-area-inset-bottom))
      max(7px, env(safe-area-inset-left));
  }

  .hud-top-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "center center"
      "left right";
    gap: 6px;
  }

  .hud-center-col {
    grid-area: center;
    gap: 5px;
  }

  .hud-left-col {
    grid-area: left;
    gap: 5px;
  }

  .hud-right-col {
    grid-area: right;
    gap: 5px;
  }

  .hud-resources-row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .wood-capsule {
    height: 29px;
    padding: 2px 4px 2px 5px;
    gap: 4px;
  }

  .capsule-icon {
    width: 22px;
    height: 22px;
    margin-left: -6px;
  }

  .capsule-val {
    font-size: 0.78rem;
    min-width: 18px;
  }

  .capsule-plus-btn {
    width: 20px;
    height: 20px;
    font-size: 0.86rem;
  }

  .energy-bar-track {
    width: 52px;
    height: 16px;
  }

  .energy-bar-text {
    font-size: 0.66rem;
  }

  .timer-plaque {
    min-width: 140px;
    padding: 3px 11px 5px;
  }

  .hourglass-icon {
    width: 18px;
    height: 22px;
  }

  .timer-digits {
    font-size: 1.06rem;
  }

  .timer-subtitle {
    font-size: 0.65rem;
  }

  .profile-plaque {
    min-width: 0;
    width: 100%;
    max-width: 195px;
    padding: 4px 7px 4px 5px;
    gap: 6px;
  }

  .profile-avatar-ring {
    width: 34px;
    height: 34px;
  }

  .profile-name {
    font-size: 0.76rem;
  }

  .profile-prey-wrap {
    display: none;
  }

  .profile-xp-track {
    min-width: 62px;
    height: 15px;
  }

  .profile-xp-text {
    font-size: 0.64rem;
  }

  .leaderboard-plaque {
    width: 148px;
    padding: 4px 5px 5px;
  }

  .leaderboard-title {
    font-size: 0.72rem;
    padding-bottom: 3px;
    margin-bottom: 3px;
  }

  .lb-row {
    padding: 2px 5px;
    font-size: 0.66rem;
  }

  .lb-row:nth-child(n + 4) {
    display: none;
  }

  .hud-utility-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .wood-view-switch {
    display: none;
  }

  .gold-circle-btn {
    width: 31px;
    height: 31px;
    border-width: 2px;
  }

  .gold-circle-btn svg {
    width: 15px;
    height: 15px;
  }

  .hud-right-widgets {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }

  #hudMinimapCanvas {
    width: 96px;
    height: 76px;
  }

  .power-readout {
    padding: 4px 8px;
    gap: 5px;
    border-radius: 10px;
  }

  .pow-body strong {
    font-size: 0.7rem;
  }

  .pow-body small {
    font-size: 0.62rem;
  }

  .hud-bottom-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .hud-bottom-left {
    align-self: end;
  }

  .wood-steer-switch .wood-seg-btn {
    padding: 5px 8px;
    font-size: 0.66rem;
    min-height: 28px;
  }

  /* Dedicated Mobile Touch Power Activation Pad (Bottom-Right Thumb Zone) */
  .hud-ability-dock {
    justify-self: end;
    display: grid;
    grid-template-columns: repeat(4, auto);
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: center;
    gap: 7px 6px;
    padding: 7px 8px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(16, 24, 38, 0.56) 0%, rgba(10, 16, 26, 0.72) 100%);
    border: 1.5px solid rgba(251, 191, 36, 0.42);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(4px);
    touch-action: none;
  }

  .hud-ability-dock .orb-skill {
    grid-column: 1;
    grid-row: 1;
  }

  .hud-ability-dock .orb-shield {
    grid-column: 2;
    grid-row: 1;
  }

  .hud-ability-dock .orb-speed {
    grid-column: 3;
    grid-row: 1;
  }

  .hud-ability-dock .orb-ghost {
    grid-column: 4;
    grid-row: 1;
  }

  .hud-ability-dock .orb-boost {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 164px;
    height: 44px;
    border-radius: 999px;
    flex-direction: row;
    gap: 8px;
    padding: 0 16px;
    border-width: 3px;
  }

  .hud-ability-dock .orb-boost .orb-icon {
    font-size: 1.25rem;
  }

  .hud-ability-dock .orb-boost .orb-sub {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .hud-ability-dock .orb-boost .orb-badge {
    position: static;
    margin-left: auto;
    height: 20px;
    min-width: 38px;
    font-size: 0.64rem;
  }

  .arcade-orb-btn {
    width: 48px;
    height: 48px;
    border-width: 2.5px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .arcade-orb-btn.touch-pressed {
    transform: scale(0.9) !important;
    filter: brightness(1.18);
  }

  .orb-icon {
    font-size: 1.15rem;
  }

  .orb-sub {
    font-size: 0.56rem;
  }

  .orb-badge {
    min-width: 22px;
    height: 17px;
    padding: 0 4px;
    font-size: 0.54rem;
    bottom: -4px;
    right: -4px;
  }

  /* Level is already visible in top-left HUD plaque — hide redundant bottom-right plaque on mobile phones to keep the thumb power pad roomy */
  .level-mode-plaque {
    display: none;
  }

  .overlay {
    padding: 6px;
  }

  .overlay-card,
  .overlay-card.dashboard-card {
    padding: 13px 11px;
    border-radius: 15px;
  }

  .final-stats,
  .final-stats.three-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .final-stats strong {
    font-size: 1.18rem;
  }

  .end-result-head h2 {
    font-size: 1.38rem;
  }

  .overlay-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .overlay-actions .primary-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .overlay-actions .arcade-gold-btn,
  .overlay-actions .reward-btn,
  .overlay-actions .secondary-btn,
  .overlay-actions .reset-danger-btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .shop-stage-split {
    grid-template-columns: 1fr;
  }
}

/* Short Mobile Landscape */
@media (max-height: 520px) {
  .arcade-hud {
    padding: 5px 8px;
  }

  .leaderboard-plaque {
    width: 162px;
    padding: 4px 6px;
  }

  .lb-row:nth-child(n + 4) {
    display: none;
  }

  .profile-plaque {
    min-width: 188px;
    padding: 4px 8px 4px 5px;
  }

  .profile-avatar-ring {
    width: 34px;
    height: 34px;
  }

  .timer-plaque {
    padding: 3px 12px 5px;
    min-width: 146px;
  }

  .timer-digits {
    font-size: 1.12rem;
  }

  .timer-subtitle {
    font-size: 0.65rem;
  }

  #hudMinimapCanvas {
    width: 108px;
    height: 82px;
  }

  .arcade-orb-btn {
    width: 46px;
    height: 46px;
  }

  .orb-boost {
    width: 52px;
    height: 52px;
  }

  .orb-icon {
    font-size: 1.12rem;
  }

  .level-mode-plaque {
    min-width: 136px;
    padding: 4px 8px;
  }
}

/* ===== CENTER STONE PEDESTAL + CLEAN NAMEPLATE ===== */
.hero-pedestal-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  width: 100%;
  min-height: 220px;
}

.hero-snake-stage.hero-3d-hitbox {
  position: relative;
  z-index: 3;
  width: clamp(220px, 32vw, 340px);
  height: clamp(200px, 38vh, 300px);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 0;
}

.hero-snake-stage.hero-3d-hitbox .dash-preview-canvas {
  width: 100%;
  height: 100%;
  border-radius: 20px;
}

.hero-stone-nameplate {
  position: relative;
  z-index: 4;
  margin-top: 6px;
  margin-bottom: 4px;
  display: flex;
  justify-content: center;
}

.stone-name-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.96) 0%, rgba(69, 26, 3, 0.96) 100%);
  border: 3px solid #fde047;
  box-shadow:
    inset 0 2px 3px rgba(255, 245, 200, 0.45),
    0 8px 20px rgba(8, 18, 10, 0.52);
  color: #fef9c3;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(0.95rem, 1.45vw, 1.18rem);
}

.stone-ribbon-star {
  color: #fde047;
  font-size: 1.1rem;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.85);
}

/* ===== SIDE SNAKE ABILITIES CARD (LEFT RAIL) ===== */
.lobby-abilities-card {
  border-radius: 16px;
  padding: 9px 10px;
  background: linear-gradient(180deg, rgba(66, 32, 10, 0.9) 0%, rgba(40, 18, 5, 0.92) 100%);
  border: 2.5px solid #d99732;
  box-shadow: 0 8px 18px rgba(10, 18, 12, 0.42), inset 0 1px 2px rgba(255, 244, 200, 0.28);
  color: #fef3c7;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lac-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lac-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fde047;
  letter-spacing: 0.02em;
}

.lac-flavor {
  font-size: 0.67rem;
  color: #fde68a;
  opacity: 0.9;
  line-height: 1.25;
}

.lac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.lac-cell {
  background: rgba(255, 251, 235, 0.11);
  border: 1px solid rgba(253, 224, 71, 0.25);
  border-radius: 10px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lac-cell strong {
  font-family: 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== BIG QUESTS ICON LAUNCHER BUTTON ===== */
.big-quest-hub-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 20px;
  border: 3.5px solid #fef08a;
  border-bottom: 6px solid #9a3412;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 45%, #c2410c 100%);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.45),
    0 10px 24px rgba(154, 52, 18, 0.48);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), filter 150ms ease;
}

.big-quest-hub-btn:hover {
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.07);
}

.big-quest-hub-btn:active {
  transform: translateY(1px) scale(0.98);
}

.bq-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.32) 48%, transparent 65%);
  transform: translateX(-100%);
  animation: bqShineSweep 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bqShineSweep {
  0%, 60% { transform: translateX(-120%); }
  100% { transform: translateX(130%); }
}

.bq-emblem {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, #fffbeb, #fde047 68%, #d97706 100%);
  border: 2.5px solid #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 5px 12px rgba(69, 26, 3, 0.38);
  animation: bqBounceIcon 2.6s ease-in-out infinite;
}

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

.bq-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bq-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(69, 26, 3, 0.55);
}

.bq-stages {
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fef08a;
}

.bq-cta {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffedd5;
}

.bq-badge {
  position: absolute;
  top: 7px;
  right: 9px;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  border: 2.5px solid #fef08a;
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(185, 28, 28, 0.65);
  animation: bqBadgePop 1.4s ease-in-out infinite;
  z-index: 3;
}

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

/* ===== 3-STAGE ADVENTURE QUESTS MODAL ===== */
.overlay.quests-modal-overlay,
.overlay.avatar-modal-overlay {
  z-index: 38;
  background: rgba(12, 24, 16, 0.72);
  backdrop-filter: blur(8px);
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.quests-modal-card,
.avatar-modal-card {
  width: min(920px, 100%);
  max-height: min(92vh, 760px);
  border-radius: 26px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 4px solid #d97706;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quests-modal-header,
.avatar-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: linear-gradient(180deg, #78350f 0%, #451a03 100%);
  border-bottom: 3px solid #fbbf24;
  color: #fef9c3;
}

.quests-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quests-modal-header h2,
.avatar-modal-header h2 {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1.12rem, 2.2vw, 1.48rem);
  color: #fde047;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.quests-modal-sub,
.avatar-modal-sub {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #fde68a;
  font-weight: 700;
}

.quests-wallet-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quest-stage-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px 8px;
  background: rgba(251, 191, 36, 0.16);
}

.quest-stage-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 10px;
  border-radius: 15px;
  border: 2.5px solid #d97706;
  border-bottom: 4px solid #92400e;
  background: #ffffff;
  color: #78350f;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.quest-stage-tab:hover {
  transform: translateY(-2px);
}

.quest-stage-tab.active {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  color: #451a03;
  border-color: #fef08a;
  border-bottom-color: #92400e;
  box-shadow: 0 6px 14px rgba(217, 119, 6, 0.32);
}

.qs-pill {
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fef08a;
}

.quest-stage-banner {
  margin: 0 16px 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, #fef08a, #fed7aa);
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: #78350f;
  font-size: 0.82rem;
}

.quest-stage-banner strong {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.96rem;
}

.quests-modal-body {
  padding: 8px 16px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.quests-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.quests-card-grid .mission-card {
  padding: 13px 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 2.5px solid #fcd34d;
  box-shadow: 0 6px 16px rgba(120, 53, 15, 0.12);
}

.quests-card-grid .mission-card.ready {
  border-color: #16a34a;
  background: linear-gradient(180deg, #f0fdf4, #dcfce7);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.24);
}

.quests-card-grid .mission-title {
  font-size: 0.92rem;
  color: #451a03;
}

.quests-card-grid .mission-claim-btn {
  padding: 8px 12px;
  font-size: 0.84rem;
}

/* ===== 10 SNAKE HERO AVATARS MODAL (5 MALE · 5 FEMALE) ===== */
.avatar-filter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px 6px;
}

.avatar-filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 2.5px solid #d97706;
  background: #ffffff;
  color: #78350f;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.avatar-filter-btn.active {
  background: linear-gradient(180deg, #fde047, #f59e0b);
  color: #451a03;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.32);
}

.avatar-picker-grid {
  padding: 10px 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.avatar-group-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.avatar-section-title {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1rem;
  color: #78350f;
  display: flex;
  align-items: center;
  gap: 6px;
}

.avatar-cards-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.avatar-choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 11px;
  border-radius: 18px;
  border: 3px solid #fcd34d;
  border-bottom: 5px solid #d97706;
  background: #ffffff;
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), border-color 150ms ease, box-shadow 150ms ease;
}

.avatar-choice-card:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: #f59e0b;
  box-shadow: 0 10px 22px rgba(180, 83, 9, 0.24);
}

.avatar-choice-card.selected {
  border-color: #16a34a;
  border-bottom-color: #15803d;
  background: linear-gradient(180deg, #f0fdf4, #dcfce7);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.32), 0 10px 22px rgba(22, 163, 74, 0.24);
}

.avatar-choice-thumb {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 3.5px solid #fbbf24;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  background: #ecfdf5;
}

.avatar-choice-card.selected .avatar-choice-thumb {
  border-color: #16a34a;
}

.avatar-choice-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-choice-name {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #451a03;
}

.avatar-choice-role {
  font-size: 0.69rem;
  font-weight: 800;
  color: #92400e;
}

.avatar-selected-pill {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.68rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: #16a34a;
  color: #ffffff;
}

/* ===== BIG WORLD MAP ICON LAUNCHER (OPENS FULL-SCREEN 3D MAP VIEWER) ===== */
.big-map-hub-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 22px;
  border: 3.5px solid #99f6e4;
  border-bottom: 6px solid #115e59;
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 58%, #115e59 100%);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.44), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), filter 150ms ease;
}

.big-map-hub-btn:hover {
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.07);
}

.big-map-hub-btn:active {
  transform: translateY(2px) scale(0.985);
}

.bm-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0.3) 48%, rgba(255, 255, 255, 0) 68%);
  transform: translateX(-120%);
  animation: bqShineSweep 3.8s ease-in-out infinite 1.2s;
  pointer-events: none;
}

.bm-3d-tag {
  position: absolute;
  top: 7px;
  right: 9px;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fde047, #f59e0b);
  border: 1.5px solid #ffffff;
  color: #451a03;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

.bm-emblem {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, #f0fdfa, #ccfbf1 62%, #5eead4 100%);
  border: 2.5px solid #fef08a;
  display: grid;
  place-items: center;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.28);
}

.bm-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bm-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fef08a;
  text-shadow: 0 2px 0 #134e4a;
}

.bm-world-name {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-sub {
  font-size: 0.72rem;
  font-weight: 800;
  color: #ccfbf1;
}

/* ===== DEDICATED FULL-SCREEN 3D WORLD MAP VIEWER OVERLAY ===== */
.overlay.map3d-overlay {
  position: absolute;
  inset: 0;
  z-index: 34;
  background: transparent;
  backdrop-filter: none;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: auto;
  cursor: pointer;
}

.overlay.map3d-overlay.hidden {
  display: none;
}

.map3d-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  pointer-events: auto;
  cursor: default;
}

.map3d-title-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 20px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(102, 51, 18, 0.94), rgba(68, 32, 10, 0.96));
  border: 2.5px solid #f59e0b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
  color: #ffffff;
}

.map3d-kicker {
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fde047;
}

.map3d-title-pill h2 {
  margin: 1px 0 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1.02rem, 2.2vw, 1.38rem);
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.map3d-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map3d-select-btn {
  padding: 10px 18px;
  border-radius: 14px;
  border: 2.5px solid #bbf7d0;
  border-bottom: 4px solid #166534;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.42);
}

.map3d-select-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
}

.map3d-bottom-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 10px 14px 12px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(64, 31, 10, 0.88), rgba(40, 18, 6, 0.94));
  border: 2.5px solid #e5a93c;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.48);
  pointer-events: auto;
}

.map3d-info-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fef3c7;
}

.map3d-biome-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.map3d-biome-strip .biome-thumb-btn {
  min-height: 68px;
}

/* ===== FIT-ALL-DEVICES RESPONSIVE POLISH (DESKTOP · TABLET · MOBILE PORTRAIT · MOBILE LANDSCAPE) ===== */
.lobby-shell {
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.arcade-hud {
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
}

/* Tablet & Compact Laptop (<= 1040px) */
@media (max-width: 1040px) {
  .lobby-stage-grid {
    grid-template-columns: minmax(175px, 215px) minmax(0, 1fr) minmax(195px, 235px);
    gap: 10px;
  }
  .big-map-hub-btn,
  .big-quest-hub-btn {
    padding: 10px 11px;
    gap: 9px;
  }
  .bm-emblem,
  .bq-emblem {
    width: 50px;
    height: 50px;
  }
  .bm-emblem svg,
  .bq-emblem svg {
    width: 44px;
    height: 44px;
  }
  .bm-title,
  .bq-title {
    font-size: 0.96rem;
  }
  .lobby-abilities-card {
    padding: 8px 9px;
  }
  .lac-cell strong {
    font-size: 0.68rem;
  }
}

/* Mobile Portrait & Narrow Phones (<= 760px) */
@media (max-width: 760px) {
  .lobby-shell {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    justify-content: space-between;
  }
  .lobby-top-bar {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
  }
  .lobby-brand-crest {
    order: -1;
    width: 100%;
    justify-content: center;
  }
  .brand-logo-text {
    font-size: 1.45rem;
  }
  .lobby-profile-card {
    padding: 5px 8px;
    max-width: 56%;
  }
  .lobby-avatar-ring {
    width: 40px;
    height: 40px;
  }
  .lobby-name-input {
    width: 96px;
    font-size: 0.8rem;
  }
  .lobby-currency-bar {
    gap: 5px;
  }
  .lobby-currency-bar .wood-capsule {
    padding: 4px 7px;
    font-size: 0.78rem;
  }
  .lobby-stage-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex: 1 0 auto;
  }
  /* Keep center 3D Hero Serpent open & prominent above action hubs on portrait phones! */
  .lobby-hero-stage {
    order: 1;
    min-height: 220px;
    justify-content: flex-end;
    padding-bottom: 4px;
  }
  .hero-3d-hitbox {
    min-height: 170px;
  }
  .lobby-right-hub {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .lobby-left-rail {
    order: 3;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .lobby-left-rail .rail-tile {
    padding: 7px 6px;
    min-height: 54px;
  }
  .lobby-left-rail .rail-label {
    font-size: 0.72rem;
  }
  .lobby-left-rail .rail-sub {
    display: none;
  }
  .lobby-left-rail .lobby-abilities-card,
  .lobby-left-rail .lobby-next-snake-card {
    grid-column: 1 / -1;
  }
  .lobby-bottom-dock {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
  }
  .lobby-play-btn {
    width: 100%;
    min-width: 0;
    padding: 12px 18px;
  }
  .map3d-biome-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .map3d-top-bar {
    justify-content: center;
  }
  .map3d-top-right {
    width: 100%;
    justify-content: space-between;
  }
  .avatar-cards-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quest-stage-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quests-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Short Mobile Landscape Screens (Phones turned sideways: height <= 540px) */
@media (max-height: 540px) and (orientation: landscape) {
  .lobby-shell {
    gap: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .brand-logo-text {
    font-size: 1.25rem;
  }
  .lobby-stage-grid {
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) minmax(175px, 215px);
    gap: 8px;
  }
  .lobby-left-rail .rail-tile {
    padding: 5px 8px;
    gap: 4px;
  }
  .lobby-left-rail .rail-sub,
  .lobby-abilities-card .lac-flavor,
  .lobby-next-snake-card {
    display: none;
  }
  .lobby-abilities-card {
    padding: 6px 8px;
  }
  .big-map-hub-btn,
  .big-quest-hub-btn {
    padding: 7px 9px;
    gap: 8px;
    border-radius: 16px;
  }
  .bm-emblem,
  .bq-emblem {
    width: 42px;
    height: 42px;
  }
  .bm-emblem svg,
  .bq-emblem svg {
    width: 36px;
    height: 36px;
  }
  .bm-sub,
  .bq-sub {
    display: none;
  }
  .hero-3d-hitbox {
    min-height: 110px;
  }
  .lobby-bottom-dock {
    padding: 5px 10px;
  }
  .lobby-play-btn {
    padding: 8px 24px;
  }
  .map3d-biome-strip .biome-thumb-btn {
    min-height: 48px;
  }
  .map3d-info-strip {
    display: none;
  }
}

/* ============================================================================
   AAA WOOD-AND-LEAF REFERENCE LOBBY DASHBOARD (.ref-*)
   ============================================================================ */

.ref-lobby-overlay {
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  overflow: hidden !important;
}

.ref-dash-shell {
  position: relative;
  z-index: 4;
  width: 100%;
  height: 100%;
  max-height: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(22px, calc(14px + env(safe-area-inset-bottom))) max(14px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  pointer-events: none;
  box-sizing: border-box;
  overflow: hidden;
}

.ref-dash-shell button,
.ref-dash-shell input,
.ref-dash-shell [role="button"],
.ref-dash-shell .ref-profile-plaque,
.ref-dash-shell .ref-currency-pill,
.ref-dash-shell .ref-level-card,
.ref-dash-shell .ref-bottom-nav,
.ref-dash-shell .ref-equipped-ribbon {
  pointer-events: auto;
}

/* ---------- TOP BAR ---------- */
.ref-top-bar {
  display: grid;
  grid-template-columns: minmax(215px, 1fr) auto minmax(215px, 1fr);
  align-items: start;
  gap: 12px;
}

/* Carved Wood Profile Plaque (Top-Left) */
.ref-profile-plaque {
  position: relative;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 7px 6px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(12deg, rgba(255, 214, 153, 0.06) 0 3px, rgba(0, 0, 0, 0.05) 3px 7px),
    linear-gradient(180deg, #9b521f 0%, #6f330f 55%, #4b1f07 100%);
  border: 3px solid #3c1705;
  box-shadow:
    inset 0 2px 0 rgba(255, 224, 178, 0.45),
    inset 0 -3px 0 rgba(45, 16, 4, 0.8),
    0 6px 16px rgba(15, 23, 42, 0.45);
  min-width: 224px;
  max-width: 268px;
}

.ref-leaf-sprout {
  position: absolute;
  top: -8px;
  left: -6px;
  width: 28px;
  height: 18px;
  border-radius: 16px 2px 16px 2px;
  background: linear-gradient(135deg, #86efac 0%, #22c55e 52%, #15803d 100%);
  border: 2px solid #14532d;
  transform: rotate(-22deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}

.ref-avatar-btn {
  position: relative;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 55%, #5c2808 100%);
  border: 3px solid #3c1705;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(254, 240, 138, 0.7);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.ref-avatar-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.55), 0 6px 14px rgba(0, 0, 0, 0.45);
}

.ref-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ref-profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.ref-name-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 13, 3, 0.72);
  border: 1.5px solid rgba(251, 191, 36, 0.38);
  border-radius: 999px;
  padding: 2px 9px 2px 6px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55);
}

.ref-crown-icon {
  font-size: 0.9rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.ref-name-input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.75);
}

.ref-name-input:focus {
  color: #fef08a;
}

.ref-profile-level-text {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: #fef3c7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  text-align: center;
  line-height: 1;
}

.ref-xp-track {
  height: 10px;
  border-radius: 999px;
  background: #2b1204;
  border: 1.5px solid #1c0b02;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  padding: 1px;
}

.ref-xp-fill {
  height: 100%;
  min-width: 10%;
  border-radius: 999px;
  background: linear-gradient(180deg, #bef264 0%, #4ade80 48%, #16a34a 100%);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
  transition: width 0.35s ease;
}

/* Top-Center Leaf-Framed Carved Wood SNAKE SURGE Sign */
.ref-brand-sign {
  position: relative;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
}

.ref-sign-board {
  position: relative;
  z-index: 2;
  padding: 6px 32px 10px;
  border-radius: 22px 22px 28px 28px;
  background:
    repeating-linear-gradient(-8deg, rgba(255, 220, 165, 0.07) 0 4px, rgba(0, 0, 0, 0.06) 4px 9px),
    linear-gradient(180deg, #a85b22 0%, #7c3a11 52%, #502107 100%);
  border: 3.5px solid #3c1604;
  box-shadow:
    inset 0 3px 0 rgba(255, 228, 179, 0.45),
    inset 0 -5px 0 rgba(48, 17, 4, 0.85),
    0 9px 22px rgba(15, 23, 42, 0.48);
}

.ref-sign-leaves {
  position: absolute;
  top: 50%;
  width: 56px;
  height: 54px;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
}

.ref-sign-leaves::before,
.ref-sign-leaves::after {
  content: '';
  position: absolute;
  border-radius: 70% 8% 70% 8%;
  background: linear-gradient(135deg, #bef264 0%, #22c55e 50%, #15803d 100%);
  border: 2.5px solid #14532d;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.ref-sign-leaves.leaves-left {
  left: -4px;
}
.ref-sign-leaves.leaves-left::before {
  width: 44px;
  height: 24px;
  top: 3px;
  left: 0;
  transform: rotate(-28deg);
}
.ref-sign-leaves.leaves-left::after {
  width: 40px;
  height: 22px;
  bottom: 3px;
  left: 4px;
  transform: rotate(22deg);
}

.ref-sign-leaves.leaves-right {
  right: -4px;
}
.ref-sign-leaves.leaves-right::before {
  width: 44px;
  height: 24px;
  top: 3px;
  right: 0;
  transform: scaleX(-1) rotate(-28deg);
}
.ref-sign-leaves.leaves-right::after {
  width: 40px;
  height: 22px;
  bottom: 3px;
  right: 4px;
  transform: scaleX(-1) rotate(22deg);
}

.ref-sign-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
}

.ref-word-snake {
  font-size: clamp(1.55rem, 2.7vw, 2.35rem);
  background: linear-gradient(180deg, #fffbeb 0%, #fde047 38%, #f59e0b 78%, #d97706 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.6px #451a03;
  filter: drop-shadow(0 3px 0 #451a03) drop-shadow(0 5px 8px rgba(0, 0, 0, 0.45));
}

.ref-word-surge {
  font-size: clamp(1.35rem, 2.3vw, 2.0rem);
  margin-top: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 45%, #38bdf8 82%, #0284c7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px #0c2e59;
  filter: drop-shadow(0 3px 0 #0c2e59) drop-shadow(0 5px 8px rgba(0, 0, 0, 0.45));
}

/* Top-Right Currency Pills & Settings Gear */
.ref-currency-cluster {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ref-currency-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 5px 4px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20, 32, 46, 0.88) 0%, rgba(12, 20, 30, 0.94) 100%);
  border: 2.5px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.65),
    0 5px 12px rgba(15, 23, 42, 0.42);
  min-width: 112px;
}

.ref-gold-pill {
  border-color: rgba(250, 204, 21, 0.65);
}

.ref-diamond-pill {
  border-color: rgba(56, 189, 248, 0.65);
}

.ref-coin-emblem,
.ref-gem-emblem {
  width: 29px;
  height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  flex-shrink: 0;
}

.ref-coin-emblem svg,
.ref-gem-emblem svg {
  width: 100%;
  height: 100%;
}

.ref-currency-val {
  flex: 1;
  text-align: center;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.8);
  padding: 0 2px;
}

.ref-plus-btn {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 2px solid #14532d;
  background: linear-gradient(180deg, #86efac 0%, #22c55e 52%, #15803d 100%);
  color: #ffffff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s ease, filter 0.14s ease;
}

.ref-plus-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

.ref-settings-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 2.5px solid #475569;
  background: linear-gradient(180deg, #475569 0%, #1e293b 55%, #0f172a 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 7px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    0 5px 12px rgba(15, 23, 42, 0.48);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.ref-settings-btn:hover {
  transform: rotate(22deg) scale(1.06);
  border-color: #fde047;
}

.ref-settings-btn svg {
  width: 100%;
  height: 100%;
}

.ref-music-btn {
  border-color: #f59e0b;
}

.ref-music-btn:hover {
  transform: scale(1.08);
  border-color: #fde047;
}

.ref-music-btn.is-muted {
  border-color: #64748b;
  opacity: 0.72;
}

.ref-music-btn.is-muted svg path {
  fill: #94a3b8;
}

/* ---------- MIDDLE 3-COLUMN STAGE ---------- */
.ref-middle-grid {
  display: grid;
  grid-template-columns: minmax(175px, 212px) minmax(0, 1fr) minmax(205px, 248px);
  align-items: center;
  gap: 12px;
  min-height: 0;
}

/* LEFT 4-BUTTON STACK */
.ref-left-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
}

.ref-side-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px 9px 10px;
  border-radius: 17px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.ref-side-card:hover {
  transform: translateX(4px) scale(1.02);
  filter: brightness(1.06);
}

.ref-side-card:active {
  transform: scale(0.97);
}

.ref-wood-tile {
  background:
    repeating-linear-gradient(10deg, rgba(255, 214, 153, 0.06) 0 3px, rgba(0, 0, 0, 0.05) 3px 7px),
    linear-gradient(180deg, #9d5320 0%, #6f330f 56%, #4a1e06 100%);
  border: 3px solid #3c1604;
  box-shadow:
    inset 0 2px 0 rgba(255, 224, 178, 0.45),
    inset 0 -3px 0 rgba(42, 15, 3, 0.85),
    0 6px 14px rgba(15, 23, 42, 0.42);
}

.ref-blue-tile {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 46%, #1d4ed8 100%);
  border: 3px solid #1e3a8a;
  box-shadow:
    inset 0 2px 0 rgba(224, 242, 254, 0.65),
    inset 0 -4px 0 rgba(23, 37, 84, 0.72),
    0 6px 14px rgba(15, 23, 42, 0.42);
}

/* Circular Archery Target Quest Medallion (Never a Rectangle!) */
.ref-quest-target-btn {
  width: 82px;
  height: 82px;
  padding: 4px;
  align-self: center;
  border-radius: 50% !important;
  flex-direction: column !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: radial-gradient(circle at 35% 30%, #fef08a 0%, #d97706 60%, #78350f 100%);
  border: 3px solid #451a03;
  box-shadow:
    inset 0 2px 0 rgba(255, 251, 235, 0.75),
    0 6px 16px rgba(15, 23, 42, 0.48);
  text-align: center;
  overflow: visible;
}

.ref-quest-target-btn:hover {
  transform: scale(1.08) !important;
  filter: brightness(1.06);
}

.ref-quest-target-icon {
  width: 68px !important;
  height: 68px !important;
  flex: 0 0 68px !important;
  border-radius: 50%;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.42));
}

.ref-quest-target-copy {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #92400e 0%, #451a03 100%);
  border: 1.8px solid #fde047;
  border-radius: 999px;
  padding: 1px 9px 2px;
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.45);
  width: auto !important;
  align-items: center;
  z-index: 2;
}

.ref-quest-target-copy .ref-tile-title {
  font-size: 0.72rem;
  line-height: 1.05;
  color: #fffbeb;
  white-space: nowrap;
}

.ref-quest-target-copy .ref-tile-sub {
  display: none !important;
}

.quests-heading-with-target {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.quests-heading-target-svg {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.ref-tile-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
}

.ref-tile-icon svg {
  width: 100%;
  height: 100%;
}

.ref-tile-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ref-tile-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.08;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.72);
}

.ref-tile-sub {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  color: #fde68a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-red-badge {
  position: absolute;
  top: -7px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff6b6b 0%, #ef4444 50%, #b91c1c 100%);
  border: 2px solid #ffffff;
  color: #ffffff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(185, 28, 28, 0.65);
  z-index: 4;
}

/* CENTER STAGE (OPEN WATERFALL MEADOW + HERO SNAKE + MOVING 3D INSECTS) */
.ref-center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-height: 0;
  padding-bottom: 2px;
  pointer-events: none;
}

.ref-center-spacer {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.ref-equipped-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(114, 54, 15, 0.88) 0%, rgba(69, 28, 6, 0.94) 100%);
  border: 2px solid #fbbf24;
  color: #fef3c7;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(0.68rem, 1.15vw, 0.82rem);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* RIGHT RAIL: 3D World Map · Power Ups · Top Rank */
.ref-right-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
}

/* Purple-Magenta & Gold 3D World Map Card (Matches reference Special Event card) */
.ref-event-map-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 10px 12px 11px;
  border-radius: 19px;
  border: 3px solid #facc15;
  background: linear-gradient(135deg, #c026d3 0%, #7e22ce 48%, #4c1d95 100%);
  box-shadow:
    inset 0 2px 0 rgba(254, 240, 138, 0.65),
    inset 0 -4px 0 rgba(59, 7, 100, 0.85),
    0 8px 20px rgba(15, 23, 42, 0.48);
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.ref-event-map-card:hover {
  transform: translateX(-4px) scale(1.025);
  filter: brightness(1.08);
}

.ref-event-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 22%, rgba(255, 255, 255, 0.22) 48%, transparent 72%);
  pointer-events: none;
}

.ref-event-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.ref-event-clock {
  font-size: 1.15rem;
  line-height: 1;
}

.ref-event-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.04rem;
  color: #fef08a;
  text-shadow: 0 2px 3px rgba(59, 7, 100, 0.9);
  letter-spacing: 0.02em;
}

.ref-event-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ref-event-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.ref-event-biome {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.65);
}

.ref-event-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(34, 10, 56, 0.72);
  border: 1.5px solid rgba(250, 204, 21, 0.65);
  color: #fef08a;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.7rem;
}

.ref-event-art {
  width: 52px;
  height: 46px;
  flex: 0 0 52px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.48));
}

.ref-event-art svg {
  width: 100%;
  height: 100%;
}

/* Glossy Cyan Power Ups Card */
.ref-powerups-card {
  position: relative;
  padding: 10px 12px 11px;
  border-radius: 19px;
  border: 3px solid #67e8f9;
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.86) 0%, rgba(3, 105, 161, 0.92) 55%, rgba(12, 74, 110, 0.95) 100%);
  box-shadow:
    inset 0 2px 0 rgba(224, 242, 254, 0.72),
    inset 0 -4px 0 rgba(8, 47, 73, 0.8),
    0 8px 18px rgba(15, 23, 42, 0.45);
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.ref-powerups-card:hover {
  transform: translateX(-4px) scale(1.02);
  filter: brightness(1.07);
}

.ref-pu-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 8px;
}

.ref-pu-title {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(8, 47, 73, 0.88);
}

.ref-info-btn {
  position: absolute;
  right: -4px;
  top: -5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: linear-gradient(180deg, #f472b6 0%, #db2777 100%);
  color: #ffffff;
  font-family: 'Fredoka', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 0.82rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 7px rgba(157, 23, 77, 0.65);
  transition: transform 0.15s ease;
}

.ref-info-btn:hover {
  transform: scale(1.15);
}

.ref-pu-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ref-pu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ref-pu-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid #e0f2fe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.45), 0 4px 10px rgba(0, 0, 0, 0.38);
}

.ref-pu-circle.pu-bolt {
  background: radial-gradient(circle at 35% 30%, #fef08a 0%, #f59e0b 60%, #b45309 100%);
}
.ref-pu-circle.pu-shield {
  background: radial-gradient(circle at 35% 30%, #bae6fd 0%, #0284c7 62%, #1e3a8a 100%);
}
.ref-pu-circle.pu-magnet {
  background: radial-gradient(circle at 35% 30%, #fecaca 0%, #dc2626 62%, #7f1d1d 100%);
}

.ref-pu-dur {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #ffffff;
  background: rgba(8, 47, 73, 0.75);
  border-radius: 999px;
  padding: 1px 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

/* Top Rank Golden Trophy Crest */
.ref-top-rank-badge {
  align-self: flex-end;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.18s ease;
}

.ref-top-rank-badge:hover {
  transform: translateY(-3px) scale(1.06);
}

.ref-rank-trophy {
  font-size: 2.15rem;
  line-height: 1;
  margin-bottom: -8px;
  z-index: 2;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55));
}

.ref-rank-plaque {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 9px 16px 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, #9a4c18 0%, #6b2e0c 58%, #471c05 100%);
  border: 2.5px solid #fbbf24;
  box-shadow:
    inset 0 2px 0 rgba(254, 240, 138, 0.45),
    0 6px 14px rgba(15, 23, 42, 0.5);
  min-width: 102px;
}

.ref-rank-kicker {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  color: #fef3c7;
  line-height: 1.1;
}

.ref-rank-num {
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 1.32rem;
  color: #fde047;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.85);
}

/* ---------- LOWER PLAY ACTION ROW ---------- */
.ref-play-row {
  display: grid;
  grid-template-columns: minmax(195px, 246px) minmax(240px, 340px) minmax(185px, 232px);
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 2px 0 4px;
}

/* Carved Wood Level Progress Card (Left of PLAY) */
.ref-level-card {
  padding: 9px 13px 10px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(12deg, rgba(255, 214, 153, 0.06) 0 3px, rgba(0, 0, 0, 0.05) 3px 7px),
    linear-gradient(180deg, #9a4e1c 0%, #6d310e 55%, #471d06 100%);
  border: 3px solid #3c1604;
  box-shadow:
    inset 0 2px 0 rgba(255, 224, 178, 0.45),
    inset 0 -4px 0 rgba(42, 15, 3, 0.85),
    0 7px 16px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-level-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ref-level-star {
  font-size: 1.75rem;
  line-height: 1;
  color: #fde047;
  text-shadow: 0 2px 4px rgba(120, 53, 15, 0.9);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.ref-level-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ref-level-heading {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  color: #fef3c7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.ref-level-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ref-step-btn {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1.5px solid #fbbf24;
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  color: #fef08a;
  font-size: 0.72rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.ref-step-btn:hover:not(:disabled) {
  transform: scale(1.1);
}

.ref-step-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ref-level-val {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.ref-level-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #2b1204;
  border: 1.5px solid #1c0b02;
  padding: 1px;
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.75);
}

.ref-level-bar-fill {
  height: 100%;
  min-width: 8%;
  border-radius: 999px;
  background: linear-gradient(180deg, #bef264 0%, #4ade80 50%, #16a34a 100%);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.65);
  transition: width 0.35s ease;
}

/* GIANT GLOSSY ORANGE-GOLD PLAY BUTTON WITH FLANKING LEAVES */
.ref-mega-play-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ref-play-leaves {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 54px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.ref-play-leaves::before,
.ref-play-leaves::after {
  content: '';
  position: absolute;
  border-radius: 75% 10% 75% 10%;
  background: linear-gradient(135deg, #bef264 0%, #22c55e 52%, #15803d 100%);
  border: 2.5px solid #14532d;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.ref-play-leaves.play-leaves-left {
  left: -18px;
}
.ref-play-leaves.play-leaves-left::before {
  width: 36px;
  height: 22px;
  top: 4px;
  left: 0;
  transform: rotate(-28deg);
}
.ref-play-leaves.play-leaves-left::after {
  width: 34px;
  height: 20px;
  bottom: 4px;
  left: 4px;
  transform: rotate(24deg);
}

.ref-play-leaves.play-leaves-right {
  right: -18px;
}
.ref-play-leaves.play-leaves-right::before {
  width: 36px;
  height: 22px;
  top: 4px;
  right: 0;
  transform: scaleX(-1) rotate(-28deg);
}
.ref-play-leaves.play-leaves-right::after {
  width: 34px;
  height: 20px;
  bottom: 4px;
  right: 4px;
  transform: scaleX(-1) rotate(24deg);
}

.ref-mega-play-btn {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 15px 30px;
  border-radius: 26px;
  border: 4px solid #fef08a;
  background: linear-gradient(180deg, #fde047 0%, #fb923c 32%, #f97316 68%, #c2410c 100%);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.65),
    inset 0 -7px 0 rgba(154, 52, 18, 0.82),
    0 0 0 4px #7c2d12,
    0 12px 28px rgba(15, 23, 42, 0.55),
    0 0 26px rgba(251, 146, 60, 0.55);
  text-shadow: 0 3px 0 #7c2d12, 0 5px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.ref-mega-play-btn:hover {
  transform: translateY(-3px) scale(1.03);
  filter: brightness(1.07);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.78),
    inset 0 -7px 0 rgba(154, 52, 18, 0.82),
    0 0 0 4px #7c2d12,
    0 16px 32px rgba(15, 23, 42, 0.6),
    0 0 34px rgba(253, 224, 71, 0.7);
}

.ref-mega-play-btn:active {
  transform: translateY(2px) scale(0.98);
}

.ref-mega-play-shine {
  position: absolute;
  top: 4px;
  left: 12%;
  right: 12%;
  height: 36%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
}

.ref-mega-play-icon {
  font-size: 1.05em;
  color: #fef9c3;
  filter: drop-shadow(0 3px 0 #7c2d12);
}

/* Glossy Purple Endless Mode Button (Right of PLAY) */
.ref-endless-btn {
  padding: 5px;
  border-radius: 20px;
  border: 3px solid #3c1604;
  background: linear-gradient(180deg, #9a4e1c 0%, #6d310e 55%, #471d06 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 224, 178, 0.45),
    0 7px 16px rgba(15, 23, 42, 0.46);
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.ref-endless-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
}

.ref-endless-btn:active {
  transform: scale(0.97);
}

.ref-endless-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 14px;
  border: 2px solid #e9d5ff;
  background: linear-gradient(180deg, #a855f7 0%, #7c3aed 48%, #4c1d95 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -4px 0 rgba(59, 7, 100, 0.75);
}

.ref-endless-inf {
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 2rem;
  line-height: 0.8;
  color: #fde047;
  text-shadow: 0 2px 4px rgba(46, 16, 101, 0.9);
}

.ref-endless-text {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 0.96rem;
  line-height: 1.08;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 2px 3px rgba(46, 16, 101, 0.9);
}

.ref-endless-arrow {
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 1.55rem;
  line-height: 1;
  color: #fde047;
  text-shadow: 0 2px 3px rgba(46, 16, 101, 0.9);
}

/* ---------- BOTTOM CARVED-WOOD 5-TAB NAVIGATION BAR ---------- */
.ref-bottom-nav {
  justify-self: center;
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border-radius: 20px;
  background:
    repeating-linear-gradient(10deg, rgba(255, 214, 153, 0.05) 0 3px, rgba(0, 0, 0, 0.06) 3px 7px),
    linear-gradient(180deg, #8b4513 0%, #5c2808 55%, #3a1704 100%);
  border: 3px solid #2b1003;
  box-shadow:
    inset 0 2px 0 rgba(255, 224, 178, 0.4),
    0 8px 22px rgba(15, 23, 42, 0.55);
}

.ref-nav-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 6px 6px;
  border-radius: 14px;
  border: 2px solid rgba(60, 22, 4, 0.65);
  background: linear-gradient(180deg, #984d1b 0%, #6d310e 58%, #4b1f07 100%);
  box-shadow: inset 0 2px 0 rgba(255, 224, 178, 0.28);
  color: #fef3c7;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.ref-nav-tab:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.ref-nav-tab.active {
  border-color: #fde047;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 48%, #9a3412 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 251, 235, 0.72),
    0 0 18px rgba(251, 191, 36, 0.72);
  color: #ffffff;
}

.ref-nav-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.ref-nav-icon svg {
  width: 100%;
  height: 100%;
}

.ref-nav-label {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.05;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}

.ref-red-badge.nav-badge {
  top: -5px;
  right: 8px;
  min-width: 21px;
  height: 21px;
  font-size: 0.74rem;
}

/* ---------- INTERACTIVE MODALS: LUCKY SPIN, LEADERBOARD & SETTINGS ---------- */
.ref-modal-overlay {
  z-index: 60;
  background: rgba(10, 18, 30, 0.72) !important;
  backdrop-filter: blur(7px);
  padding: 16px;
}

.ref-modal-card {
  width: min(94vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 26px;
  padding: 18px 20px 22px;
  background:
    repeating-linear-gradient(10deg, rgba(255, 214, 153, 0.05) 0 4px, rgba(0, 0, 0, 0.04) 4px 9px),
    linear-gradient(180deg, #8f4719 0%, #5c2708 55%, #3d1804 100%);
  border: 4px solid #fbbf24;
  box-shadow:
    inset 0 2px 0 rgba(255, 236, 179, 0.45),
    0 18px 46px rgba(0, 0, 0, 0.65);
  color: #fef3c7;
}

.ref-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ref-modal-header h2 {
  margin: 0;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.35rem;
  color: #fde047;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.75);
}

.ref-modal-sub {
  margin: 2px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fed7aa;
}

/* Lucky Spin Wheel */
.lucky-spin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lucky-spin-card .ref-modal-header {
  width: 100%;
  text-align: left;
}

.spin-vault-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.spin-vault-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(45, 22, 8, 0.88) 0%, rgba(28, 12, 4, 0.94) 100%);
  border: 2.5px solid rgba(251, 191, 36, 0.55);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.35);
  text-align: left;
  transition: transform 160ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.spin-vault-box.is-diamond {
  border-color: rgba(56, 189, 248, 0.65);
}

.spin-vault-box.is-gold.chest-collecting {
  border-color: #fde047;
  box-shadow: 0 0 22px rgba(250, 204, 21, 0.85), inset 0 0 12px rgba(250, 204, 21, 0.35);
  transform: scale(1.06);
}

.spin-vault-box.is-diamond.chest-collecting {
  border-color: #7dd3fc;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.9), inset 0 0 12px rgba(56, 189, 248, 0.35);
  transform: scale(1.06);
}

.spin-vault-box.chest-hit {
  animation: chestHitBounce 190ms ease-out;
}

.spin-vault-ico {
  font-size: 1.55rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}

.spin-vault-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.spin-vault-lbl {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fed7aa;
  opacity: 0.9;
}

.spin-vault-box.is-diamond .spin-vault-lbl {
  color: #bae6fd;
}

.spin-vault-val {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.7);
}

.spin-vault-box.is-diamond .spin-vault-val {
  color: #7dd3fc;
}

.lucky-wheel-stage {
  position: relative;
  width: 264px;
  height: 264px;
  margin: 6px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lucky-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: 50% 18%;
  z-index: 6;
  font-size: 2rem;
  line-height: 1;
  color: #fde047;
  -webkit-text-stroke: 1.5px #7c2d12;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
  transition: transform 65ms ease-out;
}

.lucky-pointer.pointer-tick {
  transform: translateX(-50%) rotate(-24deg) scale(1.08);
}

.lucky-wheel-disc {
  position: relative;
  width: 252px;
  height: 252px;
  border-radius: 50%;
  border: 7px solid #fde047;
  background: conic-gradient(
    #f97316 0deg 45deg,
    #0284c7 45deg 90deg,
    #eab308 90deg 135deg,
    #8b5cf6 135deg 180deg,
    #22c55e 180deg 225deg,
    #ec4899 225deg 270deg,
    #ef4444 270deg 315deg,
    #06b6d4 315deg 360deg
  );
  box-shadow:
    0 0 0 4px #7c2d12,
    inset 0 0 18px rgba(0, 0, 0, 0.35),
    0 12px 26px rgba(0, 0, 0, 0.55);
  will-change: transform;
}

.lw-slice {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  margin-left: -36px;
  margin-top: -20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ffffff;
  font-family: 'Fredoka', sans-serif;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.lw-slice strong {
  font-size: 0.92rem;
  line-height: 1;
}

.lw-slice small {
  font-size: 0.66rem;
  font-weight: 800;
  opacity: 0.95;
}

.lw-slice.s0 { transform: rotate(22.5deg) translateY(-84px); }
.lw-slice.s1 { transform: rotate(67.5deg) translateY(-84px); }
.lw-slice.s2 { transform: rotate(112.5deg) translateY(-84px); }
.lw-slice.s3 { transform: rotate(157.5deg) translateY(-84px); }
.lw-slice.s4 { transform: rotate(202.5deg) translateY(-84px); }
.lw-slice.s5 { transform: rotate(247.5deg) translateY(-84px); }
.lw-slice.s6 { transform: rotate(292.5deg) translateY(-84px); }
.lw-slice.s7 { transform: rotate(337.5deg) translateY(-84px); }

.lucky-wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef9c3 0%, #f59e0b 65%, #92400e 100%);
  border: 4px solid #ffffff;
  color: #7c2d12;
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

.lucky-prize-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 18px;
  margin-bottom: 8px;
  border-radius: 999px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
  color: #fffbeb;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 2.5px solid #fef08a;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.7), 0 4px 10px rgba(0, 0, 0, 0.45);
  animation: luckyBannerPop 380ms cubic-bezier(0.22, 1.35, 0.36, 1);
}

.lucky-prize-banner.is-diamond {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  border-color: #bae6fd;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.8), 0 4px 10px rgba(0, 0, 0, 0.45);
}

@keyframes luckyBannerPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.lucky-spin-result {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.96rem;
  color: #fef08a;
  min-height: 24px;
  margin-bottom: 10px;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.7);
}

.spin-action-btn {
  max-width: 300px;
  font-size: 1.15rem !important;
  padding: 12px 24px !important;
}

.spin-action-btn.collect-gold-mode {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 52%, #b45309 100%) !important;
  color: #451a03 !important;
  border-color: #fef9c3 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) !important;
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.85), 0 6px 0 #78350f !important;
  animation: collectBtnPulse 1.1s ease-in-out infinite;
}

.spin-action-btn.collect-diamond-mode {
  background: linear-gradient(180deg, #7dd3fc 0%, #0ea5e9 52%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border-color: #e0f2fe !important;
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.9), 0 6px 0 #1e3a8a !important;
  animation: collectBtnPulse 1.1s ease-in-out infinite;
}

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

.spin-action-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: grayscale(0.25);
  animation: none !important;
}

/* Leaderboard Modal */
.lobby-lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobby-lb-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(30, 12, 3, 0.58);
  border: 2px solid rgba(251, 191, 36, 0.25);
}

.lobby-lb-row.is-me {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.34), rgba(217, 119, 6, 0.2));
  border-color: #fde047;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.35);
}

.lobby-lb-rank {
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  text-align: center;
  color: #fde047;
}

.lobby-lb-name {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.96rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

.lobby-lb-meta {
  font-size: 0.72rem;
  color: #fed7aa;
  font-weight: 700;
}

.lobby-lb-score {
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  font-size: 0.96rem;
  color: #86efac;
  white-space: nowrap;
}

/* Settings & Snake Stats Modal */
.settings-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-stat-box {
  background: rgba(30, 12, 3, 0.58);
  border: 1.5px solid rgba(251, 191, 36, 0.32);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-stat-box span {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fcd34d;
}

.settings-stat-box strong {
  font-size: 0.88rem;
  color: #ffffff;
}

.settings-next-goal {
  background: rgba(30, 12, 3, 0.52);
  border: 1.5px solid rgba(251, 191, 36, 0.3);
  border-radius: 14px;
  padding: 10px 12px;
}

.settings-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.settings-action-btn {
  padding: 11px 12px;
  border-radius: 14px;
  border: 2px solid #fbbf24;
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  color: #ffffff;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s ease, filter 0.14s ease;
}

.settings-action-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.settings-action-btn.tone-gift {
  border-color: #f0abfc;
  background: linear-gradient(180deg, #c026d3 0%, #7e22ce 100%);
}

.settings-action-btn.tone-danger {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
}

/* ---------- ZERO-TRUNCATION ICON SAFEGUARDS (ALL VIEWPORTS) ---------- */
.ref-dash-shell *,
.ref-dash-shell *::before,
.ref-dash-shell *::after {
  box-sizing: border-box;
}

.ref-top-bar > *,
.ref-middle-grid > *,
.ref-play-row > *,
.ref-bottom-nav > *,
.ref-side-card,
.ref-event-map-card,
.ref-powerups-card,
.ref-level-card,
.ref-endless-btn,
.ref-nav-tab {
  min-width: 0;
}

.ref-avatar-btn,
.ref-coin-emblem,
.ref-gem-emblem,
.ref-plus-btn,
.ref-settings-btn,
.ref-tile-icon,
.ref-event-art,
.ref-pu-circle,
.ref-level-star,
.ref-step-btn,
.ref-endless-inf,
.ref-endless-arrow,
.ref-nav-icon,
.ref-rank-trophy {
  flex-shrink: 0;
}

.ref-side-card,
.ref-powerups-card,
.ref-nav-tab,
.ref-bottom-nav,
.ref-currency-cluster,
.ref-profile-plaque {
  overflow: visible;
}

/* ---------- RESPONSIVE BREAKPOINTS (TABLET, MOBILE PORTRAIT, NARROW PHONE & LANDSCAPE) ---------- */
@media (max-width: 1080px) {
  .ref-dash-shell {
    height: 100%;
    max-height: 100%;
    padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(26px, calc(16px + env(safe-area-inset-bottom))) max(10px, env(safe-area-inset-left));
    gap: 5px;
  }
  .ref-top-bar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }
  .ref-profile-plaque {
    min-width: 0;
    width: 100%;
    max-width: 215px;
    padding: 4px 10px 5px 5px;
    gap: 7px;
  }
  .ref-avatar-btn {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
  .ref-name-input {
    font-size: 0.82rem;
  }
  .ref-brand-sign {
    padding: 0 18px;
  }
  .ref-sign-board {
    padding: 4px 18px 6px;
  }
  .ref-sign-leaves {
    width: 38px;
    height: 38px;
  }
  .ref-word-snake {
    font-size: clamp(1.2rem, 2.2vw, 1.75rem);
  }
  .ref-word-surge {
    font-size: clamp(1.02rem, 1.9vw, 1.48rem);
  }
  .ref-currency-cluster {
    gap: 5px;
  }
  .ref-currency-pill {
    min-width: 0;
    gap: 4px;
    padding: 3px 4px 3px 5px;
  }
  .ref-coin-emblem,
  .ref-gem-emblem {
    width: 23px;
    height: 23px;
  }
  .ref-currency-val {
    font-size: 0.88rem;
    min-width: 22px;
  }
  .ref-plus-btn {
    width: 22px;
    height: 22px;
    font-size: 0.96rem;
  }
  .ref-settings-btn {
    width: 36px;
    height: 36px;
    padding: 6px;
  }
  .ref-middle-grid {
    grid-template-columns: minmax(144px, 180px) minmax(0, 1fr) minmax(170px, 206px);
    gap: 8px;
    min-height: 0;
  }
  .ref-left-stack,
  .ref-right-stack {
    gap: 7px;
  }
  .ref-side-card {
    padding: 6px 9px 6px 8px;
    gap: 8px;
  }
  .ref-tile-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .ref-tile-title {
    font-size: 0.85rem;
  }
  .ref-event-map-card,
  .ref-powerups-card {
    padding: 7px 9px 8px;
  }
  .ref-event-title {
    font-size: 0.9rem;
  }
  .ref-event-biome {
    font-size: 0.78rem;
  }
  .ref-event-art {
    width: 40px;
    height: 36px;
    flex-basis: 40px;
  }
  .ref-pu-row {
    gap: 5px;
  }
  .ref-pu-circle {
    width: 36px;
    height: 36px;
    font-size: 1.08rem;
  }
  .ref-rank-trophy {
    font-size: 1.85rem;
    margin-bottom: -7px;
  }
  .ref-rank-plaque {
    padding: 7px 14px 5px;
    min-width: 92px;
  }
  .ref-rank-num {
    font-size: 1.18rem;
  }
  .ref-equipped-ribbon {
    font-size: 0.72rem;
    padding: 4px 11px;
  }
  .ref-play-row {
    grid-template-columns: minmax(150px, 200px) minmax(180px, 265px) minmax(144px, 188px);
    gap: 10px;
    padding: 0 0 2px;
  }
  .ref-play-leaves {
    width: 30px;
    height: 40px;
  }
  .ref-play-leaves.play-leaves-left {
    left: -10px;
  }
  .ref-play-leaves.play-leaves-right {
    right: -10px;
  }
  .ref-mega-play-btn {
    padding: 10px 18px;
    font-size: clamp(1.3rem, 2.2vw, 1.75rem);
    gap: 9px;
  }
  .ref-level-card {
    padding: 7px 10px 8px;
    gap: 4px;
  }
  .ref-endless-inner {
    padding: 7px 10px;
    gap: 6px;
  }
  .ref-endless-inf {
    font-size: 1.5rem;
  }
  .ref-endless-text {
    font-size: 0.82rem;
  }
  .ref-bottom-nav {
    width: min(100%, 680px);
    gap: 4px;
    padding: 4px 5px 5px;
    margin-bottom: 6px;
  }
  .ref-nav-tab {
    padding: 5px 3px 5px;
    gap: 2px;
  }
  .ref-nav-icon {
    width: 22px;
    height: 22px;
  }
  .ref-nav-label {
    font-size: 0.7rem;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Tablet In-Game Touch Power Dock Polish */
  .hud-ability-dock {
    gap: 8px;
  }
  .arcade-orb-btn {
    width: 56px;
    height: 56px;
    touch-action: none;
  }
  .orb-boost {
    width: 62px;
    height: 62px;
  }
}

/* Mobile Portrait Screens (<= 760px): Single-Screen Small Edge-Hugging Icons with Unobstructed Center Snake */
@media (max-width: 760px) {
  .ref-lobby-overlay {
    overflow: hidden !important;
  }
  .ref-dash-shell {
    height: 100%;
    max-height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 5px;
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(22px, calc(14px + env(safe-area-inset-bottom))) max(6px, env(safe-area-inset-left));
  }
  .ref-top-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "logo logo"
      "profile currency";
    align-items: center;
    gap: 5px;
  }
  .ref-brand-sign {
    grid-area: logo;
    padding: 0 14px;
  }
  .ref-sign-board {
    padding: 3px 16px 4px;
    border-radius: 14px 14px 18px 18px;
    border-width: 2.5px;
  }
  .ref-sign-leaves {
    width: 26px;
    height: 26px;
  }
  .ref-sign-leaves.leaves-left::before,
  .ref-sign-leaves.leaves-right::before {
    width: 22px;
    height: 13px;
  }
  .ref-sign-leaves.leaves-left::after,
  .ref-sign-leaves.leaves-right::after {
    width: 20px;
    height: 12px;
  }
  .ref-word-snake {
    font-size: 1.08rem;
    -webkit-text-stroke: 1px #451a03;
  }
  .ref-word-surge {
    font-size: 0.92rem;
    -webkit-text-stroke: 1px #0c2e59;
  }
  .ref-profile-plaque {
    grid-area: profile;
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 3px 7px 4px 4px;
    gap: 5px;
    border-radius: 13px;
    border-width: 2px;
  }
  .ref-leaf-sprout {
    width: 18px;
    height: 11px;
    top: -5px;
    left: -4px;
  }
  .ref-avatar-btn {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-width: 2px;
    padding: 1.5px;
  }
  .ref-profile-info {
    gap: 2px;
  }
  .ref-name-pill {
    padding: 1px 6px 1px 4px;
    gap: 3px;
  }
  .ref-crown-icon {
    font-size: 0.72rem;
  }
  .ref-name-input {
    font-size: 0.72rem;
  }
  .ref-profile-level-text {
    font-size: 0.62rem;
  }
  .ref-xp-track {
    height: 6px;
  }
  .ref-currency-cluster {
    grid-area: currency;
    gap: 4px;
    justify-self: end;
  }
  .ref-currency-pill {
    min-width: 0;
    padding: 2px 3px 2px 4px;
    gap: 3px;
    border-width: 2px;
  }
  .ref-coin-emblem,
  .ref-gem-emblem {
    width: 17px;
    height: 17px;
  }
  .ref-currency-val {
    font-size: 0.74rem;
    min-width: 16px;
    padding: 0 1px;
  }
  .ref-plus-btn {
    width: 18px;
    height: 18px;
    font-size: 0.82rem;
    border-width: 1.5px;
  }
  .ref-settings-btn {
    width: 30px;
    height: 30px;
    padding: 4px;
    border-radius: 10px;
    border-width: 2px;
  }

  /* 3-Column Edge-Hugging Middle Stage: Ultra-Compact Side Buttons so Hero & Meadow Stay Open */
  .ref-middle-grid {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) 54px;
    align-items: center;
    gap: 4px;
    min-height: 0;
  }
  .ref-left-stack {
    order: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    align-self: center;
  }
  .ref-side-card {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px 2px 3px;
    gap: 1px;
    border-radius: 10px;
    border-width: 1.8px;
  }
  .ref-side-card.ref-quest-target-btn {
    width: 44px;
    height: 44px;
    padding: 2px;
    border-radius: 50% !important;
    border-width: 2px;
    margin: 2px 0 5px;
  }
  .ref-side-card.ref-quest-target-btn .ref-quest-target-icon {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
  }
  .ref-side-card.ref-quest-target-btn .ref-quest-target-copy {
    bottom: -6px;
    padding: 0 5px 1px;
    border-width: 1.2px;
  }
  .ref-side-card.ref-quest-target-btn .ref-tile-title {
    font-size: 0.48rem;
  }
  .ref-side-card:hover {
    transform: scale(1.04);
  }
  .ref-tile-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }
  .ref-tile-copy {
    align-items: center;
    width: 100%;
  }
  .ref-tile-title {
    font-size: 0.49rem;
    line-height: 1.05;
    white-space: normal;
    word-break: keep-all;
  }
  .ref-tile-sub {
    display: none;
  }
  .ref-red-badge {
    top: -4px;
    right: -3px;
    min-width: 15px;
    height: 15px;
    font-size: 0.56rem;
    padding: 0 3px;
    border-width: 1.5px;
  }

  .ref-center-stage {
    order: 0;
    min-height: 0;
    height: 100%;
    padding-bottom: 2px;
  }
  .ref-equipped-ribbon {
    font-size: 0.58rem;
    padding: 2px 7px;
    gap: 4px;
    border-width: 1.5px;
  }

  .ref-right-stack {
    order: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    align-self: center;
  }
  .ref-event-map-card {
    padding: 4px 3px;
    border-radius: 10px;
    border-width: 1.8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
  }
  .ref-event-head {
    margin-bottom: 0;
    justify-content: center;
    gap: 2px;
  }
  .ref-event-clock {
    display: none;
  }
  .ref-event-title {
    font-size: 0.5rem;
    line-height: 1.02;
  }
  .ref-event-body {
    justify-content: center;
    gap: 0;
  }
  .ref-event-copy {
    display: none;
  }
  .ref-event-art {
    width: 24px;
    height: 20px;
    flex-basis: 24px;
  }

  .ref-powerups-card {
    padding: 4px 2px;
    border-radius: 10px;
    border-width: 1.8px;
  }
  .ref-pu-header {
    justify-content: center;
    margin-bottom: 3px;
    padding-right: 0;
  }
  .ref-pu-title {
    font-size: 0.49rem;
    line-height: 1;
  }
  .ref-info-btn {
    right: -4px;
    top: -6px;
    width: 14px;
    height: 14px;
    font-size: 0.55rem;
    border-width: 1.3px;
  }
  .ref-pu-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .ref-pu-item {
    flex-direction: row;
    justify-content: center;
    gap: 2px;
  }
  .ref-pu-circle {
    width: 18px;
    height: 18px;
    font-size: 0.62rem;
    border-width: 1.4px;
  }
  .ref-pu-dur {
    font-size: 0.48rem;
    padding: 1px 3px;
  }

  .ref-top-rank-badge {
    align-self: center;
    flex-direction: column;
    gap: 0;
  }
  .ref-rank-trophy {
    font-size: 0.96rem;
    margin-bottom: -4px;
  }
  .ref-rank-plaque {
    padding: 4px 5px 2px;
    min-width: 46px;
    border-radius: 9px;
    border-width: 1.8px;
  }
  .ref-rank-kicker {
    font-size: 0.46rem;
  }
  .ref-rank-num {
    font-size: 0.72rem;
  }

  /* Compact Single-Row Play Bar on Mobile */
  .ref-play-row {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.16fr) minmax(0, 0.84fr);
    grid-template-areas: none;
    gap: 5px;
    padding: 0;
  }
  .ref-level-card,
  .ref-mega-play-wrap,
  .ref-endless-btn {
    grid-area: auto;
  }
  .ref-level-card {
    padding: 4px 5px 5px;
    border-radius: 11px;
    border-width: 1.8px;
    gap: 3px;
  }
  .ref-level-top {
    gap: 3px;
  }
  .ref-level-star {
    font-size: 0.84rem;
  }
  .ref-level-heading {
    font-size: 0.5rem;
  }
  .ref-level-stepper {
    gap: 2px;
  }
  .ref-step-btn {
    width: 16px;
    height: 16px;
    font-size: 0.52rem;
    border-radius: 4px;
  }
  .ref-level-val {
    font-size: 0.62rem;
  }
  .ref-level-bar-track {
    height: 5px;
  }

  .ref-mega-play-wrap {
    padding: 0 4px;
  }
  .ref-play-leaves {
    width: 16px;
    height: 22px;
  }
  .ref-play-leaves.play-leaves-left {
    left: -3px;
  }
  .ref-play-leaves.play-leaves-right {
    right: -3px;
  }
  .ref-play-leaves.play-leaves-left::before,
  .ref-play-leaves.play-leaves-right::before {
    width: 14px;
    height: 9px;
  }
  .ref-play-leaves.play-leaves-left::after,
  .ref-play-leaves.play-leaves-right::after {
    width: 13px;
    height: 8px;
  }
  .ref-mega-play-btn {
    padding: 7px 8px;
    font-size: 0.96rem;
    gap: 5px;
    border-radius: 15px;
    border-width: 2px;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.65),
      inset 0 -3px 0 rgba(154, 52, 18, 0.82),
      0 0 0 2px #7c2d12,
      0 5px 12px rgba(15, 23, 42, 0.45);
  }

  .ref-endless-btn {
    padding: 2px;
    border-radius: 12px;
    border-width: 1.8px;
  }
  .ref-endless-inner {
    padding: 5px 5px;
    gap: 3px;
    border-radius: 9px;
    border-width: 1.4px;
  }
  .ref-endless-inf {
    font-size: 1rem;
  }
  .ref-endless-text {
    font-size: 0.58rem;
    line-height: 1.05;
  }
  .ref-endless-arrow {
    font-size: 0.88rem;
  }

  /* Compact Non-Truncating 5-Tab Bottom Navigation */
  .ref-bottom-nav {
    width: 100%;
    gap: 2px;
    padding: 2px 3px 3px;
    border-radius: 13px;
    border-width: 1.8px;
    margin-bottom: 4px;
  }
  .ref-nav-tab {
    padding: 3px 2px;
    gap: 1px;
    border-radius: 9px;
    border-width: 1.4px;
  }
  .ref-nav-icon {
    width: 16px;
    height: 16px;
  }
  .ref-nav-label {
    font-size: clamp(0.48rem, 2vw, 0.58rem);
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ref-red-badge.nav-badge {
    top: -4px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    font-size: 0.54rem;
  }
  .settings-stats-grid,
  .settings-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* Narrow Mobile Portrait Screens (<= 440px): Extra-crisp compact icon sizing */
@media (max-width: 440px) {
  .ref-middle-grid {
    grid-template-columns: 46px minmax(0, 1fr) 50px;
    gap: 3px;
  }
  .ref-tile-icon {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }
  .ref-tile-title {
    font-size: 0.46rem;
  }
  .ref-equipped-ribbon .hero-skin-dot,
  .ref-equipped-ribbon .hero-skin-name {
    display: none;
  }
  .ref-level-star {
    display: none;
  }
  .ref-endless-arrow {
    display: none;
  }
  .ref-nav-icon {
    width: 15px;
    height: 15px;
  }
  .ref-nav-label {
    font-size: 0.48rem;
    letter-spacing: -0.02em;
  }
}

/* Mobile Landscape Lobby: Ultra-Compact Edge Buttons — Zero Overlap, Wide-Open Center */
@media (max-height: 540px) and (orientation: landscape) {
  .ref-dash-shell {
    padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    gap: 3px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
  .ref-top-bar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: none;
    gap: 6px;
  }
  .ref-brand-sign,
  .ref-profile-plaque,
  .ref-currency-cluster {
    grid-area: auto;
  }
  .ref-profile-plaque {
    padding: 2px 6px 3px 3px;
    gap: 4px;
    border-radius: 11px;
    border-width: 2px;
    max-width: 195px;
  }
  .ref-avatar-btn {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-width: 1.5px;
  }
  .ref-name-pill {
    padding: 0 5px 0 3px;
  }
  .ref-name-input {
    font-size: 0.65rem;
  }
  .ref-profile-level-text {
    font-size: 0.56rem;
  }
  .ref-xp-track {
    height: 4px;
  }
  .ref-sign-board {
    padding: 2px 12px 3px;
    border-radius: 12px 12px 15px 15px;
    border-width: 2px;
  }
  .ref-word-snake {
    font-size: 0.92rem;
    -webkit-text-stroke: 0.9px #451a03;
  }
  .ref-word-surge {
    font-size: 0.78rem;
    -webkit-text-stroke: 0.8px #0c2e59;
  }
  .ref-currency-pill {
    min-width: 0;
    padding: 2px 3px 2px 4px;
    gap: 3px;
    border-width: 1.8px;
  }
  .ref-coin-emblem,
  .ref-gem-emblem {
    width: 16px;
    height: 16px;
  }
  .ref-currency-val {
    font-size: 0.7rem;
  }
  .ref-plus-btn {
    width: 16px;
    height: 16px;
    font-size: 0.78rem;
  }
  .ref-settings-btn {
    width: 26px;
    height: 26px;
    padding: 4px;
    border-radius: 8px;
    border-width: 1.8px;
  }

  /* Slim edge-hugging rails that never overlap the play row! */
  .ref-middle-grid {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr) 118px;
    align-items: center;
    gap: 6px;
    min-height: 0;
    overflow: visible;
  }
  .ref-center-stage {
    order: 0;
    min-height: 0;
    height: 100%;
    padding-bottom: 0;
  }
  .ref-equipped-ribbon {
    font-size: 0.56rem;
    padding: 2px 7px;
    border-width: 1.4px;
  }
  .ref-left-stack {
    order: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    align-self: center;
  }
  .ref-right-stack {
    order: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    align-self: center;
  }
  /* Compact horizontal pill-cards for left rail (zero vertical bloat!) */
  .ref-side-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 3px 6px;
    border-radius: 9px;
    border-width: 1.8px;
    gap: 5px;
  }
  .ref-side-card.ref-quest-target-btn {
    width: 42px;
    height: 42px;
    padding: 2px;
    align-self: center;
    flex-direction: column !important;
    justify-content: center;
    border-radius: 50% !important;
    border-width: 2px;
    margin: 1px 0 5px;
  }
  .ref-side-card.ref-quest-target-btn .ref-quest-target-icon {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  .ref-side-card.ref-quest-target-btn .ref-quest-target-copy {
    bottom: -6px;
    padding: 0 5px 1px;
    border-width: 1.2px;
  }
  .ref-side-card.ref-quest-target-btn .ref-tile-title {
    font-size: 0.48rem;
  }
  .ref-tile-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }
  .ref-tile-copy {
    align-items: flex-start;
  }
  .ref-tile-title {
    font-size: 0.6rem;
    line-height: 1.05;
    white-space: nowrap;
  }
  .ref-tile-sub {
    display: none;
  }
  .ref-red-badge {
    top: -4px;
    right: -3px;
    min-width: 14px;
    height: 14px;
    font-size: 0.54rem;
    border-width: 1.4px;
  }

  /* Compact right rail: horizontal Endless Game card + 3-across Power Ups row */
  .ref-event-map-card {
    padding: 4px 6px;
    border-radius: 10px;
    border-width: 1.8px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: 4px;
  }
  .ref-event-head {
    margin-bottom: 0;
    justify-content: flex-start;
  }
  .ref-event-title {
    font-size: 0.58rem;
    line-height: 1.05;
  }
  .ref-event-body {
    gap: 0;
  }
  .ref-event-copy {
    display: none;
  }
  .ref-event-art {
    width: 24px;
    height: 21px;
    flex-basis: 24px;
  }
  .ref-powerups-card {
    padding: 4px 5px;
    border-radius: 10px;
    border-width: 1.8px;
  }
  .ref-pu-header {
    margin-bottom: 3px;
    justify-content: center;
  }
  .ref-pu-title {
    font-size: 0.54rem;
  }
  .ref-pu-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }
  .ref-pu-item {
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  .ref-pu-circle {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
    border-width: 1.5px;
  }
  .ref-pu-dur {
    font-size: 0.48rem;
    padding: 1px 3px;
  }
  .ref-top-rank-badge {
    display: none;
  }

  /* Slim Play Action Row (never collides with rails) */
  .ref-play-row {
    grid-template-columns: minmax(110px, 146px) minmax(130px, 185px) minmax(105px, 140px);
    grid-template-areas: none;
    justify-content: center;
    gap: 7px;
    padding: 0;
  }
  .ref-mega-play-wrap,
  .ref-level-card,
  .ref-endless-btn {
    grid-area: auto;
  }
  .ref-mega-play-btn {
    padding: 5px 12px;
    font-size: 0.96rem;
    gap: 5px;
    border-radius: 14px;
    border-width: 2px;
  }
  .ref-play-leaves {
    width: 16px;
    height: 22px;
  }
  .ref-level-card {
    padding: 3px 6px 4px;
    border-radius: 10px;
    border-width: 1.8px;
    gap: 2px;
  }
  .ref-level-star {
    font-size: 0.8rem;
  }
  .ref-level-heading {
    font-size: 0.48rem;
  }
  .ref-level-val {
    font-size: 0.6rem;
  }
  .ref-step-btn {
    width: 15px;
    height: 15px;
    font-size: 0.5rem;
  }
  .ref-level-bar-track {
    height: 4px;
  }
  .ref-endless-btn {
    padding: 2px;
    border-radius: 11px;
    border-width: 1.8px;
  }
  .ref-endless-inner {
    padding: 4px 6px;
    gap: 3px;
    border-radius: 8px;
    border-width: 1.4px;
  }
  .ref-endless-inf {
    font-size: 0.92rem;
  }
  .ref-endless-text {
    font-size: 0.56rem;
    line-height: 1.05;
  }
  .ref-endless-arrow {
    font-size: 0.85rem;
  }

  /* Ultra-Slim Bottom Nav Bar */
  .ref-bottom-nav {
    width: min(100%, 520px);
    padding: 2px 3px;
    gap: 2px;
    border-radius: 12px;
    border-width: 1.8px;
    margin-bottom: 0;
  }
  .ref-nav-tab {
    padding: 2px 2px;
    gap: 1px;
    border-radius: 8px;
    border-width: 1.4px;
  }
  .ref-nav-icon {
    width: 15px;
    height: 15px;
  }
  .ref-nav-label {
    font-size: 0.54rem;
  }
}

/* ---------- MOBILE PLAYABILITY OVERHAUL: WIDE-OPEN ARENA (PORTRAIT & LANDSCAPE) + CLEAN GAME OVER ---------- */
@media (max-width: 760px) {
  /* 1. Compact Edge-Hugging Mobile Portrait Gameplay HUD (frees >75% of screen!) */
  .arcade-hud {
    padding:
      max(5px, env(safe-area-inset-top))
      max(6px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
  }

  /* Hide redundant currency/energy strip & level-mode switch during active mobile play */
  .arcade-hud .hud-resources-row,
  .arcade-hud .profile-prey-wrap,
  .arcade-hud .timer-subtitle,
  .arcade-hud .wood-view-switch,
  .arcade-hud .level-mode-plaque {
    display: none !important;
  }

  .arcade-hud .hud-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "left center right";
    align-items: start;
    gap: 4px;
  }

  .arcade-hud .hud-left-col {
    grid-area: left;
    gap: 4px;
    align-items: flex-start;
  }

  .arcade-hud .hud-center-col {
    grid-area: center;
    gap: 0;
  }

  .arcade-hud .hud-right-col {
    grid-area: right;
    gap: 4px;
    align-items: flex-end;
  }

  .arcade-hud .profile-plaque {
    min-width: 0;
    width: auto;
    max-width: 132px;
    padding: 3px 6px 3px 4px;
    gap: 5px;
    border-radius: 12px;
    border-width: 2px;
  }

  .arcade-hud .profile-plaque .wood-leaf,
  .arcade-hud .timer-plaque .wood-leaf,
  .arcade-hud .leaderboard-plaque .wood-leaf {
    display: none;
  }

  .arcade-hud .profile-avatar-ring {
    width: 26px;
    height: 26px;
    border-width: 2px;
  }

  .arcade-hud .profile-name {
    font-size: 0.66rem;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arcade-hud .profile-level-label {
    font-size: 0.6rem;
  }

  .arcade-hud .profile-xp-track {
    min-width: 44px;
    height: 12px;
  }

  .arcade-hud .profile-xp-text {
    font-size: 0.56rem;
  }

  .arcade-hud .timer-plaque {
    min-width: 76px;
    padding: 3px 9px 4px;
    border-radius: 12px;
    border-width: 2px;
  }

  .arcade-hud .hourglass-icon {
    width: 13px;
    height: 16px;
  }

  .arcade-hud .timer-digits {
    font-size: 0.92rem;
    line-height: 1;
  }

  .arcade-hud .leaderboard-plaque {
    width: 112px;
    padding: 3px 5px 4px;
    border-radius: 10px;
    border-width: 2px;
    opacity: 0.88;
  }

  .arcade-hud .leaderboard-title {
    font-size: 0.62rem;
    padding-bottom: 2px;
    margin-bottom: 2px;
  }

  .arcade-hud .lb-row {
    padding: 1.5px 4px;
    font-size: 0.58rem;
  }

  /* Compact Mobile Combo Streak Window */
  .arcade-hud .combo-hud {
    min-width: 0;
    width: 112px;
    max-width: 112px;
    padding: 3px 6px;
    border-radius: 8px;
    border-width: 1.5px;
    opacity: 0.92;
  }

  .arcade-hud .combo-top-row {
    gap: 4px;
    margin-bottom: 2px;
  }

  .arcade-hud .combo-mult {
    font-size: 0.6rem;
    line-height: 1.05;
  }

  .arcade-hud .combo-count {
    font-size: 0.52rem;
  }

  .arcade-hud .combo-bar-track {
    height: 3px;
  }

  .arcade-hud .hud-utility-row {
    flex-wrap: nowrap;
    gap: 3px;
  }

  /* Keep utility buttons super compact on phones; hide extra settings gear during active play */
  .arcade-hud #hudSettingsBtn,
  .arcade-hud #hudShopBtn {
    display: none;
  }

  .arcade-hud .gold-circle-btn {
    width: 27px;
    height: 27px;
    border-width: 2px;
  }

  .arcade-hud .gold-circle-btn svg {
    width: 13px;
    height: 13px;
  }

  .arcade-hud .hud-minimap-frame {
    padding: 3px;
    border-radius: 10px;
    border-width: 2px;
    opacity: 0.9;
  }

  .arcade-hud #hudMinimapCanvas {
    width: 78px;
    height: 60px;
  }

  /* Clean Floating Bottom Thumb Controls (lifted cleanly above mobile OS gesture bar!) */
  .arcade-hud .hud-bottom-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 6px;
    padding-bottom: max(14px, calc(10px + env(safe-area-inset-bottom)));
  }

  .arcade-hud .wood-steer-switch {
    padding: 2px;
    border-width: 2px;
    border-radius: 12px;
  }

  .arcade-hud .wood-steer-switch .wood-seg-btn {
    padding: 4px 7px;
    font-size: 0.6rem;
    min-height: 24px;
  }

  .arcade-hud .hud-ability-dock {
    justify-self: end;
    display: grid;
    grid-template-columns: repeat(4, auto);
    grid-template-rows: auto;
    align-items: center;
    justify-items: center;
    gap: 5px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    touch-action: none;
  }

  .arcade-hud .arcade-orb-btn {
    width: 36px;
    height: 36px;
    border-width: 2px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.38);
  }

  .arcade-hud .orb-icon {
    font-size: 0.9rem;
  }

  .arcade-hud .orb-sub {
    font-size: 0.46rem;
    margin-top: -1px;
  }

  /* Hide the black "TAP" pill that covered orb labels on phones; keep only subtle Boost % badge */
  .arcade-hud .arcade-orb-btn:not(.orb-boost) .orb-badge {
    display: none;
  }

  /* Mobile Portrait: Transparent Circular Speed Boost (Double Inverted V) in Left-Thumb Zone — Away from Left & Bottom Edges */
  .arcade-hud .hud-ability-dock .orb-boost {
    position: absolute;
    left: max(32px, calc(26px + env(safe-area-inset-left)));
    bottom: max(108px, calc(96px + env(safe-area-inset-bottom)));
    z-index: 25;
    pointer-events: auto;
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 50%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.14) !important;
    border: 2.5px solid rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow:
      inset 0 2px 6px rgba(255, 255, 255, 0.24),
      0 4px 14px rgba(0, 0, 0, 0.28);
  }

  .arcade-hud .hud-ability-dock .orb-boost.boosting,
  .arcade-hud .hud-ability-dock .orb-boost.touch-pressed {
    background: rgba(251, 191, 36, 0.34) !important;
    border-color: #fde047 !important;
    box-shadow:
      inset 0 2px 8px rgba(255, 255, 255, 0.45),
      0 0 22px rgba(250, 204, 21, 0.72);
    transform: scale(0.93);
  }

  .arcade-hud .hud-ability-dock .orb-boost.boosting .orb-boost-mobile-ico {
    color: #fef08a;
    transform: translateY(-2px);
  }

  .arcade-hud .hud-ability-dock .orb-boost .orb-boost-desktop-ico,
  .arcade-hud .hud-ability-dock .orb-boost .orb-sub {
    display: none !important;
  }

  .arcade-hud .hud-ability-dock .orb-boost .orb-boost-mobile-ico {
    display: inline-flex !important;
    width: 30px;
    height: 30px;
    transition: transform 0.12s ease, color 0.12s ease;
  }

  .arcade-hud .hud-ability-dock .orb-boost .orb-badge {
    position: absolute;
    bottom: -5px;
    right: 50%;
    transform: translateX(50%);
    margin-left: 0;
    height: 15px;
    min-width: 30px;
    padding: 0 4px;
    font-size: 0.52rem;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #ffffff;
  }

  /* 2. Clean Zero-Overflow Mobile Game Over Modal */
  .overlay-card,
  .overlay-card.dashboard-card,
  .end-dashboard-card {
    width: min(96vw, 440px);
    max-width: 100%;
    max-height: 92vh;
    overflow-x: hidden !important;
    overflow-y: auto;
    padding: 10px 10px 12px;
    gap: 8px;
    box-sizing: border-box;
  }

  .end-dashboard-card .player-profile-bar {
    padding: 7px 9px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .end-dashboard-card .end-result-head {
    padding: 10px 10px 10px;
    gap: 7px;
  }

  .end-dashboard-card .end-result-head h2 {
    font-size: 1.22rem;
    margin: 0;
  }

  .end-dashboard-card .final-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .end-dashboard-card .final-stat-tile {
    padding: 6px 8px;
  }

  .end-dashboard-card .final-stat-tile strong {
    font-size: 1.08rem;
  }

  .end-dashboard-card .collect-gold-banner {
    padding: 9px 10px;
    gap: 7px;
    flex-direction: column;
    align-items: stretch;
  }

  .end-dashboard-card .collect-gold-btn {
    width: 100%;
    padding: 10px 12px;
    min-height: 44px;
    font-size: 0.96rem;
  }

  /* Stack Snake & Level panels vertically so zero text is ever clipped! */
  .end-dashboard-card .end-dash-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
    min-width: 0;
  }

  .end-dashboard-card .dash-panel {
    min-width: 0;
    padding: 8px 10px;
  }

  .end-dashboard-card .end-snake-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .end-dashboard-card .end-snake-thumb {
    width: 72px;
    height: 54px;
    flex: 0 0 72px;
  }

  .end-dashboard-card .end-snake-meta {
    min-width: 0;
    flex: 1 1 auto;
    word-break: break-word;
  }

  .end-dashboard-card .end-tip-line {
    display: none;
  }

  /* 3. Compact Mobile Snake Store (Minimizes Scrolling & Shrinks Card Details Cleanly!) */
  .overlay.shop-fullscreen {
    padding: 0;
  }

  .shop-full-shell {
    padding:
      max(5px, env(safe-area-inset-top))
      6px
      max(10px, env(safe-area-inset-bottom));
    gap: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shop-top-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "left right"
      "tabs tabs";
    align-items: center;
    gap: 5px 6px;
    padding: 6px 8px;
    border-radius: 14px;
    border-width: 2px;
  }

  .shop-top-left {
    grid-area: left;
    gap: 6px;
    min-width: 0;
  }

  .shop-back-btn {
    padding: 4px 8px;
    min-height: 28px;
    font-size: 0.72rem;
    border-radius: 10px;
  }

  .shop-title-lockup h2 {
    font-size: 0.88rem;
    line-height: 1.05;
  }

  .shop-best-inline {
    display: none;
  }

  .shop-top-right {
    grid-area: right;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .shop-top-right .wood-capsule {
    height: 25px;
    padding: 1px 6px 1px 4px;
    gap: 3px;
  }

  .shop-top-right .capsule-icon {
    width: 18px;
    height: 18px;
    margin-left: 0;
  }

  .shop-top-right .capsule-val {
    font-size: 0.72rem;
    min-width: 14px;
  }

  .shop-free-btn {
    padding: 3px 7px !important;
    min-height: 25px !important;
    font-size: 0.66rem !important;
    border-radius: 9px !important;
    white-space: nowrap;
  }

  .shop-top-tabs {
    grid-area: tabs;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 3px;
  }

  .shop-cat-tab {
    justify-content: center;
    padding: 5px 4px;
    min-height: 30px;
    font-size: 0.72rem;
    gap: 4px;
    border-radius: 10px;
  }

  .shop-cat-tab .label-full {
    display: none;
  }

  .shop-cat-tab .label-short {
    display: inline;
  }

  .shop-full-body {
    gap: 6px;
  }

  /* Compact single-row horizontal preview strip (~76px tall instead of ~360px!) */
  .shop-preview-stage {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 14px;
    border-width: 2px;
  }

  .shop-stage-split {
    display: block;
    min-width: 0;
  }

  #shopRefImageWrap,
  .preview-view-switch {
    display: none !important;
  }

  .shop-live-wrap {
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
  }

  #shopPreviewCanvas {
    height: 64px !important;
    min-height: 64px !important;
  }

  .shop-preview-info {
    min-width: 0;
    gap: 2px;
    padding: 0;
    text-align: left;
  }

  .shop-preview-title-row {
    gap: 5px;
  }

  #previewSnakeName {
    font-size: 0.84rem;
    line-height: 1.1;
  }

  .shop-preview-skin-line {
    font-size: 0.64rem;
    line-height: 1.15;
  }

  .shop-preview-stats {
    font-size: 0.6rem;
    line-height: 1.18;
  }

  .shop-gate-banner {
    padding: 5px 8px;
    font-size: 0.66rem;
    border-radius: 10px;
    margin-bottom: 4px;
  }

  /* Compact 2-Column Mobile Store Cards — fit 4-6 cards per viewport! */
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px;
    padding: 2px 1px 14px;
  }

  .item-card {
    padding: 7px 7px;
    border-radius: 12px;
    border-width: 2px;
    gap: 4px;
    min-width: 0;
  }

  .item-top {
    gap: 4px;
  }

  .item-name {
    font-size: 0.74rem;
    line-height: 1.12;
  }

  .item-tier {
    font-size: 0.58rem;
  }

  .card-preview-canvas {
    height: 44px;
    border-radius: 7px;
  }

  .card-ref-banner {
    aspect-ratio: 16 / 9;
    max-height: 52px;
    border-radius: 7px;
  }

  .card-identity-note {
    font-size: 0.58rem;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .stat-list {
    gap: 2px;
    font-size: 0.62rem;
    line-height: 1.15;
  }

  .stat-row {
    gap: 4px;
  }

  .upgrade-pips,
  .upgrade-steps {
    gap: 3px;
    margin: 1px 0;
  }

  .item-btn {
    min-height: 29px;
    padding: 0 7px;
    font-size: 0.68rem;
    border-radius: 8px;
  }
}

/* Mobile Landscape Gameplay HUD (Short Height <= 520px) */
@media (max-height: 520px) {
  .arcade-hud {
    padding: 4px 7px;
  }

  .arcade-hud .hud-resources-row,
  .arcade-hud .profile-prey-wrap,
  .arcade-hud .timer-subtitle,
  .arcade-hud .wood-view-switch,
  .arcade-hud .level-mode-plaque {
    display: none !important;
  }

  .arcade-hud .profile-plaque {
    min-width: 140px;
    max-width: 162px;
    padding: 3px 7px 3px 4px;
    gap: 6px;
    border-width: 2px;
  }

  .arcade-hud .profile-avatar-ring {
    width: 26px;
    height: 26px;
  }

  .arcade-hud .profile-name {
    font-size: 0.68rem;
  }

  .arcade-hud .leaderboard-plaque {
    width: 124px;
    padding: 3px 5px;
    opacity: 0.86;
  }

  .arcade-hud .lb-row {
    font-size: 0.58rem;
    padding: 1.5px 4px;
  }

  .arcade-hud .combo-hud {
    min-width: 0;
    width: 118px;
    max-width: 118px;
    padding: 3px 6px;
    border-radius: 8px;
    border-width: 1.5px;
    opacity: 0.92;
  }

  .arcade-hud .combo-top-row {
    gap: 4px;
    margin-bottom: 2px;
  }

  .arcade-hud .combo-mult {
    font-size: 0.62rem;
  }

  .arcade-hud .combo-count {
    font-size: 0.54rem;
  }

  .arcade-hud .combo-bar-track {
    height: 3px;
  }

  .arcade-hud .timer-plaque {
    min-width: 84px;
    padding: 3px 10px 4px;
    border-width: 2px;
  }

  .arcade-hud .timer-digits {
    font-size: 0.96rem;
  }

  .arcade-hud .gold-circle-btn {
    width: 28px;
    height: 28px;
    border-width: 2px;
  }

  .arcade-hud .gold-circle-btn svg {
    width: 13px;
    height: 13px;
  }

  .arcade-hud #hudMinimapCanvas {
    width: 82px;
    height: 60px;
  }

  .arcade-hud .hud-bottom-row {
    padding-bottom: max(12px, calc(8px + env(safe-area-inset-bottom)));
  }

  .arcade-hud .hud-ability-dock {
    justify-self: end;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .arcade-hud .arcade-orb-btn {
    width: 36px;
    height: 36px;
    border-width: 2px;
  }

  /* Mobile Landscape: Transparent Circular Speed Boost (Double Inverted V) in Left-Thumb Zone — Away from Left & Bottom Edges */
  .arcade-hud .hud-ability-dock .orb-boost,
  .arcade-hud .orb-boost {
    position: absolute;
    left: max(54px, calc(42px + env(safe-area-inset-left)));
    bottom: max(74px, calc(64px + env(safe-area-inset-bottom)));
    z-index: 25;
    pointer-events: auto;
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 50%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    gap: 0;
    background: rgba(255, 255, 255, 0.14) !important;
    border: 2.5px solid rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow:
      inset 0 2px 6px rgba(255, 255, 255, 0.24),
      0 4px 14px rgba(0, 0, 0, 0.28);
  }

  .arcade-hud .hud-ability-dock .orb-boost.boosting,
  .arcade-hud .hud-ability-dock .orb-boost.touch-pressed,
  .arcade-hud .orb-boost.boosting,
  .arcade-hud .orb-boost.touch-pressed {
    background: rgba(251, 191, 36, 0.34) !important;
    border-color: #fde047 !important;
    box-shadow:
      inset 0 2px 8px rgba(255, 255, 255, 0.45),
      0 0 20px rgba(250, 204, 21, 0.72);
    transform: scale(0.93);
  }

  .arcade-hud .orb-boost .orb-boost-desktop-ico,
  .arcade-hud .orb-boost .orb-sub {
    display: none !important;
  }

  .arcade-hud .orb-boost .orb-boost-mobile-ico {
    display: inline-flex !important;
    width: 28px;
    height: 28px;
  }

  .arcade-hud .orb-boost .orb-badge {
    position: absolute;
    bottom: -5px;
    right: 50%;
    transform: translateX(50%);
    margin-left: 0;
    height: 15px;
    min-width: 28px;
    padding: 0 4px;
    font-size: 0.5rem;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #ffffff;
  }

  .arcade-hud .arcade-orb-btn:not(.orb-boost) .orb-badge {
    display: none;
  }

  .arcade-hud .orb-icon {
    font-size: 0.9rem;
  }

  .arcade-hud .orb-sub {
    font-size: 0.46rem;
  }

  /* Compact Mobile Landscape Snake Store (side-by-side preview + 3-col cards!) */
  .shop-full-shell {
    padding: 4px 8px 6px;
    gap: 5px;
    overflow: hidden;
  }

  .shop-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
  }

  .shop-title-lockup h2 {
    font-size: 0.85rem;
  }

  .shop-best-inline {
    display: none;
  }

  .shop-cat-tab .label-full {
    display: none;
  }

  .shop-cat-tab .label-short {
    display: inline;
  }

  .shop-cat-tab {
    padding: 4px 8px;
    min-height: 26px;
    font-size: 0.72rem;
  }

  .shop-full-body {
    display: grid !important;
    grid-template-columns: 180px minmax(0, 1fr) !important;
    gap: 7px;
    min-height: 0;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .shop-preview-stage {
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 4px;
    overflow: hidden;
  }

  #shopRefImageWrap,
  .preview-view-switch {
    display: none !important;
  }

  #shopPreviewCanvas {
    height: 82px !important;
    min-height: 82px !important;
  }

  .shop-catalog-col {
    min-height: 0;
    overflow-y: auto !important;
  }

  .shop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .item-card {
    padding: 6px 7px;
    gap: 3px;
    border-width: 2px;
    border-radius: 11px;
  }

  .item-name {
    font-size: 0.72rem;
  }

  .card-preview-canvas {
    height: 40px;
  }

  .card-ref-banner {
    max-height: 46px;
  }

  .stat-list {
    font-size: 0.6rem;
    gap: 1.5px;
  }

  .item-btn {
    min-height: 26px;
    font-size: 0.66rem;
    padding: 0 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
