:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --ink: #171717;
    --ink-2: #525252;
    --ink-3: #737373;
    --border: #e5e5e5;
    --chip: #f5f5f5;
    --accent: #a34b2c;
    --accent-strong: #8a3c21;
    --map-water: #e8eeed;
    --map-block: #f0efec;
    --map-green: #eef1e9;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC",
        "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0a0a;
        --surface: #111111;
        --ink: #fafafa;
        --ink-2: #a3a3a3;
        --ink-3: #737373;
        --border: #262626;
        --chip: #171717;
        --accent: #e08a63;
        --accent-strong: #f0a184;
        --map-water: #15201e;
        --map-block: #1a1a1a;
        --map-green: #161a14;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

@supports (min-height: 100dvh) {
    body { min-height: 100dvh; }
}

.hero, .bar, main, .foot {
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

main { flex: 1 0 auto; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.018em; }

/* 首页 hero：居中的标记 + 站名 + 一段说明 */
.hero { padding-top: 6rem; padding-bottom: 3rem; text-align: center; }
.hero-mark { margin: 0 0 1.1rem; }
.hero h1 { margin: 0; font-size: 2.25rem; font-weight: 900; letter-spacing: -0.025em; }
.hero .lede {
    max-width: 34rem;
    margin: 3rem auto 0;
    color: var(--ink-2);
    text-wrap: balance;
}

.mark { width: 2.4rem; height: 2.4rem; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: square; }
.mark circle { fill: var(--accent); stroke: none; }

.nav {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.4rem;
    font-size: 0.93rem;
}

.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* 内页页头：一行，左边站名右边导航 */
.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.bar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.bar-brand .mark { width: 1.6rem; height: 1.6rem; }
.bar .nav { margin-top: 0; justify-content: flex-end; gap: 0.3rem 1.05rem; font-size: 0.88rem; }

/* 时间线 */
.timeline { list-style: none; margin: 0; padding: 0; }

.entry {
    display: grid;
    grid-template-columns: 7rem 2.75rem minmax(0, 1fr);
}

.when {
    grid-column: 1;
    padding-top: 0.15rem;
    text-align: right;
    color: var(--ink-3);
    font-size: 0.75rem;
    line-height: 1.25rem;
    font-variant-numeric: tabular-nums;
}

.when .dist { display: block; }

.rail { grid-column: 2; display: flex; flex-direction: column; align-items: center; }

.rail::after {
    content: "";
    flex: 1 0 auto;
    width: 2px;
    margin-top: 0.4rem;
    border-radius: 999px;
    background: var(--chip);
}

.entry:last-child .rail::after { background: linear-gradient(var(--border), transparent); }

.bub {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--chip);
}

.bub.small { width: 1.35rem; height: 1.35rem; }

.gl { width: 1rem; height: 1rem; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bub.small .gl { width: 0.72rem; height: 0.72rem; }

.body { grid-column: 3; padding-bottom: 3rem; }
.entry:last-child .body { padding-bottom: 1.5rem; }

.chip {
    display: inline-block;
    margin: 0;
    padding: 0.08rem 0.62rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--chip);
    color: var(--ink-3);
    font-size: 0.76rem;
}

.body h2 { margin: 0.5rem 0 0.75rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.body h2 a { color: var(--ink); text-decoration: none; }
.body h2 a:hover { color: var(--accent); }
.body p { margin: 0.75rem 0; font-size: 0.875rem; line-height: 1.7; color: var(--ink-2); }
.body .more { margin-top: 1rem; font-size: 0.875rem; }
.body .more a { text-decoration: none; font-weight: 500; }
.body .more a:hover { text-decoration: underline; }

.micro .body { padding-bottom: 2.2rem; }
.micro .body p { margin: 0; }

/* 内页正文 */
.post, .page { max-width: 42rem; }

.crumb { margin: 0 0 1.6rem; font-size: 0.9rem; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.post-when { margin: 0; color: var(--ink-3); font-size: 0.86rem; }
.post h1 { margin: 0.5rem 0 1.5rem; font-size: 2.1rem; font-weight: 800; }
.post h2 { margin: 2.3rem 0 0.8rem; font-size: 1.22rem; font-weight: 700; }
.post p { margin: 1.15rem 0; }
.post ul { margin: 1.15rem 0; padding-left: 1.2rem; }
.post li { margin: 0.4rem 0; }
.post li::marker { color: var(--accent); }

.pull {
    margin: 1.9rem 0;
    padding: 0.1rem 0 0.1rem 1.15rem;
    border-left: 3px solid var(--accent);
    color: var(--ink);
}

sup a { text-decoration: none; padding: 0 0.1rem; }

.notes { margin-top: 2.6rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.notes h2 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.4rem; }
.notes ol { margin: 0; padding-left: 1.2rem; color: var(--ink-2); font-size: 0.93rem; }
.notes li { margin: 0.35rem 0; }
.fnback { text-decoration: none; }

.update {
    margin: 2.2rem 0 0;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--chip);
}

.update p { margin: 0.35rem 0; font-size: 0.95rem; color: var(--ink-2); }
.update .update-head { margin-top: 0; color: var(--ink-3); font-size: 0.8rem; }

/* 路线图 */
.fig { margin: 1.6rem 0 1.9rem; }

.map {
    display: block;
    width: 100%;
    height: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.fig figcaption { margin-top: 0.6rem; color: var(--ink-3); font-size: 0.83rem; }

.mw { fill: var(--map-water); }
.mb { fill: var(--map-block); }
.mg { fill: var(--map-green); }
.mr { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ms { fill: var(--accent); }
.me { fill: var(--accent); }
.mm { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.md { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.mn { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.ml, .mk {
    /* 描边留白：标签压在路线或楼板上时仍然读得清 */
    paint-order: stroke;
    stroke: var(--surface);
    stroke-width: 4px;
    stroke-linejoin: round;
}
.ml { fill: var(--ink-3); font-size: 13px; }
.mk { fill: var(--ink-3); font-size: 11px; letter-spacing: 0.1em; }

/* 上一趟 / 下一趟 */
.pnwrap { display: grid; gap: 0.7rem; max-width: 42rem; margin: 3rem 0 0; }

.pn {
    display: block;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-size: 0.98rem;
}

.pn:hover { border-color: var(--accent); color: var(--accent); }
.pn span { display: block; margin-bottom: 0.2rem; color: var(--ink-3); font-size: 0.78rem; }

/* 表格 / 词汇表 */
.tablewrap { overflow-x: auto; max-width: 42rem; }

.routes { width: 100%; border-collapse: collapse; margin: 1.5rem 0 0; font-size: 0.95rem; }
.routes th {
    padding: 0 0.7rem 0.55rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--ink-3);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}
.routes td { padding: 0.65rem 0.7rem 0.65rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.routes .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.routes td:last-child, .routes th:last-child { padding-right: 0; }
.routes .total td { border-bottom: 0; border-top: 2px solid var(--border); font-weight: 700; }
.routes .total { color: var(--ink-3); }

.gloss { margin: 1.7rem 0 0; max-width: 42rem; }
.gloss dt { margin-top: 1.6rem; font-weight: 700; }
.gloss dt:first-child { margin-top: 0; }
.gloss dt:target { color: var(--accent); }
.gloss .alt { color: var(--ink-3); font-weight: 400; font-size: 0.9em; }
.gloss dd { margin: 0.35rem 0 0; color: var(--ink-2); }

main h1 { margin: 0 0 0.9rem; font-size: 2rem; font-weight: 800; }
main > p { max-width: 42rem; }

/* 页脚 */
.foot {
    margin-top: 4rem;
    padding-top: 1.4rem;
    padding-bottom: 3.5rem;
    border-top: 1px solid var(--border);
    color: var(--ink-3);
    font-size: 0.88rem;
    text-align: center;
}

.foot p { margin: 0.3rem 0; }
.foot a { color: var(--ink-2); }
.fine { font-size: 0.8rem; }

@media (max-width: 46rem) {
    .entry { grid-template-columns: 2.2rem minmax(0, 1fr); }
    .when {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        gap: 0.7rem;
        text-align: left;
        margin-bottom: 0.45rem;
    }
    .when .dist { display: inline; }
    .rail { grid-column: 1; grid-row: 1 / span 2; }
    .body { grid-column: 2; grid-row: 2; }
    .hero { padding-top: 3.2rem; }
    .hero h1 { font-size: 2.1rem; }
    .post h1 { font-size: 1.7rem; }
    body { font-size: 16px; }
}
