:root {
  --ink: #0d0b1a;
  --panel: rgba(13, 11, 26, 0.88);
  --mint: #6ff2c2;
  --gold: #ffcc4d;
  --coral: #ff6f61;
  --white: #f4f1ea;
  --dim: #a59fb8;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--white);
  font-family: var(--mono);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#stage {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: size;
  overflow: hidden;
  background: var(--ink);
  box-shadow: 0 0 0 1px #1d1833;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: crosshair;
}

/* CRT vignette */
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, 0.45) 100%);
}

.hud-buttons {
  position: absolute;
  top: 2.2cqh;
  left: 1.2cqw;
  display: flex;
  gap: 0.8cqw;
  z-index: 2;
}
.hud-buttons[hidden] { display: none; }
.hud-buttons button {
  font: 700 1.5cqw/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--white);
  background: rgba(13, 11, 26, 0.7);
  border: 1px solid rgba(111, 242, 194, 0.45);
  padding: 0.9cqh 0.9cqw;
  min-width: 4cqw;
  cursor: pointer;
}
#btn-sound { font-size: 1.1cqw; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 18, 0.55);
  z-index: 3;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(78cqw, 900px);
  max-height: 92cqh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid rgba(111, 242, 194, 0.35);
  padding: 3cqh 3cqw;
  font-size: 1.7cqw;
  line-height: 1.45;
}
.panel.center { text-align: center; width: min(60cqw, 700px); }

#logo {
  width: 60%;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto 1cqh;
}

h2 {
  margin: 0 0 2cqh;
  font-size: 2.8cqw;
  letter-spacing: 0.12em;
  color: var(--mint);
}
.kicker { color: var(--gold); letter-spacing: 0.1em; margin: 0 0 3cqh; }
.fine { color: var(--dim); font-size: 1.3cqw; margin: 2cqh 0 0; }
ol { margin: 0; padding-left: 2.4cqw; }
li { margin-bottom: 1.2cqh; }
b { color: var(--white); }
.mint { color: var(--mint); }
.gold { color: var(--gold); }
.coral { color: var(--coral); }

.row { display: flex; gap: 1.5cqw; justify-content: center; margin-top: 2.5cqh; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 1.5cqh; align-items: center; }

.btn {
  font: 700 1.9cqw/1 var(--mono);
  letter-spacing: 0.1em;
  color: var(--white);
  background: transparent;
  border: 2px solid rgba(244, 241, 234, 0.6);
  padding: 1.6cqh 2.6cqw;
  min-width: 18cqw;
  cursor: pointer;
}
.btn.primary { color: var(--ink); background: var(--mint); border-color: var(--mint); }
.btn:focus-visible, .hud-buttons button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.6cqw;
}
.card-table th {
  color: var(--dim);
  font-weight: 400;
  text-align: left;
  padding: 0.6cqh 0.8cqw;
  border-bottom: 1px solid rgba(244, 241, 234, 0.2);
}
.card-table td { padding: 0.8cqh 0.8cqw; text-align: left; }
.card-table th:last-child, .card-table td:last-child { text-align: right; }
.card-table td.pts { color: var(--gold); }
.card-table td.neg { color: var(--coral); }
.total { font-size: 2.6cqw; margin: 2.5cqh 0 0; letter-spacing: 0.1em; }

.rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--ink);
  color: var(--mint);
  place-items: center;
  font: 700 16px/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-align: center;
}
@media (orientation: portrait) and (pointer: coarse) {
  .rotate { display: grid; }
}
