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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #10141c;
  font-family: 'Rubik', 'Segoe UI', system-ui, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
}

body.playing #game {
  cursor: none;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.screen > * {
  pointer-events: auto;
}

.overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 11, 17, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  0% { transform: scale(0.75) translateY(14px); opacity: 0; }
  70% { transform: scale(1.03) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

.panel {
  background: rgba(13, 17, 25, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 30px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: popIn 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
}

.panel.wide {
  padding: 28px 34px;
}

.panel h2 {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffe08a, #ff9f43);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel h2.defeat {
  background: linear-gradient(180deg, #ff8a8a, #e23b3b);
  -webkit-background-clip: text;
  background-clip: text;
}

.btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, #7ed04e, #4d9c2c);
  border: none;
  border-bottom: 4px solid #2f6b1a;
  border-radius: 14px;
  padding: 13px 36px;
  cursor: pointer;
  min-width: 220px;
  transition: transform 0.08s ease, filter 0.15s ease;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.btn:hover {
  filter: brightness(1.12);
}

.btn:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 4px solid rgba(0, 0, 0, 0.4);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease, opacity 0.15s;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.off {
  opacity: 0.35;
}

.icon-btn.off::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 3px;
  border-radius: 2px;
  background: #ff5b4a;
  transform: rotate(-40deg);
}

.icon-btn {
  position: relative;
}

#hud {
  z-index: 5;
}

#hud .hud-top,
#hud .boss-bar,
#hud .banner,
#vignette {
  pointer-events: none !important;
}

#hud .hud-btns .icon-btn,
#hud .ammo-slot {
  pointer-events: auto;
}

.ammo-slot {
  cursor: pointer;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.hp-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 210px;
}

.tank-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #bfe8ff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.hp-track {
  width: 220px;
  height: 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #8be05c, #4d9c2c);
  border-radius: 8px;
  transition: width 0.2s ease;
}

.hp-fill.low {
  background: linear-gradient(180deg, #ff8a6a, #d3332a);
}

.hp-fill.heal {
  animation: hpHealFlash 0.45s ease-out;
}

@keyframes hpHealFlash {
  0%   { box-shadow: 0 0 18px #7ed04e, 0 0 6px #fff inset; filter: brightness(1.4); }
  100% { box-shadow: none; filter: brightness(1); }
}

.hp-text {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.ammo-slots {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.ammo-slot {
  position: relative;
  min-width: 44px;
  padding: 4px 6px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #cfe5ff;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.ammo-slot .ammo-key {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.ammo-slot .ammo-label {
  font-size: 12px;
}

.ammo-slot.active {
  border-color: #ffd94d;
  background: rgba(255, 217, 77, 0.16);
  color: #ffe89a;
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(255, 217, 77, 0.35);
}

.ammo-slot.empty {
  opacity: 0.55;
}

.ammo-slot.empty .ammo-label {
  color: rgba(255, 255, 255, 0.4);
}

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

.score {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}

.combo {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffd94d;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  padding: 3px 12px;
  display: inline-block;
}

.combo.pop {
  animation: comboPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes comboPop {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.hud-btns {
  display: flex;
  gap: 8px;
}

.boss-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 56vw);
  text-align: center;
}

.boss-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ff8a7a;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  margin-bottom: 4px;
}

.boss-track {
  height: 13px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 120, 100, 0.45);
  border-radius: 8px;
  overflow: hidden;
}

.boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #ff7a5c, #c62b2b);
  transition: width 0.15s ease;
}

.banner {
  position: absolute;
  top: 26%;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none !important;
}

.banner-main {
  font-size: clamp(38px, 7vw, 72px);
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff, #ffd94d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
}

.banner-sub {
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 600;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.banner-anim {
  animation: bannerPop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes bannerPop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(230, 30, 10, 0.5) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  animation: popIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* top-center stats bar */
.menu-stats {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
}

/* top-right settings icons */
#menu > .menu-icons {
  position: absolute;
  top: 18px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 5;
}

/* action buttons under the title */
.menu-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.menu-actions .btn {
  min-width: 200px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(13, 17, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 7px 14px;
  min-width: 170px;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.6);
}

.stat-val {
  font-size: 17px;
  font-weight: 900;
  color: #ffd94d;
}

.coin-pill .stat-val {
  color: #ffe89a;
}

/* tank selector heading */
.ts-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}

.ts-img {
  width: 100%;
  max-width: 280px;
  height: 90px;
  object-fit: contain;
  display: block;
  margin: 0 auto 6px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.06), transparent 70%);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  border-radius: 10px;
}

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

.logo-tank {
  width: 110px;
  height: 58px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  animation: tankBob 2.6s ease-in-out infinite;
}

@keyframes tankBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(1.5deg); }
}

.logo {
  font-size: clamp(42px, 9vw, 84px);
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1;
  background: linear-gradient(180deg, #ffe08a 15%, #ff9f43 70%, #e56b1f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 rgba(60, 30, 5, 0.85)) drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55));
  transform: rotate(-2deg);
}

.logo-of {
  display: inline-block;
  font-size: 0.32em;
  vertical-align: middle;
  margin: 0 10px;
  letter-spacing: 6px;
  opacity: 0.9;
}

.tagline {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.tank-select {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.tank-card {
  width: 330px;
  background: rgba(13, 17, 25, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 18px;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.ts-name {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffe08a;
}

.ts-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin: 4px 0 8px;
  min-height: 28px;
}

.ts-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.ts-lock-note {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ff8a6a;
}

.stat {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.stat span {
  width: 52px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.65);
  text-align: left;
}

.track {
  flex: 1;
  height: 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.25s ease;
}

.arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.best-line {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.65);
}

.best-line span {
  color: #ffd94d;
  font-weight: 800;
}

.menu-icons {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.how-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  text-align: left;
}

.how-list b {
  color: #ffd94d;
  margin-right: 4px;
}

.keys-line {
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 22px;
  margin: 6px 0 8px;
}

.stat-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-big span {
  font-size: 26px;
  font-weight: 900;
  color: #ffe08a;
}

.stat-big label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.55);
}

.clear-score {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.8);
}

.clear-score span {
  color: #ffd94d;
  font-weight: 900;
}

.up-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.tutorial-panel {
  width: min(440px, 92vw);
  text-align: center;
  padding: 26px 24px 22px;
}
.tut-body {
  position: relative;
  min-height: 200px;
  margin: 8px 0 4px;
}
.tut-step {
  display: none;
  animation: tutFade .22s ease both;
}
.tut-step.on { display: block; }
.tut-icon {
  width: 96px;
  height: 96px;
  margin: 4px auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5a524;
  background: rgba(245, 165, 36, 0.1);
  border: 1px solid rgba(245, 165, 36, 0.3);
  border-radius: 50%;
}
.tut-icon svg { width: 60%; height: 60%; }
.tut-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #f5a524;
  margin: 6px 0 8px;
}
.tut-text {
  font-size: 15px;
  line-height: 1.5;
  color: #cfd6e0;
  max-width: 340px;
  margin: 0 auto;
}
.tut-text b { color: #e7ecf3; }
.tut-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
}
.tut-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background .18s, transform .18s;
}
.tut-dots .dot.on {
  background: #f5a524;
  transform: scale(1.25);
}
.tut-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
}
.tut-actions .btn { min-width: 120px; padding: 11px 22px; font-size: 14px; }
@keyframes tutFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Settings panel — full-bleed two-column layout ===== */
.settings-panel {
  width: min(880px, 96vw);
  height: min(560px, 90vh);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
  overflow: hidden;
}
.set-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.set-header h2 {
  margin: 0;
  text-align: left;
  font-size: 22px;
  letter-spacing: 1.4px;
}
.set-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.set-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e7ecf3;
  border-color: var(--line);
}
.set-close svg { width: 18px; height: 18px; }

.set-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  flex: 1;
  min-height: 0;
}

.set-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.set-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font: 600 13px/1 inherit;
  letter-spacing: 0.4px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s, border-color .15s;
}
.set-nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e7ecf3;
}
.set-nav-item.on {
  background: rgba(245, 165, 36, 0.12);
  color: #f5a524;
  border-color: rgba(245, 165, 36, 0.35);
}
.set-nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.set-nav-ico svg { width: 18px; height: 18px; }
.set-nav-danger { color: #ff7a6a; }
.set-nav-item.on .set-nav-danger { color: #ff7a6a; }

.set-content {
  padding: 20px 26px 24px;
  overflow-y: auto;
  min-height: 0;
}
.set-section { display: none; }
.set-section.on {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  animation: tutFade .22s ease both;
}
.set-section.on > .set-card { flex: 0 0 auto; }
.set-section.on > .set-h { flex: 0 0 auto; }

.set-h {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.6px;
  color: #f5a524;
  margin: 0 0 10px;
}
.set-h-danger { color: #ff7a6a; }

.set-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 16px;
}
.set-card-danger {
  border-color: rgba(255, 80, 60, 0.35);
  background: rgba(60, 18, 18, 0.25);
}
.set-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  font-size: 14px;
  color: #cfd6e0;
}
.set-row:last-child { border-bottom: none; }
.set-row-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.set-label { font-size: 14px; color: #e7ecf3; font-weight: 600; }
.set-sub { font-size: 12px; color: var(--muted); }

.set-toggle-wrap { display: inline-flex; cursor: pointer; flex-shrink: 0; }
.set-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.set-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background .18s, border-color .18s;
  flex-shrink: 0;
}
.set-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #e7ecf3;
  border-radius: 50%;
  transition: transform .18s, background .18s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.set-toggle:checked + .set-slider {
  background: rgba(245, 165, 36, 0.55);
  border-color: rgba(245, 165, 36, 0.7);
}
.set-toggle:checked + .set-slider::after { transform: translateX(20px); background: #f5a524; }
.set-toggle:focus-visible + .set-slider { outline: 2px solid #f5a524; outline-offset: 2px; }

.set-range-wrap { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.set-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 24px;
}
.set-range::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, #f5a524 var(--val, 90%), rgba(255, 255, 255, 0.14) var(--val, 90%));
  border-radius: 4px;
}
.set-range::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}
.set-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f5a524;
  margin-top: -6px;
  border: 2px solid #161c26;
  box-shadow: 0 0 0 1px #f5a524;
}
.set-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f5a524;
  border: 2px solid #161c26;
  box-shadow: 0 0 0 1px #f5a524;
}
.set-val {
  min-width: 42px;
  text-align: right;
  font: 600 12px ui-monospace, Menlo, monospace;
  color: #f5a524;
  font-variant-numeric: tabular-nums;
}

.set-danger-text {
  font-size: 13px;
  line-height: 1.55;
  color: #ffd9a8;
  margin: 14px 4px 16px;
}
.set-reset-row { display: flex; justify-content: flex-start; padding: 4px 4px 14px; }

.btn-danger {
  background: #c0392b;
  color: #fff;
  border: 1px solid #a83224;
  min-width: 200px;
}
.btn-danger:hover { background: #d04a3a; }
.btn-danger.confirm {
  background: #7a1818;
  border-color: #6b0f0f;
  animation: dangerPulse 1.2s ease-in-out infinite;
}
@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 80, 60, 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 80, 60, 0); }
}

.set-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}
.set-footer-hint {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-footer .btn { flex-shrink: 0; min-width: 120px; padding: 9px 22px; font-size: 13px; }

.set-confirm {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 4px 6px;
}
.set-confirm-text {
  font-size: 13px;
  color: #ffd9a8;
  line-height: 1.5;
  max-width: 380px;
}
.set-confirm-btns { display: flex; gap: 10px; }
.set-confirm-btns .btn { min-width: 120px; padding: 9px 18px; font-size: 13px; }

.fps {
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font: 600 12px ui-monospace, Menlo, monospace;
  color: #7ed04e;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 6px;
  pointer-events: none;
}

.cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  width: 148px;
  font-family: inherit;
  background: linear-gradient(180deg, rgba(40, 50, 68, 0.95), rgba(22, 28, 40, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 4px solid rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  padding: 18px 12px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: #ffd94d;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.card-ammo {
  border-color: rgba(126, 233, 255, 0.6);
  background: linear-gradient(180deg, rgba(30, 50, 70, 0.95), rgba(14, 26, 40, 0.95));
}

.card-ammo .card-name {
  color: #7ee9ff;
}

.card-ammo:hover {
  border-color: #7ee9ff;
  box-shadow: 0 14px 30px rgba(126, 233, 255, 0.35);
}

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

.card.selected {
  border-color: #ffd94d;
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(255, 217, 77, 0.35), 0 0 0 2px rgba(255, 217, 77, 0.55) inset;
  background: linear-gradient(180deg, rgba(70, 62, 30, 0.95), rgba(38, 32, 16, 0.95));
}

.card-ammo.selected {
  border-color: #7ee9ff;
  box-shadow: 0 14px 30px rgba(126, 233, 255, 0.35), 0 0 0 2px rgba(126, 233, 255, 0.55) inset;
  background: linear-gradient(180deg, rgba(24, 56, 78, 0.95), rgba(10, 30, 46, 0.95));
}

.card-pick {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.4);
  min-height: 12px;
}

.card.selected .card-pick {
  color: #ffd94d;
}

.card-ammo.selected .card-pick {
  color: #7ee9ff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn:disabled:active {
  transform: none;
  border-bottom-width: 4px;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 217, 77, 0.14);
  border: 1px solid rgba(255, 217, 77, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd94d;
}

.card-icon svg {
  width: 26px;
  height: 26px;
}

.card-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
}

.card-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  line-height: 1.35;
}

@media (min-width: 641px) and (max-width: 1040px) {
  .menu-actions { flex-direction: column; }
}

@media (max-width: 640px) {
  .hp-track { width: 130px; }
  .hp-wrap { min-width: 130px; }
  .score { font-size: 24px; }
  .panel { padding: 22px 20px; gap: 10px; }
  .btn { min-width: 180px; padding: 12px 26px; font-size: 15px; }
  .tank-card { width: 240px; }
  .ts-img { max-width: 220px; height: 70px; }
  .stats-grid { gap: 14px; }
  .stat-big span { font-size: 20px; }
  .boss-bar { width: 60vw; }
  .logo-tank { width: 84px; }
  .menu-hint { display: none; }

  .menu-stats { top: 10px; gap: 8px; }
  .stat-pill { min-width: 96px; padding: 6px 10px; gap: 8px; }
  .stat-val { font-size: 14px; }
  #menu > .menu-icons { top: 10px; right: 10px; }
  .menu-actions { flex-direction: column; }
  .menu-actions .btn { min-width: 200px; }
}

/* ---- polish: coins ---- */
.coin-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 800;
  color: #ffd94d;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.coin-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe89a, #ffb525 70%);
  box-shadow: 0 0 6px rgba(255, 200, 60, 0.6), inset 0 -1px 2px rgba(120, 70, 0, 0.6);
}

/* ---- polish: level progress ---- */
.level-progress {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(46vw, 420px);
  height: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #7ed04e, #ffd94d);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(255, 217, 77, 0.4);
}

.progress-flag {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

/* ---- polish: cinematic screen frame ---- */
#screen-frame {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
  box-shadow: inset 0 0 130px rgba(6, 9, 16, 0.55);
  background: linear-gradient(180deg, rgba(6, 9, 16, 0.22), transparent 12%, transparent 88%, rgba(6, 9, 16, 0.3));
}

/* ---- polish: touch drive controls ---- */
.drive {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 26px;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

.drive-btn {
  pointer-events: auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 14, 22, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: background 0.1s ease, transform 0.1s ease;
}

.drive-btn svg {
  width: 34px;
  height: 34px;
}

.drive-btn.pressed {
  background: rgba(255, 217, 77, 0.3);
  border-color: #ffd94d;
  transform: scale(0.94);
}

.drive.hidden {
  display: none !important;
}

/* ---- polish: new best badge ---- */
.new-best {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #1c1408;
  background: linear-gradient(180deg, #ffe08a, #ffb525);
  border-radius: 999px;
  padding: 5px 18px;
  box-shadow: 0 4px 14px rgba(255, 180, 40, 0.45);
  animation: bestPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes bestPop {
  0% { transform: scale(0.4) rotate(-6deg); opacity: 0; }
  70% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

/* ---- polish: menu extras ---- */
.menu-hint {
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.55);
}

.menu-hint b {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 800;
}

.version-tag {
  position: fixed;
  bottom: 10px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.35);
}

/* ---- incoming wave telegraph ---- */
.incoming {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffb35c;
  background: rgba(40, 22, 8, 0.6);
  border: 1px solid rgba(255, 179, 92, 0.5);
  border-radius: 999px;
  padding: 5px 18px;
  animation: comboPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

/* ---- hurt flash ---- */
#hurt-flash {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 40, 20, 0.35) 100%);
  opacity: 0;
}

#hurt-flash.hit {
  animation: hurtAnim 0.35s ease-out;
}

@keyframes hurtAnim {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- achievement toast ---- */
.ach-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: linear-gradient(180deg, rgba(30, 38, 54, 0.96), rgba(16, 21, 32, 0.96));
  border: 1px solid rgba(255, 217, 77, 0.6);
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffe08a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  transition: transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.3s;
}

.ach-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(30px);
  display: block !important;
}

/* ---- fever combo ---- */
.combo.fever {
  color: #ff8a6a;
  background: rgba(120, 20, 8, 0.55);
  box-shadow: 0 0 16px rgba(255, 90, 60, 0.5);
}

/* ---- daily modifier chip ---- */
.mod-chip {
  margin-top: 8px;
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #aef2ff;
  background: rgba(20, 60, 80, 0.55);
  border: 1px solid rgba(126, 233, 255, 0.45);
  border-radius: 999px;
  padding: 5px 16px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---- hangar ---- */
.hg-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, 80vw);
}

.hg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
}

.hg-info {
  flex: 1;
  text-align: left;
}

.hg-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffe08a;
}

.hg-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.hg-buy {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #7ed04e, #4d9c2c);
  border: none;
  border-bottom: 3px solid #2f6b1a;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.hg-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.hg-lv {
  display: flex;
  gap: 3px;
  margin-top: 5px;
}

.hg-pip {
  width: 14px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.hg-pip.on {
  background: #ffd94d;
}
