:root {
  --bg: #101410;
  --panel: #182019;
  --panel-2: #202a22;
  --ink: #f2f6ed;
  --muted: #a9b7a9;
  --line: #334033;
  --accent: #38b59f;
  --accent-2: #f1b45a;
  --danger: #e85c4a;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

button {
  min-height: 44px;
  border: 1px solid #415143;
  border-radius: 8px;
  background: #253126;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus-visible {
  border-color: var(--accent);
  background: #2b3a31;
  outline: 2px solid transparent;
}

button:disabled {
  cursor: not-allowed;
  color: #788579;
  background: #20261f;
  border-color: #30382f;
}

button.primary {
  background: #1e6f63;
  border-color: #50cdb8;
}

button.armed {
  border-color: var(--accent-2);
  background: #4b3822;
}

.shell {
  width: min(1380px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: stretch;
}

.arena-panel {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141a14;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px var(--shadow);
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 23 / 16;
  touch-action: none;
  background: #111711;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.game-title,
.objective,
.stats,
.actions,
.upgrades,
.status-line {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.game-title {
  padding: 18px 18px 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.objective {
  padding: 16px;
}

.objective p {
  margin-bottom: 0;
  color: #d9e4d5;
  line-height: 1.45;
}

.stats {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.stat-row strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.meter {
  height: 12px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #30382f;
}

#coreMeter {
  width: 100%;
  height: 100%;
  background: var(--accent);
}

.actions,
.upgrades {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.upgrades {
  grid-template-columns: 1fr;
}

.status-line {
  margin: 0;
  padding: 14px 16px;
  color: #dfe8dc;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    grid-row: 1;
  }

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

@media (max-width: 560px) {
  .shell {
    padding: 10px;
    gap: 10px;
  }

  .upgrades {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }
}
