/* ============================================================
   Arcade polish layer — key art, marquee, neon framing.
   Loaded after styles.css so these rules win where they overlap.
   ============================================================ */

/* --- Roguelike run stat bar (DOM HUD above the gameplay canvas) ----------- */
.roguelike-stat-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 6px 0 8px;
  padding: 8px 12px;
  border: 1px solid rgba(25, 247, 255, 0.28);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(6, 12, 28, 0.82), rgba(22, 10, 46, 0.7));
  box-shadow: inset 0 0 18px rgba(25, 247, 255, 0.06);
}
.roguelike-stat-bar .stat-hero {
  font: 800 0.82rem/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #45ff8a;
  text-shadow: 0 0 10px rgba(69, 255, 138, 0.45);
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
.roguelike-stat-bar .stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  flex: 1 1 auto;
}
.roguelike-stat-bar .stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(2, 6, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}
.roguelike-stat-bar .stat-chip[data-stat="obj"][data-directional="true"] {
  flex: 1 1 260px;
  min-width: min(100%, 230px);
  border-color: rgba(25, 247, 255, 0.34);
  background: linear-gradient(90deg, rgba(25, 247, 255, 0.1), rgba(2, 6, 16, 0.55));
}
.roguelike-stat-bar .stat-chip[data-stat="obj"][data-directional="true"] strong {
  white-space: normal;
  line-height: 1.18;
}
.roguelike-stat-bar .stat-chip span {
  font: 700 0.6rem/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.1em;
  color: rgba(214, 228, 255, 0.6);
}
.roguelike-stat-bar .stat-chip strong {
  font: 800 0.86rem/1 "Segoe UI", system-ui, sans-serif;
  color: #eaf2ff;
}
.roguelike-stat-bar .stat-chip[data-tone="cyan"] strong { color: #19f7ff; }
.roguelike-stat-bar .stat-chip[data-tone="red"] strong { color: #ff5d6c; }
.roguelike-stat-bar .stat-chip[data-tone="gold"] strong { color: #ffe84d; }
.roguelike-stat-bar .stat-chip[data-tone="green"] strong { color: #45ff8a; }
.roguelike-stat-bar .stat-chip[data-tone="orange"] strong { color: #ff7b2f; }
.roguelike-stat-bar .stat-xp {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 180px;
}
.roguelike-stat-bar .stat-xp span {
  font: 700 0.62rem/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.06em;
  color: rgba(69, 255, 138, 0.85);
  white-space: nowrap;
}
.roguelike-stat-bar .stat-xp-track {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(69, 255, 138, 0.4);
  overflow: hidden;
}
.roguelike-stat-bar .stat-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(69, 255, 138, 0.7), rgba(25, 247, 255, 0.95));
  transition: width 200ms ease;
}
.roguelike-stat-bar .stat-fx {
  display: flex;
  gap: 6px;
}
.roguelike-stat-bar .stat-fx span {
  font: 800 0.6rem/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 8px;
  color: #04121f;
  background: linear-gradient(135deg, #19f7ff, #45ff8a);
}
@media (max-width: 720px) {
  .roguelike-stat-bar { gap: 5px 7px; padding: 6px 8px; }
  .roguelike-stat-bar .stat-chip { padding: 2px 6px; }
  .roguelike-stat-bar .stat-chip strong { font-size: 0.78rem; }
  .roguelike-stat-bar .stat-chip[data-stat="obj"][data-directional="true"] {
    flex-basis: 100%;
    order: -1;
  }
  /* Phone: keep only the vitals readable at a glance — hide secondary chips so
     the bar stays ONE row and the game window keeps maximum height. */
  .roguelike-stat-bar .stat-hero { display: none; }
  .roguelike-stat-bar .stat-chip[data-stat="level"],
  .roguelike-stat-bar .stat-chip[data-stat="wpn"],
  .roguelike-stat-bar .stat-chip[data-stat="aug"] { display: none; }
  .roguelike-stat-bar .stat-xp { flex-basis: 100%; min-width: 0; }
}

/* Fullscreen: the stat bar is reparented INTO the combat mount — float it over
   the top edge of the canvas as a translucent HUD strip. */
.official-combat-mount:fullscreen .roguelike-stat-bar,
.official-combat-mount[data-viewport="fullscreen"] .roguelike-stat-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100vw - 32px));
  z-index: 6;
  margin: 0;
  background: linear-gradient(135deg, rgba(6, 12, 28, 0.66), rgba(22, 10, 46, 0.56));
  backdrop-filter: blur(3px);
  pointer-events: none;
}


/* Splash marquee key-art banner replaces the plain H1. */
.splash-marquee {
  position: relative;
  margin: 0 0 18px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(25, 247, 255, 0.25),
    0 18px 60px rgba(0, 0, 0, 0.65),
    0 0 70px rgba(255, 61, 242, 0.18);
  animation: marquee-glow 4.5s ease-in-out infinite;
}
.splash-marquee-art {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}
@keyframes marquee-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(25,247,255,0.25), 0 18px 60px rgba(0,0,0,0.65), 0 0 60px rgba(255,61,242,0.16); }
  50%      { box-shadow: 0 0 0 1px rgba(25,247,255,0.45), 0 18px 60px rgba(0,0,0,0.65), 0 0 95px rgba(25,247,255,0.30); }
}

/* Featured cabinet shows the original 3D rotating cabinet sprite (no static banner). */
.splash-featured-cabinet-art { position: relative; }

/* Neon arcade border frame around the whole official app shell. */
.official-app::after {
  content: "";
  position: fixed;
  inset: 6px;
  border-radius: 18px;
  pointer-events: none;
  z-index: 40;
  border: 2px solid rgba(25, 247, 255, 0.16);
  box-shadow:
    inset 0 0 60px rgba(25, 247, 255, 0.06),
    inset 0 0 120px rgba(255, 61, 242, 0.05);
}

/* Cabinet grid tiles: tighten into glowing arcade machines. */
.official-cabinet-grid .neon-cabinet,
.official-cabinet-grid > * {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.official-cabinet-grid .neon-cabinet:hover,
.official-cabinet-grid > *:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 0 32px rgba(25, 247, 255, 0.35);
}

/* HMH key art used as the game-menu / boot backdrop. */
.game-intro-shell {
  position: relative;
}
.game-intro-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5,7,15,0.78), rgba(5,7,15,0.92)),
    url("./assets/generated/hmh-key-art/hard-money-heroes-keyart-bg.jpg") center/cover no-repeat;
  border-radius: 16px;
  opacity: 0.45;
  z-index: 0;
}
.game-intro-shell > * { position: relative; z-index: 1; }

.arcade-floor-view .official-cabinet-grid,
.mode-select-view .official-mode-grid,
.arcade-floor-view .arcade-walk-in,
.mode-select-view > div,
.mode-select-view .ranked-tooltip {
  background: rgba(5, 7, 15, 0.52);
  border: 1px solid rgba(25, 247, 255, 0.16);
  backdrop-filter: blur(10px);
}

.arcade-floor-view .arcade-walk-in,
.mode-select-view > div,
.mode-select-view .ranked-tooltip {
  border-radius: 18px;
  padding: 16px 18px;
}

.arcade-floor-view .official-cabinet-grid,
.mode-select-view .official-mode-grid {
  padding: 18px;
  border-radius: 24px;
}

@media (max-width: 800px) {
  .splash-marquee { margin-bottom: 12px; }
  .official-app::after { inset: 3px; }
}

/* --- Splash layout balance fix --- */
/* Center the left column content vertically so the marquee + CTA form a true
   hero block instead of being bottom-anchored against the tall key art. */
.wallet-splash-view .splash-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 14px;
  align-self: center;
  max-width: 720px;
  margin: 0 auto;
}
.wallet-splash-view .splash-copy .big-action {
  margin: 4px auto 0;
}
/* Guest-first CTA row: primary "Play Free" + secondary "Connect Wallet". */
.wallet-splash-view .splash-cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 4px auto 0;
  position: relative;
  z-index: 20;
}
.wallet-splash-view .splash-cta-row .big-action {
  margin: 0;
}
/* Ranked card flags that it needs a wallet for guests (still clickable). */
.mode-card.ranked-card[data-needs-wallet="true"]::after {
  content: "Wallet required";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 14, 26, 0.82);
  color: #d6e4ff;
  border: 1px solid rgba(120, 160, 240, 0.55);
}
/* Keep the centered hero compact so the CTA stays above the fold. */
.wallet-splash-view .splash-marquee {
  max-width: 560px;
  margin: 0 auto;
}
.wallet-splash-view .splash-marquee .splash-marquee-art {
  max-height: 26vh;
  width: auto;
  margin: 0 auto;
}
/* Compact featured-cabinet card under the centered hero CTA. */
.splash-featured-cabinet-mini {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(100%, 420px);
  margin: 6px auto 0;
  padding: 8px 14px;
  text-align: left;
  border: 1px solid rgba(69, 255, 138, 0.32);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(7, 5, 18, 0.92), rgba(19, 49, 78, 0.5));
  box-shadow: 0 0 22px rgba(69, 255, 138, 0.14);
}
.splash-featured-cabinet-mini .splash-featured-cabinet-art {
  min-height: 72px;
  width: 72px;
  place-items: center;
}
.splash-featured-cabinet-mini .splash-featured-cabinet-copy { gap: 1px; }
.splash-featured-cabinet-mini .splash-featured-cabinet-copy strong { font-size: 0.95rem; }
.splash-featured-cabinet-mini .splash-featured-cabinet-copy small { font-size: 0.72rem; }
/* On short viewports, hide the featured card so the CTA clears the bottom ad. */
@media (max-height: 720px) {
  .splash-featured-cabinet-mini { display: none; }
}
/* Make the locked cabinets read as intentional 'coming soon' tiles, not dead boxes. */
.splash-cabinet-stack .neon-cabinet.cabinet-locked {
  position: relative;
  opacity: 0.72;
  border: 1px solid rgba(25, 247, 255, 0.18);
  background: linear-gradient(140deg, rgba(20,28,52,0.9), rgba(12,10,28,0.9));
}
.splash-cabinet-stack .neon-cabinet.cabinet-locked::after {
  content: "COMING SOON";
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(255, 232, 77, 0.85);
}

/* Back-navigation buttons on mode-select / level-intro screens */
.back-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-bottom: 14px;
  padding: 8px 16px;
  background: rgba(8, 14, 32, 0.72);
  border: 1px solid rgba(25, 247, 255, 0.35);
  border-radius: 10px;
  color: #9fe9ff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.back-nav-button:hover {
  transform: translateX(-3px);
  background: rgba(25, 247, 255, 0.16);
  border-color: rgba(25, 247, 255, 0.7);
  color: #d6f6ff;
}
.back-nav-button:active { transform: translateX(-1px) scale(0.98); }

/* ---- Character-select roster ---- */
.character-select-view { display: flex; flex-direction: column; gap: 22px; padding: 8px 0; }
.char-select-head h2 { margin: 4px 0 8px; }
.character-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
}
.hero-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  text-align: left;
  background: linear-gradient(180deg, rgba(12, 20, 44, 0.88), rgba(8, 14, 32, 0.82));
  border: 1px solid rgba(25, 247, 255, 0.22);
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.hero-card.active:hover {
  transform: translateY(-4px);
  border-color: rgba(25, 247, 255, 0.85);
  box-shadow: 0 12px 34px rgba(25, 247, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.06);
}
.hero-card.active {
  border-color: rgba(25, 247, 255, 0.55);
}
.hero-card.locked { opacity: 0.62; cursor: not-allowed; filter: grayscale(0.85); }
.hero-card-stage {
  position: relative;
  height: 210px;
  display: flex;
  /* Anchor the sprite to the floor line (where the ::after floor ellipse sits)
     instead of centering — center-alignment left a dead band of empty space
     above shorter sprites, which read as broken on mobile. */
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 22px;
  background:
    radial-gradient(ellipse 70% 45% at 50% 85%, rgba(25,247,255,0.12), transparent 70%),
    radial-gradient(circle at 50% 55%, rgba(25,247,255,0.16), rgba(6,10,28,0) 72%);
  border-radius: 14px;
  border: 1px solid rgba(25, 247, 255, 0.08);
}
.hero-card-stage::after {
  /* subtle "floor" ellipse beneath the sprite */
  content: '';
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 62%;
  height: 14px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.45), transparent 70%);
  pointer-events: none;
}
.hero-card-stage .hmh-cabinet-rotator { width: 180px; height: 180px; position: relative; z-index: 1; }
.hero-card-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.hero-locked-badge {
  position: absolute;
  bottom: 12px;
  padding: 5px 16px;
  background: rgba(255, 71, 111, 0.92);
  color: #fff;
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(255, 71, 111, 0.45);
}
.hero-name {
  font-size: 1.5rem;
  color: #ffffff;
  letter-spacing: 0.02em;
  line-height: 1.15;
  font-weight: 800;
  text-shadow: 0 1px 8px rgba(25, 247, 255, 0.22);
}
.hero-tagline {
  display: inline-block;
  align-self: flex-start;
  margin-top: 0;
  padding: 4px 12px;
  color: #061022;
  background: linear-gradient(90deg, #19f7ff, #45ff8a);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  box-shadow: 0 1px 6px rgba(25, 247, 255, 0.32);
}
.hero-bio {
  color: rgba(214, 228, 255, 0.88);
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 4px 0 2px;
}
.hero-loadout {
  display: grid;
  gap: 5px;
  padding: 9px 11px;
  border: 1px solid rgba(25, 247, 255, 0.18);
  border-radius: 7px;
  background: rgba(4, 13, 31, 0.72);
  text-align: left;
}
.hero-loadout-weapon {
  color: #ffe84d;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.hero-loadout-passive {
  color: rgba(214, 228, 255, 0.88);
  font-size: 0.76rem;
  line-height: 1.4;
}
.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(25, 247, 255, 0.12);
}
.hero-stat-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 12px; }
.hero-stat-label { display: inline-flex; align-items: center; gap: 7px; font-size: 0.74rem; color: #9fe9ff; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-stat-icon { width: 18px; height: 18px; display: grid; place-items: center; color: #19f7ff; line-height: 1; filter: drop-shadow(0 0 4px rgba(25,247,255,0.4)); }
.hero-stat-icon .arcade-icon { width: 16px; height: 16px; }
.hero-stat-name { font-weight: 700; }
.hero-stat-track { height: 10px; background: rgba(255,255,255,0.08); border-radius: 5px; overflow: hidden; box-shadow: inset 0 0 4px rgba(0,0,0,0.5); border: 1px solid rgba(25,247,255,0.08); }
.hero-stat-fill { height: 100%; background: linear-gradient(90deg, #19f7ff, #45ff8a); border-radius: 5px; box-shadow: 0 0 10px rgba(25,247,255,0.55); transition: width 0.4s cubic-bezier(.3,1.4,.5,1); }
.hero-unlock-progress {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 232, 77, 0.22);
  border-radius: 12px;
  background: rgba(255, 232, 77, 0.06);
}
.hero-unlock-progress-label {
  color: #ffe84d;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.hero-unlock-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,232,77,0.18);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.48);
}
.hero-unlock-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffe84d, #ff8a45);
  box-shadow: 0 0 12px rgba(255,232,77,0.45);
}
.hero-unlock-progress-note {
  color: rgba(214,228,255,0.72);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}
.hero-cta {
  margin-top: 14px;
  padding: 10px 14px;
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: #061022;
  background: linear-gradient(90deg, #ffe84d, #ffb84d);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(255, 232, 77, 0.35);
  text-transform: uppercase;
}
.hero-card.locked .hero-cta { color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.08); box-shadow: none; }

/* ---- Nav account: avatar chip + sign out ---- */
.official-nav-account { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; }
.nav-avatar-button { padding: 0; background: none; border: none; cursor: pointer; line-height: 0; }
.avatar-chip-img, .avatar-chip-initial {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(25, 247, 255, 0.6);
  color: #fff; font-weight: 800;
}
.avatar-chip-initial { font-family: system-ui, sans-serif; }
.nav-avatar { width: 34px; height: 34px; font-size: 0.95rem; }
.nav-avatar-button:hover .avatar-chip-img,
.nav-avatar-button:hover .avatar-chip-initial { border-color: rgba(25, 247, 255, 1); box-shadow: 0 0 10px rgba(25,247,255,0.5); }
.nav-signout-button {
  padding: 6px 12px; background: rgba(255, 71, 111, 0.16);
  border: 1px solid rgba(255, 71, 111, 0.5); border-radius: 8px;
  color: #ff9bb2; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; cursor: pointer; transition: background 0.12s ease;
}
.nav-signout-button:hover { background: rgba(255, 71, 111, 0.3); color: #fff; }

/* ---- Avatar editor on profile ---- */
.avatar-editor-row { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.profile-avatar { width: 72px; height: 72px; font-size: 1.8rem; }
.avatar-preview-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(8,14,32,0.78);
}
.avatar-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.avatar-preview-hint {
  position: absolute;
  inset: auto 6px 6px 6px;
  margin: 0;
  padding: 3px 6px;
  background: rgba(3,10,24,0.72);
  border-radius: 999px;
  font-size: 0.6rem;
  text-align: center;
}
.avatar-editor-controls { display: flex; flex-direction: column; gap: 6px; }
.avatar-file-input { display: none; }
.avatar-feedback[data-state="ok"] { color: #45ff8a; }
.avatar-feedback[data-state="error"] { color: #ff6f8f; }
.avatar-saved-flash {
  animation: avatarSavedFlash 0.8s ease;
  box-shadow: 0 0 0 2px rgba(69,255,138,0.6), 0 0 22px rgba(69,255,138,0.45);
}
.username-saved-flash {
  animation: avatarSavedFlash 0.8s ease;
  box-shadow: 0 0 0 2px rgba(69,255,138,0.6), 0 0 22px rgba(69,255,138,0.45);
}
@keyframes avatarSavedFlash {
  0% { box-shadow: 0 0 0 0 rgba(69,255,138,0.0); }
  30% { box-shadow: 0 0 0 3px rgba(69,255,138,0.85), 0 0 30px rgba(69,255,138,0.6); }
  100% { box-shadow: 0 0 0 2px rgba(69,255,138,0.45), 0 0 18px rgba(69,255,138,0.35); }
}

/* ---- Profile hero card (wallet profile parent account) ---- */
.profile-hero-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 22px;
  min-height: auto;
}
.profile-hero-topline {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-hero-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid rgba(25, 247, 255, 0.5);
  box-shadow: 0 0 20px rgba(25, 247, 255, 0.25);
  flex: 0 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 14, 32, 0.6);
}
.profile-hero-avatar .avatar-chip-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-hero-identity {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}
.profile-hero-name {
  font-size: 1.4rem;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-shadow: 0 1px 6px rgba(25, 247, 255, 0.2);
  word-break: break-word;
}
.profile-hero-identity small {
  font-size: 0.78rem;
  color: rgba(159, 233, 255, 0.82);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  line-height: 1.5;
  word-break: break-all;
}
.profile-hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(25, 247, 255, 0.14);
}
.profile-hero-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(8, 14, 32, 0.55);
  border: 1px solid rgba(25, 247, 255, 0.1);
  border-radius: 10px;
}
.profile-hero-stat span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(159, 233, 255, 0.75);
}
.profile-hero-stat strong {
  font-size: 1.05rem;
  color: #45ff8a;
  letter-spacing: 0.01em;
  text-shadow: 0 0 8px rgba(69,255,138,0.25);
}
.profile-quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
}
.profile-action-primary {
  background: linear-gradient(90deg, #ffe84d, #ffb84d);
  color: #061022;
  border-color: rgba(255, 232, 77, 0.5);
  box-shadow: 0 4px 14px rgba(255, 232, 77, 0.3);
}
.profile-action-primary:hover { filter: brightness(1.1); transform: translateY(-2px); }

/* Wallet-rail + achievements + recent runs sub-cards on the profile view */
.profile-command-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 980px) {
  .profile-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-hero-card {
    grid-column: span 2;
  }
}
.profile-wallet-rail-card {
  background: linear-gradient(180deg, rgba(12, 20, 44, 0.85), rgba(6, 10, 28, 0.8));
}
.profile-wallet-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.profile-achievements-card .achievement-list,
.profile-recent-runs-card .recent-runs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.profile-achievements-card .achievement-row,
.profile-recent-runs-card .recent-runs-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(8, 14, 32, 0.5);
  border: 1px solid rgba(25, 247, 255, 0.08);
}
.profile-achievements-card .achievement-row.unlocked {
  border-color: rgba(69, 255, 138, 0.4);
  background: rgba(69, 255, 138, 0.06);
}

/* ---- Leaderboard avatar ---- */
.leaderboard-row-avatar { width: 26px; height: 26px; font-size: 0.7rem; flex: 0 0 auto; }

/* ---- Redesigned leaderboard ---- */
.leaderboard-header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.leaderboard-title { margin: 0; font-size: 1.2rem; letter-spacing: 0.08em; color: #ffe84d; text-shadow: 0 0 12px rgba(255,232,77,0.4); }
.leaderboard-podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end;
  margin: 8px 0 18px; padding: 12px 6px 0;
}
.podium-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.podium-medal { font-size: 1.6rem; line-height: 1; filter: drop-shadow(0 0 6px rgba(255,232,77,0.5)); }
.podium-avatar { width: 52px; height: 52px; font-size: 1.3rem; }
.podium-rank-1 .podium-avatar { width: 64px; height: 64px; border-color: #ffd54a; box-shadow: 0 0 18px rgba(255,213,74,0.6); }
.podium-rank-2 .podium-avatar { border-color: #c7d0dc; }
.podium-rank-3 .podium-avatar { border-color: #d8995a; }
.podium-name { font-size: 0.8rem; color: #d6f6ff; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { font-size: 0.82rem; font-weight: 800; color: #45ff8a; }
.podium-stand {
  margin-top: 6px; width: 100%; display: flex; align-items: flex-start; justify-content: center;
  border-radius: 8px 8px 0 0; background: linear-gradient(180deg, rgba(25,247,255,0.22), rgba(25,247,255,0.04));
  border: 1px solid rgba(25,247,255,0.3); border-bottom: none;
}
.podium-rank-1 .podium-stand { height: 64px; background: linear-gradient(180deg, rgba(255,213,74,0.3), rgba(255,213,74,0.05)); border-color: rgba(255,213,74,0.5); }
.podium-rank-2 .podium-stand { height: 46px; }
.podium-rank-3 .podium-stand { height: 32px; }
.podium-stand-rank { padding-top: 6px; font-weight: 800; color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.leaderboard-entry {
  display: grid; grid-template-columns: 36px 26px 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px 12px; background: rgba(8,14,32,0.55); border: 1px solid rgba(25,247,255,0.12);
  border-radius: 10px; transition: border-color 0.12s ease, transform 0.12s ease;
}
.leaderboard-entry:hover { border-color: rgba(25,247,255,0.4); transform: translateX(2px); }
.leaderboard-entry.is-current-player { border-color: rgba(255,232,77,0.7); background: rgba(255,232,77,0.08); }
.leaderboard-rank { font-weight: 800; color: #9fe9ff; font-size: 0.82rem; }
.leaderboard-name { color: #d6f6ff; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-settled { color: #45ff8a; font-weight: 800; }
.leaderboard-score { font-weight: 800; color: #45ff8a; font-size: 0.9rem; }
.leaderboard-you-card {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px;
  background: linear-gradient(90deg, rgba(255,232,77,0.14), rgba(25,247,255,0.06));
  border: 1px solid rgba(255,232,77,0.5); border-radius: 12px;
}
.leaderboard-you-rank { font-weight: 800; letter-spacing: 0.08em; color: #ffe84d; }
.leaderboard-you-score { margin-left: auto; font-weight: 800; color: #45ff8a; }

/* ---- Leaderboard search + sortable Top-50 table ---- */
.leaderboard-controls { display: flex; gap: 8px; margin: 4px 0 10px; }
.leaderboard-search {
  flex: 1 1 auto; min-width: 0; padding: 8px 12px; border-radius: 10px;
  background: rgba(6,12,28,0.7); border: 1px solid rgba(25,247,255,0.28);
  color: #e7f6ff; font-size: 0.85rem; outline: none;
}
.leaderboard-search:focus { border-color: rgba(25,247,255,0.6); box-shadow: 0 0 0 2px rgba(25,247,255,0.18); }
.leaderboard-search::placeholder { color: rgba(159,233,255,0.5); }
.leaderboard-table { display: flex; flex-direction: column; gap: 4px; }
/* Shared column template across head + rows so columns line up exactly. */
.leaderboard-table-head, .leaderboard-trow {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 72px 52px 72px 44px 70px;
  align-items: center; gap: 8px;
}
.leaderboard-table-head { padding: 4px 12px; border-bottom: 1px solid rgba(25,247,255,0.18); margin-bottom: 2px; }
.leaderboard-th {
  background: none; border: none; padding: 2px 0; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em;
  color: #7f93b8; text-transform: uppercase; transition: color 0.12s ease;
}
.leaderboard-th:hover { color: #9fe9ff; }
.leaderboard-th.is-sorted { color: #19f7ff; }
.leaderboard-th.th-score, .leaderboard-th.th-kills, .leaderboard-th.th-survive, .leaderboard-th.th-level, .leaderboard-th.th-date { text-align: right; }
.leaderboard-trow {
  padding: 7px 12px; background: rgba(8,14,32,0.55); border: 1px solid rgba(25,247,255,0.1);
  border-radius: 9px; transition: border-color 0.12s ease, transform 0.12s ease;
}
.leaderboard-trow:hover { border-color: rgba(25,247,255,0.36); transform: translateX(2px); }
.leaderboard-trow.is-current-player { border-color: rgba(255,232,77,0.7); background: rgba(255,232,77,0.08); }
.lt-rank { font-weight: 800; color: #9fe9ff; font-size: 0.8rem; }
.lt-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lt-name-text { color: #d6f6ff; font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-settled { flex: 0 0 auto; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.04em; color: #45ff8a; opacity: 0.85; }
.lt-score { text-align: right; font-weight: 800; color: #45ff8a; font-size: 0.86rem; }
.lt-kills, .lt-survive, .lt-level, .lt-date { text-align: right; font-size: 0.76rem; color: #aebdd4; }
.lt-date { color: #8b9bc0; }
.leaderboard-empty { padding: 18px 12px; text-align: center; color: #8b9bc0; font-size: 0.85rem; }
/* On narrow screens, hide the lower-priority highlight columns to keep it readable. */
@media (max-width: 560px) {
  .leaderboard-table-head, .leaderboard-trow { grid-template-columns: 36px minmax(0,1fr) 64px 60px; }
  .leaderboard-th.th-kills, .leaderboard-th.th-level,
  .lt-kills, .lt-level { display: none; }
}

/* ---- Achievements grid ---- */
/* The achievements card is a column flexbox; force its children to span the
   full card width so the grid lays out HORIZONTALLY (multi-column) instead of
   collapsing to a single content-width column. */
.achievements-module { grid-column: 1 / -1; }
.achievements-card { align-items: stretch; }
.achievements-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; width: 100%; }
.achievements-count { color: #45ff8a; font-size: 0.9rem; white-space: nowrap; }
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 12px;
  width: 100%;
}
.achievement-badge {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 6px; border-radius: 12px; text-align: center;
  background: rgba(8,14,32,0.6); border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.achievement-badge:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }
.achievement-badge.unlocked:hover { transform: translateY(-3px); }
.achievement-badge.locked { opacity: 0.42; filter: grayscale(0.9); }
.achievement-badge.unlocked.tier-bronze { border-color: #cd7f32; box-shadow: 0 0 10px rgba(205,127,50,0.3); }
.achievement-badge.unlocked.tier-silver { border-color: #c7d0dc; box-shadow: 0 0 10px rgba(199,208,220,0.3); }
.achievement-badge.unlocked.tier-gold { border-color: #ffd54a; box-shadow: 0 0 12px rgba(255,213,74,0.45); }
.achievement-badge.unlocked.tier-platinum { border-color: #7bf6ff; box-shadow: 0 0 14px rgba(123,246,255,0.5); }
.achievement-icon { font-size: 1.6rem; line-height: 1; }
.achievement-icon-image {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(25,247,255,0.25));
}
.achievement-badge.locked .achievement-icon-image { filter: grayscale(0.8) drop-shadow(0 0 5px rgba(255,255,255,0.12)); opacity: 0.85; }
.achievement-name { font-size: 0.64rem; color: #d6f6ff; line-height: 1.2; }
.achievement-badge.locked .achievement-name { color: rgba(214,228,255,0.6); }
.achievement-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 3;
  min-width: 180px;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(3,10,24,0.96);
  border: 1px solid rgba(25,247,255,0.35);
  color: #d6f6ff;
  font-size: 0.68rem;
  line-height: 1.35;
  box-shadow: 0 0 16px rgba(25,247,255,0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}
.achievement-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(25,247,255,0.35);
}
.achievement-badge:hover .achievement-tooltip,
.achievement-badge:focus-visible .achievement-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

/* ---- Ranked entry-fee / signature modal ---- */
.ranked-entry-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3, 7, 17, 0.82); backdrop-filter: blur(4px);
}
.ranked-entry-card {
  width: min(440px, 92vw); padding: 26px;
  background: linear-gradient(160deg, rgba(14,22,46,0.98), rgba(8,12,28,0.98));
  border: 1px solid rgba(25,247,255,0.4); border-radius: 18px;
  box-shadow: 0 0 40px rgba(25,247,255,0.25);
}
.ranked-entry-card h2 { margin: 2px 0 8px; color: #ffe84d; }
.ranked-entry-copy { color: rgba(214,228,255,0.85); font-size: 0.85rem; line-height: 1.5; }
.ranked-entry-rows { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.ranked-entry-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: rgba(8,14,32,0.6); border-radius: 8px;
  border: 1px solid rgba(25,247,255,0.12);
}
.ranked-entry-row span { color: #9fe9ff; font-size: 0.8rem; }
.ranked-entry-row strong { color: #d6f6ff; font-size: 0.85rem; }
.ranked-entry-chainguard {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 12px;
  background: rgba(255,71,111,0.12); border: 1px solid rgba(255,71,111,0.5); border-radius: 10px;
}
.ranked-entry-chainguard strong { color: #ff9bb2; }
.ranked-entry-chainguard span { color: rgba(255,214,224,0.85); font-size: 0.8rem; }
.ranked-entry-status { min-height: 20px; font-size: 0.82rem; margin: 6px 0; }
.ranked-entry-status[data-state="pending"] { color: #ffe84d; }
.ranked-entry-status[data-state="ok"] { color: #45ff8a; }
.ranked-entry-status[data-state="error"] { color: #ff6f8f; }
.ranked-entry-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.ranked-entry-actions .big-action { flex: 1; }
.ranked-entry-actions .back-nav-button { margin-bottom: 0; }

/* --- Animated splash loop video (replaces the static marquee PNG) --------- */
.splash-loop-video {
  border-radius: 12px;
  object-fit: cover;
  background: #05070f;
  box-shadow: 0 0 0 1px rgba(25,247,255,0.30), 0 18px 60px rgba(0,0,0,0.65), 0 0 70px rgba(255,61,242,0.16);
}

/* --- Partner ad space (horizontal + vertical) ----------------------------- */
.ad-banner {
  display: block;
  position: relative;
  text-decoration: none;
  border-radius: 12px;
  overflow: hidden;
  background-color: #0a1024;
  background-size: cover;
  background-position: center top;   /* the calm dark ceiling strip sits up top */
  background-repeat: no-repeat;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  box-shadow: 0 0 0 1px rgba(25,247,255,0.20), 0 10px 34px rgba(0,0,0,0.55);
}
/* Real reflowing text overlay (replaces the old baked-text SVG so the contact
   email is live text that wraps/shrinks to the device width and never crops). */
.ad-banner-overlay {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  text-align: center;
  /* Dark scrim so text stays readable over the busy arcade art. */
  background: linear-gradient(90deg, rgba(6,10,22,0.82), rgba(6,10,22,0.5) 45%, rgba(6,10,22,0.82));
}
.ad-banner-title {
  font: 800 clamp(13px, 3.4vw, 18px)/1.05 "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0.04em;
  color: #ffe84d;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  text-transform: uppercase;
}
.ad-banner-copy {
  font: 600 clamp(9px, 2.2vw, 12px)/1.2 "Trebuchet MS", Verdana, sans-serif;
  color: #cdd8f5;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
.ad-banner-email {
  font: 700 clamp(9px, 2.4vw, 12.5px)/1.2 "Trebuchet MS", Verdana, sans-serif;
  color: #19f7ff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  /* Always fit the full address: wrap if needed rather than crop. */
  word-break: break-all;
  overflow-wrap: anywhere;
}
.ad-banner::after {
  content: "AD";
  position: absolute;
  top: 6px; right: 8px;
  font: 700 9px/1 "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 1.5px;
  color: rgba(154,167,199,0.85);
  background: rgba(6,10,22,0.6);
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
}
.ad-banner:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 0 0 1px rgba(25,247,255,0.45), 0 14px 40px rgba(0,0,0,0.6), 0 0 40px rgba(25,247,255,0.25);
}
.ad-banner-horizontal {
  position: fixed;
  left: 50%;
  bottom: clamp(8px, 1.6vw, 18px);
  transform: translateX(-50%);
  width: min(728px, calc(100vw - 24px));
  /* Auto-height so wrapped text is never clipped; min keeps the art readable. */
  min-height: 64px;
  background-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0)), url('./assets/ads/ad-horizontal-bg.jpg');
  z-index: 5;
  margin: 0;
  /* Let clicks pass through to splash-screen buttons behind the banner. */
  pointer-events: none;
}
.ad-banner-horizontal .ad-banner-overlay {
  pointer-events: none;
}
.ad-banner-horizontal:hover { transform: translateX(-50%) translateY(-2px); }
.ad-banner-vertical {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  /* Sit above the music player: player is ~116px tall at bottom ~24px. */
  bottom: clamp(150px, 4vw + 140px, 168px);
  width: clamp(150px, 14vw, 200px);
  min-height: 300px;
  background-image: url('./assets/ads/ad-vertical-bg.jpg');
  z-index: 5;
  margin: 0;
  /* Let clicks pass through to elements behind the banner (Connect Wallet,
     Enter Arcade buttons on the splash screen). The <a> tag itself still
     receives clicks on its visible area via pointer-events: auto below. */
  pointer-events: none;
}
.ad-banner-vertical .ad-banner-overlay {
  justify-content: flex-end;
  padding-bottom: 16px;
  pointer-events: none;
}
/* Ad banners only belong on the wallet-splash landing, not inside gameplay/menus. */
#officialApp:not([data-step="wallet-splash"]) .ad-banner-horizontal,
#officialApp:not([data-step="wallet-splash"]) .ad-banner-vertical {
  display: none;
}
/* Remove the tall rail ad on narrow screens (portrait mobile). */
@media (max-width: 720px) {
  .ad-banner-vertical { display: none !important; }
  .ad-banner-horizontal { bottom: 8px; width: calc(100vw - 16px); }
}
/* Remove the vertical rail ad on landscape mobile too — short viewport heights
   (phones held sideways) where the tall ad blocks too much of the screen. */
@media (orientation: landscape) and (max-height: 560px) {
  .ad-banner-vertical { display: none !important; }
}

/* Keep the fixed jukebox out of the Free/Ranked cards. Wide screens place it
   in the backdrop's reserved upper-right negative space; medium screens move it
   into flow. The existing <=720px rule below already handles mobile. */
@media (min-width: 1360px) {
  #officialApp[data-step="mode-select"] .arcade-music-player {
    top: 110px;
    bottom: auto;
  }
}

@media (min-width: 721px) and (max-width: 1359px) {
  #officialApp[data-step="mode-select"] .arcade-music-player {
    position: static;
    align-self: flex-end;
    width: min(360px, 100%);
    margin: 10px 0 14px;
  }
}

@media (max-width: 720px) {
  .official-app {
    padding: 10px;
  }

  .official-nav {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }

  .official-nav > strong {
    flex: 1 1 100%;
    margin-right: 0;
    font-size: 0.92rem;
  }

  .official-nav-tabs {
    width: 100%;
    gap: 6px;
  }

  .official-nav-tabs > * {
    flex: 1 1 auto;
    min-height: 42px;
  }

  .arcade-music-player {
    position: static;
    width: 100%;
    max-width: none;
    margin: 10px 0 14px;
  }

  .official-view {
    padding-inline: 0;
  }

  .official-cabinet-grid,
  .official-mode-grid,
  .character-roster {
    grid-template-columns: 1fr;
  }

  .official-cabinet-grid > *,
  .official-mode-grid > *,
  .character-roster > * {
    min-width: 0;
  }

  .mode-card,
  .hero-card {
    min-height: 44px;
  }

  .gameplay-topbar,
  .gameplay-control-bar {
    gap: 8px;
  }

  .gameplay-control-bar {
    flex-wrap: wrap;
  }

  .gameplay-control-bar button,
  .gameplay-control-strip button,
  .back-nav-button,
  .primary-button,
  .secondary-button,
  .mode-card,
  .hero-card {
    min-height: 44px;
  }

  .gameplay-control-bar .secondary-button {
    flex: 1 1 46%;
  }

  .combat-hud-overlay {
    max-width: 100%;
  }

  .official-combat-mount {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .official-combat-mount canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
  }

  .official-footer {
    gap: 6px 10px;
    text-align: center;
    padding-bottom: 10px;
  }
}

@media (max-width: 420px) {
  .official-nav-tabs > * {
    flex: 1 1 100%;
  }

  .official-footer {
    font-size: 0.64rem;
    letter-spacing: 0.06em;
  }

  .hero-card-stage {
    height: 132px;
    padding-bottom: 16px;
  }

  .hero-card-stage::after {
    bottom: 12px;
  }

  .hero-card-stage .hmh-cabinet-rotator {
    width: 108px;
    height: 108px;
  }

  /* Tighten the achievements grid on phones so badges stay tappable but still
     read as a horizontal grid (not a single stretched column). */
  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
  }
  .achievement-name { font-size: 0.58rem; }
}

/* ---- Coming-soon cabinet key-art banners (MWEB Invaders, LitVM Legends) ---- */
/* Key art sits behind the COMING SOON headline + title/desc, cropped to fill the
   card width with a dark overlay so the neon copy stays readable. */
.official-cabinet-card.banner-cabinet-card {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  justify-content: flex-end;
  filter: none; /* override the generic .locked greyscale so art reads in color */
}
.official-cabinet-card.banner-cabinet-card.locked {
  filter: none;
}
.cabinet-card-banner {
  position: absolute;
  inset: 0;
  background-size: cover;          /* fit width, crop to fill */
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 0;
  transition: transform .4s ease;
}
.official-cabinet-card.banner-cabinet-card::after {
  /* Dark gradient overlay: darker at the bottom where the copy lives. */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(4, 11, 26, 0.55) 0%,
    rgba(4, 11, 26, 0.35) 38%,
    rgba(4, 11, 26, 0.82) 78%,
    rgba(4, 11, 26, 0.94) 100%
  );
  z-index: 1;
  pointer-events: none;
}
.official-cabinet-card.banner-cabinet-card .cabinet-card-copy {
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
.official-cabinet-card.banner-cabinet-card .cabinet-status-label {
  color: #ffe84d;
  letter-spacing: 0.14em;
}
.official-cabinet-card.banner-cabinet-card:hover:not(:disabled) .cabinet-card-banner {
  transform: scale(1.05);
}

/* ---- Free Mode / Play Ranked banner mode buttons ---- */
/* Key art fills each button (cover/crop), darkened by an inline gradient overlay
   baked into the background-image stack, with the title + description on top. */
.mode-row-banners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.mode-banner-button {
  position: relative;
  min-height: 116px;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
  text-align: left;
  border: 1px solid rgba(25, 247, 255, 0.3);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background-size .35s ease;
}
.mode-banner-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255, 232, 77, 0.6);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 28px rgba(25, 247, 255, 0.18);
}
.mode-banner-button.primary-button:hover:not(:disabled) {
  border-color: rgba(69, 255, 138, 0.7);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 28px rgba(69, 255, 138, 0.22);
}
.mode-banner-button:disabled {
  filter: grayscale(0.6) brightness(0.7);
  cursor: not-allowed;
}
.mode-banner-copy {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  width: 100%;
}
.mode-banner-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #f4faff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.95);
  line-height: 1.05;
}
.mode-banner-button.primary-button .mode-banner-title { color: #d9ffe9; }
.mode-banner-button.secondary-button .mode-banner-title { color: #e9f6ff; }
.mode-banner-desc {
  font-size: 0.64rem;
  line-height: 1.25;
  color: rgba(226, 240, 255, 0.92);
  text-shadow: 0 1px 6px rgba(0,0,0,0.95);
}
@media (max-width: 560px) {
  .mode-row-banners { grid-template-columns: 1fr; }
}

/* --- Game switcher tabs (per-game leaderboards + profile stats) ----------- */
.leaderboard-game-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.profile-game-tabs { margin-top: 8px; }
.leaderboard-game-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 8px 16px;
  border-radius: 10px;
  opacity: 0.6;
  border: 1px solid rgba(25,247,255,0.28);
  background: rgba(8,14,32,0.7);
  cursor: pointer;
}
.leaderboard-game-tab.is-active {
  opacity: 1;
  border-color: #ffe84d;
  box-shadow: 0 0 10px rgba(255,232,77,0.4);
  background: linear-gradient(135deg, rgba(255,232,77,0.14), rgba(25,247,255,0.1));
}
.leaderboard-game-tab.is-locked { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.6); }
.leaderboard-game-tab-title { font-weight: 800; font-size: 0.82rem; letter-spacing: 0.02em; }
.leaderboard-game-tab-badge {
  font-size: 0.54rem; font-weight: 800; letter-spacing: 0.1em;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(255,123,47,0.25); color: #ffb454;
}

/* Override cadence tab colors to match the cyan/gold HMH palette */
.leaderboard-cadence-tabs {
  background: rgba(8, 14, 32, 0.4);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(25, 247, 255, 0.1);
  backdrop-filter: blur(2px);
}
.leaderboard-cadence-tab {
  background: transparent;
  border-color: rgba(25, 247, 255, 0.18);
  color: rgba(159, 233, 255, 0.82);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding: 7px 14px;
  border-radius: 8px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.leaderboard-cadence-tab:hover:not(.is-active):not(:disabled) {
  color: #fff;
  border-color: rgba(25, 247, 255, 0.5);
  background: rgba(25, 247, 255, 0.06);
}
.leaderboard-cadence-tab.is-active {
  background: linear-gradient(90deg, rgba(25, 247, 255, 0.24), rgba(69, 255, 138, 0.18));
  border-color: rgba(25, 247, 255, 0.6);
  color: #fff;
  box-shadow: 0 0 10px rgba(25, 247, 255, 0.35), inset 0 0 8px rgba(25, 247, 255, 0.15);
  letter-spacing: 0.15em;
}

/* Leaderboard table polish: tighter rows, stronger rank badges */
.leaderboard-trow.top-3 { border-left: 3px solid transparent; }
.leaderboard-trow.rank-gold    { border-left-color: #ffe84d; }
.leaderboard-trow.rank-silver  { border-left-color: #c0c8cf; }
.leaderboard-trow.rank-bronze  { border-left-color: #cd7f32; }
.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 6px;
}
.leaderboard-rank.rank-gold   { background: rgba(255, 232, 77, 0.2); color: #ffe84d; }
.leaderboard-rank.rank-silver { background: rgba(192, 200, 207, 0.18); color: #e5ecf2; }
.leaderboard-rank.rank-bronze { background: rgba(205, 127, 50, 0.2); color: #f4b774; }

/* --- Profile: per-game stats grid + recent run history ------------------- */
.game-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.game-stat-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(8,14,32,0.6);
  border: 1px solid rgba(25,247,255,0.16);
}
.game-stat-value { font-size: 1.05rem; font-weight: 900; color: #19f7ff; }
.game-stat-label { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; color: #8fa0c8; text-transform: uppercase; }
.game-stats-subhead { display: block; margin-top: 14px; }
.game-history-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.game-history-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(4,6,16,0.55); border: 1px solid rgba(52,93,204,0.18);
}
.game-history-score { font-weight: 800; color: #ffe84d; font-size: 0.82rem; }
.game-history-detail { font-size: 0.72rem; color: #c8d4ff; }
@media (max-width: 560px) {
  .game-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Sign out confirmation modal ------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 19, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: modalFadeIn 0.15s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  background: linear-gradient(145deg, rgba(18, 11, 44, 0.98), rgba(7, 5, 18, 0.98));
  border: 2px solid rgba(25, 247, 255, 0.6);
  border-radius: 16px;
  padding: 24px 28px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 0 40px rgba(25, 247, 255, 0.2), 0 12px 48px rgba(0, 0, 0, 0.6);
  animation: modalSlideUp 0.2s ease;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.signout-modal h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  letter-spacing: 0.02em;
}
.signout-modal p {
  margin: 0 0 20px;
  font-size: 0.8rem;
  color: #c8d4ff;
  line-height: 1.5;
  text-align: center;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-actions .btn {
  min-width: 110px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.12s ease;
}
.btn-secondary {
  background: rgba(25, 247, 255, 0.12);
  border-color: rgba(25, 247, 255, 0.4);
  color: #19f7ff;
}
.btn-secondary:hover {
  background: rgba(25, 247, 255, 0.25);
  box-shadow: 0 0 14px rgba(25, 247, 255, 0.4);
}
.btn-danger {
  background: rgba(255, 71, 111, 0.18);
  border-color: rgba(255, 71, 111, 0.5);
  color: #ff9bb2;
}
.btn-danger:hover {
  background: rgba(255, 71, 111, 0.35);
  box-shadow: 0 0 16px rgba(255, 71, 111, 0.5);
  color: #fff;
}

/* --- Leaderboards: filters above one primary board ----------------------- */
.leaderboard-filter-shell {
  grid-column: 1 / -1;
  width: 100%;
}
.leaderboard-command-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: min(1180px, 100%);
  margin-inline: auto;
}
.leaderboard-command-grid > .leaderboard-filter-panel,
.leaderboard-command-grid > .leaderboard-board-card {
  grid-column: 1 / -1;
}
.leaderboard-filter-panel,
.leaderboard-board-card {
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
}
.leaderboard-command-grid > .leaderboard-filter-panel:hover,
.leaderboard-command-grid > .leaderboard-board-card:hover {
  transform: none;
}
.leaderboard-filter-panel {
  padding: clamp(16px, 2vw, 22px);
  border-color: rgba(25, 247, 255, 0.34);
  background:
    radial-gradient(circle at 9% 0%, rgba(255, 232, 77, 0.14), transparent 18rem),
    linear-gradient(135deg, rgba(7, 14, 32, 0.94), rgba(5, 8, 23, 0.9));
}
.leaderboard-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
}
.leaderboard-filter-copy {
  display: grid;
  gap: 6px;
  max-width: 760px;
}
.leaderboard-filter-copy strong {
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1.05;
}
.leaderboard-filter-copy small {
  max-width: 68ch;
}
.leaderboard-filter-summary {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 190px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 232, 77, 0.34);
  border-radius: 16px;
  background: rgba(255, 232, 77, 0.08);
  box-shadow: inset 0 0 18px rgba(255, 232, 77, 0.05);
}
.leaderboard-filter-summary-game {
  color: #ffe84d;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.leaderboard-filter-summary strong {
  font-size: 1.15rem;
  color: #fff;
}
.leaderboard-filter-summary small {
  color: #9fe9ff;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.leaderboard-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
  width: 100%;
  margin-top: 16px;
}
.leaderboard-filter-group {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}
.leaderboard-filter-label {
  color: rgba(159, 233, 255, 0.78);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.leaderboard-game-tabs.leaderboard-filter-buttons,
.leaderboard-cadence-tabs.leaderboard-filter-buttons {
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}
.leaderboard-filter-button,
.leaderboard-game-tab.leaderboard-filter-button,
.leaderboard-cadence-tab.leaderboard-filter-button {
  min-height: 0;
  padding: 9px 14px;
  border-radius: 999px;
  opacity: 0.72;
  background: rgba(6, 12, 28, 0.72);
  border: 1px solid rgba(25, 247, 255, 0.26);
  color: rgba(214, 246, 255, 0.88);
  box-shadow: none;
}
.leaderboard-filter-button:hover:not(:disabled) {
  opacity: 1;
  border-color: rgba(25, 247, 255, 0.58);
  transform: translateY(-1px);
}
.leaderboard-filter-button.is-active,
.leaderboard-game-tab.leaderboard-filter-button.is-active,
.leaderboard-cadence-tab.leaderboard-filter-button.is-active {
  opacity: 1;
  color: #05070f;
  border-color: rgba(255, 232, 77, 0.88);
  background: linear-gradient(135deg, #ffe84d, #19f7ff);
  box-shadow: 0 0 18px rgba(25, 247, 255, 0.32), 0 0 16px rgba(255, 232, 77, 0.22);
}
.leaderboard-board-card {
  width: 100%;
  padding: clamp(18px, 2.3vw, 28px);
  border-color: rgba(255, 232, 77, 0.34);
  background:
    radial-gradient(circle at top center, rgba(25, 247, 255, 0.12), transparent 24rem),
    linear-gradient(180deg, rgba(4, 11, 26, 0.94), rgba(2, 5, 16, 0.94));
}
.leaderboard-header-v9 {
  flex-direction: row;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
}
.leaderboard-header-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 10px;
  min-width: min(420px, 100%);
}
.leaderboard-header-stat {
  padding: 10px 12px;
  border: 1px solid rgba(25, 247, 255, 0.2);
  border-radius: 14px;
  background: rgba(8, 14, 32, 0.72);
  text-align: right;
}
.leaderboard-header-stat span {
  display: block;
  color: rgba(159, 233, 255, 0.7);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.leaderboard-header-stat strong {
  display: block;
  color: #45ff8a;
  font-size: 1.08rem;
}
.leaderboard-table {
  max-height: min(58vh, 560px);
  border-radius: 14px;
  border-color: rgba(25, 247, 255, 0.24);
}
@media (max-width: 760px) {
  .leaderboard-filter-head,
  .leaderboard-header-v9 {
    flex-direction: column;
    align-items: stretch;
  }
  .leaderboard-filter-summary {
    justify-items: start;
    min-width: 0;
  }
  .leaderboard-filter-grid {
    grid-template-columns: 1fr;
  }
  .leaderboard-header-stats {
    grid-template-columns: 1fr;
    min-width: 0;
  }
}
#officialApp[data-step="leaderboards"] .arcade-music-player {
  display: none;
}
.hero-carousel-hint {
  display: none;
}
@media (min-width: 701px) {
  #officialApp[data-step="character-select"] .arcade-music-player {
    display: none;
  }
}

@media (max-width: 700px) {
  .hero-carousel-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 10px;
    color: #9fe9ff;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .hero-carousel-hint span {
    color: #ffe84d;
    font-size: 1.1rem;
  }
  #officialCharacterRoster.character-roster {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(86vw, 340px);
    align-items: stretch;
    gap: 14px;
    margin-inline: -12px;
    padding: 4px 12px 18px;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 12px;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
  }
  #officialCharacterRoster .hero-card {
    min-width: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
  #officialCharacterRoster .hero-card-stage {
    min-height: 168px;
  }
  #officialCharacterRoster .hero-card-inner {
    padding: 16px;
    gap: 10px;
  }
  #officialCharacterRoster .hero-card-bio {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }
  #officialCharacterRoster .hero-stats {
    gap: 7px;
    margin-top: 8px;
    padding-top: 10px;
  }
  #officialCharacterRoster .hero-cta {
    margin-top: 10px;
  }
}
