:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080b12;
  color: #edf7ff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(8, 31, 44, 0.92), rgba(8, 11, 18, 0.98) 52%, rgba(33, 17, 46, 0.96)),
    #080b12;
}

button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-weight: 850;
  color: #061016;
  background: #57f1ff;
  box-shadow: 0 4px 0 #12758b;
  cursor: pointer;
}

button:hover:not(:disabled) {
  filter: brightness(1.06);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.45;
}

.app {
  position: relative;
  width: min(1280px, 100vw);
  height: min(760px, 100vh);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1522;
  box-shadow: 0 24px 82px rgba(0, 0, 0, 0.48);
}

.playfield {
  position: relative;
  min-width: 0;
  background: #101827;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.banner {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  min-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  font-weight: 900;
  color: #edf7ff;
  background: rgba(9, 15, 27, 0.84);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.boss-bar {
  position: absolute;
  left: 50%;
  top: 68px;
  z-index: 14;
  width: min(430px, calc(100% - 34px));
  border: 1px solid rgba(255, 79, 114, 0.45);
  border-radius: 8px;
  padding: 8px 10px 10px;
  color: #edf7ff;
  background: rgba(9, 15, 27, 0.9);
  box-shadow: 0 0 28px rgba(255, 79, 114, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
}

.boss-bar span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.boss-bar div {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.boss-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff4f72, #ffe66d);
  box-shadow: 0 0 18px rgba(255, 79, 114, 0.55);
}

.wave-skip {
  position: absolute;
  left: 50%;
  top: 118px;
  z-index: 15;
  min-width: 118px;
  min-height: 42px;
  color: #061016;
  background: linear-gradient(135deg, #f8ff7a, #57f1ff);
  box-shadow: 0 4px 0 #12758b, 0 0 24px rgba(248, 255, 122, 0.22);
  transform: translateX(-50%);
}

.panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 40;
  width: calc(100% - 50px);
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 14px;
  min-width: 0;
  padding: clamp(14px, 2vw, 22px);
  overflow-y: auto;
  background: #0a0f19;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.48);
  transform: translateX(calc(100% + 52px));
  transition: transform 180ms ease;
}

.panel.open {
  transform: translateX(0);
}

.open-sidebar {
  position: absolute;
  right: 0;
  top: 50%;
  z-index: 42;
  width: 50px;
  min-height: 48px;
  border-radius: 8px 0 0 8px;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0;
  color: #061016;
  background: linear-gradient(180deg, #57f1ff, #7cffb2);
  box-shadow: -4px 0 22px rgba(0, 0, 0, 0.36);
}

.open-sidebar.in-gap {
  left: 0;
  right: auto;
  min-height: 96px;
  border-radius: 0 8px 8px 0;
  box-shadow: 4px 0 22px rgba(0, 0, 0, 0.36);
}

.open-sidebar.hidden {
  display: none !important;
}

.speed-toggle {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 14;
  width: 72px;
  min-height: 52px;
  color: #061016;
  background: linear-gradient(135deg, #f8ff7a, #57f1ff);
  box-shadow: 0 5px 0 #12758b, 0 0 24px rgba(87, 241, 255, 0.25);
}

.speed-toggle.active {
  background: linear-gradient(135deg, #7cffb2, #57f1ff);
  box-shadow: 0 3px 0 #1d8755, 0 0 28px rgba(124, 255, 178, 0.35);
}

.speed-3-toggle {
  position: absolute;
  left: 202px;
  bottom: 14px;
  z-index: 14;
  min-width: 104px;
  min-height: 52px;
  color: #061016;
  background: linear-gradient(135deg, #d66dff, #57f1ff);
  box-shadow: 0 5px 0 #71359f, 0 0 24px rgba(214, 109, 255, 0.25);
}

.speed-3-toggle.active {
  background: linear-gradient(135deg, #ffe66d, #d66dff);
  box-shadow: 0 3px 0 #8b6b12, 0 0 28px rgba(255, 230, 109, 0.35);
}

.speed-3-toggle:disabled {
  color: rgba(237, 247, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.pause-toggle {
  position: absolute;
  left: 96px;
  bottom: 14px;
  z-index: 14;
  min-width: 92px;
  min-height: 52px;
  color: #061016;
  background: linear-gradient(135deg, #ffef7a, #57f1ff);
  box-shadow: 0 5px 0 #12758b, 0 0 24px rgba(87, 241, 255, 0.22);
}

.pause-toggle.hidden {
  display: none !important;
}

#autoSkip.active {
  color: #061016;
  background: #7cffb2;
  box-shadow: 0 3px 0 #1d8755;
}

.quick-lobby {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 14;
  min-width: 92px;
  min-height: 52px;
  color: #061016;
  background: linear-gradient(135deg, #57f1ff, #7cffb2);
  box-shadow: 0 5px 0 #12758b, 0 0 24px rgba(87, 241, 255, 0.25);
}

.quick-lobby.hidden {
  display: none !important;
}

.game-cash {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 14;
  min-width: 110px;
  border: 1px solid rgba(124, 255, 178, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  color: #061016;
  background: linear-gradient(135deg, #7cffb2, #57f1ff);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
  font-weight: 950;
}

.game-cash.hidden {
  display: none !important;
}

.defense-count {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 14;
  min-width: 150px;
  border: 1px solid rgba(87, 241, 255, 0.28);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
  color: #edf7ff;
  background: rgba(9, 15, 27, 0.86);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
  transform: translateX(-50%);
  font-weight: 950;
}

.defense-count.hidden {
  display: none !important;
}

.close-sidebar {
  display: none;
}

.brand span,
.section-title span,
.stats span,
dt {
  display: block;
  color: #98b8c8;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(2.3rem, 5vw, 3.35rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stats div,
.selected,
.tower-card {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stats div {
  padding: 10px;
}

.stats strong {
  display: block;
  margin-top: 2px;
  font-size: 1.38rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  margin-bottom: 9px;
}

.section-title small {
  max-width: 175px;
  color: #c0d7e5;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.22;
}

.tower-shop {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(168px, 1fr);
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-color: #57f1ff rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
}

.full-armory-button {
  width: 100%;
  min-height: 40px;
  margin: 0 0 10px;
  color: #061016;
  background: linear-gradient(90deg, #57f1ff, #7cffb2);
  box-shadow: 0 4px 0 #12758b;
}

.tower-shop::-webkit-scrollbar {
  height: 10px;
}

.tower-shop::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.tower-shop::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(90deg, #57f1ff, #ff6bd6);
}

.tower-card {
  display: grid;
  grid-template-rows: 62px auto auto;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-height: 158px;
  padding: 10px;
  color: #edf7ff;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 24px rgba(87, 241, 255, 0.04);
  scroll-snap-align: start;
  text-align: left;
}

.armory-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
  background: rgba(4, 8, 14, 0.78);
  backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

.armory-window {
  width: min(940px, 100%);
  max-height: min(680px, calc(100vh - 34px));
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  border: 1px solid rgba(87, 241, 255, 0.32);
  border-radius: 8px;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(16, 28, 43, 0.96), rgba(9, 14, 24, 0.98)),
    #0a0f19;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.armory-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.armory-head span {
  display: block;
  color: #98b8c8;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.armory-head h2 {
  margin: 2px 0 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 0.95;
}

.armory-head button {
  order: -1;
  min-width: 92px;
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.armory-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 12px;
  padding: 2px 4px 4px;
}

.armory-grid .tower-card {
  min-height: 190px;
  grid-template-rows: 86px auto auto;
}

.armory-grid .tower-icon {
  height: 86px;
}

.armory-grid .tower-icon::before {
  bottom: 14px;
  width: 68px;
  height: 40px;
}

.armory-grid .tower-icon::after {
  transform: translateX(-50%) scale(1.28);
  transform-origin: center;
}

.tower-card.active {
  border-color: rgba(87, 241, 255, 0.9);
  background: rgba(87, 241, 255, 0.16);
}

.tower-icon {
  position: relative;
  display: block;
  width: 100%;
  height: 62px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.12), transparent 34%),
    radial-gradient(circle at 50% 70%, var(--tower-color), transparent 34%),
    #111b2a;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 -18px 28px rgba(0, 0, 0, 0.28);
}

.tower-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 46px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 7px 7px 5px 5px;
  background:
    linear-gradient(90deg, transparent 16%, rgba(255,255,255,0.28) 17% 19%, transparent 20% 80%, rgba(255,255,255,0.28) 81% 83%, transparent 84%),
    linear-gradient(180deg, #394556, #151c27);
  box-shadow: 0 0 16px color-mix(in srgb, var(--tower-color), transparent 42%);
}

.tower-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 13px;
  width: 58px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #1a2331, var(--tower-color), #1a2331);
  box-shadow: 0 0 14px color-mix(in srgb, var(--tower-color), transparent 25%);
}

.tower-bolt .tower-icon::after {
  top: 10px;
  width: 18px;
  height: 42px;
  border-radius: 6px;
}

.tower-ember .tower-icon::before {
  width: 50px;
  height: 34px;
  border-radius: 50% 50% 8px 8px;
}

.tower-ember .tower-icon::after {
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 10%, var(--tower-color) 24%, #1a2331 62%);
}

.tower-frost .tower-icon::after {
  top: 10px;
  width: 46px;
  height: 46px;
  border: 2px solid var(--tower-color);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 46%, var(--tower-color) 47% 53%, transparent 54%),
    linear-gradient(0deg, transparent 46%, var(--tower-color) 47% 53%, transparent 54%),
    #172333;
}

.tower-nova .tower-icon::before {
  width: 54px;
  height: 30px;
  border-radius: 18px 18px 8px 8px;
}

.tower-nova .tower-icon::after {
  top: 8px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 8%, var(--tower-color) 20%, transparent 58%),
    conic-gradient(from 20deg, transparent 0 12%, var(--tower-color) 14% 18%, transparent 20% 43%, var(--tower-color) 45% 49%, transparent 51% 74%, var(--tower-color) 76% 80%, transparent 82%);
}

.tower-rail .tower-icon::after {
  top: 8px;
  width: 14px;
  height: 50px;
  border-radius: 5px;
  box-shadow:
    -18px 8px 0 -3px #1a2331,
    18px 8px 0 -3px #1a2331,
    0 0 16px color-mix(in srgb, var(--tower-color), transparent 16%);
}

.tower-plasmaRanger .tower-icon::before {
  width: 56px;
  height: 28px;
  border-radius: 9px;
}

.tower-plasmaRanger .tower-icon::after {
  top: 15px;
  width: 78px;
  height: 10px;
  background: linear-gradient(90deg, #1a2331, var(--tower-color), #edf7ff, var(--tower-color), #1a2331);
  box-shadow:
    0 18px 0 -3px #1a2331,
    0 0 18px color-mix(in srgb, var(--tower-color), transparent 12%);
}

.tower-sentinel .tower-icon::after {
  top: 18px;
  width: 72px;
  height: 10px;
  box-shadow:
    0 15px 0 -2px #1a2331,
    0 0 14px color-mix(in srgb, var(--tower-color), transparent 18%);
}

.tower-arc .tower-icon::after {
  top: 10px;
  width: 44px;
  height: 44px;
  border: 2px dashed var(--tower-color);
  border-radius: 50%;
  background: radial-gradient(circle, #edf7ff 0 8%, var(--tower-color) 18%, #172333 48%);
}

.tower-titanBulwark .tower-icon::before,
.tower-titanStorm .tower-icon::before,
.tower-titanGodcore .tower-icon::before,
.tower-titanVoid .tower-icon::before {
  width: 62px;
  height: 38px;
  border-radius: 9px 9px 6px 6px;
}

.tower-titanBulwark .tower-icon::after,
.tower-titanStorm .tower-icon::after,
.tower-titanGodcore .tower-icon::after,
.tower-titanVoid .tower-icon::after {
  top: 8px;
  width: 62px;
  height: 18px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 10%, var(--tower-color) 18%, transparent 36%),
    linear-gradient(90deg, #101723, var(--tower-color), #101723);
  box-shadow:
    -18px 24px 0 -5px color-mix(in srgb, var(--tower-color), transparent 25%),
    18px 24px 0 -5px color-mix(in srgb, var(--tower-color), transparent 25%),
    0 0 20px color-mix(in srgb, var(--tower-color), transparent 12%);
}

.tower-moneyFarm .tower-icon::before {
  width: 54px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 45%, rgba(255,255,255,0.22) 46% 54%, transparent 55%),
    linear-gradient(180deg, #224139, #101d19);
}

.tower-moneyFarm .tower-icon::after {
  top: 10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 8%, var(--tower-color) 16%, transparent 44%),
    linear-gradient(90deg, transparent 42%, var(--tower-color) 43% 57%, transparent 58%);
}

.tower-quantumPrism .tower-icon::after {
  top: 8px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: radial-gradient(circle, #fff 0 8%, var(--tower-color) 22%, #172333 58%);
}

.tower-droneBarracks .tower-icon::before {
  width: 60px;
  height: 34px;
  border-radius: 9px;
}

.tower-droneBarracks .tower-icon::after {
  top: 13px;
  width: 68px;
  height: 14px;
  box-shadow:
    -20px 20px 0 -4px #172333,
    20px 20px 0 -4px #172333,
    0 0 16px color-mix(in srgb, var(--tower-color), transparent 18%);
}

.tower-copy strong,
.tower-copy small {
  display: block;
}

.tower-copy small {
  margin-top: 3px;
  color: #c0d7e5;
  font-size: 0.72rem;
  font-weight: 700;
}

.cost {
  color: #57f1ff;
  font-size: 0.86rem;
  font-weight: 950;
  align-self: end;
}

.selected {
  padding: 12px;
  align-self: start;
}

.panel .selected {
  display: none;
}

.tower-upgrade-panel {
  position: absolute;
  right: 14px;
  top: 50%;
  z-index: 13;
  width: min(210px, calc(100vw - 28px));
  display: grid;
  gap: 7px;
  border: 1px solid rgba(87, 241, 255, 0.32);
  border-radius: 8px;
  padding: 10px;
  color: #edf7ff;
  background: rgba(9, 15, 27, 0.9);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  transform: translateY(-50%);
}

.tower-upgrade-panel strong,
.tower-upgrade-panel span {
  display: block;
}

.tower-upgrade-panel span {
  color: #c0d7e5;
  font-size: 0.78rem;
  font-weight: 800;
}

.tower-upgrade-panel button {
  min-height: 38px;
}

#quickSell {
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

dl div {
  border-radius: 8px;
  padding: 9px;
  background: rgba(0, 0, 0, 0.18);
}

dd {
  margin: 2px 0 0;
  font-size: 1.04rem;
  font-weight: 900;
}

.tower-actions,
.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: end;
}

#startWave {
  grid-column: span 2;
  min-height: 48px;
  color: #061016;
  background: #7cffb2;
  box-shadow: 0 4px 0 #1d8755;
}

#autoSkip,
#waveProgress,
#runTime,
#dronesLeft,
#sell {
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

#runTime,
#waveProgress,
#dronesLeft {
  cursor: default;
  opacity: 1;
}

.lobby-overlay,
.mode-overlay,
.crate-overlay,
.chance-overlay,
.account-overlay,
.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
  background:
    linear-gradient(135deg, rgba(6, 15, 26, 0.93), rgba(18, 10, 29, 0.9)),
    rgba(4, 8, 14, 0.86);
  backdrop-filter: blur(10px);
}

.lobby-window {
  width: min(1020px, 100%);
  max-height: min(710px, calc(100vh - 34px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  border: 1px solid rgba(87, 241, 255, 0.26);
  border-radius: 8px;
  padding: clamp(14px, 2vw, 20px);
  overflow: auto;
  background: linear-gradient(145deg, rgba(12, 24, 38, 0.98), rgba(8, 12, 20, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.lobby-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.lobby-head span,
.coin-bank span,
.mode-window span {
  display: block;
  color: #98b8c8;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.lobby-head h2 {
  margin: 2px 0 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.95;
}

.coin-bank {
  min-width: 120px;
  border: 1px solid rgba(87, 241, 255, 0.18);
  border-radius: 8px;
  padding: 12px;
  text-align: right;
  background: rgba(87, 241, 255, 0.08);
}

.coin-bank strong {
  display: block;
  margin-top: 2px;
  font-size: 1.65rem;
}

.coin-bank small {
  display: block;
  margin-top: 4px;
  color: #c0d7e5;
  font-size: 0.76rem;
  font-weight: 850;
}

.lobby-section {
  min-width: 0;
}

.map-grid,
.crate-grid,
.loadout-grid,
.mode-choices {
  display: grid;
  gap: 10px;
}

.map-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.crate-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.loadout-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 10px;
}

.map-card,
.crate-card,
.loadout-card,
.mode-card {
  min-height: 92px;
  padding: 12px;
  color: #edf7ff;
  text-align: left;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.map-card.active,
.crate-card.active,
.loadout-card.active,
.mode-card.active {
  border-color: rgba(87, 241, 255, 0.9);
  background: rgba(87, 241, 255, 0.16);
}

.map-card strong,
.crate-card strong,
.loadout-card strong,
.mode-card strong,
.map-card small,
.crate-card small,
.loadout-card small,
.mode-card small {
  display: block;
}

.map-card small,
.crate-card small,
.loadout-card small,
.mode-card small {
  margin-top: 5px;
  color: #c0d7e5;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.25;
}

.loadout-toggle {
  width: 100%;
  min-height: 44px;
}

.crate-card em {
  display: block;
  margin-top: 10px;
  color: #57f1ff;
  font-style: normal;
  font-weight: 950;
}

.crate-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  justify-items: start;
}

.crate-card .open-label,
.crate-card .chance-label {
  display: inline-block;
  margin-top: 10px;
  border-radius: 6px;
  padding: 7px 9px;
  color: #061016;
  background: #57f1ff;
  font-weight: 950;
}

.crate-card .chance-label {
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.crate-overlay,
.chance-overlay,
.account-overlay,
.tutorial-overlay,
.result-overlay {
  z-index: 24;
  background: rgba(4, 8, 14, 0.76);
}

.crate-reveal,
.chance-window,
.account-window,
.tutorial-window {
  width: min(460px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  border: 1px solid rgba(87, 241, 255, 0.32);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(145deg, rgba(13, 27, 43, 0.98), rgba(8, 12, 20, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.crate-reveal span,
.chance-window > span,
.account-window > span,
.tutorial-window > span {
  color: #98b8c8;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.crate-reveal h2,
.chance-window h2,
.account-window h2,
.tutorial-window h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.crate-reveal p {
  margin: 0;
  color: #c0d7e5;
  font-weight: 750;
}

.chance-list {
  width: 100%;
  display: grid;
  gap: 8px;
}

.chance-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
}

.chance-list span {
  color: #57f1ff;
  font-weight: 950;
}

.account-window input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.08);
}

.account-list {
  width: 100%;
  display: grid;
  gap: 8px;
  color: #c0d7e5;
  font-size: 0.82rem;
  font-weight: 800;
}

.account-list span {
  color: #98b8c8;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.account-list button {
  width: 100%;
  min-height: 38px;
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.account-actions,
.tutorial-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.delete-confirm {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 79, 114, 0.12);
}

.accounts-button {
  min-height: 48px;
  color: #edf7ff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.crate-box {
  position: relative;
  width: 180px;
  height: 150px;
  margin: 8px 0 4px;
}

.crate-core,
.crate-lid {
  position: absolute;
  left: 50%;
  width: 150px;
  transform: translateX(-50%);
  border: 2px solid rgba(87, 241, 255, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 12%, rgba(255,255,255,0.22) 13% 16%, transparent 17% 83%, rgba(255,255,255,0.22) 84% 87%, transparent 88%),
    linear-gradient(145deg, #243143, #0d1522);
  box-shadow: inset 0 0 22px rgba(87, 241, 255, 0.12), 0 18px 50px rgba(0, 0, 0, 0.44);
}

.crate-core {
  bottom: 0;
  height: 96px;
}

.crate-lid {
  top: 28px;
  height: 44px;
  transform-origin: left bottom;
  transition: transform 620ms ease, top 620ms ease;
}

.crate-box.opening {
  animation: crate-shake 520ms ease-in-out 2;
}

.crate-box.opened .crate-lid {
  top: 4px;
  transform: translateX(-50%) rotate(-13deg);
}

.crate-box.opened::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 38px;
  width: 120px;
  height: 120px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.96), rgba(87,241,255,0.58) 28%, rgba(255,107,214,0.18) 55%, transparent 72%);
  animation: crate-glow 900ms ease-out both;
}

@keyframes crate-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px) rotate(-2deg); }
  50% { transform: translateX(5px) rotate(2deg); }
  75% { transform: translateX(-3px) rotate(-1deg); }
}

@keyframes crate-glow {
  from { opacity: 0; transform: translateX(-50%) scale(0.35); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

.result-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
  backdrop-filter: blur(10px);
}

.result-window {
  width: min(500px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  border: 1px solid rgba(87, 241, 255, 0.32);
  border-radius: 8px;
  padding: 26px;
  text-align: center;
  background: linear-gradient(145deg, rgba(13, 27, 43, 0.98), rgba(8, 12, 20, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.result-window span {
  color: #98b8c8;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.result-window h2 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 5rem);
  line-height: 0.9;
}

.result-window p {
  margin: 0;
  color: #c0d7e5;
  font-weight: 800;
}

.result-window button {
  min-width: 180px;
  min-height: 50px;
  color: #061016;
  background: linear-gradient(90deg, #7cffb2, #57f1ff);
  box-shadow: 0 4px 0 #1d8755;
}

.play-map {
  min-height: 52px;
  color: #061016;
  background: linear-gradient(90deg, #7cffb2, #57f1ff);
  box-shadow: 0 4px 0 #1d8755;
}

.mode-overlay {
  z-index: 16;
  background: rgba(4, 8, 14, 0.58);
}

.mode-window {
  width: min(700px, 100%);
  border: 1px solid rgba(87, 241, 255, 0.3);
  border-radius: 8px;
  padding: 18px;
  background: rgba(9, 15, 27, 0.92);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
}

.mode-window h2 {
  margin: 0 0 12px;
  font-size: clamp(2.8rem, 8vw, 5rem);
  line-height: 0.9;
}

.mode-choices {
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
}

@media (max-width: 900px) {
  body {
    place-items: start center;
  }

  .app {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  .playfield {
    height: 100%;
    min-height: 0;
  }

  .panel {
    border-left: 0;
    border-top: 0;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .playfield {
    min-height: 360px;
  }

  .panel {
    padding: 12px;
  }

  .tower-card {
    grid-template-rows: 58px auto auto;
  }

  .cost {
    grid-column: auto;
  }
}
