/* ============================================================================
   ChcknR0ad — Official InOut Games Dungeon-Asphalt & Colored Manhole Style
   Strictly 100% Crisp Unfiltered bg.jpg (Zero full-screen scrim)
   ============================================================================ */

:root {
  --asphalt-deep: #161922;
  --asphalt-card: #1E222D;
  --asphalt-elevated: #262C3A;
  --asphalt-border: #363F54;
  --manhole-emerald: #22C55E;
  --manhole-cyan: #06B6D4;
  --manhole-purple: #A855F7;
  --manhole-gold: #FFB800;
  --flame-orange: #FF5722;
  --flame-red: #EF4444;
  --arcade-green: #16A34A;
  --arcade-green-dark: #116932;
  --arcade-amber: #F59E0B;
  --arcade-amber-dark: #B45309;
  --arcade-gold: #FFD700;
  --text-white: #FFFFFF;
  --text-light: #E2E8F0;
  --text-muted: #94A3B8;
  --font-main: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--text-white);
  /* scroll (not fixed) — fixed backgrounds break touch scroll in mobile WebViews */
  background: url('bg.jpg') center/cover no-repeat scroll;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

button, input, select, textarea {
  font-family: var(--font-main);
}

.hidden {
  display: none !important;
}

/* ============================================================================
   TOAST NOTIFICATION BANNER
   ============================================================================ */
.toast-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--asphalt-deep);
  color: var(--arcade-gold);
  border: 2px solid var(--manhole-gold);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.75);
  text-align: center;
  max-width: 92vw;
  pointer-events: none;
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* ============================================================================
   SCREEN SWITCHING ARCHITECTURE (STRICT PORTRAIT PHONE SHELL)
   ============================================================================ */
.app-screen {
  display: none;
  width: 100%;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 12px 10px 20px;
}

.app-screen.active {
  display: flex;
  flex-direction: column;
}

/* Hub & welcome: fixed viewport scrollport (flex min-height was blocking scroll) */
#screen-welcome,
#screen-home {
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* ============================================================================
   SCREEN 1: WELCOME SCREEN (#screen-welcome)
   ============================================================================ */
#screen-welcome {
  justify-content: flex-start;
  align-items: center;
}

.welcome-card {
  width: 100%;
  margin: auto 0;
  background: var(--asphalt-deep);
  border: 3px solid var(--manhole-gold);
  border-radius: 24px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.85);
}

.welcome-badge-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.asphalt-pill {
  background: var(--asphalt-elevated);
  border: 1.5px solid var(--manhole-cyan);
  color: var(--manhole-cyan);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.flame-pill {
  background: var(--flame-orange);
  color: var(--text-white);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.welcome-logo-frame {
  position: relative;
  width: 126px;
  height: 126px;
  margin: 0 auto 14px;
  border-radius: 24px;
  border: 3px solid var(--manhole-emerald);
  background: var(--asphalt-card);
  padding: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
}

.welcome-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.golden-egg-orbit {
  position: absolute;
  bottom: -10px;
  right: -10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--asphalt-deep);
  border: 2.5px solid var(--arcade-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.75);
}

.brand-title {
  font-size: 2.3rem;
  font-weight: 700;
  color: var(--arcade-gold);
  text-shadow: 0 3px 0 #92400E, 0 5px 12px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.brand-subtitle {
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--text-light);
  margin-bottom: 16px;
}

.welcome-feature-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.feature-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8rem;
  font-weight: 600;
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-emerald { background: var(--manhole-emerald); }
.dot-flame { background: var(--flame-orange); }
.dot-gold { background: var(--manhole-gold); }

/* ============================================================================
   CHUNKY 3D ARCADE BUTTONS
   ============================================================================ */
.btn-arcade {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-white);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-arcade:active:not(:disabled) {
  transform: translateY(3px);
}

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

.btn-green-3d {
  background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%);
  border: 2px solid #86EFAC;
  box-shadow: 0 5px 0 var(--arcade-green-dark), 0 8px 16px rgba(0, 0, 0, 0.6);
}

.btn-gold-3d {
  background: linear-gradient(180deg, #FBBF24 0%, #F59E0B 100%);
  border: 2px solid #FDE68A;
  color: #161922;
  box-shadow: 0 5px 0 var(--arcade-amber-dark), 0 8px 16px rgba(0, 0, 0, 0.6);
}

.btn-cyan-3d {
  background: linear-gradient(180deg, #22D3EE 0%, #0891B2 100%);
  border: 2px solid #A5F3FC;
  box-shadow: 0 5px 0 #155E75, 0 8px 16px rgba(0, 0, 0, 0.6);
}

.btn-xl {
  font-size: 1.15rem;
  padding: 15px 18px;
}

.btn-sub {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.92;
  margin-top: 2px;
  letter-spacing: 0.4px;
}

/* ============================================================================
   SCREEN 2: BENTO-GRID COMMAND HUB (#screen-home)
   ============================================================================ */
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--asphalt-deep);
  border: 2px solid var(--asphalt-border);
  border-radius: 18px;
  padding: 9px 11px;
  margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.75);
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.hub-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--manhole-gold);
  object-fit: cover;
}

.hub-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--arcade-gold);
  line-height: 1.1;
}

.hub-caption {
  font-size: 0.72rem;
  color: var(--manhole-emerald);
  font-weight: 600;
}

.hub-currencies {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.82rem;
  font-weight: 700;
}

.egg-pill { border-color: var(--manhole-gold); color: var(--arcade-gold); }
.feather-pill { border-color: var(--manhole-cyan); color: var(--manhole-cyan); }
.record-pill { border-color: var(--flame-orange); color: #FF8A65; }

.icon-btn-3d {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--asphalt-elevated);
  border: 2px solid var(--asphalt-border);
  color: var(--text-white);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #0B0D13;
  flex-shrink: 0;
}

.icon-btn-3d:active {
  transform: translateY(2px);
}

/* Asymmetric Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.bento-card {
  background: var(--asphalt-deep);
  border: 2.5px solid var(--asphalt-border);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-wide {
  grid-column: span 2;
}

.bento-half {
  grid-column: span 1;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.bento-half:hover {
  border-color: var(--manhole-gold);
}

.hero-launch-card {
  border-color: var(--manhole-emerald);
  background: linear-gradient(180deg, #1A212D 0%, #161922 100%);
}

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

.tag-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: var(--manhole-cyan);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stage-headline {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-white);
}

.stage-target-badge {
  background: var(--asphalt-card);
  border: 2px solid var(--manhole-gold);
  border-radius: 12px;
  padding: 5px 10px;
  text-align: right;
  flex-shrink: 0;
}

.stage-target-badge span {
  display: block;
  font-size: 0.63rem;
  color: var(--text-muted);
  font-weight: 700;
}

.stage-target-badge strong {
  font-size: 0.92rem;
  color: var(--arcade-gold);
}

.stage-desc {
  font-size: 0.84rem;
  color: var(--text-light);
  line-height: 1.38;
  margin-bottom: 12px;
}

/* 4 Difficulty Lanes Selector */
.lane-selector-block {
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
}

.lane-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.lane-summary-badge {
  color: var(--arcade-gold);
}

.lane-buttons-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.lane-btn {
  background: var(--asphalt-deep);
  border: 2px solid var(--asphalt-border);
  border-radius: 10px;
  padding: 7px 4px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.lane-btn.active[data-lane="EASY"] {
  border-color: var(--manhole-emerald);
  background: #132A20;
  color: #4ADE80;
}

.lane-btn.active[data-lane="MEDIUM"] {
  border-color: var(--manhole-cyan);
  background: #102630;
  color: #38BDF8;
}

.lane-btn.active[data-lane="HARD"] {
  border-color: var(--manhole-purple);
  background: #231636;
  color: #C084FC;
}

.lane-btn.active[data-lane="DAREDEVIL"] {
  border-color: var(--flame-orange);
  background: #311512;
  color: #FF7043;
}

.lane-name {
  font-size: 0.72rem;
  font-weight: 700;
}

.lane-mult {
  font-size: 0.64rem;
  opacity: 0.9;
}

/* Launch Controls Row */
.launch-controls-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.pouch-stepper {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 14px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 118px;
}

.pouch-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.pouch-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-step-btn {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.5px solid var(--asphalt-border);
  background: var(--asphalt-elevated);
  color: var(--text-white);
  font-weight: 700;
  cursor: pointer;
}

.pouch-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--arcade-gold);
}

.btn-launch {
  flex: 1;
  font-size: 1rem;
}

/* Bento Half Cards */
.card-badge-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 8px;
  background: var(--asphalt-card);
}

.emerald-glow { border: 2px solid var(--manhole-emerald); }
.gold-glow { border: 2px solid var(--manhole-gold); }

.bento-card h3 {
  font-size: 1.02rem;
  margin-bottom: 4px;
}

.bento-meta {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.mini-manhole-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.mh-dot {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 4px;
  border-radius: 999px;
  background: var(--asphalt-card);
  border: 1.5px solid;
}

.mh-emerald { border-color: var(--manhole-emerald); color: var(--manhole-emerald); }
.mh-cyan { border-color: var(--manhole-cyan); color: var(--manhole-cyan); }
.mh-purple { border-color: var(--manhole-purple); color: var(--manhole-purple); }
.mh-gold { border-color: var(--manhole-gold); color: var(--manhole-gold); }

.perk-status-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.perk-tag {
  flex: 1;
  text-align: center;
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 8px;
  padding: 4px 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-light);
}

.btn-card-action {
  width: 100%;
  background: var(--asphalt-elevated);
  border: 1.5px solid var(--asphalt-border);
  color: var(--arcade-gold);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-card-action:active {
  transform: translateY(1px);
}

.trophy-counter-pill {
  background: var(--asphalt-card);
  border: 1.5px solid var(--manhole-gold);
  color: var(--arcade-gold);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.recent-runs-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
}

.run-log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.run-log-empty {
  background: var(--asphalt-card);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.bento-footer-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
}

.btn-daily-bonus {
  border-color: var(--manhole-emerald);
  color: #4ADE80;
}

/* ============================================================================
   SCREEN 3: SEPARATE FULLSCREEN GAMEPLAY SCREEN (#screen-game)
   ============================================================================ */
#screen-game {
  height: 100dvh;
  max-height: 100dvh;
  padding: 8px 8px 10px;
  justify-content: space-between;
  overflow: hidden;
}

.game-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--asphalt-deep);
  border: 2px solid var(--asphalt-border);
  border-radius: 16px;
  padding: 7px 9px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75);
}

.hud-stat-group {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.hud-stat-box {
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 10px;
  padding: 4px 8px;
  text-align: center;
  min-width: 74px;
}

.mult-box { border-color: var(--manhole-gold); }
.payout-box { border-color: var(--manhole-emerald); }

.hud-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
}

.hud-val {
  font-size: 0.88rem;
  font-weight: 700;
}

.gold-text { color: var(--arcade-gold); }
.emerald-text { color: #4ADE80; }
.cyan-text { color: var(--manhole-cyan); }

.hud-badges-right {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hud-mini-pill {
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

/* Stage Progress Bar */
.stage-goal-bar-wrap {
  background: var(--asphalt-deep);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 12px;
  padding: 5px 10px;
  margin: 6px 0;
}

.stage-goal-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.lane-tag-inline {
  color: var(--arcade-gold);
}

.stage-goal-track {
  width: 100%;
  height: 7px;
  background: var(--asphalt-card);
  border-radius: 999px;
  overflow: hidden;
}

.stage-goal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--manhole-emerald), var(--manhole-gold));
  transition: width 0.25s ease;
}

/* Interactive Highway Canvas Arena */
.canvas-arena-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 200px;
  border-radius: 16px;
  border: 2.5px solid var(--asphalt-border);
  background: var(--asphalt-deep);
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.82);
}

#highway-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

.canvas-float-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #161922;
  border: 1.5px solid var(--manhole-gold);
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

/* Bottom Arcade Control Deck */
.game-controls-deck {
  background: var(--asphalt-deep);
  border: 2px solid var(--asphalt-border);
  border-radius: 18px;
  padding: 8px;
  margin-top: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.8);
}

.manhole-lane-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.col-pick-btn {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 10px;
  padding: 6px 4px;
  color: var(--text-light);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.col-pick-btn .col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.col-pick-btn.active {
  border-color: var(--manhole-gold);
  background: #272217;
  color: var(--arcade-gold);
}

.col-pick-btn.active .col-dot {
  background: var(--arcade-gold);
}

.primary-arcade-btns {
  display: grid;
  grid-template-columns: 0.9fr 1.05fr 1.25fr;
  gap: 7px;
}

.btn-main-txt {
  font-size: 0.86rem;
  font-weight: 700;
}

/* ============================================================================
   MODALS & PANELS (ZERO BLUR, SOLID HIGH-CONTRAST ASPHALT CARDS)
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(12, 14, 20, 0.72);
}

.modal-panel {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  background: var(--asphalt-deep);
  border: 3px solid var(--manhole-gold);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.92);
}

.modal-compact {
  max-width: 410px;
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--asphalt-card);
  border-bottom: 2px solid var(--asphalt-border);
}

.modal-header h2 {
  font-size: 1.15rem;
  color: var(--text-white);
}

.btn-close-modal {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--asphalt-border);
  background: var(--asphalt-elevated);
  color: var(--text-white);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px 0;
  background: var(--asphalt-deep);
}

.modal-tab {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 12px;
  padding: 8px;
  color: var(--text-light);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-tab.active {
  border-color: var(--manhole-gold);
  color: var(--arcade-gold);
  background: #272217;
}

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

/* 30 Stages Grid */
.stages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.stage-item-card {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
}

.stage-item-card.active-stage {
  border-color: var(--manhole-emerald);
}

.stage-item-card.locked-stage {
  opacity: 0.6;
}

.stage-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 700;
}

.stage-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--arcade-gold);
}

.stage-item-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Upgrades & Heroes Stack */
.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.list-card {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 14px;
  padding: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-card.unlocked {
  border-color: var(--manhole-emerald);
}

.list-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--asphalt-deep);
  border: 2px solid var(--asphalt-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.list-card-info {
  flex: 1;
}

.list-card-info h4 {
  font-size: 0.92rem;
  color: var(--text-white);
  margin-bottom: 2px;
}

.list-card-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-buy-small {
  background: var(--arcade-green);
  border: 2px solid #86EFAC;
  color: var(--text-white);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-buy-small.selected {
  background: var(--manhole-gold);
  border-color: #FDE68A;
  color: #161922;
}

/* Stats & Achievements */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-tile {
  background: var(--asphalt-card);
  border: 1.5px solid var(--asphalt-border);
  border-radius: 12px;
  padding: 9px;
  text-align: center;
}

.stat-tile span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-tile strong {
  font-size: 1.05rem;
  color: var(--arcade-gold);
}

.section-subtitle {
  font-size: 0.92rem;
  color: var(--manhole-cyan);
  margin: 10px 0 8px;
}

/* Outcome Modal */
.outcome-header {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--asphalt-card);
  border: 3px solid var(--manhole-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.outcome-title {
  text-align: center;
  font-size: 1.35rem;
  color: var(--arcade-gold);
  margin-bottom: 6px;
}

.outcome-desc {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 14px;
}

.outcome-stats-box {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.outcome-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--asphalt-border);
}

.outcome-row:last-child {
  border-bottom: none;
}

.outcome-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Settings, Support, Rate, Share & Legal */
.settings-card {
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.settings-card h3 {
  font-size: 0.95rem;
  color: var(--arcade-gold);
  margin-bottom: 8px;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--asphalt-border);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row strong {
  font-size: 0.86rem;
  display: block;
}

.toggle-row p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.toggle-pill {
  min-width: 58px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--asphalt-border);
  background: var(--asphalt-deep);
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.toggle-pill.on {
  background: var(--arcade-green);
  border-color: #86EFAC;
  color: var(--text-white);
}

.version-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--asphalt-deep);
  border: 1.5px solid var(--manhole-cyan);
  border-radius: 12px;
  padding: 9px 11px;
  margin-bottom: 10px;
}

.version-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.version-banner strong {
  font-size: 0.92rem;
  color: var(--arcade-gold);
}

.version-banner p {
  font-size: 0.72rem;
  color: var(--manhole-cyan);
}

.help-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-help-tile {
  background: var(--asphalt-deep);
  border: 2px solid var(--asphalt-border);
  border-radius: 12px;
  padding: 10px 8px;
  color: var(--text-white);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.btn-help-tile .tile-ic {
  font-size: 1.25rem;
}

.btn-help-tile strong {
  font-size: 0.82rem;
}

.btn-help-tile span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.danger-tile {
  border-color: #7F1D1D;
}

.settings-note {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.legal-btns-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Support Form & Rating */
.custom-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--manhole-cyan);
}

.form-input {
  width: 100%;
  background: var(--asphalt-card);
  border: 2px solid var(--asphalt-border);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--text-white);
  font-size: 0.85rem;
}

.form-textarea {
  resize: vertical;
}

.support-confirm-box {
  background: #132A20;
  border: 2px solid var(--manhole-emerald);
  color: #86EFAC;
  border-radius: 12px;
  padding: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 10px;
  text-align: center;
}

.center-text {
  text-align: center;
}

.modal-intro {
  font-size: 0.84rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.star-rating-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.star-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--asphalt-border);
  background: var(--asphalt-card);
  color: #475569;
  font-size: 1.5rem;
  cursor: pointer;
}

.star-btn.active {
  border-color: var(--manhole-gold);
  color: var(--arcade-gold);
  background: #272217;
}

.share-promo-card {
  background: var(--asphalt-card);
  border: 2px dashed var(--manhole-gold);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.share-code-badge {
  display: inline-block;
  background: var(--asphalt-deep);
  border: 2px solid var(--manhole-emerald);
  color: #4ADE80;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.legal-scroll h4 {
  color: var(--arcade-gold);
  font-size: 0.92rem;
  margin: 10px 0 4px;
}

.legal-scroll p {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.45;
  margin-bottom: 8px;
}

@media (max-width: 380px) {
  .brand-title { font-size: 1.95rem; }
  .lane-buttons-row { grid-template-columns: repeat(2, 1fr); }
  .primary-arcade-btns { grid-template-columns: 1fr 1fr 1.2fr; }
}

/* ==========================================================================
   MOBILE VIEWPORT, SAFE-AREA & TOUCH ERGONOMICS OPTIMIZATION
   ========================================================================== */
html, body {
  min-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-y pinch-zoom;
}

canvas {
  touch-action: none;
  display: block;
}

input, select, textarea {
  font-size: 16px !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.screen, .app-screen, .app-shell, #app-root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 390px) {
  body {
    font-size: 13.5px;
  }
}

@media (max-height: 700px) {
  .welcome-logo, .welcome-logo-frame, .crest-ring, .logo-spotlight-frame {
    transform: scale(0.88);
  }
}

@media (min-width: 768px) and (hover: hover) {
  html, body {
    background-attachment: fixed;
  }
}
