: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;
  padding: 18px;
  gap: 14px;
}
.screen.hidden { display: none; }

.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
  transform: scale(1.02);
}

.hidden { display: none !important; }

/* top bar */
.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 4px 6px;
}
.title {
  font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--text-primary);
}
.date {
  font-size: 16px; color: var(--text-secondary); font-weight: 500;
}

/* ring */
.ring-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ring { display: block; }
.ring-track {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 16;
}
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 16;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
}
.ring-fill.complete {
  stroke: var(--accent-secondary);
  filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.6));
}

.ring-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ring-ml {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--text-primary);
  line-height: 1;
}
.ring-unit {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 600;
}
.ring-goal {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
}

/* primary add button */
.actions {
  display: flex;
  justify-content: center;
  padding: 0 6px;
}
.btn {
  border-radius: var(--radius-md);
  padding: 0 22px;
  font-size: 22px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 88px;
}
.btn.big { width: 100%; max-width: 460px; }
.btn.primary {
  background: linear-gradient(180deg, #00d4ff 0%, #009ec2 100%);
  color: #001218;
}
.btn .plus { font-size: 36px; font-weight: 800; line-height: 1; }
.btn .lbl { font-size: 22px; }

/* bottom nav */
.bottomnav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 6px;
}
.navbtn {
  border-radius: var(--radius-md);
  min-height: 60px;
  font-size: 16px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.navbtn.primary { background: var(--bg-tertiary); color: var(--accent); }
.navbtn.warn { color: var(--danger); }

/* picker screens */
.picker {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.picker-value {
  font-size: 96px;
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--accent);
  line-height: 1;
}
.picker-unit {
  font-size: 22px;
  color: var(--text-secondary);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 6px;
}
.chip {
  min-height: 72px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
}
.chip.selected {
  background: var(--bg-tertiary);
  color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* history */
.histlist {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 6px;
  overflow: hidden;
}
.histrow {
  display: grid;
  grid-template-columns: 90px 1fr 110px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  min-height: 50px;
}
.histrow.today { background: var(--bg-tertiary); }
.histrow .day { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.histrow .bar {
  position: relative;
  height: 14px;
  background: #14141f;
  border-radius: 7px;
  overflow: hidden;
}
.histrow .bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 7px;
}
.histrow .bar-fill.done { background: var(--accent-secondary); }
.histrow .ml { font-size: 16px; color: var(--text-secondary); text-align: right; font-weight: 600; }
.histrow .ml.done { color: var(--accent-secondary); }
