:root {
  --bg: #fbfbf9; --fg: #1d2125; --muted: #5b636b; --line: #d9dcdf; --card: #ffffff;
  --accent: #1f6f8b; --up: #b4462f; --down: #2f7d4f; --warn-bg: #fff4d6; --warn-fg: #6b4a00;
  --info-bg: #eef5f8; --chart-fill: rgba(31,111,139,.14);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181b; --fg: #e8eaec; --muted: #a3abb3; --line: #33393f; --card: #1c2024;
    --accent: #6fb7d2; --up: #e58a74; --down: #74c493; --warn-bg: #3a3017; --warn-fg: #f3d58a;
    --info-bg: #1b2a31; --chart-fill: rgba(111,183,210,.16); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.65; font-size: 16px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 16px; }
header.site { border-bottom: 1px solid var(--line); }
header.site .wrap { padding-top: 12px; padding-bottom: 12px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
header.site a.home { color: var(--fg); text-decoration: none; font-weight: 700; }
header.site .tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
h1 { font-size: 1.45rem; line-height: 1.35; margin: 18px 0 6px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
p { margin: 8px 0; }
a { color: var(--accent); overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .93rem; }
.notice { background: var(--warn-bg); color: var(--warn-fg); border-radius: 8px; padding: 10px 12px; font-size: .92rem; margin: 12px 0; }
.info { background: var(--info-bg); border-radius: 8px; padding: 10px 12px; font-size: .92rem; margin: 12px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 14px 0; }
form.calc { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { form.calc { grid-template-columns: 1fr 1fr auto; align-items: end; } }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
input, select, button { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; width: 100%; min-height: 44px; }
button { background: var(--accent); color: #fff; border: none; font-weight: 700; cursor: pointer; }
@media (prefers-color-scheme: dark) { button { color: #0d1214; } }
.err { color: var(--up); font-size: .92rem; min-height: 1.2em; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 12px 0; }
@media (min-width: 640px) { .summary { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat .k { font-size: .78rem; color: var(--muted); }
.stat .v { font-size: 1.12rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); }
.legend { font-size: .82rem; color: var(--muted); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .92rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--card); font-weight: 600; font-size: .8rem; color: var(--muted); }
td.l, th.l { text-align: left; }
td.cp { text-align: left; white-space: normal; min-width: 8em; font-size: .82rem; color: var(--muted); }
tr.half td { background: var(--info-bg); }
.slow { color: var(--up); } .fast { color: var(--down); }
ul.races { list-style: none; padding: 0; margin: 0; }
ul.races li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: var(--card); }
ul.races .name { font-weight: 700; font-size: 1.05rem; }
footer { border-top: 1px solid var(--line); margin-top: 32px; color: var(--muted); font-size: .85rem; }
dl.src dt { font-weight: 600; margin-top: 10px; }
dl.src dd { margin: 2px 0 0 0; }
p, li, dd, td.cp { overflow-wrap: anywhere; }
code { font-size: .9em; }
