:root {
  --sky: #e8d7a8;
  --ui-blue: #3d7bd6;
  --ui-blue-dark: #2a5fad;
  --ui-panel: #3a6fbf;
  --gold: #f2c94c;
  --gem: #e56ad8;
  --road: #8b9199;
  --text: #1e2a3a;
  --white: #fff;
  --game-w: 854px;
  --game-h: 480px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1219;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

/* ── Portrait restriction (mobile only) ── */
#rotatePrompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #141c28 0%, #0a0f16 100%);
  color: #fff;
  text-align: center;
}

.rotate-panel {
  max-width: 320px;
}

.rotate-icon {
  display: block;
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: rotateHint 2s ease-in-out infinite;
}

.rotate-km {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.rotate-en {
  font-size: 0.95rem;
  opacity: 0.75;
  line-height: 1.4;
}

@keyframes rotateHint {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(90deg);
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  #rotatePrompt {
    display: flex;
  }

  #game-container {
    visibility: hidden;
    pointer-events: none;
  }
}

/* ── Desktop: centered 16:9 box ── */
body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  min-height: 100dvh;
  padding: 12px;
}

#game-container {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(var(--game-w), calc(100vw - 24px), calc((100vh - 24px) * 16 / 9));
  height: min(var(--game-h), calc(100vh - 24px), calc((100vw - 24px) * 9 / 16));
  aspect-ratio: 16 / 9;
  max-width: var(--game-w);
  max-height: var(--game-h);
  font-size: clamp(0.75rem, 1.35vw, 0.9375rem);
  background: var(--sky);
  overflow: hidden;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ── Mobile landscape: full-screen ── */
@media (max-width: 900px) and (orientation: landscape) {
  body {
    display: block;
    padding: 0;
  }

  #game-container {
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    aspect-ratio: unset;
    border-radius: 0;
    box-shadow: none;
    font-size: clamp(0.6875rem, 2.1vh, 0.875rem);
  }
}

/* ── Game stage (canvas area) ── */
#gameStage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

canvas {
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  touch-action: none;
}

#gameStage.stage-hit {
  animation: stageHitFlash 0.32s ease-out;
}

@keyframes stageHitFlash {
  0% {
    box-shadow: inset 0 0 0 0 rgba(255, 40, 40, 0);
  }
  25% {
    box-shadow:
      inset 0 0 0 0.3125rem rgba(255, 60, 60, 0.95),
      inset 0 0 2.5rem rgba(255, 0, 0, 0.35);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(255, 40, 40, 0);
  }
}

/* ── Top HUD ── */
#topHud {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  pointer-events: none;
  flex-shrink: 0;
}

#topHud > * {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

#pauseBtn {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.625rem;
  background: rgba(255, 255, 255, 0.85);
  color: #5a6575;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0.125rem 0 rgba(0, 0, 0, 0.12);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.audio-toggle {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.625rem;
  background: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0.125rem 0 rgba(0, 0, 0, 0.12);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.audio-toggle.muted {
  opacity: 0.82;
}

.stage-badge {
  flex-shrink: 0;
  min-width: 2.75rem;
  height: 2.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.625rem;
  background: rgba(255, 255, 255, 0.95);
  color: #1e3a5f;
  font: inherit;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  box-shadow: 0 0.125rem 0 rgba(0, 0, 0, 0.12);
  border: 2px solid #4aa3ff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.stage-badge-label {
  font-size: 0.375rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #2f7fd4;
}

.stage-badge-num {
  font-size: 0.8125rem;
  font-weight: 900;
  color: #1e3a5f;
}

.stage-badge:active {
  transform: scale(0.96);
}

.progress-wrap {
  flex: 1;
  min-width: 0;
  padding: 0 0.25rem;
}

.objective {
  margin-top: 0.25rem;
  font-size: clamp(0.625rem, 2.2vw, 0.75rem);
  font-weight: 800;
  color: #3d2a1c;
  text-align: center;
  text-shadow: 0 0.0625rem 0 rgba(255, 255, 255, 0.5);
  transition: color 0.2s ease;
}

.objective.state-journey {
  color: #1e8449;
}
.objective.state-advancing {
  color: #1e8449;
}
.objective.state-fighting {
  color: #d35400;
}
.objective.state-duel {
  color: #c0392b;
  animation: obj-pulse 0.9s ease-in-out infinite;
}
.objective.state-swarm {
  color: #e74c3c;
  animation: obj-pulse 0.55s ease-in-out infinite;
}
.objective.state-cleared {
  color: #2471a3;
}
.objective.state-wait {
  color: #f39c12;
  animation: obj-pulse 1.2s ease-in-out infinite;
}

@keyframes obj-pulse {
  50% {
    opacity: 0.72;
  }
}

.progress-track {
  position: relative;
  height: 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4aa3ff, #2f78e0);
  transition: width 0.1s linear;
}

.progress-track .node,
.progress-track .chest {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.875rem;
  line-height: 1;
}

.progress-track .node {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #6aa0e0;
}

.progress-track .n1 {
  left: 28%;
}
.progress-track .n2 {
  left: 52%;
}
.progress-track .c1 {
  left: 88%;
}

.currency {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.25rem 0.625rem 0.25rem 0.375rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0.125rem 0 rgba(0, 0, 0, 0.1);
  font-weight: 800;
  font-size: 0.8125rem;
  color: var(--text);
}

.pill i {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}

.pill.gold {
  transition: transform 0.12s ease-out;
}

.pill.gold.coin-pop {
  transform: scale(1.2);
}

.pill.gold i {
  background: radial-gradient(circle at 35% 30%, #ffe98a, #e6b422 60%, #b8860b);
  border: 1px solid #a67c00;
}

.pill.gem i {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 3px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #f3a0ef, #c84ec4);
  border: 1px solid #9a3a98;
}

/* ── HP float (above soldier head) ── */
.hp-float {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -100%);
}

#gameStage .hp-float {
  position: absolute;
}

.hp-hbar {
  width: 2.75rem;
  height: 0.375rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
}

.hp-hbar > div {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e67e22, #ffb347);
  transform-origin: left center;
  transform: scaleX(1);
  transition: background 0.15s, transform 0.12s ease-out;
}

.hp-float.hp-hit .hp-hbar {
  animation: hpBarPulse 0.35s ease-out;
  border-color: #ff4444;
}

.hp-float.hp-hit .hp-hbar > div {
  background: linear-gradient(90deg, #c0392b, #ff6b6b);
}

@keyframes hpBarPulse {
  0%,
  100% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.18);
  }
}

.engage-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 30, 0.42);
  cursor: pointer;
  touch-action: manipulation;
}

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

.engage-panel {
  text-align: center;
  color: #fff;
  padding: 1.25rem 1.75rem;
  border-radius: 1.125rem;
  background: rgba(20, 32, 48, 0.82);
  border: 2px solid rgba(255, 220, 120, 0.55);
  box-shadow: 0 0.75rem 2.25rem rgba(0, 0, 0, 0.45);
  animation: engagePulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

.engage-icon {
  font-size: 2.625rem;
  margin-bottom: 0.375rem;
}

.engage-panel h2 {
  font-size: clamp(1.375rem, 5.5vw, 1.875rem);
  margin-bottom: 0.375rem;
  text-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.5);
}

.engage-sub {
  font-size: 0.875rem;
  opacity: 0.85;
  margin-bottom: 0.625rem;
}

.engage-hint {
  font-size: 0.75rem;
  opacity: 0.7;
}

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

/* ── Bottom bar ── */
#bottomBar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem calc(0.625rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #4a88d8, var(--ui-panel));
  border-top: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.energy-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 4.5rem;
}

.energy-plus {
  appearance: none;
  border: none;
  border-radius: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: #5a9aef;
  color: #fff;
  font-weight: 800;
  font-size: 0.8125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  box-shadow: 0 0.1875rem 0 #2f5fad;
}

.energy-plus:active {
  transform: translateY(0.125rem);
  box-shadow: 0 0.0625rem 0 #2f5fad;
}

.energy-plus:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.energy-meter {
  position: relative;
  height: 1.125rem;
  border-radius: 0.375rem;
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.energy-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffe566, #f5c518);
}

.energy-meter span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.45);
}

.skills {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

.skill {
  appearance: none;
  border: none;
  width: 4rem;
  height: 4rem;
  border-radius: 0.875rem;
  background: #5a9aef;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0.25rem 0 #2f5fad;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  position: relative;
  flex-shrink: 0;
}

.skill.tier {
  background: #6aa86a;
  box-shadow: 0 0.25rem 0 #3f6f3f;
}

.skill:active:not(:disabled) {
  transform: translateY(0.125rem);
  box-shadow: 0 0.125rem 0 #2f5fad;
}

.skill.tier:active:not(:disabled) {
  box-shadow: 0 0.125rem 0 #3f6f3f;
}

.skill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.skill .icon {
  font-size: 1.375rem;
  line-height: 1;
}

.skill .cost {
  font-size: 0.6875rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 0.0625rem 0.375rem;
}

.skill .charges {
  position: absolute;
  top: 0.3125rem;
  right: 0.3125rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.125rem;
  text-align: center;
}

.skill.recharging .charges {
  background: rgba(0, 0, 0, 0.6);
  color: #ffe566;
  font-size: 0.625rem;
}

.skill.empty {
  opacity: 0.5;
}

.skill:not(:disabled):active .charges {
  transform: scale(0.92);
}

/* Mobile landscape: slightly larger tap targets */
@media (max-width: 900px) and (orientation: landscape) {
  #topHud {
    padding: 0.5rem 0.625rem;
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
  }

  #bottomBar {
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  .skill {
    width: clamp(3.25rem, 11vh, 4rem);
    height: clamp(3.25rem, 11vh, 4rem);
  }

  #pauseBtn {
    width: clamp(2rem, 7vh, 2.25rem);
    height: clamp(2rem, 7vh, 2.25rem);
  }
}

/* ── Overlays ── */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 28, 40, 0.65);
  padding: 1rem;
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(21.25rem, 100%);
  background: #fff8e8;
  border-radius: 1.125rem;
  padding: 1.625rem 1.25rem;
  text-align: center;
  color: var(--text);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.3);
  border: 3px solid #e0c98a;
}

.panel h1 {
  font-size: clamp(1.5rem, 6vw, 1.875rem);
  margin-bottom: 0.5rem;
}

.panel p {
  font-size: 1.0625rem;
  font-weight: 700;
}

.panel .sub {
  opacity: 0.7;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.panel button {
  appearance: none;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: var(--ui-blue);
  cursor: pointer;
  box-shadow: 0 0.25rem 0 var(--ui-blue-dark);
}

.panel button:active {
  transform: translateY(0.125rem);
  box-shadow: 0 0.125rem 0 var(--ui-blue-dark);
}

.panel .btn-secondary {
  margin-top: 0.625rem;
  background: #6a7a8a;
  box-shadow: 0 0.25rem 0 #4a5560;
}

.panel .btn-secondary:active {
  box-shadow: 0 0.125rem 0 #4a5560;
}

.panel .btn-gem {
  display: block;
  width: 100%;
  margin-bottom: 0.625rem;
  background: linear-gradient(180deg, #c084fc 0%, #9333ea 100%);
  box-shadow: 0 0.25rem 0 #6b21a8;
}

.panel .btn-gem:active {
  box-shadow: 0 0.125rem 0 #6b21a8;
}

.panel .btn-gem:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.gift-banner {
  font-size: 1.125rem !important;
  color: #c0392b;
  margin-bottom: 0.25rem;
}

.gift-loot {
  color: #b8860b !important;
  font-size: 0.9375rem !important;
  margin-bottom: 0.75rem;
}

.skill.tier.maxed .cost b {
  font-size: 0.625rem;
}

.panel .btn-shop {
  display: block;
  width: 100%;
  margin-top: 0.625rem;
  background: linear-gradient(180deg, #f0c14b 0%, #d4a017 100%);
  color: #3d2a1c;
  box-shadow: 0 0.25rem 0 #9a7b12;
}

.panel .btn-shop:active {
  box-shadow: 0 0.125rem 0 #9a7b12;
}

.shop-panel {
  width: min(22rem, 100%);
}

.shop-gold {
  margin-bottom: 0.75rem !important;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.shop-item {
  display: flex !important;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  margin: 0 !important;
  padding: 0.625rem 0.75rem !important;
  text-align: left !important;
  background: #fff !important;
  color: var(--text) !important;
  border: 2px solid #e0c98a !important;
  box-shadow: 0 0.125rem 0 #c9b06a !important;
  border-radius: 0.75rem !important;
}

.shop-item:active:not(:disabled) {
  transform: translateY(0.0625rem);
  box-shadow: 0 0.0625rem 0 #c9b06a !important;
}

.shop-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-ico {
  font-size: 1.375rem;
  width: 1.75rem;
  text-align: center;
}

.shop-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.shop-info b {
  font-size: 0.9375rem;
}

.shop-info small {
  font-size: 0.6875rem;
  color: #6a7580;
  font-weight: 700;
}

.shop-price {
  font-size: 0.875rem;
  font-weight: 900;
  color: #b8860b;
  white-space: nowrap;
}

.shop-hint {
  font-size: 0.6875rem !important;
  opacity: 0.65;
  margin-bottom: 0.5rem !important;
}

/* ── Home screen (live game preview) ── */
.home-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: #1a2332;
}

.home-screen.hidden {
  display: none;
}

.home-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  pointer-events: none;
}

.home-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(20, 28, 40, 0.55) 0%, transparent 18%),
    linear-gradient(0deg, rgba(15, 22, 32, 0.72) 0%, transparent 28%);
}

.home-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.home-ui > * {
  pointer-events: auto;
}

.home-hud {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  position: relative;
  z-index: 5;
  background: linear-gradient(
    180deg,
    rgba(20, 28, 40, 0.72) 0%,
    rgba(20, 28, 40, 0.28) 75%,
    transparent 100%
  );
}

.home-hud .currency {
  margin-left: 0;
}

.home-hud-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

.home-stage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(15.5rem, 58vw);
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border: 2px solid #4aa3ff;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: left;
  font: inherit;
  pointer-events: auto;
  position: relative;
  z-index: 6;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.home-stage:active {
  transform: scale(0.98);
}

.home-stage-badge {
  flex-shrink: 0;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.25rem;
  border-radius: 0.5rem;
  background: linear-gradient(180deg, #5eb0ff 0%, #2f7fd4 100%);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.35);
}

.home-stage-info {
  min-width: 0;
  flex: 1;
}

.home-stage-label {
  display: block;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #2f7fd4;
  line-height: 1.1;
}

.home-stage-info b,
.home-stage b {
  display: block;
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-stage-info small,
.home-stage small {
  display: block;
  color: #6a7580;
  font-size: 0.5rem;
  margin-top: 0.1rem;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.home-stage-chevron {
  flex-shrink: 0;
  color: #2f7fd4;
  font-size: 0.875rem;
  font-weight: 900;
  line-height: 1;
}

.stage-select-overlay {
  z-index: 60;
  pointer-events: auto;
}

.stage-select-panel {
  max-width: min(22rem, 92vw);
  pointer-events: auto;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4375rem;
  margin: 0.75rem 0 1rem;
}

.stage-pick {
  position: relative;
  aspect-ratio: 1;
  min-height: 2.75rem;
  border: 2px solid #3d5a80;
  border-radius: 0.625rem;
  background: linear-gradient(180deg, #2a3f5c 0%, #1a2a40 100%);
  color: #fff8e8;
  font-size: 0.9375rem;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.stage-pick small {
  position: absolute;
  bottom: 0.2rem;
  left: 0;
  right: 0;
  font-size: 0.375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 248, 232, 0.7);
  text-align: center;
  line-height: 1;
  padding: 0 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-pick.selected {
  border-color: #5fdc3a;
  box-shadow: 0 0 0 2px rgba(95, 220, 58, 0.45);
  background: linear-gradient(180deg, #3a6a3a 0%, #245024 100%);
}

.stage-pick.locked {
  opacity: 0.45;
  cursor: not-allowed;
  background: #222830;
  border-color: #444;
  color: #889;
}

.stage-pick.locked::after {
  content: "🔒";
  position: absolute;
  top: 0.15rem;
  right: 0.2rem;
  font-size: 0.5rem;
}

.home-title-block {
  padding: 0.375rem 1rem 0;
  text-align: center;
  pointer-events: none;
  position: relative;
  z-index: 1;
  text-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.65);
}

.home-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #ffd96c;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 0.375rem;
}

.home-title {
  font-size: clamp(1.125rem, 4.8vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fff8e8;
  line-height: 1.15;
}

.home-tagline {
  margin-top: 0.25rem;
  font-size: clamp(0.625rem, 2vw, 0.75rem);
  font-weight: 700;
  color: rgba(255, 248, 232, 0.82);
}

.home-cta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4375rem;
  padding: 1.5rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.home-play {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: min(11rem, 52vw);
  height: 3.125rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 0.875rem;
  background: linear-gradient(180deg, #a8ff62 0%, #5fdc3a 48%, #45bf28 100%);
  box-shadow:
    0 0.375rem 0 #2a8a18,
    0 0 1.25rem rgba(120, 255, 80, 0.45),
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.45);
  color: #15340e;
  font-size: 1.3125rem;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 0.08em;
  animation: homePlayPulse 2s ease-in-out infinite;
}

.home-play-icon {
  font-size: 0.875rem;
}

.home-play:active {
  transform: translateY(0.125rem) scale(0.98);
  box-shadow: 0 0.125rem 0 #2a8a18;
}

@keyframes homePlayPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0.375rem 0 #2a8a18,
      0 0 1.25rem rgba(120, 255, 80, 0.4),
      inset 0 0.0625rem 0 rgba(255, 255, 255, 0.45);
  }
  50% {
    transform: scale(1.045);
    box-shadow:
      0 0.375rem 0 #2a8a18,
      0 0 1.75rem rgba(120, 255, 80, 0.65),
      inset 0 0.0625rem 0 rgba(255, 255, 255, 0.45);
  }
}

.home-tip {
  pointer-events: none;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.6);
}

@media (max-width: 900px) and (orientation: landscape) {
  .home-hud {
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
  }

  .home-cta {
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  .home-play {
    height: 2.75rem;
    font-size: 1.125rem;
  }

  .home-title {
    font-size: clamp(0.9375rem, 3.8vh, 1.375rem);
  }
}
