:root {
  color-scheme: dark;
  --bg: #02030a;
  --panel: #080a18;
  --line: #1d2654;
  --blue: #2ad8ff;
  --blue-deep: #1024b0;
  --yellow: #ffd12e;
  --text: #f8f8ff;
  --muted: #9da7da;
  --pink: #ff6fb1;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: radial-gradient(circle at 50% 20%, #111a3a 0, var(--bg) 46rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-panel {
  width: min(100%, 760px);
  display: grid;
  gap: 12px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 48px;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(8, 10, 24, 0.92);
  border: 1px solid var(--line);
}

.hud div {
  min-width: 0;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1.05rem, 3.4vw, 1.5rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.icon-button,
.vote-button {
  border: 1px solid #3448a2;
  background: #12183a;
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 1.45rem;
  line-height: 1;
}

.icon-button:hover,
.vote-button:hover {
  border-color: var(--blue);
  background: #18215b;
}

.icon-button:active,
.vote-button:active {
  transform: translateY(1px) scale(0.98);
}

.canvas-frame {
  position: relative;
  width: 100%;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
  color: var(--yellow);
  font-size: clamp(1.4rem, 8vw, 4rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 18px rgba(255, 209, 46, 0.7);
}

.overlay.is-hidden {
  display: none;
}

.vote-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 72px));
  grid-template-rows: repeat(2, 54px);
  justify-content: center;
  gap: 8px;
}

.vote-button {
  min-width: 0;
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: 900;
}

.vote-button.up {
  grid-column: 2;
}

.vote-button.left {
  grid-column: 1;
  grid-row: 2;
}

.vote-button.down {
  grid-column: 2;
  grid-row: 2;
}

.vote-button.right {
  grid-column: 3;
  grid-row: 2;
}

.vote-button.is-active {
  color: #050710;
  border-color: var(--yellow);
  background: var(--yellow);
  box-shadow: 0 0 22px rgba(255, 209, 46, 0.38);
}

.tally {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: rgba(8, 10, 24, 0.92);
  border: 1px solid var(--line);
}

.tally-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
}

.tally-row span,
.tally-row strong {
  font-variant-numeric: tabular-nums;
}

meter {
  width: 100%;
  height: 8px;
}

meter::-webkit-meter-bar {
  background: #12183a;
  border: 0;
  border-radius: 999px;
}

meter::-webkit-meter-optimum-value {
  background: linear-gradient(90deg, var(--blue), var(--yellow));
  border-radius: 999px;
}

meter::-moz-meter-bar {
  background: linear-gradient(90deg, var(--blue), var(--yellow));
  border-radius: 999px;
}

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

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 42px;
    padding: 8px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .vote-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, 50px);
  }

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