:root {
  --bg: #f5f0e7;
  --panel: #17313b;
  --panel-soft: #264a56;
  --ink: #0d1417;
  --line: #d8c8af;
  --accent: #e85d3d;
  --you: #2a7fff;
  --npc: #2b6b57;
  --invuln: #f4a259;
  --bullet: #111111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Hiragino Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff9ef 0, transparent 30%),
    linear-gradient(135deg, #f0e4d1 0%, #ece6da 45%, #e7efe8 100%);
}

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

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, #102129 100%);
  color: #f6f1e7;
  padding: 24px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.05;
}

.lede {
  margin: 0 0 18px;
  color: #d7e4e3;
  line-height: 1.5;
}

.controls {
  display: grid;
  gap: 12px;
}

.controls label,
.hud div {
  display: grid;
  gap: 6px;
}

.controls select,
.controls button,
.controls input {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: var(--panel-soft);
  color: #fff8ef;
  padding: 10px 12px;
  font: inherit;
}

.tuning {
  margin-top: 4px;
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 12px;
}

.tuning h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d7e4e3;
}

.tuning label {
  display: grid;
  gap: 6px;
}

.tuning span {
  justify-self: end;
  color: #ffd7b6;
  font-weight: 700;
}

.tuning input[type="range"] {
  padding: 0;
}

.controls button {
  cursor: pointer;
  background: linear-gradient(135deg, #d95a3f, #f08c57);
  color: #fff7f2;
  font-weight: 700;
}

.hud {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c3d4d1;
}

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

.scoreboard {
  margin-top: 18px;
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.scoreboard h2 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d7e4e3;
}

#scoreboard-list {
  display: grid;
  gap: 8px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.score-row.you {
  outline: 1px solid rgba(255, 215, 182, 0.5);
}

.score-row .name {
  color: #eef5f4;
}

.score-row .value {
  color: #ffd7b6;
  font-weight: 700;
}

.legend {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
}

.swatch.self {
  background: var(--you);
}

.swatch.npc {
  background: var(--npc);
}

.swatch.invuln {
  background: var(--invuln);
}

.swatch.bullet {
  background: var(--bullet);
}

.notes {
  margin: 20px 0 0;
  padding-left: 18px;
  color: #dce8e7;
  line-height: 1.5;
}

.footer-link {
  margin-top: 18px;
  color: #d7e4e3;
}

.footer-link a {
  color: #ffd7b6;
}

.stage-wrap {
  display: grid;
  place-items: center;
  padding: 20px;
}

canvas {
  width: min(92vw, 920px);
  height: min(92vw, 920px);
  max-height: 92vh;
  border-radius: 24px;
  box-shadow:
    0 24px 70px rgba(13, 20, 23, 0.18),
    inset 0 0 0 1px rgba(23, 49, 59, 0.08);
  background: #faf5e9;
}

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

  .panel {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}
