.defense-shell {
  width: min(1380px, 100%);
}

.compact-heading h1 {
  font-size: clamp(2.2rem, 6vw, 4.7rem);
}

.defense-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 14px;
}

.build-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 15px;
}

.build-panel h2,
.selection-panel h3 {
  margin: 3px 0 0;
  font-size: 1.12rem;
}

.tower-list {
  display: grid;
  gap: 7px;
}

.tower-choice {
  min-height: 67px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.tower-choice:hover {
  transform: translateX(2px);
  border-color: var(--mint);
}

.tower-choice.active {
  border-color: var(--acid);
  background: rgba(200, 255, 54, 0.09);
  box-shadow: inset 0 0 19px rgba(200, 255, 54, 0.05);
}

.tower-choice b,
.tower-choice small {
  display: block;
}

.tower-choice b {
  font-size: 0.78rem;
}

.tower-choice small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.25;
}

.tower-icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 12px;
  background: #16231f;
}

.tandoor-icon::before {
  content: "";
  position: absolute;
  inset: 9px 11px 6px;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(#eb8458, #7a2d27);
  box-shadow: 0 0 10px rgba(255, 104, 70, 0.44);
}

.tandoor-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 15px;
  left: 15px;
  top: 7px;
  border-radius: 60% 40% 60% 40%;
  background: var(--gold);
  transform: rotate(22deg);
}

.chutney-icon::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 4px solid #44d995;
  border-radius: 50% 50% 45% 45%;
  background: #1a744f;
  box-shadow: 0 0 11px rgba(68, 217, 149, 0.38);
}

.naan-icon::before {
  content: "";
  position: absolute;
  width: 26px;
  height: 18px;
  left: 7px;
  top: 11px;
  border-radius: 52% 48% 45% 55%;
  background: #f1cf86;
  box-shadow: inset -4px -3px 0 #bf8d47;
  transform: rotate(-18deg);
}

.tower-choice kbd {
  color: var(--muted);
}

.selection-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.17);
}

.selection-panel > p:not(.eyebrow) {
  min-height: 44px;
  margin: 7px 0 11px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.selection-panel .btn {
  flex: 1;
  padding: 8px 7px;
  font-size: 0.72rem;
}

.resource-note {
  margin: auto 0 0;
  padding: 10px;
  border: 1px solid rgba(255, 200, 86, 0.17);
  border-radius: 10px;
  color: #aaa897;
  background: rgba(255, 200, 86, 0.035);
  font-size: 0.63rem;
  line-height: 1.45;
}

.stage-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 9px;
}

.canvas-frame {
  padding: 9px;
  border-radius: 20px;
  background: #050b0a;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: #0d1714;
  cursor: crosshair;
  touch-action: none;
}

.wave-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  color: var(--cream);
  font-family: Impact, sans-serif;
  font-size: clamp(3rem, 9vw, 7rem);
  letter-spacing: 0.06em;
  text-shadow: 0 5px 30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -44%) scale(1.25);
}

.wave-banner.show {
  animation: wave-call 1250ms ease-out;
}

@keyframes wave-call {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(1.35); }
  20%, 65% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(0.92); }
}

.corner-legend {
  position: absolute;
  left: 20px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 8px;
  color: rgba(255, 243, 207, 0.65);
  background: rgba(0, 0, 0, 0.55);
  font-size: clamp(0.42rem, 1.2vw, 0.62rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.entrance-dot,
.door-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
}

.door-dot {
  margin-left: 6px;
  background: var(--acid);
}

.stage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px 0;
}

.stage-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.heat-stat strong {
  color: var(--gold);
}

.controls-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

.mini-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 18px 0;
}

.mini-guide span {
  padding: 9px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 0.65rem;
}

.mini-guide b {
  display: block;
  color: var(--cream);
  font-size: 0.72rem;
}

.mini-guide i {
  width: 19px;
  height: 19px;
  display: block;
  margin: 0 auto 5px;
  border-radius: 50%;
}

.guide-burst { background: #ff7150; box-shadow: 0 0 8px #ff7150; }
.guide-chill { background: #4fe0a3; box-shadow: 0 0 8px #4fe0a3; }
.guide-rapid { background: #f2ce7f; box-shadow: 0 0 8px #f2ce7f; }
.centered { justify-content: center; }
.result-link { display: inline-grid; place-items: center; text-decoration: none; }

@media (max-width: 900px) {
  .defense-layout {
    grid-template-columns: 1fr;
  }

  .build-panel {
    display: grid;
    grid-template-columns: 0.7fr 1.5fr 1fr;
    align-items: start;
  }

  .resource-note {
    display: none;
  }

  .tower-choice {
    min-height: 54px;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .tower-icon {
    width: 32px;
    height: 32px;
    transform: scale(0.8);
    transform-origin: center;
  }

  .tower-choice kbd {
    display: none;
  }
}

@media (max-width: 640px) {
  .build-panel {
    grid-template-columns: 1fr;
  }

  .build-panel > div:first-child {
    display: none;
  }

  .tower-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .tower-choice {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .tower-choice small {
    font-size: 0.54rem;
  }

  .canvas-frame {
    padding: 4px;
    border-radius: 13px;
  }

  canvas {
    border-radius: 9px;
  }

  .stage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-actions .button-row {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr;
  }
}
