: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: box-shadow 0.15s ease, border-color 0.15s ease, transform 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 {
  height: 60px; flex: 0 0 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid #20202c;
}
.app-title { font-size: 20px; font-weight: 600; letter-spacing: 0.2px; }
.clock {
  font-size: 17px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
}
.clock.hint { font-size: 14px; color: var(--text-muted); }

/* ---------- Home body / ring ---------- */
.home-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px;
  padding: 8px 24px;
}
.ring-wrap { position: relative; width: 248px; height: 248px; }
.ring { width: 248px; height: 248px; display: block; }
.ring-track { fill: none; stroke: var(--bg-tertiary); stroke-width: 16; }
.ring-progress {
  fill: none; stroke: var(--accent); stroke-width: 16; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 120px 120px;
  transition: stroke-dashoffset 0.9s linear, stroke 0.3s ease;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.countdown {
  font-size: 48px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.ring-label {
  margin-top: 8px; font-size: 14px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 2px;
}
.ring-wrap.dim .ring-progress { stroke: var(--text-muted); }
.ring-wrap.dim .countdown { color: var(--text-secondary); }

/* ---------- Today progress ---------- */
.today-row { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 10px; }
.today-head { display: flex; align-items: center; justify-content: space-between; }
.today-count { font-size: 19px; font-weight: 600; }
.streak-chip {
  font-size: 13px; color: var(--accent-secondary);
  background: var(--bg-tertiary); padding: 5px 12px; border-radius: 999px;
  letter-spacing: 0.3px;
}
.today-track {
  height: 12px; background: var(--bg-tertiary);
  border-radius: 999px; overflow: hidden;
}
.today-fill {
  height: 100%; width: 0%;
  background: var(--accent); border-radius: 999px;
  transition: width 0.4s ease, background 0.3s ease;
}
.today-fill.done { background: var(--accent-secondary); }

/* ---------- Bottom navigation ---------- */
.home-nav { flex: 0 0 auto; padding: 14px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.nav-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nav-row2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.nav-btn {
  min-height: 72px;
  background: var(--bg-secondary); color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 17px; font-weight: 600; font-family: inherit;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.nav-btn.wide { width: 100%; min-height: 80px; font-size: 20px; }
.nav-btn.primary {
  background: var(--accent); color: #04121a; font-weight: 700;
}
.nav-btn.primary:focus { box-shadow: 0 0 26px rgba(0, 212, 255, 0.65); }
.nav-row3 .nav-btn { font-size: 16px; min-height: 70px; }

/* ---------- Reminder alert ---------- */
.alert-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  padding: 40px; text-align: center;
}
.alert-icon {
  width: 130px; height: 130px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 70px; font-weight: 700; color: var(--accent);
  background: radial-gradient(circle at 50% 45%, rgba(0,212,255,0.18), var(--bg-secondary));
  border: 3px solid var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(0,212,255,0); }
  50% { transform: scale(1.06); box-shadow: 0 0 38px rgba(0,212,255,0.55); }
}
.alert-title { font-size: 36px; font-weight: 700; letter-spacing: 0.3px; }
.alert-sub { font-size: 18px; color: var(--text-secondary); }
.alert-actions { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }

/* ---------- Stats ---------- */
.stats-body { flex: 1; display: flex; flex-direction: column; gap: 22px; padding: 22px 24px; }
.stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.stat-card .big {
  font-size: 32px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-card .lbl { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

.chart {
  flex: 1; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 8px; background: var(--bg-secondary);
  border-radius: var(--radius-md); padding: 18px 16px;
}
.bar-col {
  flex: 1; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px;
}
.bar-val { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; min-height: 16px; }
.bar-track {
  width: 36px; height: 150px; background: var(--bg-tertiary);
  border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden;
}
.bar {
  width: 100%; min-height: 3px; background: var(--accent);
  border-radius: 8px 8px 0 0; transition: height 0.4s ease;
}
.bar.met { background: var(--accent-secondary); }
.bar-lbl { font-size: 13px; color: var(--text-muted); }
.bar-col.today .bar-lbl { color: var(--accent); font-weight: 700; }
.bar-col.today .bar-track { outline: 2px solid rgba(0,212,255,0.35); }

/* ---------- Settings ---------- */
.settings-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 24px; }
.setting-row {
  min-height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--bg-secondary); border-radius: var(--radius-md);
}
.set-label { font-size: 17px; }
.set-value {
  display: flex; align-items: center; gap: 12px;
  font-size: 17px; font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.set-value .chev { color: var(--text-muted); font-size: 22px; line-height: 1; }
.toggle-val { color: var(--accent-secondary); }

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 12px 22px; border-radius: 999px; font-size: 15px;
  border: 1px solid #2a2a3a; box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  opacity: 1; transition: opacity 0.3s ease; z-index: 10; pointer-events: none;
}
.toast.hidden { opacity: 0; display: none; }
