:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; min-height: 72px;
  background: var(--bg-primary); border-bottom: 1px solid #20202c;
}
.header-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.header-label { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.header-info h1 { font-size: 26px; font-weight: 800; color: var(--text-primary); }
.header-total { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.header-num { font-size: 28px; font-weight: 800; color: var(--accent); }

/* ===== Stage (home) ===== */
.stage {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 10px 20px;
}
.result-label { font-size: 13px; letter-spacing: 4px; font-weight: 700; color: var(--text-muted); }
.result-num {
  font-size: 150px; font-weight: 800; line-height: 0.9; color: var(--text-primary);
  text-shadow: 0 0 40px rgba(0, 212, 255, 0.35);
  font-variant-numeric: tabular-nums;
}
.result-num.pop { animation: pop 0.34s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(0.5); opacity: 0.4; } 100% { transform: scale(1); opacity: 1; } }
.stage-meta { display: flex; gap: 10px; align-items: center; }
.chip {
  background: var(--bg-tertiary); color: var(--text-secondary);
  border-radius: 999px; padding: 7px 16px; font-size: 15px; font-weight: 700;
}
.chip-mode { color: var(--accent-secondary); }

/* ===== Pick button ===== */
.pick-btn {
  margin: 0 20px; height: 92px; border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: #04141a; font-size: 32px; font-weight: 800; letter-spacing: 3px;
  display: flex; align-items: center; justify-content: center;
}
.pick-btn:focus { border-color: #ffffff; box-shadow: 0 0 28px rgba(0, 212, 255, 0.7); }
.pick-btn.busy { opacity: 0.6; }

/* ===== Nav row ===== */
.nav-row { display: flex; gap: 12px; padding: 14px 20px 18px; }
.nav-btn {
  flex: 1; height: 60px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 17px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
}
.nav-btn.danger { color: var(--danger); }

/* ===== Settings ===== */
.settings-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 10px 20px 8px; display: flex; flex-direction: column; gap: 12px;
}
.settings-body::-webkit-scrollbar { width: 6px; }
.settings-body::-webkit-scrollbar-thumb { background: #2c2c3c; border-radius: 3px; }
.section-label {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700; margin-top: 4px;
}
.preset-row { display: flex; gap: 8px; }
.preset {
  flex: 1; height: 52px; border-radius: var(--radius-md);
  background: var(--bg-secondary); color: var(--text-primary);
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper-label { font-size: 18px; font-weight: 700; color: var(--text-secondary); width: 50px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.step {
  min-width: 54px; height: 50px; border-radius: var(--radius-md); padding: 0 6px;
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-value { min-width: 82px; text-align: center; font-size: 26px; font-weight: 800; color: var(--accent); }

/* ===== Mode selector ===== */
.mode-row { display: flex; align-items: center; gap: 12px; }
.mode-arrow {
  width: 60px; height: 64px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--accent);
  font-size: 34px; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.mode-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.mode-name { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.mode-desc { font-size: 14px; color: var(--text-secondary); }
.dist { display: flex; align-items: flex-end; gap: 4px; height: 56px; padding: 8px 4px 0; }
.dist-bar {
  flex: 1; background: linear-gradient(180deg, var(--accent), #0077aa);
  border-radius: 3px 3px 0 0; min-height: 6%;
  transition: height 0.2s ease;
}

/* ===== Toggle ===== */
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 18px; border-radius: var(--radius-md);
  background: var(--bg-secondary); color: var(--text-primary); width: 100%;
}
.toggle-label { font-size: 18px; font-weight: 700; }
.toggle-state {
  font-size: 16px; font-weight: 800; color: var(--text-muted);
  background: var(--bg-tertiary); border-radius: 999px;
  padding: 6px 16px; min-width: 56px; text-align: center;
}
.toggle.on .toggle-state { color: #04141a; background: var(--accent-secondary); }

/* ===== History ===== */
.history-list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 12px 18px; display: flex; flex-direction: column; gap: 10px;
}
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: #2c2c3c; border-radius: 3px; }
.history-row {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 12px 16px; min-height: 64px;
  display: flex; align-items: center; gap: 14px;
}
.hr-num { font-size: 34px; font-weight: 800; color: var(--text-primary); min-width: 96px; text-align: center; }
.hr-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hr-meta { font-size: 14px; color: var(--text-secondary); }
.hr-mode { color: var(--accent-secondary); font-weight: 700; }
.hr-time { font-size: 12px; color: var(--text-muted); }
.empty-state {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 20px;
}

/* ===== Confirm ===== */
.confirm-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 20px 40px; text-align: center;
}
.confirm-icon { font-size: 64px; color: var(--danger); line-height: 1; }
.confirm-text { font-size: 19px; line-height: 1.5; color: var(--text-secondary); max-width: 440px; }
