:root {
  color-scheme: dark;
  --bg: #0f1115;
  --card: #171a21;
  --border: #2a2e37;
  --text: #e6e8ec;
  --muted: #9aa1ac;
  --accent: #6ea8fe;
  --danger: #ff6b6b;
  --good: #4ade80;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", sans-serif;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.wrap { width: 100%; max-width: 700px; }

header { text-align: center; margin-bottom: 24px; }
h1 { margin: 0 0 6px; font-size: 1.8rem; }
.sub { color: var(--muted); margin: 0; font-size: 0.9rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.hide { display: none; }

.row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.field { flex: 1; min-width: 160px; }
.field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.field input[type="range"] { width: 100%; }

.btn-group { display: flex; gap: 8px; }
.mode-btn {
  flex: 1;
  padding: 10px;
  background: #0f1115;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.mode-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(110,168,254,0.1); }

.primary-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #0f1115;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.primary-btn:hover { opacity: 0.9; }

.best { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }

.hud {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  background: #0f1115;
  border-radius: 8px;
  padding: 10px 16px;
}
.hud-item { display: flex; flex-direction: column; align-items: center; font-size: 1.1rem; font-weight: 700; }
.hud-label { font-size: 0.7rem; color: var(--muted); font-weight: 400; margin-bottom: 2px; }

#game-canvas {
  width: 100%;
  height: 420px;
  background: #05060a;
  border-radius: 8px;
  cursor: crosshair;
  display: block;
}

.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.result-card {
  background: #0f1115;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-label { font-size: 0.75rem; color: var(--muted); }
.result-value { font-size: 1.4rem; font-weight: 700; color: var(--accent); }

h2, h3 { margin-top: 0; }
h3 { font-size: 0.95rem; color: var(--muted); }

#hist-canvas { width: 100%; height: 160px; background: #0f1115; border-radius: 8px; margin-bottom: 20px; }
