: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 ---- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
  min-height: 64px;
}
.bar-title { font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
.bar-date { font-size: 15px; color: var(--text-secondary); }
.bar-back { font-size: 16px; color: var(--accent); font-weight: 600; min-width: 70px; }
.bar-spacer { min-width: 70px; }

/* ---- home ---- */
.home-body {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  padding: 12px 0;
}
.ring-wrap { position: relative; width: 210px; height: 210px; }
.ring { width: 210px; height: 210px; transform: rotate(-90deg); }
.ring-track {
  fill: none; stroke: var(--bg-tertiary); stroke-width: 16;
}
.ring-fill {
  fill: none; stroke: var(--accent-secondary); stroke-width: 16;
  stroke-linecap: round;
  stroke-dasharray: 534.07;
  stroke-dashoffset: 534.07;
  transition: stroke-dashoffset 0.4s ease, stroke 0.2s ease;
}
.ring-center {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-value { font-size: 58px; font-weight: 800; line-height: 1; }
.ring-value.over { color: var(--danger); }
.ring-label { font-size: 16px; color: var(--text-secondary); margin-top: 6px; }

.mini-stats {
  display: flex; gap: 14px; width: 100%; padding: 0 24px;
}
.mini {
  flex: 1; background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 12px 8px; text-align: center;
}
.mini-num { display: block; font-size: 24px; font-weight: 700; }
.mini-lbl { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- nav grid ---- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 16px 24px 24px;
}
.card {
  display: flex; align-items: center; gap: 14px;
  min-height: 88px; padding: 0 20px;
  background: var(--bg-secondary); color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 19px; font-weight: 600; text-align: left;
}
.card-ico { font-size: 26px; width: 32px; text-align: center; }
.card-txt { flex: 1; }

/* ---- entry screens (add / exercise) ---- */
.entry-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 24px;
  padding: 28px 32px;
}
.pending {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 8px;
}
.pending-num { font-size: 84px; font-weight: 800; line-height: 1; color: var(--accent); }
.pending-unit { font-size: 18px; color: var(--text-secondary); margin-top: 6px; }
.presets {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px;
  width: 100%;
}
.preset {
  min-height: 64px;
  background: var(--bg-secondary); color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 18px; font-weight: 700;
}
.stepper {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  width: 100%;
}
.step {
  min-width: 96px; min-height: 64px;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 22px; font-weight: 700;
}
.step-hint { font-size: 15px; color: var(--text-muted); min-width: 80px; text-align: center; }
.step-val { font-size: 20px; font-weight: 700; min-width: 130px; text-align: center; }
.primary {
  width: 100%; min-height: 80px; margin-top: auto;
  background: var(--accent); color: #00181f;
  border-radius: var(--radius-md);
  font-size: 22px; font-weight: 800; letter-spacing: 0.5px;
}
.danger {
  width: 100%; min-height: 72px;
  background: transparent; color: var(--danger);
  border: 2px solid var(--danger); border-radius: var(--radius-md);
  font-size: 19px; font-weight: 700;
}
.danger.focusable:focus { box-shadow: 0 0 20px rgba(255,68,102,0.4); border-color: var(--danger); }

/* ---- setup ---- */
.setup-body {
  flex: 1; display: flex; flex-direction: column; gap: 20px;
  padding: 24px 32px;
}
.field { display: flex; flex-direction: column; gap: 12px; }
.field-lbl { font-size: 17px; color: var(--text-secondary); font-weight: 600; }
.result {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 18px 22px; display: flex; flex-direction: column; gap: 12px;
}
.result-row { display: flex; justify-content: space-between; align-items: baseline; }
.result-lbl { font-size: 17px; color: var(--text-secondary); }
.result-num { font-size: 24px; font-weight: 800; color: var(--accent-secondary); }

/* ---- stats ---- */
.stats-body {
  flex: 1; display: flex; flex-direction: column; gap: 16px;
  padding: 24px 32px;
}
.stat-card {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 18px 22px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card.big { padding: 24px 22px; }
.stat-lbl { font-size: 16px; color: var(--text-secondary); }
.stat-val { font-size: 36px; font-weight: 800; }
.stat-card.big .stat-val { font-size: 52px; color: var(--accent-secondary); }
.stat-card.big .stat-val.over { color: var(--danger); }
.stat-sub { font-size: 14px; color: var(--text-muted); }

/* ---- toast ---- */
.toast {
  position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 14px 28px; border-radius: 999px;
  font-size: 18px; font-weight: 700;
  box-shadow: 0 0 24px rgba(0,255,136,0.25);
  border: 1px solid var(--accent-secondary);
  opacity: 1; transition: opacity 0.3s ease;
  z-index: 10;
}
.toast.fade { opacity: 0; }
