: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;
}
#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; }

button.focusable {
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
}

/* ---------- shared layout ---------- */
.app-header { padding: 22px 26px 14px; }
.scr-title {
  font-size: 15px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 700;
}
.scr-pad { padding: 8px 26px 26px; }
.fill { flex: 1; display: flex; flex-direction: column; gap: 18px; min-height: 0; }

.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 8px 22px;
}
.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid #ffffff12;
  font-size: 18px;
}
.row:last-child { border-bottom: none; }
.r-lbl { color: var(--text-secondary); }
.r-val { font-weight: 700; color: var(--text-primary); }

.btn-row { display: flex; gap: 14px; margin-top: auto; }
.wide-btn {
  flex: 1; height: 84px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.wide-btn.primary { background: #06303a; color: var(--accent); }
.wide-btn.danger { color: var(--danger); }

/* ---------- home ---------- */
#home { align-items: center; justify-content: center; padding: 22px 40px; }
.home-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 22px; }
.home-logo { width: 56px; height: 56px; margin-bottom: 2px; }
.home-title { font-size: 35px; font-weight: 800; letter-spacing: 0.5px; }
.home-sub { color: var(--text-secondary); font-size: 16px; }

.menu { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.menu-btn {
  position: relative;
  height: 80px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  display: flex; align-items: center;
  padding: 0 22px 0 0;
  overflow: hidden;
}
.accent-bar { width: 6px; height: 100%; flex: 0 0 6px; }
.a-cyan { background: var(--accent); }
.a-green { background: var(--accent-secondary); }
.a-amber { background: #ffd166; }
.a-muted { background: var(--text-muted); }
.m-label { margin-left: 22px; font-size: 21px; font-weight: 600; }
.m-chev { margin-left: auto; font-size: 30px; color: var(--text-muted); line-height: 1; }

.home-hint { margin-top: 22px; color: var(--text-muted); font-size: 14px; letter-spacing: 1px; }

/* ---------- track ---------- */
#track { padding: 0; }
.track-top {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid #ffffff14;
}
.track-title { font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; }
.badge {
  font-size: 12px; font-weight: 800; letter-spacing: 1.5px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg-tertiary); color: var(--text-secondary);
}
.badge.live { color: var(--accent-secondary); background: #062c1c; }
.badge.demo { color: #ffd166; background: #322a06; }

.track-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 12px 20px; min-height: 0;
}

.gauge {
  position: relative;
  width: 220px; height: 220px; flex: 0 0 220px;
  border-radius: 50%;
  background: conic-gradient(var(--gauge-color, var(--accent)) calc(var(--pct, 0) * 1%), var(--bg-tertiary) 0);
  display: grid; place-items: center;
}
.gauge.beat { animation: beat 0.26s ease-out; }
@keyframes beat {
  0% { transform: scale(1); }
  28% { transform: scale(1.045); }
  100% { transform: scale(1); }
}
.gauge-hole {
  position: absolute; inset: 16px; border-radius: 50%;
  background: var(--bg-primary);
}
.gauge-center { position: relative; z-index: 1; text-align: center; }
.cad-num { font-size: 70px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.cad-unit { font-size: 13px; letter-spacing: 2px; color: var(--text-secondary); margin-top: 6px; }

.cat { font-size: 22px; font-weight: 700; color: var(--text-muted); height: 26px; }

.stats { width: 100%; max-width: 480px; display: flex; justify-content: space-between; }
.stat { flex: 1; text-align: center; }
.s-val { font-size: 24px; font-weight: 700; }
.s-lbl { font-size: 11px; letter-spacing: 1.5px; color: var(--text-secondary); margin-top: 4px; }

.activity {
  width: 100%; max-width: 480px; height: 8px;
  background: var(--bg-tertiary); border-radius: 999px; overflow: hidden;
}
.activity-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  border-radius: 999px;
  transition: width 0.18s ease-out;
}

.track-controls {
  flex: 0 0 auto;
  display: flex; gap: 14px;
  padding: 14px 24px 24px;
  background: var(--bg-primary);
}
.ctrl-btn {
  flex: 1; height: 84px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ctrl-btn.danger { color: var(--danger); }

/* ---------- history ---------- */
.hist-empty { color: var(--text-secondary); font-size: 18px; padding: 24px 4px; text-align: center; }
.hist-list {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding-right: 4px;
}
.hist-list::-webkit-scrollbar { width: 6px; }
.hist-list::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 999px; }
.hist-item {
  flex: 0 0 auto;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px;
}
.hi-main { display: flex; flex-direction: column; gap: 4px; }
.hi-date { font-size: 17px; font-weight: 700; }
.hi-sub { font-size: 13px; color: var(--text-secondary); }
.hi-cad { text-align: right; }
.hi-cad b { font-size: 22px; }
.hi-cad span { font-size: 11px; color: var(--text-secondary); display: block; letter-spacing: 1px; }

/* ---------- settings ---------- */
.set-list { display: flex; flex-direction: column; gap: 12px; }
.set-row {
  width: 100%; height: 78px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
}
.set-lbl { font-size: 18px; }
.set-val { font-size: 18px; font-weight: 700; color: var(--accent); }
.set-note { color: var(--text-muted); font-size: 14px; padding: 4px 4px 0; }

/* ---------- about ---------- */
.about-card p { font-size: 16px; line-height: 1.5; color: var(--text-primary); margin-bottom: 12px; }
.about-card p:last-child { margin-bottom: 0; }
.about-card .muted { color: var(--text-secondary); font-size: 14px; }
.about-card strong { color: var(--accent); }
