/* ==========================================================================
   Skybridge Crowd: Gate Rush — Hyper-Casual Bright Toy 3D Stylesheet
   Archetype: hypercasual_toy_3d (#4FC9F8, #EBF8FC, #A2A797, #ABCFCD, #1C2B4A)
   Strict Performance Hygiene: ZERO css blur filters over WebGL2!
   ========================================================================== */

:root {
  --sky-primary: #4FC9F8;
  --sky-deep: #0369A1;
  --sky-ice: #EBF8FC;
  --surface-white: #FFFFFF;
  --surface-soft: #F4FAFD;
  --stone-muted: #A2A797;
  --mint-soft: #ABCFCD;
  --ink-navy: #1C2B4A;
  --ink-body: #334669;
  --ink-muted: #64748B;
  --accent-green: #0EAA60;
  --accent-gold: #F59E0B;
  --accent-orange: #FF7A2F;
  --accent-danger: #EF4444;
  --accent-violet: #8B5CF6;
  --scrim-clean: rgba(20, 32, 58, 0.56);

  --font-display: 'Titan One', 'Arial Rounded MT Bold', 'Trebuchet MS', 'Arial Black', system-ui, sans-serif;
  --font-accent: 'Fredoka', 'Arial Rounded MT Bold', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #4FC9F8;
  color: var(--ink-navy);
  font-family: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
}

button, select, input {
  font-family: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

[hidden] {
  display: none !important;
}

/* ==================== 3D PLAYFIELD & OVERLAY CANVASES ==================== */
#canvas-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background: linear-gradient(180deg, #3BBDF5 0%, #EBF8FC 100%);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.fx-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  z-index: 6;
}

#cutin-canvas {
  z-index: 60;
}

.ui-motion-overlay-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  z-index: 220;
}

#floating-fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 12;
}

.floating-num {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: #FFFFFF;
  -webkit-text-stroke: 1.5px #1C2B4A;
  text-shadow: 0 3px 0 #1C2B4A;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
}

.floating-num.is-good {
  color: #4ADE80;
}

.floating-num.is-bad {
  color: #FF6B6B;
}

.floating-num.is-gold {
  color: #FFE066;
  font-size: 29px;
}

/* ==================== EXACT 9-SLICE PAINTED CHROME ==================== */
.btn-9slice {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 24.000px 30.000px 26.000px 30.000px;
  border-image: url('../assets/ui/btn_primary.png') 148 150 150 150 fill / 24.000px 30.000px 26.000px 30.000px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  min-width: 230px;
  min-height: 78px;
  height: auto;
  padding: 0 12px;
  cursor: pointer;
  overflow: visible !important;
  filter: drop-shadow(0 6px 12px rgba(20, 32, 58, 0.24));
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-9slice:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.05) drop-shadow(0 8px 16px rgba(20, 32, 58, 0.28));
}

.btn-9slice:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

.btn-9slice:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-9slice-text {
  position: relative;
  z-index: 2;
  margin-top: -2px;
  padding: 2px 4px;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.24;
  letter-spacing: 0.5px;
  color: #14121F;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}

.panel-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 62.250px 32.750px 27.750px 32.500px;
  border-image: url('../assets/ui/frame_panel.png') 249 131 111 130 fill / 62.250px 32.750px 27.750px 32.500px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 18px 34px rgba(20, 32, 58, 0.34));
}

/* ==================== PILL & UTILITY BUTTONS ==================== */
.btn-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 3px solid var(--ink-navy);
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-navy);
  background: #FFFFFF;
  box-shadow: 0 4px 0 var(--ink-navy);
  cursor: pointer;
  overflow: visible !important;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn-pill:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn-pill:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink-navy);
}

.btn-pill-sky {
  background: linear-gradient(180deg, #67DAFF 0%, #38BDF8 100%);
  color: #14121F;
}

.btn-pill-gold {
  background: linear-gradient(180deg, #FFE47A 0%, #FBBF24 100%);
  color: #14121F;
}

.btn-pill-green {
  background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
  color: #FFFFFF;
  text-shadow: 0 2px 0 #0D5428;
}

.btn-pill-danger {
  background: linear-gradient(180deg, #FF7B7B 0%, #EF4444 100%);
  color: #FFFFFF;
  text-shadow: 0 2px 0 #7F1D1D;
}

.btn-pill-ghost {
  background: #EBF8FC;
  color: var(--ink-navy);
}

.btn-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== RED-DOT NOTIFICATION BADGE (NEVER CLIP!) ==================== */
.notify-badge {
  position: absolute;
  top: -6px;
  right: 0;
  z-index: 35;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #FF3B5C;
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 3px 6px rgba(28, 43, 74, 0.35);
  color: #FFFFFF;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 17px;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  transform-origin: right center;
  animation: badgePulse 1.6s ease-in-out infinite;
}

.notify-badge.hidden {
  display: none !important;
}

.notify-badge[aria-hidden="false"] {
  display: inline-flex !important;
}

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

/* ==================== TITLE SCREEN ==================== */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.title-bg-layer {
  position: absolute;
  inset: 0;
  background: url('../assets/art/title_bg.jpg') center center / cover no-repeat;
  opacity: 0.42;
  pointer-events: none;
}

.title-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(235, 248, 252, 0.18) 0%, rgba(20, 32, 58, 0.48) 100%);
  pointer-events: none;
}

.title-card {
  position: relative;
  z-index: 2;
  width: min(680px, 94vw);
  padding: 12px 24px 18px;
  text-align: center;
}

.title-ribbon-tag {
  margin-top: -46px;
  margin-bottom: 18px;
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #14121F;
}

.title-hero-showcase {
  display: flex;
  align-items: center;
  gap: 22px;
  text-align: left;
  background: #F4FAFD;
  border: 2.5px solid #CFEAF6;
  border-radius: 22px;
  padding: 16px 20px;
}

.title-portrait-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 40%, #FFFFFF 0%, #BEEBFF 100%);
  border: 3px solid var(--ink-navy);
  box-shadow: 0 6px 0 rgba(28, 43, 74, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.title-portrait-img {
  width: 118px;
  height: 118px;
  object-fit: contain;
}

.title-brand-col {
  min-width: 0;
  flex: 1;
}

.game-logo-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.02;
  color: #FFFFFF;
  -webkit-text-stroke: 2px #1C2B4A;
  text-shadow: 0 5px 0 #1C2B4A, 0 10px 20px rgba(28, 43, 74, 0.28);
}

.game-logo-subtitle {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 12px;
  border-radius: 999px;
  background: #FFE066;
  border: 2.5px solid #1C2B4A;
  font-family: var(--font-display);
  font-size: 18px;
  color: #1C2B4A;
}

.title-pitch {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.42;
  color: var(--ink-body);
}

.loading-wrap {
  margin-top: 18px;
  padding: 12px 16px;
  background: #EBF8FC;
  border-radius: 16px;
  border: 2px solid #CBE8F6;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.loading-wrap.is-queued {
  border-color: #0EAA60;
  background: #DCFCE7;
}

.loading-track {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: #D6ECF7;
  border: 2px solid var(--ink-navy);
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0EAA60 0%, #4ADE80 55%, #4FC9F8 100%);
  transition: width 0.16s ease-out;
}

.loading-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-navy);
}

.loading-pct {
  font-variant-numeric: tabular-nums;
}

.title-cta-row {
  margin-top: 18px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-footer-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toy-select {
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 3px solid var(--ink-navy);
  background: #FFFFFF;
  color: var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== 16:9 MAIN HUD SHELL (>= 85% HORIZONTAL SPAN) ==================== */
#game-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#game-shell.hud-hidden {
  opacity: 0;
  pointer-events: none;
}

#game-shell button,
#game-shell select,
#game-shell .currency-pill,
#game-shell .era-gauge-card,
#game-shell .ftue-banner,
#game-shell .result-backdrop {
  pointer-events: auto;
}

/* Hide & neutralize underlying HUD controls while Result Overlay or Modal Overlay is open */
body #game-shell.has-result-overlay > :not(#result-overlay),
body #game-shell.has-result-overlay > :not(#result-overlay) *,
body #game-shell.has-modal-overlay > *,
body #game-shell.has-modal-overlay > * * {
  visibility: hidden !important;
  pointer-events: none !important;
}

body #game-shell.has-result-overlay > :not(#result-overlay),
body #game-shell.has-modal-overlay > * {
  opacity: 0 !important;
}

#game-shell .result-backdrop[hidden],
#game-shell .result-backdrop.is-closing {
  pointer-events: none !important;
}

/* Top Bar */
.top-hud {
  position: absolute;
  top: 14px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 25;
}

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.commander-mini-wrap {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 3px solid var(--ink-navy);
  box-shadow: 0 4px 0 rgba(28, 43, 74, 0.22);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.commander-mini-wrap img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.stage-pill {
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid var(--ink-navy);
  border-radius: 18px;
  padding: 6px 14px;
  box-shadow: 0 4px 0 rgba(28, 43, 74, 0.20);
  min-width: 190px;
}

.stage-world-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sky-deep);
}

.stage-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.stage-num-text {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink-navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stage-mini-track {
  flex: 1;
  min-width: 72px;
  height: 10px;
  border-radius: 999px;
  background: #DCEEF8;
  border: 1.5px solid var(--ink-navy);
  overflow: hidden;
}

.stage-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, #4FC9F8, #0EAA60);
  transition: width 0.1s linear;
}

/* Big Top-Center Crowd Counter Pill */
.crowd-counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 3.5px solid var(--ink-navy);
  box-shadow: 0 5px 0 var(--ink-navy);
  transition: transform 0.16s cubic-bezier(0.18, 1.4, 0.4, 1), background 0.16s ease;
}

.crowd-counter-pill.pop-good {
  transform: scale(1.16);
  background: #DCFCE7;
}

.crowd-counter-pill.pop-bad {
  transform: scale(0.92);
  background: #FEE2E2;
}

.crowd-count-num {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  color: var(--ink-navy);
  font-variant-numeric: tabular-nums;
}

.crowd-count-unit {
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--ink-body);
}

.era-tier-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: #4FC9F8;
  border: 2px solid var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 700;
  color: #14121F;
}

.stair-mult-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: #FFE066;
  border: 2px solid var(--ink-navy);
  font-family: var(--font-display);
  font-size: 14px;
  color: #1C2B4A;
}

/* Top-Right Currency Pills & Utility Circles */
.currency-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid var(--ink-navy);
  box-shadow: 0 4px 0 rgba(28, 43, 74, 0.22);
  overflow: visible !important;
}

.currency-pill-btn {
  cursor: pointer;
}

.currency-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.currency-val {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink-navy);
  font-variant-numeric: tabular-nums;
}

.plus-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #0EAA60;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 14px;
}

.icon-circle-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid var(--ink-navy);
  background: #FFFFFF;
  color: var(--ink-navy);
  box-shadow: 0 4px 0 rgba(28, 43, 74, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: visible !important;
}

.icon-circle-danger {
  background: #FFF1F2;
  color: #E11D48;
}

/* Boss Clash HUD Bar */
.boss-hud-bar {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 62vw);
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid var(--ink-navy);
  border-radius: 18px;
  padding: 8px 16px 10px;
  box-shadow: 0 6px 0 rgba(28, 43, 74, 0.25);
  z-index: 26;
}

.boss-hud-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.boss-mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--ink-navy);
  background: #FEE2E2;
  object-fit: cover;
}

.boss-hud-name {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink-navy);
  flex: 1;
}

.boss-telegraph-chip {
  padding: 2px 10px;
  border-radius: 999px;
  background: #EF4444;
  color: #FFFFFF;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  animation: badgePulse 0.45s ease-in-out infinite;
}

.boss-hp-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #FEE2E2;
  border: 2px solid var(--ink-navy);
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #EF4444 0%, #F97316 100%);
  transition: width 0.1s linear;
}

/* Left Rail: Era Evolution Gauge */
.left-rail {
  position: absolute;
  left: 20px;
  top: 94px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 24;
}

.era-gauge-card {
  width: 108px;
  padding: 10px 8px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid var(--ink-navy);
  box-shadow: 0 5px 0 rgba(28, 43, 74, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.era-gauge-top {
  text-align: center;
  line-height: 1.05;
}

.era-gauge-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-muted);
}

.era-tier-big {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--sky-deep);
}

.era-vertical-track {
  position: relative;
  width: 30px;
  height: 210px;
  border-radius: 999px;
  background: #E2F2FA;
  border: 2.5px solid var(--ink-navy);
  overflow: hidden;
}

.era-vertical-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #FFE066 0%, #4FC9F8 55%, #0EAA60 100%);
  transition: height 0.18s ease-out;
}

.era-rungs {
  position: absolute;
  inset: 4px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-navy);
  pointer-events: none;
}

.era-name-caption {
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--ink-navy);
  width: 100%;
  max-width: 100%;
  display: block;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-perks-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.active-perk-pill {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 2.5px solid var(--ink-navy);
  box-shadow: 0 3px 0 rgba(28, 43, 74, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.active-perk-pill img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Right Command Dock */
.right-dock {
  position: absolute;
  right: 20px;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 25;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

#game-shell.is-running .right-dock {
  opacity: 0.88;
  transform: scale(0.92);
  transform-origin: top right;
}

.dock-btn {
  position: relative;
  width: 154px;
  min-width: 146px;
  height: 44px;
  padding: 0 11px;
  border-radius: 15px;
  border: 3px solid var(--ink-navy);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 0 var(--ink-navy);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  overflow: visible !important;
}

.dock-btn-featured {
  background: linear-gradient(180deg, #FFF3B0 0%, #FFD659 100%);
}

.dock-btn.is-locked {
  opacity: 0.72;
  background: #E2E8F0;
}

.dock-btn-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}

.lock-tag {
  position: absolute;
  bottom: -7px;
  right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ink-navy);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
}

/* Pre-Run Launch Pad Bottom Dock */
.launchpad-dock {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(1140px, calc(100vw - 330px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 25;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

#game-shell.is-running .launchpad-dock {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 40px);
  pointer-events: none !important;
}

.upgrades-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.upgrade-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border-radius: 18px;
  border: 3px solid var(--ink-navy);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 5px 0 var(--ink-navy);
  cursor: pointer;
  text-align: left;
  overflow: visible !important;
}

.upgrade-card.can-afford {
  background: linear-gradient(180deg, #FFFFFF 0%, #E6FAEF 100%);
  border-color: #0E7A46;
}

.upgrade-card.cant-afford {
  opacity: 0.78;
}

.hotkey-chip {
  position: absolute;
  top: -10px;
  left: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--ink-navy);
  color: #FFFFFF;
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 700;
  z-index: 5;
}

.upg-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.upg-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.upg-title {
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-navy);
}

.upg-level {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upg-cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #FFF7D6;
  border: 2px solid var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-navy);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.upg-coin-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.launch-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 12px;
  max-width: 100%;
}

.btn-launch-main {
  min-width: 268px;
  min-height: 76px;
}

/* Active Run Tactical Surge Bar */
.run-surge-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 25;
}

.surge-btn {
  position: relative;
  width: 246px;
  height: 56px;
  padding: 0 12px;
  border-radius: 18px;
  border: 3px solid var(--ink-navy);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 0 var(--ink-navy);
  cursor: pointer;
  overflow: visible !important;
}

.surge-btn.surge-mini {
  width: 120px;
}

.dps-clarity-chip {
  background: #DCFCE7;
  color: #14532D;
}

.fps-telemetry-chip {
  background: #E0F2FE;
  color: #0C4A6E;
  font-variant-numeric: tabular-nums;
}

.result-telemetry-line {
  margin: -4px 0 12px;
  padding: 6px 12px;
  border-radius: 12px;
  background: #EBF8FC;
  border: 1.5px solid #BAE6FD;
  font-family: var(--font-accent);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-navy);
}

.surge-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 14px;
  opacity: 0.45;
  pointer-events: none;
  transition: width 0.1s linear;
}

.surge-overdrive .surge-fill {
  background: linear-gradient(90deg, #FBBF24, #FF7A2F);
}

.surge-wedge .surge-fill {
  background: linear-gradient(90deg, #38BDF8, #4ADE80);
}

.surge-btn.is-ready {
  border-color: #0EAA60;
  background: #F0FDF4;
}

.surge-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.surge-text-col {
  min-width: 0;
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.surge-name {
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-navy);
}

.surge-status {
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.steer-hint-chip {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-navy);
  white-space: nowrap;
  pointer-events: none;
}

/* Non-Blocking 4-Step FTUE Coach Banner */
.ftue-banner {
  position: absolute;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  border: 3px solid var(--ink-navy);
  box-shadow: 0 7px 0 rgba(28, 43, 74, 0.22), 0 10px 22px rgba(20, 32, 58, 0.22);
  max-width: min(740px, 86vw);
}

.ftue-header-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ftue-badge-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ftue-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0EAA60;
  flex-shrink: 0;
  animation: badgePulse 1.1s infinite;
}

.ftue-step-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: #FFE066;
  border: 2px solid var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-navy);
  white-space: nowrap;
}

.ftue-title {
  font-family: var(--font-accent);
  font-size: 13.5px;
  font-weight: 800;
  color: #0369A1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ftue-text {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.32;
  color: var(--ink-navy);
}

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

.ftue-next-btn {
  padding: 5px 13px;
  border-radius: 999px;
  border: 2px solid var(--ink-navy);
  background: #4ADE80;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-navy);
  cursor: pointer;
  white-space: nowrap;
}

.ftue-skip-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 2px solid var(--ink-navy);
  background: #EBF8FC;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-navy);
  cursor: pointer;
  white-space: nowrap;
}

/* ==================== VICTORY / DEFEAT RESULT OVERLAY ==================== */
.result-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--scrim-clean);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.result-card {
  width: min(560px, 94vw);
  padding: 8px 20px 18px;
  text-align: center;
}

.result-kicker {
  margin-top: -46px;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: 20px;
  color: #FFFFFF;
  -webkit-text-stroke: 1.5px #1C2B4A;
  text-shadow: 0 3px 0 #1C2B4A;
}

.result-headline {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink-navy);
}

.result-chest-wrap {
  margin: 8px auto 14px;
}

.result-chest-box {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF08A 100%);
  border: 2.5px solid var(--ink-navy);
}

.result-chest-caption {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-navy);
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.result-stat-tile {
  background: #F4FAFD;
  border: 2px solid #CFE8F5;
  border-radius: 16px;
  padding: 10px 12px;
}

.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.stat-val-row {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stat-num {
  font-family: var(--font-accent);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-navy);
  font-variant-numeric: tabular-nums;
}

.result-blessing-row {
  margin-bottom: 14px;
}

.ticket-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ink-navy);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
}

.defeat-powerup-strip {
  background: #FFF7ED;
  border: 2px solid #FDBA74;
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.powerup-hint {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #9A3412;
  margin-bottom: 8px;
}

.powerup-quick-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.result-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* ==================== SHARED BRIGHT TOY MODALS (js/modals.js & js/exit_modal.js) ==================== */
.modal-backdrop,
.exit-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: var(--scrim-clean);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#exit-modal-root .modal-backdrop,
.exit-modal-backdrop {
  z-index: 125;
}

.modal-card,
.exit-modal-card {
  position: relative;
  width: min(880px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 4px solid var(--ink-navy);
  border-radius: 28px;
  box-shadow: 0 18px 36px rgba(20, 32, 58, 0.36), 0 6px 0 var(--ink-navy);
  color: var(--ink-navy);
  overflow: hidden;
}

.exit-modal-card {
  width: min(540px, 94vw);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: linear-gradient(180deg, #67DAFF 0%, #4FC9F8 100%);
  border-bottom: 3px solid var(--ink-navy);
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  color: #FFFFFF;
  -webkit-text-stroke: 1.6px #1C2B4A;
  text-shadow: 0 3px 0 #1C2B4A;
}

.modal-close,
.btn-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--ink-navy);
  background: #FFFFFF;
  color: var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 22px 0;
  background: #EBF8FC;
  border-bottom: 2px solid #CFE8F5;
}

.modal-tab {
  position: relative;
  padding: 9px 18px;
  border-radius: 14px 14px 0 0;
  border: 2.5px solid var(--ink-navy);
  border-bottom: none;
  background: #D8EFFA;
  color: var(--ink-navy);
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  overflow: visible !important;
}

.modal-tab.active,
.modal-tab[aria-selected="true"] {
  background: #FFFFFF;
  color: var(--ink-navy);
  transform: translateY(2px);
}

.modal-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  background: #F4FAFD;
  flex: 1;
}

/* Grids inside Modals (minmax(0, 1fr) prevents German/Russian overflow!) */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.wardrobe-grid,
.perk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}

.shop-card,
.wardrobe-card,
.perk-card,
.event-milestone-card,
.daily-medal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border-radius: 20px;
  background: #FFFFFF;
  border: 3px solid #CBE5F5;
  box-shadow: 0 4px 0 #CBE5F5;
  color: var(--ink-navy);
  min-width: 0;
  overflow: visible !important;
}

.shop-card.is-featured,
.wardrobe-card.is-equipped,
.perk-card.is-equipped {
  border-color: var(--ink-navy);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBEB 100%);
  box-shadow: 0 5px 0 var(--ink-navy);
}

.shop-card img,
.shop-art {
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin: 0 auto;
}

#modal-root .shop-badge,
.shop-card .shop-badge,
.shop-badge,
.card-ribbon {
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #FF7A2F;
  border: 2px solid var(--ink-navy);
  color: #FFFFFF;
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 800;
  z-index: 16 !important;
}

.shop-title,
.card-title {
  font-family: var(--font-accent);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-navy);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shop-desc,
.card-desc {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-body);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.shop-buy-btn,
.modal-action-btn {
  width: 100%;
  min-height: 42px;
  padding: 6px 12px;
  border-radius: 14px;
  border: 2.5px solid var(--ink-navy);
  background: linear-gradient(180deg, #4ADE80 0%, #0EAA60 100%);
  box-shadow: 0 3px 0 var(--ink-navy);
  color: #FFFFFF;
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.shop-buy-btn:disabled,
.modal-action-btn:disabled {
  background: #CBD5E1;
  color: #475569;
  cursor: not-allowed;
}

/* Settings Rows */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid #D5ECF7;
}

.settings-row label,
.settings-label {
  font-family: var(--font-accent);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-navy);
}

.settings-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-note {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #EBF8FC;
  border: 2px solid #BAE6FD;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-body);
}

/* Exit Retention Modal Quick-Jump List */
.exit-unclaimed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}

.exit-reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  background: #FFFBEB;
  border: 2.5px solid #F59E0B;
  cursor: pointer;
  font-family: var(--font-accent);
  font-weight: 700;
  color: var(--ink-navy);
}

.exit-actions,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 22px;
  background: #EBF8FC;
  border-top: 2px solid #CFE8F5;
}

/* Toast Notifications */
.toast-root {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toy-toast {
  padding: 9px 18px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 3px solid var(--ink-navy);
  box-shadow: 0 6px 16px rgba(20, 32, 58, 0.28);
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-navy);
  animation: toastPop 0.22s ease-out;
}

@keyframes toastPop {
  from { opacity: 0; transform: translateY(-10px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== PREVIEW-ONLY [DEV F2] DEBUG PANEL ==================== */
#dev-f2-pill {
  position: fixed;
  left: 14px;
  bottom: 12px;
  z-index: 140;
  padding: 4px 10px;
  border-radius: 8px;
  border: 2px solid #1C2B4A;
  background: #FFE066;
  color: #1C2B4A;
  font-family: monospace;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

#debug-panel {
  position: fixed;
  left: 14px;
  bottom: 44px;
  z-index: 145;
  width: 300px;
  padding: 12px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 3px solid #1C2B4A;
  box-shadow: 0 10px 24px rgba(20, 32, 58, 0.35);
  font-size: 12px;
}

#debug-panel h4 {
  margin: 0 0 8px;
  font-family: var(--font-accent);
  font-size: 14px;
}

.debug-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.debug-btn-grid button {
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid #1C2B4A;
  background: #EBF8FC;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
}

/* ==================== RESPONSIVE < 900PX FALLBACK ==================== */
@media (max-width: 960px) {
  .upgrades-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .launchpad-dock {
    width: calc(100vw - 180px);
  }
  .dock-btn {
    width: 102px;
    height: 44px;
    font-size: 12px;
  }
  .era-vertical-track {
    height: 140px;
  }
  .steer-hint-chip {
    display: none;
  }
}

@media (max-width: 720px) {
  .top-hud {
    flex-wrap: wrap;
    left: 10px;
    right: 10px;
  }
  .left-rail {
    left: 8px;
    top: 118px;
    transform: scale(0.85);
    transform-origin: top left;
  }
  .right-dock {
    right: 8px;
    top: 118px;
    transform: scale(0.85);
    transform-origin: top right;
  }
  .launchpad-dock {
    width: calc(100vw - 24px);
  }
  .title-hero-showcase {
    flex-direction: column;
    text-align: center;
  }
}
