:root {
  --bg: #fbfbfb;
  --panel: #ffffff;
  --panel-2: #f6f6f7;
  --ink: #0f1012;
  --ink-2: #5f636b;
  --ink-3: #9a9ea6;
  --line: #e7e7ea;
  --line-2: #efeff1;
  --grid: #ececef;
  --rider: #c7c9ce;
  --accent: #5e6ad2;
  --up: #b45309;
  --down: #047857;
  --shadow: 0 1px 1px rgba(0,0,0,.03), 0 4px 16px rgba(0,0,0,.05);
  --pop: 0 0 0 1px rgba(0,0,0,.06), 0 12px 40px rgba(0,0,0,.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08090a; --panel: #0f1011; --panel-2: #151618; --ink: #f7f8f8; --ink-2: #8a8f98; --ink-3: #5c6069;
    --line: #1f2023; --line-2: #18191b; --grid: #17181a; --rider: #3a3d43; --accent: #828fff; --up: #f5a524; --down: #34d399;
    --shadow: 0 0 0 1px rgba(255,255,255,.02), 0 8px 30px rgba(0,0,0,.4);
    --pop: 0 0 0 1px rgba(255,255,255,.08), 0 16px 48px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08090a; --panel: #0f1011; --panel-2: #151618; --ink: #f7f8f8; --ink-2: #8a8f98; --ink-3: #5c6069;
  --line: #1f2023; --line-2: #18191b; --grid: #17181a; --rider: #3a3d43; --accent: #828fff; --up: #f5a524; --down: #34d399;
  --shadow: 0 0 0 1px rgba(255,255,255,.02), 0 8px 30px rgba(0,0,0,.4);
  --pop: 0 0 0 1px rgba(255,255,255,.08), 0 16px 48px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif; font-size: 15px; line-height: 1.55;
  letter-spacing: -0.011em; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: inherit; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line-2); }
.nav .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14.5px; text-decoration: none; letter-spacing: -0.02em; }
.brand svg { display: block; }
.home { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.home img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.home b { color: var(--ink); font-weight: 500; }
.home:hover { color: var(--ink); }
.nav .brand { margin-left: auto; }

/* hero */
.hero { padding-top: 44px; padding-bottom: 22px; }
h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; max-width: 900px;
  background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 62%, transparent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* tool */
.tool { position: relative; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line-2); }
#chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 380px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 3px 0 9px; border: 1px solid var(--line);
  background: var(--panel-2); border-radius: 7px; font-size: 12.5px; white-space: nowrap; }
.chip i, #specs th i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }
.chip b { font-weight: 500; color: var(--ink-2); }
.chip .x { width: 22px; height: 22px; border: 0; background: none; border-radius: 5px; color: var(--ink-3); cursor: pointer; font-size: 16px; line-height: 1; }
.chip .x:hover { background: var(--line); color: var(--ink); }
.add { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border: 1px dashed var(--line); background: none;
  border-radius: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.add:hover { color: var(--ink); border-color: var(--ink-3); border-style: solid; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.seg button { height: 24px; padding: 0 10px; border: 0; background: none; border-radius: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.08); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.btn:hover { border-color: var(--ink-3); }
.btn.ok { color: var(--ink); border-color: var(--ink-3); }

#chart { position: relative; padding: 56px 16px 20px; min-height: 480px; display: flex; align-items: flex-end; justify-content: center;
  background-image: radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 0); background-size: 22px 22px; }
.chart { width: 100%; height: auto; max-height: min(68vh, 680px); display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 3; stroke-dasharray: 14 18; }
.chart .grid text { fill: var(--ink-3); font-size: 54px; font-family: inherit; text-anchor: end; }
.chart .ground { stroke: var(--ink-3); stroke-width: 5; }
.chart .rider path { fill: var(--rider); }
.chart text { text-anchor: middle; font-family: Inter, system-ui, sans-serif; }
.chart .rider text, .chart .dim .sub { fill: var(--ink-2); font-size: 62px; }
.chart .dim line { stroke: var(--ink-3); stroke-width: 4; }
.chart .dim .lbl { fill: var(--ink); font-size: 72px; font-weight: 600; letter-spacing: -1px; }
.empty { color: var(--ink-3); padding: 80px 0; }

.rider-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); }
.rider-bar .note { font-size: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 28px; height: 16px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { background: var(--bg); }
.switch input:checked::after { transform: translateX(12px); }
#rider-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
#rider-fields.off { opacity: .4; pointer-events: none; }
.field { display: inline-flex; align-items: center; gap: 6px; }
.field input { width: 50px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.field input:focus, #picker input:focus { outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent); }
.field input::-webkit-inner-spin-button { opacity: .4; }
.rider-bar .spacer { flex: 1; }

/* picker */
#picker { position: absolute; z-index: 30; width: 320px; max-width: calc(100vw - 40px); background: var(--panel); border-radius: 12px; box-shadow: var(--pop); overflow: hidden; }
#picker input { width: 100%; height: 42px; border: 0; border-bottom: 1px solid var(--line); padding: 0 14px; background: none; font-size: 14px; }
#picker-list { max-height: 320px; overflow: auto; padding: 4px; }
.grp { font-size: 11.5px; color: var(--ink-3); padding: 10px 10px 4px; font-weight: 500; }
.opt { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.opt em { font-style: normal; color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.opt small { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.opt.on, .opt:hover { background: var(--panel-2); }
.none { padding: 20px; color: var(--ink-3); font-size: 13px; text-align: center; }

/* specs */
#specs { overflow-x: auto; border-top: 1px solid var(--line-2); }
#specs table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
#specs th, #specs td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: baseline; }
#specs tbody tr:last-child > * { border-bottom: 0; }
#specs thead th { font-weight: 500; font-size: 13px; }
#specs thead th a { text-decoration: none; margin-left: 7px; }
#specs thead th a:hover { text-decoration: underline; text-underline-offset: 3px; }
#specs tbody th { font-weight: 450; color: var(--ink-2); width: 160px; }
#specs td small { margin-left: 7px; font-size: 12px; }
#specs .up, #specs .down { color: var(--ink-3); }
.hint { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line); font-size: 10px; color: var(--ink-3); cursor: help; }
.reach { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); color: var(--ink); }
.reach.toes, .reach.one { color: var(--ink-2); border-style: dashed; }

/* content */
.content { padding: 72px 0 24px; display: grid; gap: 56px; }
.content h2 { font-size: 22px; letter-spacing: -0.025em; font-weight: 600; margin-bottom: 14px; }
.content p { color: var(--ink-2); max-width: 720px; }
.content p + p { margin-top: 12px; }
.content p b { color: var(--ink); font-weight: 500; }
.faq { display: grid; gap: 0; border-top: 1px solid var(--line); max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--ink-3); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 18px; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 20px; }
.links a { display: block; padding: 7px 0; color: var(--ink-2); text-decoration: none; font-size: 14px; border-bottom: 1px solid var(--line-2); }
.links a:hover { color: var(--ink); }
.note { font-size: 13px; color: var(--ink-3) !important; }

footer { margin-top: 64px; border-top: 1px solid var(--line-2); padding: 28px 0 48px; font-size: 13px; color: var(--ink-3); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
footer a { color: var(--ink-2); text-decoration: none; } footer a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .hero { padding-top: 28px; padding-bottom: 16px; }
  #chart { padding: 24px 8px 8px; min-height: 260px; }
  .bar .seg, .bar .btn { order: 2; }
}

/* overlay: blend so overlapping areas stay readable */
.chart.overlay .bike { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chart.overlay .bike { mix-blend-mode: screen; } }
:root[data-theme="dark"] .chart.overlay .bike { mix-blend-mode: screen; }
#specs tbody th, #specs thead th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
@media (max-width: 640px) {
  #chart { overflow-x: auto; justify-content: flex-start; }
  #chart .chart { min-width: calc(var(--n, 1) * 250px); max-height: none; }
  #specs tbody th { width: auto; }
}
