:root {
  --bg: #0b0f0c;
  --card: #141a15;
  --card2: #1a221c;
  --ink: #eef4ee;
  --muted: #93a093;
  --line: #263028;
  --accent: #34d058;
  --accent-dim: #1d7a34;
  --warn: #f0b429;
  --danger: #e5484d;
  --radius: 14px;
  --tab-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: calc(var(--tab-h) + 24px);
  min-height: 100vh;
}
.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: rgba(11,15,12,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 20px; }
.streak { background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.streak b { color: var(--warn); }
main { padding: 12px 12px 0; }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none;} }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card.hero h2 { margin: 4px 0 6px; font-size: 26px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--ink);
  border-radius: 10px; padding: 11px 14px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06130a; }
.btn.big { width: 100%; margin-top: 12px; padding: 14px; font-size: 16px; }
.btn.subtle { width: 100%; margin-top: 8px; background: transparent; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 9px 4px; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent-dim); color: #fff; }
.field { margin: 10px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 11px 12px; font-size: 16px;
}
.field input:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; margin: 8px 0; font-size: 14px; cursor: pointer;
}
.check-row input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.ex { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ex-head b { font-size: 15px; }
.ex-head .target { font-size: 12.5px; color: var(--muted); }
.ex-sets { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.set-dot {
  width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--muted); font-weight: 700; font-size: 15px; cursor: pointer;
}
.set-dot.done { background: var(--accent); border-color: var(--accent); color: #06130a; }
.ex-reps { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--muted); }
.ex-reps input { width: 58px; background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 6px; font-size: 15px; text-align: center; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0 12px; }
.week-day { text-align: center; font-size: 11px; color: var(--muted); }
.week-day .dot { width: 100%; aspect-ratio: 1; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); margin-top: 4px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.week-day.hit .dot { background: rgba(52,208,88,.18); border-color: var(--accent-dim); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 19px; color: var(--accent); }
.stat span { font-size: 11.5px; color: var(--muted); }
.list .item { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.list .item:last-child { border-bottom: 0; }
.list .item .tag { font-size: 11px; font-weight: 700; background: var(--accent-dim); color: #fff; border-radius: 6px; padding: 3px 7px; margin-right: 8px; }
.list .item .tag.cardio { background: #1d5f7a; }
canvas { width: 100%; display: block; }
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; height: var(--tab-h);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(15,20,16,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.tabbar button span { font-size: 11px; font-weight: 600; }
.tabbar button.on { color: var(--accent); }
.toast {
  position: fixed; bottom: calc(var(--tab-h) + 16px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--accent); color: #06130a; font-weight: 700; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .25s ease;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.danger-zone .btn { font-size: 13px; padding: 9px 10px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 8px 2px; }
