:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f2efe8;
  --ink: #1d1d1b;
  --muted: #66635c;
  --line: #e4e0d6;
  --accent: #e8552e;
  --accent-ink: #ffffff;
  --accent-soft: #fde6dd;
  --green: #1f7a5c;
  --green-soft: #dcefe7;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --max: 1080px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151513;
    --surface: #1e1e1b;
    --surface-2: #272723;
    --ink: #f1efe9;
    --muted: #a9a59b;
    --line: #34332e;
    --accent: #ff7a52;
    --accent-ink: #1a0d08;
    --accent-soft: #3a2219;
    --green: #5cc49a;
    --green-soft: #1c3229;
    --danger: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); text-underline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-top: 1.6em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
main { padding: 32px 0 64px; min-height: 60vh; }

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--surface-2); }
.nav .btn { margin-left: 6px; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--ink); font-size: 1.1rem; }
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 20px 16px; }
  .nav.open { display: flex; }
  .nav .btn { margin: 6px 0 0; }
}

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: .9rem; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; font-family: inherit; }
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.nav a.btn { color: var(--accent-ink); }
.nav a.btn:hover { background: var(--accent); }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.form-error { color: var(--danger); font-size: .9rem; min-height: 1.3em; margin: 4px 0 8px; }
.form-ok { color: var(--green); font-size: .9rem; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.green { background: var(--green-soft); color: var(--green); }

/* hero */
.hero { padding: 56px 0 24px; display: grid; gap: 40px; grid-template-columns: 1.2fr 1fr; align-items: center; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 24px; } }

.steps { counter-reset: step; }
.step { position: relative; padding-left: 52px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; }

/* stats */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: .9rem; color: var(--muted); font-weight: 600; margin-left: 3px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars .bar span.fill { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--accent); min-height: 2px; }
.bars .bar span.fill.zero { background: var(--line); }
.bars .bar .lbl { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.bars .bar .val { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* feed */
.run { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.run:last-child { border-bottom: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; text-transform: uppercase; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
.run .who a { color: var(--ink); font-weight: 700; text-decoration: none; }
.run .metrics { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.run .metrics b { font-size: 1.05rem; }
.run .actions { display: flex; gap: 8px; margin-top: 6px; }
.run .note { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.kudos-btn.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: .88rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td a { color: var(--ink); font-weight: 600; text-decoration: none; }
td.win { color: var(--green); font-weight: 700; }

/* plan */
.plan-week { margin-bottom: 14px; }
.plan-week h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.session { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.session input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--green); }
.session.done { opacity: .62; }
.session.done .s-title { text-decoration: line-through; }
.session.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.session .s-title { font-weight: 700; }
.session .s-date { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.plan-options { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.plan-option { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.plan-option.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* badges */
.badges { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.badge { text-align: center; padding: 14px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.badge .icon { font-size: 1.8rem; line-height: 1; }
.badge .name { font-size: .8rem; font-weight: 700; margin-top: 6px; }
.badge.locked { opacity: .35; filter: grayscale(1); }

/* gear */
.product { display: flex; flex-direction: column; gap: 8px; }
.product .icon { font-size: 2rem; }
.product .why { color: var(--muted); font-size: .93rem; flex: 1; }
.product .meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.disclosure { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; font-size: .9rem; color: var(--muted); }

/* guide */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.toc a { text-decoration: none; }
.guide-section { scroll-margin-top: 80px; }
.callout { border-left: 4px solid var(--green); background: var(--green-soft); padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 16px 0; }
.callout.warn { border-color: var(--accent); background: var(--accent-soft); }
details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--surface); margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }
ul.check { list-style: none; padding: 0; }
ul.check li { padding-left: 28px; position: relative; margin-bottom: 6px; }
ul.check li::before { content: "✓"; position: absolute; left: 4px; color: var(--green); font-weight: 800; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 50; }
.hidden { display: none !important; }
