:root {
  --rust: #c45a2a;
  --rust-dark: #8b3a18;
  --brass: #e8b84a;
  --oil: #1a1520;
  --metal: #3d4555;
  --neon-pink: #ff2d8a;
  --neon-cyan: #00f5d4;
  --ink: #0d0a0f;
  --panel: #2a2438;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Rubik", system-ui, sans-serif;
  color: #f0e6d8;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #4a2040 0%, transparent 50%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 40px,
      rgba(0, 245, 212, 0.03) 40px,
      rgba(0, 245, 212, 0.03) 42px
    ),
    var(--oil);
  overflow-x: auto;
}

.app {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
}

.header {
  text-align: center;
  margin-bottom: 0.75rem;
}

.header h1 {
  font-family: "Bangers", cursive;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.06em;
  color: var(--brass);
  text-shadow:
    3px 3px 0 var(--ink),
    0 0 24px var(--neon-pink);
}

.header h1 span {
  color: var(--neon-cyan);
}

.tagline {
  font-size: 0.9rem;
  opacity: 0.85;
}

.main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.75rem;
}

.panel {
  width: 200px;
  flex-shrink: 0;
  background: var(--panel);
  border: 4px solid var(--ink);
  border-radius: 12px;
  padding: 1rem;
  box-shadow:
    6px 6px 0 var(--ink),
    inset 0 0 0 2px var(--metal);
}

.panel h2 {
  font-family: "Bangers", cursive;
  font-size: 1.35rem;
  color: var(--neon-cyan);
  margin-bottom: 0.65rem;
}

.tower-shop {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tower-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
  background: linear-gradient(180deg, var(--metal) 0%, #252a35 100%);
  border: 3px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s, box-shadow 0.1s;
}

.tower-btn:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}

.tower-btn.selected {
  outline: 3px solid var(--neon-pink);
}

.tower-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tower-btn .icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.tower-btn .meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.tower-btn .cost {
  color: var(--brass);
  font-size: 0.72rem;
}

.hint,
.wave-hint {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.65rem;
  line-height: 1.35;
}

.stage-wrap {
  position: relative;
  width: 960px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 960 / 540;
  border: 5px solid var(--ink);
  border-radius: 6px;
  box-shadow:
    10px 10px 0 var(--ink),
    0 0 50px rgba(255, 45, 138, 0.12);
  background: #121018;
}

#game {
  display: block;
  width: 960px;
  max-width: 100%;
  height: auto;
  cursor: crosshair;
  image-rendering: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 10, 15, 0.78);
}

.overlay.hidden {
  display: none;
}

.bubble {
  background: #f5e6c8;
  color: var(--ink);
  border: 5px solid var(--ink);
  border-radius: 20px;
  padding: 1.5rem 2rem;
  text-align: center;
  max-width: 360px;
  box-shadow: 8px 8px 0 var(--neon-pink);
}

.bubble h2 {
  font-family: "Bangers", cursive;
  font-size: 2rem;
  color: var(--rust-dark);
  margin-bottom: 0.5rem;
}

.bubble p {
  margin-bottom: 1rem;
}

.bubble button {
  font-family: "Bangers", cursive;
  font-size: 1.2rem;
  padding: 0.5rem 1.5rem;
  background: var(--neon-cyan);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
}

.stat {
  margin-bottom: 0.75rem;
  padding: 0.45rem 0.6rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 2px solid var(--ink);
}

.stat .label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.stat .value {
  font-family: "Bangers", cursive;
  font-size: 1.5rem;
  color: var(--brass);
}

.btn-wave {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem;
  font-family: "Bangers", cursive;
  font-size: 1.1rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--brass) 0%, var(--rust) 100%);
  border: 4px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}

.btn-wave:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn-wave:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 1500px) {
  .main {
    flex-direction: column;
    align-items: center;
  }

  .panel {
    width: min(520px, 100%);
  }
}
