:root {
  color-scheme: dark;
  --bg: #0a0f14;
  --panel: #111a20;
  --panel-2: #17242b;
  --line: rgba(150, 190, 205, 0.18);
  --text: #e8f2f1;
  --muted: #8ca5a8;
  --green: #54d58a;
  --cyan: #49c6e5;
  --amber: #f0bd4f;
  --rose: #ef6d7a;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, #19323a 0, transparent 34%),
    radial-gradient(circle at 85% 10%, #30233f 0, transparent 30%),
    linear-gradient(145deg, #071015 0%, #0a0f14 48%, #111018 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

button {
  border: 1px solid var(--line);
  background: #142129;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  width: 100vw;
  height: 100vh;
  padding: 16px;
}

.game-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: #071014;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 26, 32, 0.96), rgba(12, 17, 22, 0.96));
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 10px;
  font-size: 15px;
  color: #bdd2d3;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  color: var(--amber);
  font-size: 21px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stats div,
.section,
.voice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 31, 38, 0.72);
}

.stats div {
  padding: 11px;
}

.stats span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stats strong {
  font-size: 20px;
}

.section {
  padding: 14px;
}

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

.tower {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 9px;
  border-radius: 7px;
  text-align: left;
}

.tower.selected {
  border-color: rgba(73, 198, 229, 0.8);
  background: rgba(54, 101, 115, 0.4);
}

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

.tower small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.sigil {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2), 0 0 18px currentColor;
}

.blue { color: var(--cyan); background: #176073; }
.purple { color: #ba8cff; background: #4a2775; }
.gold { color: var(--amber); background: #715a18; }

.selected-card p,
footer,
.voice p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.actions button {
  min-height: 42px;
  border-radius: 7px;
}

.actions .primary {
  grid-column: span 2;
  border-color: rgba(84, 213, 138, 0.7);
  background: linear-gradient(180deg, #1d7046, #15452f);
}

.actions #supportBtn {
  grid-column: span 2;
}

.voice {
  padding: 13px;
}

.voice div {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.squad {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: #c7dcdd;
  font-size: 13px;
}

.voice .squad {
  display: grid;
}

.squad span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.squad b {
  color: var(--cyan);
}

.squad em {
  color: var(--green);
  font-style: normal;
}

.wide {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border-radius: 7px;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(84, 213, 138, 0.65);
  animation: pulse 1.8s infinite;
}

.toast {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 18, 0.84);
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(84, 213, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(84, 213, 138, 0); }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .game-panel {
    height: 62vh;
    min-height: 420px;
  }

  .hud {
    overflow: visible;
  }
}
