: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;
  padding: 18px 22px 22px;
}
.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; gap: 14px;
  height: 52px; flex: 0 0 auto;
}
.topbar h1 {
  font-size: 26px; font-weight: 700; letter-spacing: 0.2px;
}
.topbar .date {
  margin-left: auto; color: var(--text-secondary); font-size: 16px; font-weight: 500;
}
.iconbtn {
  width: 48px; height: 48px; flex: 0 0 auto;
  background: var(--bg-secondary); color: var(--text-primary);
  border-radius: 12px; font-size: 30px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* Progress ring */
.ring-wrap {
  position: relative; width: 210px; height: 210px;
  margin: 6px auto 4px; flex: 0 0 auto;
}
.ring { width: 210px; height: 210px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-tertiary); stroke-width: 16; }
.ring-fill {
  fill: none; stroke: url(#grad); stroke-width: 16; stroke-linecap: round;
  stroke-dasharray: 502.65; stroke-dashoffset: 502.65;
  transition: stroke-dashoffset 0.5s ease;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-pct { font-size: 18px; font-weight: 600; color: var(--accent); }
.ring-total { font-size: 17px; color: var(--text-secondary); margin-top: 2px; }
.ring-total b { font-size: 40px; font-weight: 700; color: var(--text-primary); }
.ring-goal { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

/* Goal bars */
.bars {
  display: flex; gap: 5px; height: 14px;
  margin: 8px 4px 6px; flex: 0 0 auto;
}
.bars .seg {
  flex: 1 1 0; height: 100%; border-radius: 4px;
  background: var(--bg-tertiary); transition: background 0.3s ease;
}
.bars .seg.on { background: linear-gradient(180deg, var(--accent), var(--accent-secondary)); }

.status {
  text-align: center; font-size: 16px; color: var(--text-secondary);
  margin-bottom: 12px; flex: 0 0 auto; font-weight: 500;
}
.status.done { color: var(--accent-secondary); font-weight: 700; }

/* Button grid */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  flex: 1 1 auto; align-content: end;
}
.btn {
  background: var(--bg-secondary); color: var(--text-primary);
  border-radius: var(--radius-md); font-size: 20px; font-weight: 600;
  min-height: 72px; display: flex; align-items: center; justify-content: center;
}
.btn.primary { color: var(--accent); background: var(--bg-tertiary); }
.btn.alt { color: var(--text-primary); }
.btn.ghost { background: var(--bg-primary); color: var(--text-secondary); font-size: 18px; }

/* Add screen */
.add-body {
  flex: 1 1 auto; display: flex; flex-direction: column;
  justify-content: center; gap: 30px; padding-bottom: 10px;
}
.stepper {
  display: flex; align-items: center; justify-content: center; gap: 28px;
}
.round {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--bg-tertiary); color: var(--accent);
  font-size: 44px; font-weight: 300; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.round.sm { width: 60px; height: 60px; font-size: 32px; }
.amount { min-width: 170px; text-align: center; }
.amount b { font-size: 64px; font-weight: 700; }
.amount span { font-size: 22px; color: var(--text-secondary); margin-left: 6px; }
.presets {
  display: flex; gap: 12px; justify-content: center;
}
.chip {
  flex: 1 1 0; min-height: 64px; border-radius: var(--radius-md);
  background: var(--bg-secondary); color: var(--text-primary);
  font-size: 20px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.btn.big {
  min-height: 88px; font-size: 22px; background: var(--bg-tertiary); color: var(--accent-secondary);
}

/* History */
.hist-list {
  flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px;
  padding-top: 8px;
}
.hist-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 0 18px; height: 64px;
}
.hist-day { width: 92px; font-size: 17px; font-weight: 600; flex: 0 0 auto; }
.hist-bar {
  flex: 1 1 auto; height: 14px; border-radius: 7px;
  background: var(--bg-tertiary); overflow: hidden;
}
.hist-fill {
  display: block; height: 100%; border-radius: 7px;
  background: var(--accent); transition: width 0.4s ease;
}
.hist-fill.met { background: var(--accent-secondary); }
.hist-ml {
  width: 70px; text-align: right; font-size: 17px; font-weight: 600;
  color: var(--text-secondary); flex: 0 0 auto;
}

/* Settings */
.set-body {
  flex: 1 1 auto; display: flex; flex-direction: column; gap: 20px;
  padding-top: 14px;
}
.set-row {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 18px 22px; display: flex; align-items: center; justify-content: space-between;
}
.set-label { font-size: 20px; font-weight: 600; }
.set-ctrl { display: flex; align-items: center; gap: 18px; }
.set-ctrl span { min-width: 96px; text-align: center; font-size: 20px; font-weight: 600; }
.set-body .btn.alt { margin-top: auto; min-height: 80px; }
