:root {
  --ground: #f6f3ec;
  --paper: #fffdf8;
  --ink: #17213a;
  --ink-2: #4b5468;
  --line: #d9d3c6;
  --accent: #c8502e;
  --accent-ink: #ffffff;
  --swim: #2b6f9e;
  --bike: #c8502e;
  --run: #3b7a57;
  --soft: #ece7dc;
  --ok: #3b7a57;
  --warn: #9a6b00;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --maxw: 980px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #15181f; --paper: #1d2129; --ink: #ece8df; --ink-2: #b3ad9f; --line: #363b47; --soft: #262b36;
    --swim: #6fa8d6; --bike: #e8825f; --run: #7fb98f; --accent: #e8825f; --accent-ink: #15181f; --ok: #7fb98f; --warn: #d9a83a;
  }
}
:root[data-theme="dark"] {
  --ground: #15181f; --paper: #1d2129; --ink: #ece8df; --ink-2: #b3ad9f; --line: #363b47; --soft: #262b36;
  --swim: #6fa8d6; --bike: #e8825f; --run: #7fb98f; --accent: #e8825f; --accent-ink: #15181f; --ok: #7fb98f; --warn: #d9a83a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.55; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: clamp(23px, 3.2vw, 30px); margin-top: 1.6em; }
h3 { font-size: 20px; margin-top: 1.4em; }
p { margin: 0 0 1em; }
small, .muted { color: var(--ink-2); }
code { font-family: var(--font-mono); font-size: .9em; background: var(--soft); padding: 1px 5px; border-radius: 4px; }
table { border-collapse: collapse; width: 100%; margin: 1em 0 1.5em; font-size: 15.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
blockquote { margin: 1.2em 0; padding: .6em 1em; border-left: 3px solid var(--accent); background: var(--paper); color: var(--ink-2); border-radius: 0 var(--radius) var(--radius) 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
header.site { border-bottom: 1px solid var(--line); background: var(--paper); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
nav.main a { color: var(--ink-2); text-decoration: none; margin-left: 18px; font-size: 15px; padding: 8px 0; display: inline-block; }
nav.main a:hover, nav.main a[aria-current] { color: var(--ink); border-bottom: 2px solid var(--accent); }
footer.site { border-top: 1px solid var(--line); margin-top: 60px; padding: 28px 0 40px; color: var(--ink-2); font-size: 14px; }
footer.site a { color: var(--ink-2); }
main { padding: 28px 0 0; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(.95); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
input[type="text"], input[type="number"], input[type="email"], input[type="time"], select { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: inherit; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hint { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { margin-top: 0; }
.card h3 { margin-top: .2em; }
.leg-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; color: #fff; }
.leg-swim { background: var(--swim); } .leg-bike { background: var(--bike); } .leg-run { background: var(--run); } .leg-t { background: var(--ink-2); }
.pill { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); }
.notice { background: var(--soft); border-radius: var(--radius); padding: 12px 14px; font-size: 15px; }

/* hero / predictor */
.hero { padding: 24px 0 8px; }
.hero h1 { max-width: 760px; }
.hero p.lead { font-size: 19px; color: var(--ink-2); max-width: 680px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--ink-2); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--soft); }
.filelist { list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; }
.filelist li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.filelist .fname { font-family: var(--font-mono); font-size: 13px; }

.result-head { display: grid; gap: 18px; grid-template-columns: 1.2fr 1fr; align-items: end; }
@media (max-width: 640px) { .result-head { grid-template-columns: 1fr; } }
.big-time { font-family: var(--font-display); font-size: clamp(44px, 9vw, 72px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.window { font-size: 16px; color: var(--ink-2); margin-top: 6px; }
.window b { color: var(--ink); font-variant-numeric: tabular-nums; }
.splitbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 14px 0 6px; }
.splitbar div { height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.pct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.pct { background: var(--soft); border-radius: 8px; padding: 10px 12px; }
.pct b { font-size: 24px; font-family: var(--font-display); display: block; }
.pct small { font-size: 12px; }

/* email gate */
.gate { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 720px) { .gate { grid-template-columns: 1fr; } }
.gate form { display: flex; gap: 10px; flex-wrap: wrap; }
.gate form input[type="email"] { flex: 1 1 220px; }
.gate .fineprint { font-size: 13px; color: var(--ink-2); margin-top: 10px; }

/* cheat sheet */
.sheet { background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; font-size: 14px; }
.sheet h2 { margin: 0; font-size: 24px; }
.sheet .sub { color: #555; margin-bottom: 12px; }
.sheet table { font-size: 13.5px; margin: 8px 0 12px; }
.sheet th, .sheet td { padding: 5px 8px; border-bottom: 1px solid #ddd; color: #111; }
.sheet th { color: #555; }
.sheet .leg-title { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; font-weight: 700; font-size: 15px; }
.sheet .hard { margin: 8px 0; padding: 8px 10px; border-left: 3px solid #c8502e; background: #faf3ef; }
.sheet .window-box { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 12px; }
.sheet .window-box div { border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; min-width: 130px; }
.sheet .window-box b { font-size: 22px; font-family: var(--font-display); display: block; font-variant-numeric: tabular-nums; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
@media print {
  header.site, footer.site, .no-print, .tabs, .card:not(.print-only) { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .sheet { border: 0; padding: 0; page-break-inside: avoid; }
  main { padding: 0; }
}

/* blog */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.post-list h3 { margin: 0 0 4px; }
.post-list h3 a { color: var(--ink); text-decoration: none; }
.post-list h3 a:hover { color: var(--accent); }
.post-meta { font-size: 14px; color: var(--ink-2); }
article.post h1 { margin-bottom: .2em; }
article.post .post-meta { margin-bottom: 1.6em; }
article.post img { max-width: 100%; height: auto; }
.method-box { margin-top: 2.5em; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.method-box h2 { font-size: 18px; margin-top: 0; }
.voice { background: #fff6d6; color: #5a4300; border-left: 3px solid #e0b100; padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 15px; }
:root[data-theme="dark"] .voice, :root:not([data-theme="light"]) .voice { background: #3a3110; color: #f1dc8a; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .voice { background: #fff6d6; color: #5a4300; } }
.subscribe { margin: 2em 0; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.subscribe form { display: flex; gap: 10px; flex-wrap: wrap; }
.subscribe input[type="email"] { flex: 1 1 220px; }
.lang-toggle { font-size: 14px; }
.lang-toggle button { background: none; border: 0; color: var(--ink-2); font: inherit; cursor: pointer; padding: 6px; min-height: 36px; }
.lang-toggle button[aria-pressed="true"] { color: var(--ink); font-weight: 700; text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
details summary { cursor: pointer; font-weight: 600; }
details { margin: 10px 0; }
