/* 9innings — 8-bit styling */
:root {
  --bg: #0b0f1a;
  --fg: #f8f8f8;
  --accent: #fcd34d;
  --accent2: #4ade80;
  --panel: #1a1f2e;
  --panel-border: #fcd34d;
  --shadow: #000;
}

@font-face {
  font-family: "Pixel";
  src: local("Press Start 2P"), local("VT323"), local("Courier New");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  -webkit-font-smoothing: none;
  font-smooth: never;
  image-rendering: pixelated;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.topbar {
  width: 100%;
  max-width: 920px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 2px solid var(--panel-border);
}

.topbar h1 {
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--shadow);
}

.topbar h1 .dot {
  color: var(--accent2);
  display: inline-block;
  transform: translateY(-2px);
}

.topbar nav { display: flex; gap: 8px; }

.pixel-btn {
  font-family: inherit;
  background: var(--panel);
  color: var(--fg);
  border: 2px solid var(--fg);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
}

.pixel-btn:hover { background: var(--accent); color: var(--bg); }
.pixel-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }

main {
  position: relative;
  width: 100%;
  max-width: 920px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--panel);
  border: 2px solid var(--accent);
  font-size: 10px;
  letter-spacing: 1px;
}

.hud-row { display: flex; gap: 6px; align-items: center; }
.hud-label { color: var(--accent2); }
.hud-val { color: var(--accent); }
.hud-sep { color: #555; }

canvas {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 480 / 432;
  background: #2d8a2d;
  border: 4px solid #000;
  box-shadow: 0 0 0 2px var(--accent);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

.toast {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 8px 14px;
  font-size: 14px;
  letter-spacing: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms;
}

.toast.show { opacity: 1; }

.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 480px);
  background: var(--panel);
  border: 3px solid var(--accent);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 16px;
  z-index: 10;
}

.panel h2 {
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.panel p { font-size: 10px; line-height: 1.6; margin-bottom: 8px; }
.panel kbd {
  background: #333;
  border: 1px solid var(--fg);
  padding: 1px 4px;
  font-size: 9px;
}

.hidden { display: none !important; }

.scores {
  list-style: none;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
  font-size: 10px;
}

.scores li {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 6px;
  padding: 4px 2px;
  border-bottom: 1px dashed #333;
}

.scores .rank { color: var(--accent); }
.scores .name { color: var(--fg); }
.scores .score { color: var(--accent2); }
.scores .badge { color: var(--accent); font-size: 8px; }

.stats {
  font-size: 9px;
  color: #aaa;
  margin-bottom: 12px;
  padding-top: 8px;
  border-top: 1px solid #333;
}

.name-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  color: var(--accent2);
  margin: 12px 0;
}

.name-label input {
  font-family: inherit;
  background: #000;
  color: var(--accent);
  border: 2px solid var(--fg);
  padding: 6px;
  font-size: 12px;
  text-transform: uppercase;
}

.panel-actions { display: flex; gap: 8px; justify-content: flex-end; }

.foot {
  font-size: 8px;
  color: #666;
  margin-top: auto;
  padding: 8px;
  letter-spacing: 1px;
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 14px; }
  .pixel-btn { font-size: 8px; padding: 4px 6px; }
  .hud { font-size: 8px; }
}
