:root {
  --bg: #0A0F0C;
  --bg-2: #111814;
  --card: #151D18;
  --card-2: #1C2620;
  --line: #243029;
  --text: #EEF5F0;
  --muted: #8FA197;
  --faint: #5E6E65;
  --accent: #C8FA3C;
  --accent-2: #2EE6A8;
  --accent-ink: #0A0F0C;
  --warn: #FFB547;
  --danger: #FF6B6B;
  --blue: #6CB8FF;
  --grad: linear-gradient(135deg, #2EE6A8 0%, #C8FA3C 100%);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F6F2;
  --bg-2: #EAEFE9;
  --card: #FFFFFF;
  --card-2: #F2F5F1;
  --line: #DDE4DC;
  --text: #0F1812;
  --muted: #5B6B61;
  --faint: #93A198;
  --accent: #7BC400;
  --accent-2: #00B37E;
  --accent-ink: #FFFFFF;
  --shadow: 0 8px 24px rgba(20,40,30,.08);
  --grad: linear-gradient(135deg, #00B37E 0%, #86CC00 100%);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent-2); }
[hidden] { display: none !important; }

/* Splash */
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; transition: opacity .35s; }
.splash img { border-radius: 24px; animation: pulse 1.4s ease-in-out infinite; }
.splash.out { opacity: 0; pointer-events: none; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* Layout */
.app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; }
.screen {
  padding: calc(var(--safe-top) + 18px) 18px calc(var(--nav-h) + var(--safe-bottom) + 28px);
  animation: fadein .25s ease;
}
.screen.no-nav { padding-bottom: calc(var(--safe-bottom) + 28px); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 28px; line-height: 1.1; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px 12px calc(var(--safe-bottom) + 8px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--faint); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.nav a .pill { width: 56px; height: 30px; border-radius: 16px; display: grid; place-items: center; transition: background .2s; }
.nav a.active { color: var(--text); }
.nav a.active .pill { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
:root[data-theme="light"] .nav a.active .pill { color: #3E6B00; }
.nav svg { width: 22px; height: 22px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.flat { background: var(--bg-2); }
.card h2, .section-title { font-size: 17px; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
.section-title { margin: 24px 4px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.section-title a, .link { font-size: 13.5px; color: var(--accent-2); font-weight: 600; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stack > * + * { margin-top: 10px; }

/* Hero workout card */
.hero {
  position: relative; overflow: hidden;
  background: var(--grad); color: #07130C;
  border: 0; padding: 22px;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.18);
}
.hero .eyebrow { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.hero h2 { font-size: 24px; line-height: 1.15; margin: 6px 0 8px; font-weight: 800; letter-spacing: -.02em; position: relative; z-index: 1; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; position: relative; z-index: 1; }
.hero .chip { background: rgba(7,19,12,.12); color: #07130C; }
.hero .btn { position: relative; z-index: 1; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--card-2); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.chip.accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
:root[data-theme="light"] .chip.accent { color: #3E6B00; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 15px; transition: transform .1s, opacity .2s; text-decoration: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.sm svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.dark { background: #07130C; color: #EEF5F0; }
.btn.ghost { background: var(--card-2); color: var(--text); }
.btn.outline { border: 1px solid var(--line); color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--text); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }

/* Stats */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.delta { font-size: 12.5px; font-weight: 700; }
.delta.good { color: var(--accent-2); }
.delta.bad { color: var(--warn); }
.delta.neutral { color: var(--muted); }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; border-radius: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.day .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--muted); font-size: 12px; }
.day.today { background: var(--card-2); color: var(--text); }
.day.planned .dot { border: 2px dashed var(--accent-2); background: transparent; color: var(--accent-2); }
.day.done .dot { background: var(--accent); color: var(--accent-ink); border: 0; }
.day.missed .dot { background: transparent; border: 2px solid var(--line); }

/* Progress ring */
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 18px; line-height: 1; }
.ring .center small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 3px; }

/* Lists */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.list-item:last-child { border-bottom: 0; }
.list-item .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--card-2); flex: none; font-size: 20px; }
.list-item .title { font-weight: 700; font-size: 15px; }
.list-item .desc { color: var(--muted); font-size: 13px; }
.list-item.done .title { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--muted); }
.chev { color: var(--faint); }

/* Forms */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line); outline: none; font-size: 16px;
}
.input:focus { border-color: var(--accent-2); }
.seg { display: flex; background: var(--card-2); border-radius: 999px; padding: 4px; gap: 4px; border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 40px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); font-weight: 600; font-size: 14px; color: var(--muted); }
.check.on { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--text); }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick .check { padding: 12px 0; text-align: center; border-radius: 14px; }

/* Sheet */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto;
  background: var(--bg-2); border-radius: 28px 28px 0 0; padding: 10px 20px calc(var(--safe-bottom) + 22px);
  max-height: 92vh; overflow-y: auto; animation: up .28s cubic-bezier(.2,.9,.3,1);
  border-top: 1px solid var(--line);
}
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { font-size: 21px; margin: 0 0 4px; font-weight: 800; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Charts */
.chart { width: 100%; height: 180px; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 10px; font-family: inherit; }
.chart .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .goal { stroke-dasharray: 4 4; stroke-width: 1.5; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 999px; background: var(--card-2); color: var(--muted); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tab.on { background: var(--text); color: var(--bg); }

/* Auth / onboarding */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 28px); }
.auth .brand { display: flex; align-items: center; gap: 12px; }
.auth .brand img { width: 52px; height: 52px; border-radius: 16px; }
.auth .brand b { font-size: 26px; letter-spacing: .04em; font-weight: 800; }
.auth h1 { font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; margin: 0 0 14px; }
.auth h1 em { font-style: normal; padding-right: .06em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.google-btn { background: #fff; color: #1F1F1F; gap: 12px; }
.google-btn svg { width: 20px; height: 20px; }
.steps { display: flex; gap: 6px; margin-bottom: 26px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--accent); }
.onb h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.15; }
.onb .lead { color: var(--muted); margin: 0 0 24px; }
.bottom-actions { display: flex; gap: 10px; margin-top: 26px; }

/* Misc */
.tip { display: flex; gap: 12px; align-items: flex-start; }
.tip .emoji { font-size: 22px; line-height: 1; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--grad); border-radius: 4px; }
.badge-demo { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--card-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
pre.code { display: block; padding: 12px; white-space: pre-wrap; overflow-x: auto; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 6px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.rating { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rating button { padding: 14px 6px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rating button .e { font-size: 26px; }
.rating button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
