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

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px;
  background: var(--bg-primary);
  border-bottom: 1px solid #22222e;
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: 3px; color: var(--text-primary); }
.brand-sub {
  font-size: 13px; font-weight: 700; letter-spacing: 2px; color: var(--text-muted);
  min-width: 70px; text-align: right;
}
.brand-sub.live { color: var(--accent-secondary); }
.iconbtn {
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 30px; line-height: 44px; text-align: center; font-weight: 700;
}
.hint {
  text-align: center; padding: 16px; font-size: 14px; color: var(--text-muted);
  background: var(--bg-primary); border-top: 1px solid #22222e; letter-spacing: 0.5px;
}

/* ---- home ---- */
.home-main {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 28px; padding: 24px;
}
.ring-wrap { position: relative; width: 280px; height: 280px; }
.ring { width: 280px; height: 280px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--bg-tertiary); stroke-width: 14; }
.ring-prog {
  fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 628.3; stroke-dashoffset: 628.3;
  transition: stroke-dashoffset 0.5s linear;
}
.ring-prog.live { stroke: var(--accent-secondary); }
.ring-center {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.countdown { font-size: 64px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.countdown-label { font-size: 15px; color: var(--text-secondary); margin-top: 4px; letter-spacing: 0.5px; }

.home-actions { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.row2 { display: flex; gap: 16px; }
.tile {
  flex: 1; background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 16px; text-align: center; min-height: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tile-num { font-size: 30px; font-weight: 800; color: var(--accent); }
.tile-num .unit { font-size: 17px; color: var(--text-secondary); font-weight: 600; }
.tile-lbl { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---- buttons ---- */
.btn {
  width: 100%; min-height: 88px; border-radius: var(--radius-md);
  font-size: 24px; font-weight: 700; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--accent); color: #04121a; }
.btn-primary.running { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-ghost { background: var(--bg-tertiary); color: var(--text-primary); }

/* ---- alert ---- */
.alert-main {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px; padding: 32px; text-align: center;
  background: var(--bg-primary);
}
.alert-pulse {
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,255,136,0.25), rgba(0,255,136,0.02));
  border: 3px solid var(--accent-secondary);
  display: flex; align-items: center; justify-content: center;
  animation: pulse 1.6s ease-in-out infinite;
}
.alert-arrow { font-size: 80px; color: var(--accent-secondary); font-weight: 800; line-height: 1; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0,255,136,0.4); }
  50% { transform: scale(1.06); box-shadow: 0 0 40px 6px rgba(0,255,136,0.25); }
}
@media (prefers-reduced-motion: reduce) {
  .alert-pulse { animation: none; }
}
.alert-title { font-size: 52px; font-weight: 800; letter-spacing: 1px; }
.alert-sub { font-size: 19px; color: var(--text-secondary); max-width: 440px; line-height: 1.45; }
.alert-actions { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }

/* ---- settings list ---- */
.list { flex: 1; padding: 24px 28px; display: flex; flex-direction: column; gap: 26px; overflow-y: auto; }
.field { display: flex; flex-direction: column; gap: 12px; }
.field-lbl { font-size: 19px; font-weight: 700; color: var(--text-primary); }
.field-hint { font-size: 14px; color: var(--text-muted); }
.seg { display: flex; gap: 10px; }
.chip {
  flex: 1; min-height: 64px; border-radius: 10px;
  background: var(--bg-secondary); color: var(--text-secondary);
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.chip.active { background: var(--accent); color: #04121a; }
.toggle {
  width: 140px; min-height: 56px; border-radius: 28px;
  background: var(--bg-tertiary); position: relative;
  display: flex; align-items: center; padding: 0 16px;
}
.toggle .toggle-knob {
  position: absolute; left: 6px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--text-muted); transition: all 0.18s ease;
}
.toggle .toggle-txt { margin-left: auto; font-size: 18px; font-weight: 700; color: var(--text-secondary); }
.toggle[aria-pressed="true"] { background: rgba(0,212,255,0.18); }
.toggle[aria-pressed="true"] .toggle-knob { left: calc(100% - 50px); background: var(--accent); }
.toggle[aria-pressed="true"] .toggle-txt { color: var(--accent); margin-left: 0; margin-right: auto; }

/* ---- stats ---- */
.stats-main { flex: 1; padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.stat-big { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 22px; text-align: center; }
.stat-big-num { font-size: 60px; font-weight: 800; color: var(--accent-secondary); }
.stat-big-lbl { font-size: 16px; color: var(--text-secondary); margin-top: 2px; }
.stat-grid { display: flex; gap: 16px; }
.stat-cell { flex: 1; background: var(--bg-secondary); border-radius: var(--radius-md); padding: 18px; text-align: center; }
.stat-cell-num { font-size: 36px; font-weight: 800; color: var(--accent); }
.stat-cell-lbl { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 90px; padding: 0 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; border-radius: 6px 6px 0 0; background: var(--accent); min-height: 4px; transition: height 0.3s ease; }
.bar-fill.today { background: var(--accent-secondary); }
.bar-day { font-size: 12px; color: var(--text-muted); }
.bars-lbl { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: -8px; }
#btn-reset { margin-top: auto; min-height: 64px; font-size: 18px; }
