:root {
  --bg: #0d1017;
  --panel: #171d29;
  --panel2: #1f2736;
  --ink: #e8eef7;
  --muted: #8b97ab;
  --accent: #ff8a5b;
  --grid: #232c3d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  width: min(94vw, 560px);
}

.titlebar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.titlebar h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
}

.clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}

.board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

canvas {
  width: 100%;
  height: 100%;
  background: #06080d;
  border: 1px solid var(--grid);
  border-radius: 12px;
  image-rendering: pixelated;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  text-align: center;
  background: rgba(6, 8, 13, 0.82);
  border-radius: 12px;
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.lead {
  margin: 0;
  font-size: 1.05rem;
  max-width: 24rem;
}

.buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--accent);
  border: none;
  border-radius: 9px;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.hud {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.pcard {
  background: var(--panel);
  border-left: 4px solid var(--pcolor, var(--grid));
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
}

.pcard.dead {
  opacity: 0.4;
}

.pcard .name {
  font-weight: 700;
  display: flex;
  justify-content: space-between;
}

.pcard .row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  color: var(--muted);
}

.pips {
  display: inline-flex;
  gap: 2px;
}

.sicon {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
  vertical-align: -2px;
}

.pip {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--panel2);
}

.pip.on {
  background: var(--pcolor);
}

.pip.hp {
  border-radius: 50%;
}

.pip.skill.ready {
  background: #ffe14d;
}

.help {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--panel);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
}

.help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.keys p {
  margin: 0.4rem 0;
}

.keys .muted {
  color: var(--muted);
}

kbd {
  background: var(--panel2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.75rem;
}

code {
  background: var(--panel2);
  border-radius: 4px;
  padding: 1px 5px;
}
