:root {
  --bg-deep: #050c17;
  --bg-slate: #0b192c;
  --bg-panel: rgba(12, 27, 48, 0.86);
  --bg-card: rgba(16, 36, 64, 0.9);
  --border-blueprint: rgba(56, 212, 255, 0.28);
  --border-strong: rgba(56, 248, 255, 0.58);
  --cyan: #38f8ff;
  --cyan-soft: #6ce8ff;
  --gold: #ffd447;
  --gold-warm: #ffab2e;
  --danger: #ff4b66;
  --emerald: #38f2a4;
  --text-main: #ecf7ff;
  --text-sub: #8db3d6;
  --text-dim: #5c7e9e;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 15%, #112744 0%, #050b14 68%, #02060c 100%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* 9:16 WeChat Mini Game Portrait Shell */
.wx-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: min(100dvh, 860px);
  background: linear-gradient(180deg, #071426 0%, #0a1b32 45%, #061020 100%);
  border: 1px solid rgba(72, 200, 255, 0.25);
  border-radius: 24px;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.72),
    0 0 40px rgba(32, 180, 255, 0.14),
    inset 0 1px 0 rgba(160, 232, 255, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 460px) {
  .wx-shell {
    max-width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
}

.wx-shell.boss-mode {
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.8),
    0 0 48px rgba(255, 195, 55, 0.28),
    inset 0 0 36px rgba(255, 180, 40, 0.12);
  border-color: rgba(255, 212, 71, 0.48);
}

.wx-shell.shake {
  animation: shellShake 0.36s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shellShake {
  10%, 90% { transform: translate3d(-3px, 1px, 0); }
  20%, 80% { transform: translate3d(5px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 2px, 0); }
  40%, 60% { transform: translate3d(6px, -1px, 0); }
}

.storm-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.65;
}

.lightning-overlay,
.short-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.14s ease-out;
}

.lightning-overlay {
  background: radial-gradient(circle at 50% 10%, rgba(210, 245, 255, 0.55), rgba(90, 185, 255, 0.18) 55%, transparent 80%);
}

.lightning-overlay.flash {
  opacity: 1;
}

.short-overlay {
  background: radial-gradient(circle at 50% 50%, rgba(255, 50, 80, 0.12), rgba(255, 35, 65, 0.45) 95%);
}

.short-overlay.flash {
  opacity: 1;
}

/* WeChat Top Bar */
.wx-topbar {
  position: relative;
  z-index: 20;
  height: 48px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 16, 30, 0.88);
  border-bottom: 1px solid rgba(56, 212, 255, 0.2);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.wx-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(56, 212, 255, 0.12);
  border: 1px solid rgba(56, 212, 255, 0.3);
  color: var(--cyan-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}

.wx-back-btn:active {
  transform: scale(0.95);
  background: rgba(56, 212, 255, 0.24);
}

.wx-back-arrow {
  font-size: 13px;
  line-height: 1;
}

.wx-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #f0f9ff;
  text-shadow: 0 0 12px rgba(56, 248, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52%;
}

.wx-capsule {
  display: flex;
  align-items: center;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 34, 58, 0.9);
  border: 1px solid rgba(110, 210, 255, 0.3);
  padding: 0 4px;
}

.wx-cap-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 999px;
  padding: 0;
  touch-action: manipulation;
}

.wx-cap-btn:active {
  background: rgba(56, 248, 255, 0.2);
}

.wx-cap-divider {
  width: 1px;
  height: 14px;
  background: rgba(110, 210, 255, 0.28);
}

/* Screens */
.screen {
  position: relative;
  z-index: 5;
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 12px 14px 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  display: flex;
}

/* START SCREEN */
.screen-start {
  justify-content: space-between;
  gap: 10px;
}

.start-hero {
  text-align: center;
  padding: 10px 10px 8px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(16, 40, 72, 0.72) 0%, rgba(9, 22, 42, 0.92) 100%);
  border: 1px solid var(--border-blueprint);
  position: relative;
  overflow: hidden;
}

.start-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 248, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 248, 255, 0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}

.city-badge {
  position: relative;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 212, 71, 0.14);
  border: 1px solid rgba(255, 212, 71, 0.42);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.6px;
}

.start-logo-wrap {
  position: relative;
  margin-top: 8px;
}

.logo-bolt {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(255, 212, 71, 0.85));
  animation: boltPulse 2.2s ease-in-out infinite;
}

@keyframes boltPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(255, 212, 71, 0.75)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 22px rgba(56, 248, 255, 0.95)); }
}

.game-main-title {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff 0%, #6cf6ff 50%, #ffd447 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.game-sub-title {
  margin: 2px 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan-soft);
  letter-spacing: 3px;
}

/* Miniature Neon Skyline */
.skyline-banner {
  position: relative;
  height: 52px;
  margin-top: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

.sky-building {
  width: 34px;
  background: #0d223d;
  border: 1px solid rgba(72, 190, 255, 0.28);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 5px 5px 3px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  z-index: 2;
}

.sky-building.b1 { height: 28px; }
.sky-building.b2 { height: 42px; }
.sky-building.b3 { height: 50px; width: 42px; }
.sky-building.b4 { height: 38px; }
.sky-building.b5 { height: 26px; }

.sky-building span {
  display: block;
  height: 5px;
  border-radius: 1px;
  background: rgba(88, 130, 175, 0.28);
}

.sky-building.lit {
  border-color: rgba(255, 212, 71, 0.65);
  box-shadow: 0 0 14px rgba(255, 212, 71, 0.25);
}

.sky-building.lit span {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(255, 212, 71, 0.85);
}

.sky-wire {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--gold), var(--cyan), transparent);
  box-shadow: 0 0 10px var(--cyan);
}

/* Mode Selector */
.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-card {
  appearance: none;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1.5px solid rgba(76, 165, 230, 0.28);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.1s, box-shadow 0.16s;
  touch-action: manipulation;
}

.mode-card:active {
  transform: scale(0.985);
}

.mode-card.selected {
  background: linear-gradient(135deg, rgba(16, 55, 92, 0.94), rgba(14, 34, 62, 0.94));
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(56, 248, 255, 0.24), inset 0 0 0 1px rgba(56, 248, 255, 0.22);
}

.mode-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.mode-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(56, 248, 255, 0.18);
  color: var(--cyan);
  border: 1px solid rgba(56, 248, 255, 0.45);
}

.mode-tag.quick {
  background: rgba(255, 212, 71, 0.18);
  color: var(--gold);
  border-color: rgba(255, 212, 71, 0.48);
}

.mode-name {
  font-size: 15px;
  font-weight: 800;
}

.mode-desc {
  font-size: 12px;
  color: var(--text-sub);
}

/* Rules Panel */
.rules-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-blueprint);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.rules-header {
  font-size: 12px;
  font-weight: 800;
  color: var(--cyan-soft);
  margin-bottom: 5px;
}

.rules-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #cfe6fb;
}

.rules-text strong {
  color: #ffffff;
}

.legend-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(80, 180, 240, 0.22);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-sub);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-source { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.dot-live { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dot-puddle { background: #ff5670; box-shadow: 0 0 8px #ff5670; }

.start-best-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
  background: rgba(8, 20, 38, 0.78);
  border: 1px solid rgba(56, 212, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}

.start-best-bar strong {
  color: var(--gold);
}

/* Buttons */
.btn-primary {
  appearance: none;
  border: none;
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #041322;
  background: linear-gradient(135deg, #5ffbff 0%, #36d8ff 48%, #ffd447 100%);
  box-shadow: 0 8px 24px rgba(56, 248, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s, box-shadow 0.15s;
}

.btn-primary:active {
  transform: scale(0.975);
}

.btn-start-pulse {
  animation: ctaGlow 2.4s ease-in-out infinite;
}

@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 8px 22px rgba(56, 248, 255, 0.34); }
  50% { box-shadow: 0 8px 30px rgba(255, 212, 71, 0.52); }
}

.btn-secondary {
  appearance: none;
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan-soft);
  background: rgba(18, 44, 76, 0.9);
  border: 1px solid rgba(56, 212, 255, 0.42);
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-ghost {
  appearance: none;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  background: transparent;
  border: 1px solid rgba(110, 165, 210, 0.25);
  cursor: pointer;
  touch-action: manipulation;
}

/* GAMEPLAY SCREEN */
.screen-game {
  padding: 8px 12px 12px;
  gap: 8px;
  overflow: hidden;
}

.hud-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-blueprint);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 800;
  color: #eff8ff;
  background: rgba(56, 212, 255, 0.14);
  border: 1px solid rgba(56, 212, 255, 0.34);
  padding: 4px 9px;
  border-radius: 999px;
  max-width: 68%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-pill.boss {
  background: linear-gradient(90deg, rgba(255, 195, 45, 0.28), rgba(255, 95, 70, 0.28));
  border-color: rgba(255, 212, 71, 0.72);
  color: #fff3c4;
  box-shadow: 0 0 12px rgba(255, 200, 55, 0.32);
}

.stage-sep {
  opacity: 0.55;
}

.timer-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  background: rgba(5, 16, 30, 0.85);
  border: 1px solid rgba(56, 248, 255, 0.4);
  padding: 3px 10px;
  border-radius: 10px;
  text-shadow: 0 0 10px rgba(56, 248, 255, 0.45);
}

.timer-box.urgent {
  color: #ff6b81;
  border-color: rgba(255, 75, 102, 0.8);
  background: rgba(65, 10, 22, 0.85);
  animation: timerPulse 0.7s ease-in-out infinite;
}

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

.timer-icon {
  font-size: 13px;
}

.stat-mini {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
}

.stat-label {
  color: var(--text-sub);
}

.stat-mini strong {
  font-size: 15px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.targets-progress {
  display: flex;
  align-items: center;
  gap: 5px;
}

.target-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border-radius: 7px;
  background: rgba(14, 30, 52, 0.9);
  border: 1px solid rgba(90, 140, 185, 0.35);
  font-size: 14px;
  filter: grayscale(0.85) brightness(0.65);
  transition: transform 0.2s, filter 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.target-chip.lit {
  filter: none;
  border-color: var(--gold);
  background: rgba(255, 212, 71, 0.22);
  box-shadow: 0 0 12px rgba(255, 212, 71, 0.55);
  transform: scale(1.08);
}

.buff-strip {
  display: flex;
  align-items: center;
  gap: 4px;
}

.buff-badge {
  font-size: 10.5px;
  font-weight: 800;
  color: #061822;
  background: linear-gradient(90deg, #56f8ff, #ffd447);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Status Banner */
.status-banner {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(10, 26, 48, 0.85);
  border: 1px solid rgba(56, 212, 255, 0.24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan-soft);
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.status-banner.warning {
  background: rgba(82, 14, 28, 0.9);
  border-color: rgba(255, 75, 102, 0.78);
  color: #ffb8c3;
}

.status-banner.targeting {
  background: rgba(18, 52, 74, 0.94);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-cancel-tool {
  appearance: none;
  border: 1px solid rgba(255, 212, 71, 0.65);
  background: rgba(255, 212, 71, 0.16);
  color: var(--gold);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  cursor: pointer;
}

/* Board Stage */
.board-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.board-frame {
  position: relative;
  width: 100%;
  max-width: 396px;
  aspect-ratio: 1 / 1;
  max-height: 100%;
  border-radius: 16px;
  background: linear-gradient(160deg, #091a30 0%, #061223 100%);
  border: 1.5px solid rgba(56, 212, 255, 0.42);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(56, 248, 255, 0.14),
    inset 0 0 24px rgba(10, 32, 60, 0.85);
  overflow: hidden;
}

#boardCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}

.stage-clear-banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(circle, rgba(14, 48, 76, 0.84) 0%, rgba(5, 18, 34, 0.72) 100%);
  backdrop-filter: blur(3px);
  z-index: 6;
  animation: popIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.clear-badge {
  font-size: 23px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 212, 71, 0.85);
}

.clear-sub {
  font-size: 14px;
  font-weight: 700;
  color: #d8f8ff;
  background: rgba(56, 248, 255, 0.16);
  border: 1px solid rgba(56, 248, 255, 0.45);
  padding: 5px 14px;
  border-radius: 999px;
}

/* Bottom Active Tools Dock */
.tools-dock {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

.tool-btn {
  position: relative;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 8px 6px 7px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(16, 38, 66, 0.95), rgba(9, 23, 44, 0.96));
  border: 1.5px solid rgba(72, 185, 245, 0.36);
  color: var(--text-main);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, border-color 0.16s, box-shadow 0.16s, opacity 0.16s;
}

.tool-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.tool-btn.armed {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(58, 52, 22, 0.95), rgba(26, 28, 18, 0.96));
  box-shadow: 0 0 18px rgba(255, 212, 71, 0.42);
}

.tool-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  border-color: rgba(90, 120, 150, 0.25);
}

.tool-count {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--cyan);
  color: #031524;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:disabled .tool-count {
  background: #46607a;
  color: #c2d6ea;
}

.tool-icon {
  font-size: 20px;
  line-height: 1.15;
}

.tool-name {
  font-size: 12px;
  font-weight: 800;
}

.tool-hint {
  font-size: 10px;
  color: var(--text-sub);
}

/* MODALS */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(3, 10, 20, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 386px;
  background: linear-gradient(180deg, #0f2544 0%, #08172b 100%);
  border: 1.5px solid rgba(56, 248, 255, 0.45);
  border-radius: 20px;
  padding: 16px 14px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.72), 0 0 28px rgba(56, 248, 255, 0.18);
  animation: popIn 0.22s ease-out;
}

.modal-eyebrow {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.8px;
}

.modal-title {
  margin: 5px 0 3px;
  text-align: center;
  font-size: 19px;
  font-weight: 900;
  color: #ffffff;
}

.modal-subtitle {
  margin: 0 0 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
}

.upgrade-choices {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.upgrade-option {
  appearance: none;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(17, 42, 74, 0.94), rgba(10, 25, 48, 0.96));
  border: 1.5px solid rgba(72, 200, 255, 0.36);
  color: var(--text-main);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s, border-color 0.16s, box-shadow 0.16s;
}

.upgrade-option:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(56, 248, 255, 0.26);
}

.upgrade-option:active {
  transform: scale(0.98);
}

.upgrade-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(56, 248, 255, 0.14);
  border: 1px solid rgba(56, 248, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

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

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

.upgrade-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
}

.upgrade-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 212, 71, 0.2);
  color: var(--gold);
  white-space: nowrap;
}

.upgrade-desc {
  margin-top: 3px;
  font-size: 11.8px;
  line-height: 1.4;
  color: var(--text-sub);
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
}

/* END SCREEN */
.screen-end {
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
}

.medal-header {
  text-align: center;
  padding: 14px 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 40, 74, 0.85), rgba(8, 20, 38, 0.94));
  border: 1px solid var(--border-blueprint);
}

.medal-eyebrow {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--cyan-soft);
  letter-spacing: 1.5px;
}

.rank-emblem {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 10px auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #ffe680 0%, #ffb52e 55%, #b86c08 100%);
  box-shadow: 0 0 30px rgba(255, 212, 71, 0.55);
}

.rank-emblem.rank-A {
  background: radial-gradient(circle at 35% 30%, #8ffaff 0%, #24c6f5 55%, #0e639c 100%);
  box-shadow: 0 0 28px rgba(56, 248, 255, 0.52);
}

.rank-emblem.rank-B {
  background: radial-gradient(circle at 35% 30%, #98ffca 0%, #28cc88 55%, #0f6f4a 100%);
  box-shadow: 0 0 24px rgba(56, 242, 164, 0.44);
}

.rank-emblem.rank-C {
  background: radial-gradient(circle at 35% 30%, #b8d0e8 0%, #6888a8 55%, #344a62 100%);
  box-shadow: 0 0 18px rgba(130, 175, 220, 0.3);
}

.rank-letter {
  font-size: 44px;
  font-weight: 900;
  color: #061523;
  line-height: 1;
}

.rank-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 232, 130, 0.65);
  animation: slowSpin 14s linear infinite;
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.end-title {
  margin: 4px 0 4px;
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
}

.end-subtitle {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-sub);
}

.new-record-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: #091722;
  background: linear-gradient(90deg, #ffd447, #6cf6ff);
  padding: 3px 11px;
  border-radius: 999px;
}

.end-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.end-stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-blueprint);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.end-stat-label {
  font-size: 11.5px;
  color: var(--text-sub);
}

.end-stat-val {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.accent-gold { color: var(--gold); }
.accent-cyan { color: var(--cyan); }

.end-best-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  background: rgba(9, 22, 42, 0.85);
  border: 1px solid rgba(255, 212, 71, 0.32);
  font-size: 12.5px;
  color: var(--text-sub);
}

.end-best-box strong {
  color: var(--gold);
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  top: 62px;
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(8, 25, 46, 0.94);
  border: 1px solid var(--cyan);
  color: #effbff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 16px rgba(56, 248, 255, 0.3);
  white-space: nowrap;
  pointer-events: none;
}

.hidden {
  display: none !important;
}
