:root {
  --bg: #0b0f14;
  --panel: #131d2b;
  --line: #29415e;
  --text: #e7eef8;
  --muted: #9cb0c6;
  --accent: #55c5ff;
  --accent-2: #93f7cd;
  --danger: #ff6d7a;
  --tower-scout: #90f7cb;
  --tower-cannon: #ffd59e;
  --tower-frost: #9cdcff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(1000px 520px at 10% -10%, #14355f 0%, transparent 52%),
    radial-gradient(760px 460px at 100% 0%, #1a4b3d 0%, transparent 48%),
    var(--bg);
}

.shell {
  width: min(1060px, calc(100% - 16px));
  margin: 10px auto 20px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0;
  animation: rise 600ms ease-out forwards;
}

.breadcrumb a {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span { color: var(--muted); }

.top {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 42%), var(--panel);
  padding: 14px;
  opacity: 0;
  animation: rise 600ms ease-out 80ms forwards;
}

.top h1 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(24px, 4vw, 38px);
}

.top p {
  margin: 6px 0 0;
  color: var(--muted);
}

.hud {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #132133;
  padding: 10px;
  opacity: 0;
  animation: rise 600ms ease-out 160ms forwards;
}

.tower-pick {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  opacity: 0;
  animation: rise 600ms ease-out 240ms forwards;
}

.tower-btn {
  background: #19283c;
  border-color: #365173;
}

.tower-btn.active {
  background: linear-gradient(135deg, #1f8ad1, #16b69d);
  border-color: transparent;
}

.stat {
  min-width: 92px;
  border: 1px solid #355173;
  border-radius: 10px;
  background: #0f1c2d;
  padding: 8px;
}

.stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.stat strong {
  font-size: 18px;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #1f8ad1, #16b69d);
}

.btn-ghost {
  background: #19283c;
  border-color: #365173;
}

.btn-ghost.active {
  background: #5a2531;
  border-color: #8a3b4a;
}

.canvas-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0d1520;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
}

.message {
  margin: 10px 2px 0;
  color: var(--muted);
  min-height: 22px;
}

.message.alert {
  color: #ffc0c8;
}

.footer-nav {
  margin-top: 14px;
  padding: 0 2px;
  opacity: 0;
  animation: rise 600ms ease-out 320ms forwards;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.link-btn:hover {
  transform: translateY(-1px);
}

.link-back {
  background: #142233;
  border-color: #2c4260;
}

.link-back:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 201, 255, 0.16);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 680px) {
  .stat {
    min-width: 78px;
  }
}