@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/russo-one-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/russo-one-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: "Russo One", "Inter", "Segoe UI", system-ui, sans-serif;
  --bg: #05080c;
  --panel: rgba(12, 18, 25, 0.94);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef4fb;
  --muted: #8c9cad;
  --accent: #ff7a1a;
  --accent-2: #ffb35c;
  --green: #7fd15a;
  --red: #ff5a5a;
  --blue: #63b3ff;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 50% 18%, #17232f 0%, #080d13 48%, #030508 100%);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 540px;
  height: 960px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  overflow: hidden;
  border-radius: 22px;
  background: #070b10;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 40px 120px rgba(0, 0, 0, 0.8),
    0 0 100px rgba(255, 122, 26, 0.06);
}

#game {
  display: block;
  width: 540px;
  height: 960px;
  touch-action: none;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 30px;
  background: linear-gradient(180deg, rgba(2, 5, 8, 0.9) 0%, rgba(2, 5, 8, 0.4) 60%, rgba(2, 5, 8, 0) 100%);
}

.actions { display: flex; gap: 8px; pointer-events: auto; }

.hudLeft {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.hudRight {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.waveCard {
  min-width: 292px;
  padding: 7px 10px 6px;
  border-radius: 13px;
  background: rgba(6, 11, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.waveMain {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.waveBlock {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.statLabel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.1px;
  color: var(--muted);
}

.waveIcon {
  display: inline-block;
  width: 19px;
  height: 19px;
  flex: none;
  background: url('assets/icons/zombie.png') center / contain no-repeat;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.waveBlock b {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1;
  color: #ffc24a;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.waveSep {
  width: 1px;
  height: 20px;
  align-self: center;
  background: rgba(255, 255, 255, 0.14);
}

.scoreBlock {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
}

.trophyGlyph {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #ffc24a;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(255, 160, 30, 0.35));
}

.scoreBlock span {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.1px;
  color: var(--muted);
}

.scoreBlock b {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
  color: #f4f8fb;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

#waveProgress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  pointer-events: none;
}

.clockIcon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: #ff9a3d;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}

.clockIcon svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.waveCaption {
  flex: 1;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

#waveRemaining {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #f4f8fb;
  font-variant-numeric: tabular-nums;
}

#streakBadge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 9px;
  background: rgba(8, 12, 18, 0.82);
  border: 1px solid rgba(255, 209, 102, 0.28);
  color: #ffd166;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease;
}

#streakBadge.show { display: flex; opacity: 1; }

.iconBtn {
  width: 57px;
  height: 57px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(8, 13, 18, 0.78);
  color: #dce8f4;
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.iconBtn:active { transform: translateY(1px); background: rgba(255, 122, 26, 0.18); }
.iconBtn.off { color: #5f7183; }

#wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 11px;
  background: rgba(7, 12, 17, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.09);
  transition: transform 0.18s ease;
}

#wallet.bump { transform: scale(1.06); }
.walletItem { display: flex; align-items: center; gap: 6px; }

.walletItem b {
  min-width: 26px;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #eaf2fa;
}

.coinIcon {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 0;
  background: url('assets/icons/coin.png') center / contain no-repeat;
  vertical-align: -6px;
}

.gemIcon {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 0;
  background: url('assets/icons/diamond.png') center / contain no-repeat;
  vertical-align: -6px;
}

.bottombar {
  position: absolute;
  inset: auto 0 0 0;
  padding: 54px 20px 16px;
  background: linear-gradient(0deg, rgba(2, 5, 8, 0.94) 0%, rgba(2, 5, 8, 0.5) 55%, rgba(2, 5, 8, 0) 100%);
}

.hpRow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 230px;
  padding: 6px 9px;
  border-radius: 12px;
  background: rgba(5, 10, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.heartIcon {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: none;
  background: url('assets/icons/heart.png') center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.turretBtn {
  position: absolute;
  right: 16px;
  bottom: 59px;
  z-index: 16;
  width: 72px;
  height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 5px;
  border-radius: 16px;
  border: 1px solid rgba(255, 190, 80, 0.5);
  background: rgba(8, 14, 19, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  cursor: pointer;
}

.turretBtn:active { transform: scale(0.94); }
.turretBtn:disabled { opacity: 0.45; cursor: default; }

.turretIcon {
  width: 40px;
  height: 40px;
  display: block;
  background: url('assets/icons/turret.png') center / contain no-repeat;
}

.turretLabel {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.5px;
  color: #ffc24a;
}

#turretCount {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: #ff7a1a;
  color: #1a0d03;
  font-size: 14px;
  font-weight: 900;
  line-height: 22px;
  text-align: center;
}

.hpTrack {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

#hpFill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #65c94c, #a6ee6f);
  transition: width 0.18s ease-out, background 0.2s;
}

#hpFill.low { background: linear-gradient(90deg, #ff3b3b, #ff8a5c); }

#hpText {
  width: 36px;
  text-align: right;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin-top: 9px;
  padding-right: 94px;
  text-align: left;
  font-size: 14px;
  color: var(--muted);
  transition: opacity 0.6s;
}

.hint.fade { opacity: 0; }

/* overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(16, 26, 36, 0.55) 0%, rgba(2, 5, 8, 0.93) 72%);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.menuCard {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 30px 28px 24px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(22, 31, 41, 0.96), rgba(9, 14, 20, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: left;
}

.menuCard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.9;
}

.menuCard.small { max-width: 400px; text-align: center; }
.menuCard.small .primary, .menuCard.small .ghost { margin-top: 12px; }

.reviveBtn {
  height: 48px;
  border-color: rgba(255, 194, 74, 0.55);
  color: #ffc24a;
  font-size: 16px;
}

.reviveBtn:disabled { opacity: 0.6; cursor: default; }
.reviveBtn .gemIcon { width: 20px; height: 20px; vertical-align: -4px; }

.reviveStatus {
  margin-top: 8px;
  min-height: 18px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--muted);
}

.reviveStatus.hidden, .scoreRetry[hidden] { display: none; }

.reviveStatus.error { color: #ff8a8a; }

.menuCard.mainMenu {
  text-align: center;
  padding: 46px 30px 30px;
}

.menuCard.mainMenu h1 { margin-bottom: 30px; }

.shopCard {
  background: #0d141b;
  text-align: left;
  padding: 22px 26px 20px;
}

.shopCard h2 { margin: 4px 0 8px; padding-right: 78px; font-size: 42px; }
.shopCard .eyebrow { font-size: 14px; }

.shopCoinsTop {
  position: absolute;
  top: 18px;
  right: 20px;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(255, 209, 102, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.18);
  font-size: 20px;
}

.upgradeList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 12px;
}

.upgradeOption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.upgradeOption:hover { background: rgba(255, 255, 255, 0.075); }
.upgradeOption:active { transform: translateY(1px); }
.upgradeOption:disabled { opacity: 0.38; cursor: not-allowed; }

.upgradeOption .optText { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.optIcon {
  width: 46px;
  height: 46px;
  flex: none;
  background: center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.optIcon.glyphIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: #ff8a8a;
  font-size: 24px;
  filter: none;
}
.upgradeOption b { font-size: 18px; font-weight: 900; letter-spacing: 0.3px; }
.upgradeOption span { font-size: 16px; color: var(--muted); line-height: 1.35; }

.upgradeOption em {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-style: normal;
  font-size: 17px;
  font-weight: 900;
  color: #ffd166;
}

.shopFoot {
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: 10px;
}

.shopCoins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 900;
  color: #ffd166;
}

.shopBuild {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
  min-height: 30px;
}

.buildChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 16px;
  font-weight: 900;
  color: #d7e2ec;
  font-variant-numeric: tabular-nums;
}

.buildChip i {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: none;
  font-style: normal;
  background: center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.buildChip i.glyph {
  width: auto;
  height: auto;
  font-size: 16px;
  color: var(--c, #ffd166);
  background: none;
  filter: none;
}

.shopCoins .coinIcon { width: 28px; height: 28px; }
.upgradeOption em .coinIcon { width: 18px; height: 18px; }
.rerollBtn .coinIcon { width: 18px; height: 18px; }

.buildChip.base { color: #8ea3b5; font-weight: 700; }

.shopFoot .ghost { width: auto; flex: 1; margin-top: 0; height: 50px; font-size: 18px; }
.shopFoot .rerollBtn { flex: 0 0 55%; width: auto; min-width: 0; }

.eyebrow {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.8px;
  color: var(--accent);
  text-transform: uppercase;
}

.eyebrow.red { color: var(--red); }

h1 {
  margin: 8px 0 14px;
  font-family: var(--font-display);
  font-size: 62px;
  line-height: 0.83;
  font-weight: 900;
  letter-spacing: -2.5px;
  text-transform: uppercase;
  color: #f4f8fd;
  text-shadow: 0 4px 0 #000, 0 0 38px rgba(255, 122, 26, 0.28);
}

h1 .vs {
  display: inline-block;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--accent);
  vertical-align: 8px;
  margin: 0 3px;
  text-shadow: 0 0 22px rgba(255, 122, 26, 0.55);
}

h2 {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.8px;
  text-transform: uppercase;
}

.lead {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.55;
  color: #a9b8c7;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0 20px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.control b { font-size: 16px; color: var(--accent-2); letter-spacing: 0.4px; }
.control span { font-size: 14px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted); }

.primary, .ghost {
  width: 100%;
  height: 56px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.primary {
  border: 0;
  color: #180b02;
  background: linear-gradient(180deg, #ffa24c, #ff6a00);
  box-shadow:
    0 8px 0 #9e3f00,
    0 14px 30px rgba(255, 106, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.primary:active { transform: translateY(4px); box-shadow: 0 4px 0 #9e3f00, 0 8px 18px rgba(255, 106, 0, 0.2); }

.ghost {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.035);
  color: #b9c7d5;
}

.ghost:active { transform: translateY(2px); }

.menuFoot {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #596a7b;
  text-transform: uppercase;
}

.recordLine {
  margin: 4px 0 14px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-align: center;
}

.recordLine b { color: #ffd166; font-size: 14px; }

.resultGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 18px 0 8px;
}

.resultGrid div {
  padding: 12px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.resultGrid span { display: block; font-size: 14px; font-weight: 800; letter-spacing: 1.1px; color: var(--muted); }
.resultGrid b { display: block; margin-top: 4px; font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* toast */
.toast {
  position: absolute;
  z-index: 15;
  top: 150px;
  left: 50%;
  transform: translate(-50%, -8px) scale(0.96);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  background: rgba(8, 13, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.toastIcon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 10px;
  background: rgba(255, 122, 26, 0.14);
  border: 1px solid rgba(255, 122, 26, 0.45);
  font-size: 22px;
  color: var(--accent);
  font-weight: 900;
}

.toastText { display: flex; flex-direction: column; gap: 2px; }
.toastText b { font-size: 18px; font-weight: 900; letter-spacing: 0.5px; }
.toastText span { font-size: 14px; color: var(--muted); }

.toastIcon.image {
  background-size: 38px 38px;
  background-position: center;
  background-repeat: no-repeat;
}

/* loading */
.loader {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  margin-bottom: 16px;
}

#loading {
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 54px;
  background: #05080b url('assets/images/ui/preloader.png') center / cover no-repeat;
}

#loading .loader { display: none; }

.loadText {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2.4px;
  color: #f4f8fb;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.loadBar {
  width: 220px;
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

#loadBarFill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb14d, #ff6a00);
  box-shadow: 0 0 12px rgba(255, 122, 26, 0.6);
  transition: width 0.18s ease;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  #stage { border-radius: 0; }
  body::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* leaderboard */
.leaderboardCard {
  width: min(92%, 430px);
  max-height: 80%;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.lbHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lbHead h2 { margin-bottom: 8px; }

.lbClose {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: #dfe9f4;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.lbTabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 4px 0 12px;
}

.lbTab {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
}

.lbTab.active {
  border-color: rgba(255, 194, 74, 0.6);
  background: rgba(255, 122, 26, 0.16);
  color: #ffc24a;
}

.lbList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  max-height: 52vh;
  padding-right: 2px;
}

.lbStatus {
  padding: 26px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

.lbGap {
  padding: 2px 0;
  text-align: center;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  letter-spacing: 3px;
}

.lbRow {
  display: grid;
  grid-template-columns: 30px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 6px 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid transparent;
}

.lbRow.me {
  background: rgba(255, 122, 26, 0.12);
  border-color: rgba(255, 122, 26, 0.4);
}

.lbRank {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}

.lbRow:nth-child(1) .lbRank { color: #ffd166; }
.lbRow:nth-child(2) .lbRank { color: #c7d3df; }
.lbRow:nth-child(3) .lbRank { color: #d99762; }

.lbAvatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 122, 26, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffc24a;
  font-family: var(--font-display);
  font-size: 16px;
}

.lbAvatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lbName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 700;
}

.lbScore {
  font-family: var(--font-display);
  font-size: 18px;
  color: #f4f8fb;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.lbScore small {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
/* base */
.baseScreen {
  position: absolute; inset: 0; z-index: 10; overflow: hidden;
  background: #b57a36 url('assets/images/base/base-background.jpg') center / cover no-repeat;
}
.baseScene { position: absolute; inset: 0; }
.baseScene::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(4,8,12,.28) 0%, rgba(4,8,12,0) 28%, rgba(4,8,12,.25) 78%, rgba(4,8,12,.7) 100%);
}
.baseTop {
  position: absolute; z-index: 2; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: center; gap: 8px;
}
.baseLevel, .baseSupplies {
  display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 12px;
  border-radius: 12px; background: rgba(7,12,17,.82); border: 1px solid rgba(255,255,255,.14);
  color: #dfe9f4; font-size: 14px; font-weight: 800;
}
.baseLevel b, .baseSupplies b { font-family: var(--font-display); font-size: 22px; color: #ffc24a; }
.baseSupplies { margin-left: auto; }
.supplyIcon {
  width: 24px; height: 24px; display: inline-block; border-radius: 5px;
  background: linear-gradient(135deg, #e0a448, #9a5e22);
  border: 2px solid #6f4217; box-shadow: inset 0 0 0 2px rgba(255,255,255,.12);
  position: relative;
}
.supplyIcon::after { content: '▦'; position: absolute; inset: 0; display: grid; place-items: center; color: #3b210b; font-size: 12px; }
.baseMiniBtn {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(7,12,17,.82); color: #ffc24a; font-size: 20px; cursor: pointer;
}
.baseTentWrap {
  position: absolute; z-index: 1; left: 50%; top: 240px; transform: translateX(-50%);
}
.baseTent { width: 270px; filter: drop-shadow(0 18px 18px rgba(0,0,0,.35)); }
.baseBuildings { position: absolute; inset: 0; z-index: 2; }
.baseBuildNode {
  position: absolute; width: 104px; min-height: 104px; padding: 7px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: 16px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(8,14,20,.82); color: #f4f8fb; cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
}
.baseBuildNode.locked { filter: grayscale(1); opacity: .74; }
.baseBuildNode img { width: 62px; height: 62px; object-fit: contain; }
.baseBuildNode b { font-size: 14px; line-height: 1.1; text-align: center; }
.baseBuildNode small { font-size: 14px; line-height: 1.1; color: #ffc24a; text-align: center; }
.baseBuildNode.ready { border-color: rgba(255,194,74,.75); box-shadow: 0 0 0 2px rgba(255,194,74,.18), 0 8px 20px rgba(0,0,0,.28); }
.baseBuildNode .nodeLevel { position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; border-radius: 11px; background: #ff7a1a; color: #1a0d03; display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.baseBuildBtn {
  position: absolute; z-index: 3; left: 50%; top: 470px; transform: translateX(-50%);
  min-width: 240px; height: 46px; padding: 0 16px; border: 0; border-radius: 12px;
  background: linear-gradient(180deg, #ffb15c, #ff7a1a); color: #1c0d02;
  font-family: var(--font-display); font-size: 14px; cursor: pointer;
  box-shadow: 0 5px 0 #9e3f00, 0 10px 24px rgba(0,0,0,.28);
}
.baseBuildBtn:disabled { opacity: .6; cursor: default; filter: grayscale(.5); }
.baseBuildBtn small { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 700; }
.baseFooter { position: absolute; z-index: 3; left: 18px; right: 18px; bottom: 18px; }
.baseFooter .primary { width: 100%; height: 62px; font-size: 24px; }
.baseTip {
  position: absolute; z-index: 4; left: 18px; right: 18px; bottom: 92px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,194,74,.4);
  background: rgba(7,12,17,.9); color: #ffe0a6; font-size: 14px; line-height: 1.35;
}
.baseFromShop { margin-top: 10px; height: 42px; }
.baseIntroCard { text-align: center; max-height: 86%; overflow-y: auto; }
.baseIntroImg { width: 180px; height: 180px; object-fit: contain; margin: 4px auto 6px; display: block; filter: drop-shadow(0 10px 20px rgba(0,0,0,.35)); }
.baseIntroCard h2 { font-size: 28px; margin: 6px 0; }
.baseIntroCard .lead { font-size: 15px; }
.baseCard { width: min(92%, 420px); max-height: 84%; overflow-y: auto; }
.baseCardHead { display: flex; align-items: center; gap: 12px; }
.baseCardHead h2 { margin: 4px 0 0; font-size: 28px; }
.baseCardIcon { width: 74px; height: 74px; flex: none; border-radius: 14px; background: rgba(255,255,255,.05) center / contain no-repeat; border: 1px solid rgba(255,255,255,.12); }
.baseCardStats { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.baseCardStats div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.045); font-size: 14px; }
.baseCardStats b { color: #ffc24a; }
.baseCardAction { margin-top: 12px; }
.baseCard .ghost { margin-top: 8px; height: 44px; }
@media (max-width: 420px) {
  .baseTentWrap { top: 250px; }
  .baseTent { width: 235px; }
  .baseBuildNode { width: 92px; min-height: 94px; }
  .baseBuildNode img { width: 54px; height: 54px; }
  .baseBuildBtn { top: 480px; }
}
.turretBtn.hiddenTurret { display: none; }

.baseTip.hidden { display: none !important; }

.baseScreen.hidden { display: none !important; }

/* base layout overrides: plates below tent, square corners */
.baseScreen { z-index: 10; }
.baseLevel, .baseSupplies, .baseMiniBtn, .baseBuildNode, .baseBuildBtn,
.baseTip, .baseFooter .primary, .baseBuildNode .nodeLevel,
.baseCard, .baseIntroCard, .baseCardIcon, .baseCardStats div,
.baseCardAction, .baseCard .ghost, .baseCard .primary {
  border-radius: 0 !important;
}
.baseTentWrap { top: 104px; }
.baseTent { width: 214px; }
.baseBuildings {
  position: absolute; z-index: 2; left: 18px; right: 18px; top: 382px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.baseBuildNode {
  position: relative !important; left: auto !important; top: auto !important;
  width: calc((100% - 16px) / 3) !important; min-height: 104px;
}
.baseBuildBtn { top: 326px; }
.baseTip { border-radius: 0 !important; }
.baseCard::before, .baseIntroCard::before { display: none !important; }
.baseCard .primary, .baseCard .ghost, .baseIntroCard .primary, .baseIntroCard .ghost { border-radius: 0 !important; }
.baseCardIcon { border-radius: 0 !important; }
.baseCardStats div { border-radius: 0 !important; }
.baseBuildNode .nodeLevel { border-radius: 0 !important; }
.baseScreen.hidden { display: none !important; }
.baseTip.hidden { display: none !important; }
.turretBtn.hiddenTurret { display: none !important; }
@media (max-width: 420px) {
  .baseTentWrap { top: 96px; }
  .baseTent { width: 200px; }
  .baseBuildings { left: 14px; right: 14px; top: 366px; }
  .baseBuildNode { min-height: 100px; }
  .baseBuildNode img { width: 56px; height: 56px; }
  .baseBuildBtn { top: 310px; }
}
.baseBuildNode {
  height: 98px !important; min-height: 0 !important; padding: 5px 3px !important; gap: 1px !important;
  justify-content: flex-start;
}
.baseBuildNode img { width: 44px !important; height: 44px !important; }
.baseBuildNode b { font-size: 14px; }
.baseBuildNode small { font-size: 14px; }
@media (max-width: 420px) {
  .baseBuildings { top: 356px; }
  .baseBuildNode { height: 92px !important; }
  .baseBuildNode img { width: 40px !important; height: 40px !important; }
}
.baseBuildings { bottom: auto !important; height: auto !important; align-content: flex-start !important; }
/* review fixes */
.overlay .menuCard { border-radius: 0 !important; }
.overlay .menuCard::before { display: none !important; }
.overlay .menuCard .primary,
.overlay .menuCard .ghost,
.overlay .lbTab,
.overlay .lbClose { border-radius: 0 !important; }
.primary:disabled,
.ghost:disabled,
.baseCardAction:disabled {
  opacity: .55 !important;
  filter: grayscale(.45);
  box-shadow: none !important;
  cursor: default;
}
@media (max-width: 480px) {
  .topbar { padding: 10px 12px 24px; gap: 6px; }
  .hudLeft { min-width: 0; flex: 1 1 auto; }
  .hudRight { flex: 0 0 auto; }
  .waveCard { min-width: 0 !important; flex: 1 1 auto; padding: 6px 8px 5px; }
  .waveMain { gap: 6px; }
  .waveBlock { gap: 4px; }
  .scoreBlock { gap: 4px; }
  .statLabel, .scoreBlock span { font-size: 13px; letter-spacing: .6px; }
  .actions { gap: 5px; }
  .iconBtn { width: 43px; height: 43px; }
  .wallet { gap: 8px; padding: 5px 8px; }
  .walletItem b { font-size: 16px; min-width: 22px; }
  .walletItem .coinIcon, .walletItem .gemIcon { width: 22px; height: 22px; }
}
/* base v2: big tent, sitting soldier, horizontal room ribbon */
.baseTentWrap { top: 48px !important; }
.baseTent { width: 320px !important; }
.baseSoldier {
  position: absolute; z-index: 3; right: 2px; top: 200px;
  width: 148px; height: 148px; pointer-events: none;
  background-image: url('assets/images/base/soldier-idle.png');
  background-repeat: no-repeat; background-size: 400% 400%; background-position: 0 0;
  filter: drop-shadow(0 12px 16px rgba(0,0,0,.35));
}
.baseBuildings {
  position: absolute !important; z-index: 4; left: 0 !important; right: 0 !important;
  top: 372px !important; bottom: auto !important; height: 148px !important;
  display: flex !important; flex-wrap: nowrap !important; justify-content: flex-start !important;
  align-items: stretch !important; gap: 10px !important;
  padding: 0 calc(50% - 72px) !important;
  overflow-x: auto !important; overflow-y: hidden !important;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.baseBuildings::-webkit-scrollbar { display: none; }
.baseBuildNode {
  position: relative !important; left: auto !important; top: auto !important;
  flex: 0 0 144px !important; width: 144px !important; height: 142px !important;
  min-height: 0 !important; padding: 7px 5px !important;
  scroll-snap-align: center;
}
.baseBuildNode.focus { border-color: #ffc24a !important; box-shadow: 0 0 0 2px rgba(255,194,74,.28), 0 10px 24px rgba(0,0,0,.35) !important; }
.baseBuildNode img { width: 58px !important; height: 58px !important; }
.baseBuildBtn { top: 532px !important; }
@media (max-width: 360px) {
  .baseTentWrap { top: 50px !important; }
  .baseTent { width: 240px !important; }
  .baseSoldier { width: 112px; height: 112px; top: 176px; right: 0; }
  .baseBuildings { top: 300px !important; height: 126px !important; padding: 0 calc(50% - 62px) !important; }
  .baseBuildNode { flex-basis: 124px !important; width: 124px !important; height: 120px !important; }
  .baseBuildNode img { width: 48px !important; height: 48px !important; }
  .baseBuildBtn { top: 438px !important; }
}

.baseMiniBtn .baseRatingIcon { display: block; width: 34px; height: 34px; margin: 0 auto; object-fit: contain; }
/* base horizon alignment */
.baseTentWrap { top: 216px !important; }
.baseTent { width: 320px !important; }
.baseSoldier { top: 333px !important; }
.baseBuildings { top: 494px !important; }
.baseBuildBtn { top: 656px !important; }
@media (max-width: 360px) {
  .baseTentWrap { top: 281px !important; }
  .baseTent { width: 240px !important; }
  .baseSoldier { top: 364px !important; width: 112px; height: 112px; }
  .baseBuildings { top: 485px !important; }
  .baseBuildBtn { top: 623px !important; }
}
.baseScene::after { background: linear-gradient(180deg, rgba(4,8,12,.16) 0%, rgba(4,8,12,0) 16%, rgba(4,8,12,0) 70%, rgba(4,8,12,.42) 100%) !important; }

#loading .startBtn { width: 270px; height: 58px; margin-top: 18px; font-size: 20px; }
#loading .startBtn.hidden { display: none; }

/* base v3: lower hero, footer upgrade button, lower ribbon */
.baseTentWrap { top: 256px !important; }
.baseSoldier { top: 373px !important; }
.baseBuildings { top: 650px !important; height: 130px !important; }
.baseBuildNode { height: 126px !important; }
.baseBuildNode img { width: 52px !important; height: 52px !important; }
.baseFooter {
  display: flex !important; flex-direction: column; gap: 30px !important;
  left: 18px; right: 18px; bottom: 18px;
}
.baseFooter .primary { width: 100%; height: 62px; font-size: 24px; }
.baseFooter .baseBuildBtn {
  position: static !important; left: auto !important; top: auto !important;
  transform: none !important; width: 100% !important; height: 62px !important;
  min-width: 0 !important; margin: 0 !important; padding: 0 16px !important;
  font-size: 20px !important; display: block;
}
.baseHelpIcon { display: block; width: 32px; height: 32px; margin: 0 auto; object-fit: contain; }
.baseTip { bottom: 200px !important; }
@media (max-width: 360px) {
  .baseTentWrap { top: 321px !important; }
  .baseSoldier { top: 404px !important; }
  .baseBuildings { top: 585px !important; height: 110px !important; }
  .baseBuildNode { height: 106px !important; }
  .baseBuildNode img { width: 42px !important; height: 42px !important; }
  .baseFooter { gap: 20px !important; }
  .baseFooter .primary, .baseFooter .baseBuildBtn { height: 54px !important; }
  .baseFooter .baseBuildBtn { font-size: 17px !important; }
  .baseTip { bottom: 170px !important; }
}
/* base v4: compact ribbon under tent, upgrade button below ribbon */
.baseBuildings { top: 590px !important; }
.baseBuildBtn {
  position: absolute !important; left: 18px !important; right: 18px !important;
  top: 750px !important; bottom: auto !important; transform: none !important;
  width: auto !important; min-width: 0 !important; height: 62px !important;
  margin: 0 !important; font-size: 20px !important; z-index: 5;
}
.baseFooter { display: block !important; gap: 0 !important; }
.baseFooter .primary { width: 100% !important; height: 62px !important; font-size: 24px !important; }
.baseTip { bottom: 270px !important; }
@media (max-width: 360px) {
  .baseBuildings { top: 560px !important; }
  .baseBuildBtn { left: 14px !important; right: 14px !important; top: 690px !important; height: 54px !important; font-size: 17px !important; }
  .baseFooter .primary { height: 54px !important; }
}
.baseLevel { max-width: 300px; }
.baseLevel span { flex: none; }
.baseLevel b { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }

.baseTentWrap { top: 296px !important; }
.baseBuildBtn { top: 790px !important; }
@media (max-width: 360px) {
  .baseTentWrap { top: 321px !important; }
  .baseBuildBtn { top: 730px !important; }
}
