/* Transitica Wiki - an encyclopedia-style look (original stylesheet) */
:root {
	--text: #202122; --muted: #54595d; --link: #3366cc; --link-visited: #6a60b0; --new: #d73333;
	--border: #a2a9b1; --border-light: #c8ccd1; --bg-soft: #f8f9fa;
	--bg: #fff; --bg-muted: #eaecf0; --bg-hover: #eaf3ff; --bg-note: #fef6e7; --bg-title: #d8e6dc; --accent: #1f7a3f;
	--serif: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
	--sans: -apple-system, 'Segoe UI', 'Roboto', 'Lato', 'Helvetica Neue', 'Microsoft YaHei', 'Microsoft JhengHei', sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; color: var(--text); font-family: var(--sans); background: var(--bg); line-height: 1.6; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }
a.new, a.new:visited { color: var(--new); }

/* header */
.top { display: flex; align-items: center; gap: 16px; padding: 8px 24px; border-bottom: 1px solid var(--bg-muted); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.menu { border: 0; background: none; font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 2px; color: var(--text); }
.menu:hover { background: var(--bg-muted); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text) !important; text-decoration: none !important; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-family: var(--serif); font-size: 1.35rem; font-weight: 400; letter-spacing: .02em; }
.brand small { font-family: var(--serif); font-size: .8rem; color: var(--muted); }
.search { position: relative; display: flex; flex: 1; max-width: 520px; margin-left: 12px; }
.search input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 2px 0 0 2px; font: inherit; font-size: .9rem; }
.search input:focus { outline: none; border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.search button { padding: 6px 12px; border: 1px solid var(--border); border-left: 0; background: var(--bg-soft); border-radius: 0 2px 2px 0; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.suggest { display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 2px 0 0; padding: 0; list-style: none; background: var(--bg); border: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,.15); max-height: 360px; overflow: auto; }
.suggest.open { display: block; }
.suggest li a { display: block; padding: 6px 10px; color: var(--text); }
.suggest li a:hover, .suggest li.sel a { background: var(--bg-hover); text-decoration: none; }
.suggest li small { color: var(--muted); margin-left: 6px; }

/* layout */
.wrap { display: flex; max-width: 1400px; margin: 0 auto; }
.side { width: 176px; flex-shrink: 0; padding: 16px 12px 24px 24px; font-size: .875rem; }
.side h3 { font-size: .75rem; color: var(--muted); font-weight: 600; margin: 12px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--bg-muted); }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { padding: 3px 0; }
.content { flex: 1; min-width: 0; padding: 12px 32px 32px; }
/* the ☰ button hides the menu on wide screens (remembered), and opens it as a drop-down on narrow ones */
body.nav-hidden .side { display: none; }
@media (max-width: 900px) {
	.side, body.nav-hidden .side { display: none; position: fixed; top: 56px; left: 0; width: min(240px, 75vw); max-height: calc(100vh - 64px); overflow-y: auto; padding: 4px 16px 16px; background: var(--bg); border: 1px solid var(--bg-muted); border-left: 0; border-radius: 0 0 6px 0; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 9; }
	body.nav-open .side { display: block; }
	.content { padding: 12px 16px 32px; }
	.brand small { display: none; }
}

/* tabs + title */
.tabs { display: flex; align-items: flex-end; gap: 2px; font-size: .875rem; border-bottom: 1px solid var(--border); }
.tabs .tab { padding: 6px 10px; color: var(--link); }
.tabs .tab.active { color: var(--text); border-bottom: 2px solid var(--text); margin-bottom: -1px; }
.tabs .spacer { flex: 1; }
.firstHeading { font-family: var(--serif); font-weight: 400; font-size: 1.85rem; line-height: 1.3; margin: 16px 0 0; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.siteSub { font-size: .8rem; color: var(--muted); margin: 6px 0 12px; }
.body { font-size: .9375rem; }
.body h2 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; margin: 1.2em 0 .4em; padding-bottom: 2px; border-bottom: 1px solid var(--border); clear: none; }
.body h3 { font-size: 1.1rem; font-weight: 700; margin: 1em 0 .3em; }
.body p { margin: .5em 0 .8em; }
.body img { max-width: 100%; }
.body blockquote { margin: 1em 2em; color: var(--muted); }
.body code { background: var(--bg-soft); border: 1px solid var(--bg-muted); padding: 1px 4px; border-radius: 2px; font-size: .9em; }

/* infobox */
.infobox { float: right; clear: right; width: 22em; margin: 0 0 1em 1.5em; border: 1px solid var(--border); background: var(--bg-soft); font-size: .85rem; line-height: 1.5; border-collapse: collapse; }
.infobox th, .infobox td { padding: 4px 8px; vertical-align: top; text-align: left; }
.infobox th { width: 38%; font-weight: 600; }
.infobox .ib-title { text-align: center; font-size: 1.15rem; font-weight: 700; padding: 6px 8px; background: var(--bg-title); width: auto; }
.infobox .ib-sub { text-align: center; color: var(--muted); font-size: .8rem; }
.infobox .ib-section { text-align: center; background: var(--bg-muted); width: auto; }
.infobox img { display: block; max-width: 100%; margin: 0 auto; }
.infobox .ib-logo { text-align: center; background: var(--bg); padding: 10px 8px 6px; }
.infobox img.ib-bullet { width: 96px; height: 96px; }
img.chip-img { width: 1.55em; height: 1.55em; vertical-align: -.4em; margin: 0 1px; }
.bullet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); gap: 12px; margin: 1em 0; }
.bullet-grid a, .bullet-grid div { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .85rem; gap: 4px; }
.bullet-grid img { width: 72px; height: 72px; }
.infobox .ib-caption { font-weight: 400; font-size: .8rem; color: var(--muted); text-align: center; }
@media (max-width: 700px) { .infobox { float: none; width: 100%; margin: 0 0 1em; } }

/* TOC */
.toc { display: inline-block; border: 1px solid var(--border); background: var(--bg-soft); padding: 8px 14px; margin: 8px 0 12px; font-size: .875rem; }
.toc-title { font-weight: 700; text-align: center; margin-bottom: 4px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li.l3 { padding-left: 1.6em; }
.toc .num { color: var(--muted); padding-right: 4px; }

/* tables */
.wikitable { border-collapse: collapse; border: 1px solid var(--border); background: var(--bg-soft); margin: 1em 0; font-size: .875rem; }
.wikitable th, .wikitable td { border: 1px solid var(--border); padding: 4px 8px; }
.wikitable th { background: var(--bg-muted); text-align: center; }
.wikitable.sortable th { cursor: pointer; }
.wikitable.sortable th::after { content: " ⇅"; color: #888; font-size: .8em; }
.wikitable.sortable th[aria-sort="ascending"]::after { content: " ▲"; color: #36c; }
.wikitable.sortable th[aria-sort="descending"]::after { content: " ▼"; color: #36c; }
.wikitable.sortable tr.filters th { cursor: default; background: var(--bg-soft); padding: 3px 4px; }
.wikitable.sortable tr.filters th::after { content: none; }
.wikitable tr.filters input, .wikitable tr.filters select { width: 100%; min-width: 5em; box-sizing: border-box; font: inherit; font-size: .8rem; padding: 2px 4px; border: 1px solid var(--border); border-radius: 2px; background: var(--bg); }
.table-scroll { max-height: 75vh; overflow: auto; margin: .5em 0 1em; border: 1px solid var(--border); }
.table-scroll .wikitable { margin: 0; border: 0; border-collapse: separate; border-spacing: 0; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 1em 0 .4em; font-size: .875rem; }
.table-tools input { flex: 1 1 220px; max-width: 320px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 2px; font: inherit; }
.table-tools .count { color: var(--muted); }
.table-tools button { padding: 4px 10px; border: 1px solid var(--border); border-radius: 2px; background: var(--bg-soft); font: inherit; cursor: pointer; }
.table-tools button:hover { background: var(--bg-muted); }
.succession td { text-align: center; }
.succession td.svc-line { background: var(--bg); white-space: nowrap; }

/* chips + route diagram */
.chip { display: inline-block; min-width: 1.8em; padding: 0 5px; border-radius: 3px; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.6; vertical-align: middle; }
.chip-link:hover { text-decoration: none; }
.route { list-style: none; margin: 1em 0; padding: 0; max-width: 640px; }
.route li { position: relative; display: flex; align-items: center; gap: 10px; min-height: 30px; padding-left: 34px; }
.route li::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 6px; background: var(--line); }
.route li:first-child::before { top: 50%; }
.route li:last-child::before { bottom: 50%; }
.route .stop { position: absolute; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--line); }
.route li.ix .stop { border-color: #202122; border-width: 3px; width: 18px; height: 18px; left: 5px; }
.route li.end .name { font-weight: 700; }
.route .name { flex: 1; }
.route .tr { display: flex; gap: 3px; flex-wrap: wrap; }
.route .km { color: var(--muted); font-size: .8rem; width: 64px; text-align: right; }

/* main page */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.stats div { flex: 1; min-width: 120px; border: 1px solid var(--border-light); background: var(--bg-soft); padding: 10px; text-align: center; }
.stats b { display: block; font-size: 1.6rem; font-family: var(--serif); font-weight: 400; color: var(--accent); }
.stats span { color: var(--muted); font-size: .85rem; }
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; margin: 8px 0; }
.columns { columns: 3 220px; padding-left: 1.2em; }
.mp-box { border: 1px solid var(--border-light); background: var(--bg-soft); padding: 4px 14px 10px; margin: 0 0 14px; }
.mp-box h2 { border-bottom: 0; margin-top: .4em; }

/* categories + footer */
.catlinks { clear: both; border: 1px solid var(--border); background: var(--bg-soft); padding: 6px 10px; margin-top: 24px; font-size: .85rem; }
.catlinks ul { display: inline; margin: 0; padding: 0; list-style: none; }
.catlinks li { display: inline; padding: 0 .5em; border-left: 1px solid #aaa; }
.catlinks li:first-child { border-left: 0; }
.foot { max-width: 1400px; margin: 0 auto; padding: 16px 24px 32px 212px; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--bg-muted); }
@media (max-width: 900px) { .foot { padding-left: 16px; } }
.body table:not(.infobox):not(.wikitable) { border-collapse: collapse; border: 1px solid var(--border); background: var(--bg-soft); margin: 1em 0; font-size: .875rem; }
.body table:not(.infobox):not(.wikitable) th, .body table:not(.infobox):not(.wikitable) td { border: 1px solid var(--border); padding: 4px 8px; }
.body table:not(.infobox):not(.wikitable) th { background: var(--bg-muted); }

/* personal tools */
.personal { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: .875rem; }
.personal .pt-user { color: var(--muted); }

/* section edit links */
.mw-editsection { font-family: var(--sans); font-size: .8rem; font-weight: 400; margin-left: .8em; color: var(--muted); white-space: nowrap; }
.mw-headline { }

/* notices */
.mw-warning { border: 1px solid #fc3; background: var(--bg-note); padding: 8px 14px; margin: 12px 0; }
.mw-editnotice { border: 1px solid var(--border-light); background: var(--bg-hover); padding: 8px 14px; margin: 12px 0; font-size: .875rem; }
.mw-saved { border: 1px solid #14866d; background: #d5fdf4; padding: 8px 14px; margin: 12px 0; font-size: .875rem; }
.mw-revision { border: 1px solid var(--border); background: var(--bg-soft); padding: 8px 14px; margin: 12px 0; font-size: .875rem; }

/* editor */
body.edit .firstHeading { border-bottom: 0; }
#editform { margin-top: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; border: 1px solid var(--border-light); border-bottom: 0; background: var(--bg-soft); padding: 4px; }
.toolbar button { min-width: 30px; height: 28px; border: 1px solid transparent; background: none; border-radius: 2px; cursor: pointer; font: inherit; font-size: .9rem; color: var(--text); }
.toolbar button:hover { border-color: var(--border); background: var(--bg); }
.toolbar .sep { width: 1px; height: 20px; background: var(--border-light); margin: 0 4px; }
.toolbar .tb-help { margin-left: auto; font-size: .85rem; padding: 0 8px; }
#wpTextbox1 { display: block; width: 100%; min-height: 420px; border: 1px solid var(--border-light); padding: 6px 8px; font-family: Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace; font-size: .875rem; line-height: 1.5; resize: vertical; }
#wpTextbox1:focus { outline: none; border-color: var(--link); }
.editOptions { border: 1px solid var(--border-light); border-top: 0; background: var(--bg-muted); padding: 10px 12px; font-size: .875rem; }
.editOptions label[for=wpSummary] { font-weight: 600; display: block; margin-bottom: 4px; }
#wpSummary { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 2px; font: inherit; }
.editOptions .minor { display: inline-block; margin: 8px 0; }
.editButtons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
button, .editButtons button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 2px; background: var(--bg-soft); font: inherit; font-weight: 600; font-size: .875rem; color: var(--text); cursor: pointer; }
button:hover { background: var(--bg); }
button.primary { background: #36c; border-color: #36c; color: #fff; }
button.primary:hover { background: #447ff5; }
button:disabled { opacity: .6; cursor: default; }
.editButtons .cancel { margin-left: 4px; }
.editHelp { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }
.previewnote { border: 1px solid #fc3; background: var(--bg-note); padding: 4px 14px; margin-bottom: 12px; }
.previewnote h2 { font-family: var(--serif); font-weight: 400; margin: .3em 0; border: 0; }
.body.preview { border-bottom: 2px dashed var(--border-light); padding-bottom: 16px; margin-bottom: 16px; overflow: hidden; }

/* diffs */
table.diff { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; font-size: .85rem; margin: 8px 0 16px; }
table.diff col.diff-marker { width: 2%; }
table.diff col.diff-content { width: 48%; }
table.diff th { text-align: center; font-weight: 400; vertical-align: top; padding: 4px; }
.diff-lineno { font-weight: 700; padding-top: 6px; }
.diff-marker { text-align: right; font-weight: 700; color: var(--muted); }
.diff-addedline, .diff-deletedline, .diff-context { font-family: Menlo, Consolas, monospace; font-size: .8rem; border: 1px solid; border-left-width: 4px; border-radius: 3px; padding: 2px 6px; word-wrap: break-word; white-space: pre-wrap; vertical-align: top; }
.diff-addedline { border-color: #a3d3ff; background: var(--bg-hover); }
.diff-deletedline { border-color: #ffe49c; background: var(--bg-note); }
.diff-context { border-color: var(--bg-muted); background: var(--bg-soft); color: #404244; }
.diff-empty { color: var(--muted); }

/* history + recent changes */
ul.history { list-style: none; padding-left: 0; font-size: .875rem; }
ul.history li { padding: 3px 0; border-bottom: 1px solid var(--bg-muted); }
.history-user { font-weight: 600; }
.comment { color: var(--muted); font-style: italic; }
.minoredit { font-weight: 700; text-decoration: none; border: 0; }

/* forms */
.login, .upload { max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.login input[type=password], input.wide, .upload input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 2px; font: inherit; }
input.wide { width: 100%; max-width: 420px; }
.error { color: #d33; }

/* airport stations */
.airport { display: inline-block; font-size: .85em; line-height: 1; padding: .12em .28em; border-radius: .3em; background: #263238; color: #fff; vertical-align: .08em; cursor: help; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", system-ui, sans-serif; }
.route .airport { font-size: .75em; }

img.chip-img.big { width: 2.3em; height: 2.3em; vertical-align: -.75em; }
.swatch { display: inline-block; width: 1em; height: 1em; border: 1px solid var(--border); border-radius: 2px; vertical-align: -.15em; }
/* loop lines: the loop drawn as a circle under the route */
.route li.to-loop::before { bottom: 0; }
.route-loop { position: relative; max-width: 100%; overflow-x: auto; margin: 0 0 1em; }
.route-loop .loop-svg { position: absolute; left: 0; top: 0; }
.route-loop .loop-label { position: absolute; transform: translateY(-50%); font-size: .95rem; line-height: 1.6; }
.route-loop .loop-label .name { white-space: nowrap; }
.route-loop .loop-label.left { text-align: right; }
.route-loop .loop-label .tr { display: inline; }
/* express lines: the stations skipped between two stops, folded away behind a dashed line */
.route li.skip-group { display: block; min-height: 0; padding: 0 0 0 34px; }
.route li.skip-group::before { background: repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 11px); }
.route li.skip-group summary { cursor: pointer; color: var(--muted); font-size: .85rem; font-style: italic; padding: 4px 0; }
.route.skipped { margin: 0 0 0 -34px; }
.route.skipped li::before { background: repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 11px); top: 0; bottom: 0; }
.route.skipped li .stop { width: 10px; height: 10px; left: 9px; border-width: 2px; border-color: var(--border); }
.route.skipped li .name { font-size: .9rem; }
.route.skipped li .name a { color: var(--muted); }
.express-note{margin:.4em 0 .6em;padding:.35em .7em;border-left:4px solid #d4a017;background:rgba(212,160,23,.08);font-size:.95em}
.tp{display:inline-flex;align-items:center;gap:4px;white-space:nowrap}.tp-cmd{user-select:all;white-space:nowrap;font-size:.85em}
.tp-copy{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:1px solid transparent;border-radius:4px;background:none;color:var(--muted);cursor:pointer;flex:none}.tp-copy:hover{background:var(--bg-muted);border-color:var(--border-light);color:var(--text)}.tp-copy.done{color:#14866d}.tp-copy.fail{color:#d33}

/* platform numbers */
.plat { display: inline-block; min-width: 1.5em; margin: 0 1px; padding: 0 4px; border: 1px solid var(--border); border-radius: 3px; background: var(--bg-soft); font-size: .75rem; font-weight: 700; line-height: 1.5; text-align: center; color: var(--text); }
.plats { white-space: nowrap; font-size: .75rem; color: var(--muted); margin-left: auto; }
.route .plats + .km { margin-left: 0; }
.loop-label .plats { margin-left: 4px; }
.platforms td.plat-name { text-align: center; vertical-align: middle; }
.platforms td.plat-name .plat { font-size: .95rem; min-width: 2em; }
.platforms td.svc-line { white-space: nowrap; }

/* station infobox, in the style of Wikipedia's New York City Subway station boxes */
.infobox.ib-station { width: 24em; background: var(--bg); border: 1px solid var(--border); padding: 3px; border-collapse: separate; border-spacing: 0 2px; }
.ib-station th, .ib-station td { padding: 3px 6px; }
.ib-station > tbody > tr > th { width: 34%; }
.ib-station .ibs-head { background: #000; color: #fff; text-align: left; padding: 6px 8px 7px; width: auto; }
.ib-station .ibs-name { font-size: 1.35rem; font-weight: 700; line-height: 1.25; }
.ib-station .ibs-other { font-size: .85rem; font-weight: 400; opacity: .85; }
.ib-station .ibs-bullets { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 3px; }
.ib-station .ibs-bullets img.chip-img { width: 1.9em; height: 1.9em; }
.ib-station .ibs-bullets .chip { font-size: .8rem; }
.ib-station .ibs-photo { text-align: center; padding: 4px 0; }
.ib-station .ibs-bar { background: #000; color: #fff; text-align: center; font-weight: 700; padding: 3px; width: auto; }
.ib-station .ibs-service { display: flex; align-items: flex-start; gap: 5px; margin: 2px 0; }
.ib-station .ibs-service small { color: var(--muted); }
.ib-station .ibs-plats { margin-top: 2px; }
.ib-station .ibs-svc-cell { padding: 0; }
.ibs-svc { width: 100%; border-collapse: collapse; margin: 0 0 4px; font-size: .8rem; background: var(--bg-soft); border: 1px solid var(--border); }
.ibs-svc th { background: var(--bg-muted); text-align: center; font-weight: 700; padding: 4px; border: 1px solid var(--border); width: auto; }
.ibs-svc th.nb-h { width: 33%; }
.ibs-svc th.sys-h { font-size: .85rem; }
.ibs-svc td { border-top: 1px solid var(--border); text-align: center; vertical-align: middle; padding: 5px 3px; }
.ibs-svc td.stripe { width: 7px; padding: 0; }
.ibs-svc td.svc { background: var(--bg); width: 5.5em; }
.ibs-svc td.svc img.chip-img.big { width: 2.6em; height: 2.6em; display: block; margin: 0 auto 2px; }
.ibs-svc td.svc .chip.big { font-size: 1rem; min-width: 2.2em; line-height: 2.2; border-radius: 1.2em; }
.ibs-svc .svc-name { font-size: .78rem; line-height: 1.25; }
.ibs-svc .svc-pat { font-size: .75rem; color: var(--text); }
.ibs-svc .nb-name { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 5px; line-height: 1.35; }
.ibs-svc .nb-chips { display: inline-flex; align-items: center; gap: 2px; line-height: 0; }
.ibs-svc .nb-chips a { display: inline-flex; line-height: 0; }
.ibs-svc .nb-chips img.chip-img { width: 18px; height: 18px; margin: 0; vertical-align: middle; display: block; }
.ibs-svc .nb-chips .chip { font-size: .65rem; line-height: 1.5; }
.ibs-svc td { overflow: visible; }
.ibs-svc .nb-to { font-style: italic; font-size: .75rem; color: var(--text); }

/* track layout (infobox) */
.ib-station .tl-bar { position: relative; }
.ib-station .tl-toggle { position: absolute; right: 6px; top: 3px; background: none; border: 0; color: #fff; font: inherit; font-weight: 400; font-size: .8rem; cursor: pointer; padding: 0; }
.ib-station .tl-legend { text-align: right; font-size: .8rem; padding: 2px 4px 0; }
.ib-station .tl-legend a { color: #6b4ba1; }
.tl-wrap { display: flex; align-items: stretch; gap: 10px; padding: 4px 8px 10px; }
.tl-diagrams { display: flex; flex-direction: column; gap: 6px; flex: none; }
.tl-level { font-size: .72rem; color: var(--muted); }
.tl-svg { display: block; }
.tl-labels { display: flex; flex-direction: column; justify-content: space-between; font-size: .8rem; line-height: 1.35; min-width: 0; }
.tl-north { display: inline-flex; align-items: center; gap: 2px; font-size: .72rem; font-weight: 700; color: var(--text); }
.tl-key { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .72rem; color: var(--muted); padding: 2px 8px 0; }
.tl-key span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------- dark mode ([data-theme="dark"] on <html>, set by the header button) ---------------- */
:root[data-theme="dark"] {
	color-scheme: dark;
	--text: #e8eaed; --muted: #a8adb3; --link: #8ab4f8; --link-visited: #b9a6f0; --new: #ff8080;
	--border: #4a5058; --border-light: #3b4148; --bg-soft: #1f2329; --accent: #5fbf7f;
	--bg: #16191d; --bg-muted: #2a3038; --bg-hover: #243246; --bg-note: #3a3120; --bg-title: #24382b;
}
[data-theme="dark"] img.chip-img, [data-theme="dark"] .infobox img:not(.ib-bullet) { filter: none; }
[data-theme="dark"] .ib-station .ibs-head, [data-theme="dark"] .ib-station .ibs-bar { background: #000; color: #fff; }
[data-theme="dark"] .ibs-svc td.svc { background: var(--bg); }
[data-theme="dark"] .plat { background: var(--bg-muted); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .chip { box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
[data-theme="dark"] .route .stop, [data-theme="dark"] .route li::after { background: var(--bg); }
[data-theme="dark"] .route li.ix .stop { border-color: #eaecf0; }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
[data-theme="dark"] code, [data-theme="dark"] pre { background: var(--bg-soft); border-color: var(--border-light); color: var(--text); }
[data-theme="dark"] .loop-svg circle { fill: var(--bg); }
.tl-txt { fill: var(--text); stroke: var(--bg); }
.tl-pale { stroke: #b8bcc2; }
.tl-darkcase { stroke: transparent; }
[data-theme="dark"] .tl-pale { stroke: #555b63; }
[data-theme="dark"] .tl-darkcase { stroke: rgba(255,255,255,.55); }
.tl-north, .tl-key { color: var(--text); }
.theme-toggle { border: 1px solid transparent; background: none; color: var(--text); font-size: 17px; width: 32px; height: 32px; border-radius: 4px; cursor: pointer; line-height: 1; flex: none; }
.theme-toggle:hover { background: var(--bg-muted); border-color: var(--border-light); }
.tl-switch { stroke: #72777d; }
[data-theme="dark"] .tl-switch { stroke: #a2a9b1; }
.tl-dest { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; margin: 1px 0; }
.tl-dest .plat { margin: 0; }
.tl-dest .tl-chips img.chip-img { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.tl-labels .tl-top, .tl-labels .tl-bottom { display: flex; flex-direction: column; gap: 1px; }

.fare-zones td { vertical-align: top; }
.fare-zones td.fz-fare { text-align: center; font-weight: 600; }
.fz-swatch { display: inline-block; width: .8em; height: .8em; border-radius: 2px; vertical-align: -.05em; }
.fare-zones td:first-child { white-space: nowrap; }

.fare-finder { display: flex; flex-wrap: wrap; gap: .6em .8em; align-items: flex-end; margin: .6em 0 1em; padding: .8em 1em; border: 1px solid #c8ccd1; border-radius: 4px; background: #f8f9fa; }
.ff-picker { position: relative; flex: 1 1 18em; min-width: 14em; }
.ff-label { display: block; font-size: .8em; font-weight: 600; color: #54595d; margin-bottom: .2em; }
.ff-field { display: flex; align-items: center; gap: .4em; border: 1px solid #a2a9b1; border-radius: 3px; background: #fff; padding: 0 .4em; }
.ff-field:focus-within { border-color: #36c; box-shadow: inset 0 0 0 1px #36c; }
.ff-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; padding: .4em 0; color: inherit; }
.ff-picked { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.ff-picked img.chip-img, .ff-list img.chip-img { width: 1.15em; height: 1.15em; }
.ff-zone { display: inline-block; font-size: .75em; padding: .05em .45em; border-radius: 1em; background: #eaf3ff; color: #2a4b8d; border: 1px solid #c8d8f5; margin-left: .3em; white-space: nowrap; }
.ff-swap { align-self: flex-end; height: 2.1em; padding: 0 .6em; border: 1px solid #a2a9b1; border-radius: 3px; background: #fff; cursor: pointer; font-size: 1.1em; }
.ff-swap:hover { background: #eaecf0; }
.ff-panel { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid #a2a9b1; border-radius: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.ff-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4em .6em; padding: .45em .6em; border-bottom: 1px solid #eaecf0; font-size: .82em; }
.ff-sort button { font: inherit; padding: .1em .55em; border: 1px solid #c8ccd1; background: #fff; cursor: pointer; margin-left: -1px; }
.ff-sort button:first-of-type { border-radius: 3px 0 0 3px; margin-left: .3em; }
.ff-sort button:last-of-type { border-radius: 0 3px 3px 0; }
.ff-sort button.on { background: #36c; border-color: #36c; color: #fff; }
.ff-tools select { font: inherit; max-width: 11em; }
.ff-count { margin-left: auto; color: #72777d; }
.ff-list { list-style: none; margin: 0; padding: 0; max-height: 19em; overflow-y: auto; }
.ff-list li { display: flex; align-items: center; justify-content: space-between; gap: .6em; padding: .35em .6em; cursor: pointer; border-bottom: 1px solid #f3f4f6; }
.ff-list li.active { background: #eaf3ff; }
.ff-list li.chosen .ff-name { font-weight: 600; }
.ff-list li.ff-more { color: #72777d; cursor: default; font-size: .85em; }
.ff-name small { color: #72777d; margin-left: .4em; }
.ff-meta { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.ff-fare { margin-left: .5em; min-width: 3em; text-align: right; }
.fare-finder .ff-out { flex-basis: 100%; font-size: 1.05em; }
.fare-finder .ff-out b { font-size: 1.3em; }
[data-theme="dark"] .fare-finder { background: #202326; border-color: #3a3f44; }
[data-theme="dark"] .ff-field, [data-theme="dark"] .ff-panel, [data-theme="dark"] .ff-swap, [data-theme="dark"] .ff-sort button { background: #101418; border-color: #54595d; color: #eaecf0; }
[data-theme="dark"] .ff-sort button.on { background: #6d8af0; border-color: #6d8af0; color: #101418; }
[data-theme="dark"] .ff-list li { border-color: #27292d; }
[data-theme="dark"] .ff-list li.active { background: #1f2a44; }
[data-theme="dark"] .ff-zone { background: #1f2a44; color: #b6cbf5; border-color: #34497a; }
[data-theme="dark"] .ff-tools { border-color: #27292d; }
[data-theme="dark"] .ff-label { color: #a2a9b1; }
.free-note { color: #72777d; font-size: 0.9em; }
[data-theme="dark"] .free-note { color: #a2a9b1; }
/* routemaps (Wikipedia {{Routemap}} / BSicon style): 20px rows, a column of tiles, names beside them */
.routemap { display: grid; grid-template-columns: auto auto 1fr; grid-auto-rows: 20px; margin: 1em 0; max-width: 100%; overflow-x: auto; font-size: .9rem; line-height: 20px; }
.routemap .rm-row { display: contents; }
.routemap .rm-toggle { display: none; }
.routemap .rm-passed { display: none; }

.routemap .rm-icons { display: block; grid-column: 2; }
.routemap .rm-l { grid-column: 1; text-align: right; padding-right: 6px; white-space: nowrap; }
.routemap .rm-r { grid-column: 3; padding-left: 6px; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-height: 20px; }
.routemap .rm-l { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.routemap .rm-end .name { font-weight: 700; }
.routemap .tr { display: inline-flex; gap: 2px; }
.routemap .tr img.chip-img { width: 16px; height: 16px; }
.routemap .km { color: var(--muted); font-size: .78rem; margin-left: 4px; }
.routemap .plats { margin-left: 0; }
.routemap .rm-skip-label { cursor: pointer; }
.routemap .rm-skip-label { color: var(--muted); font-size: .82rem; font-style: italic; }
.routemap .rm-skip-label::before { content: "▸ "; font-style: normal; }
.routemap .rm-toggle:checked + .rm-skip .rm-skip-label::before { content: "▾ "; }
.routemap .rm-passed .name { color: var(--muted); font-size: .85rem; }
.routemap .rm-passed .name a { color: inherit; }
.rm-int { fill: #fff; stroke: #202122; }
[data-theme="dark"] .rm-int { fill: #fff; stroke: #101418; }
.routemap.rm-loop { clear: both; }
.routemap .plat { line-height: 14px; font-size: .7rem; padding: 0 3px; }
.routemap .rm-l, .routemap .rm-r { height: 20px; overflow: visible; }
.tl-buffer { stroke: #202122; }
[data-theme="dark"] .tl-buffer { stroke: #eaecf0; }
/* line routes as a table, with the routemap drawn down the first column */
.route-table { border-collapse: collapse; margin: 1em 0; }
.route-table th, .route-table td { padding: 6px 10px; vertical-align: middle; }
.route-table td.rt-ic, .route-table th.rt-ic { padding: 0 6px; position: relative; border-top-color: transparent; border-bottom-color: transparent; }
.route-table td.rt-ic { height: 36px; }
.route-table .rt-cell { position: absolute; top: 0; bottom: 0; left: 6px; }
.route-table .rt-cell { min-width: 20px; }
.route-table .rt-seg { position: absolute; display: block; }
.route-table .rt-mid { position: absolute; top: calc(50% - 10px); overflow: visible; }
.route-table .rm-hst { fill: #fff; }
.route-table .rt-end .rt-name { font-weight: 700; }
.route-table .rt-tr { line-height: 22px; }
.route-table .rt-tr img.chip-img { width: 20px; height: 20px; vertical-align: middle; }
.route-table .rt-km { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.route-table .rt-toggle { display: none; }
.route-table tr.rt-passed { display: none; }
.route-table tr.rt-skip td, .route-table tr.rt-passed td { padding-top: 3px; padding-bottom: 3px; }
.route-table tr.rt-skip td.rt-ic, .route-table tr.rt-passed td.rt-ic { height: 26px; }
.route-table .rt-skip-label { cursor: pointer; color: var(--muted); font-size: .85rem; font-style: italic; }
.route-table .rt-skip-label::before { content: "▸ "; font-style: normal; }
.route-table tr.rt-passed .rt-name, .route-table tr.rt-passed .rt-name a { color: var(--muted); font-size: .88rem; }
.route-table td.rt-ic { border-top-style: hidden; border-bottom-style: hidden; }
.route-table tr:first-child th.rt-ic { border-bottom-style: hidden; }
.route-table .rm-int { fill: var(--bg); stroke: var(--text); }
.route-table .rt-osi { font-size: .85rem; color: var(--muted); line-height: 22px; }
.route-table .rt-osi:first-child { margin-top: 0; }
.route-table .rt-tr > a + .rt-osi, .route-table .rt-tr > .chip-link + .rt-osi { margin-top: 2px; }
.route-table .rt-walk { font-weight: 700; }
.ib-station tr.ibs-walk td { padding: 8px 10px; }
.ib-station .ibs-walk-name { font-weight: 600; }
.ib-station .ibs-walk-lines { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; font-weight: 400; }
.ib-station .ibs-walk-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ib-station .ibs-walk-dist { white-space: nowrap; color: var(--muted); font-size: .85em; font-weight: 400; }
.ib-station tr.ibs-walk + tr.ibs-walk td { border-top: 1px solid var(--border-light); }
/* rolling stock sections */
.rs-specs th { text-align: left; white-space: nowrap; }
.rs-specs tr:first-child th { text-align: center; }
.rs-source { color: var(--muted); font-size: .85rem; font-style: italic; }
.route-table .rt-arrow { position: absolute; fill: var(--text); z-index: 1; }
.route-table tr.rt-back td { padding-top: 4px; padding-bottom: 4px; color: var(--muted); }
.route-table tr.rt-back td.rt-ic { height: 30px; }
.rt-caption { margin: .6em 0 0; }
/* loop lines drawn as a loop */
.loopmap-wrap { overflow-x: auto; margin: 1em 0; }
.loopmap { position: relative; font-size: .88rem; }
.loopmap svg { position: absolute; left: 0; top: 0; }
.loopmap .lm-int { fill: var(--bg); stroke: var(--text); }
.loopmap .lm-arrow { fill: var(--text); }
.loopmap .lm-label { position: absolute; white-space: nowrap; display: flex; align-items: center; gap: 4px; line-height: 1.2; }
.loopmap .lm-up { transform-origin: 0 50%; transform: translateY(-50%) rotate(-35deg); }
.loopmap .lm-down { transform-origin: 0 50%; transform: translateY(-50%) rotate(35deg); }
.loopmap .lm-left { transform: translateY(-50%); flex-direction: row-reverse; }
.loopmap .lm-right { transform: translateY(-50%); }
.loopmap .lm-end { font-weight: 700; }
.loopmap .lm-chips { display: inline-flex; gap: 2px; }
.loopmap .lm-chips img.chip-img { width: 16px; height: 16px; vertical-align: middle; margin: 0; }
.lm-details > summary { cursor: pointer; color: var(--link); margin: .3em 0; }
.loopmap .lm-label > * { flex-shrink: 0; }
.loopmap .lm-chips img.chip-img { flex-shrink: 0; }
.loopmap .lm-join { transform: translateY(-50%); }
.loopmap .lm-below { width: 124px; flex-direction: column; text-align: center; white-space: normal; gap: 2px; }
.rs-compare td:empty::after { content: "—"; color: var(--muted); }
.rs-compare tr:first-child th { text-align: center; }
.rs-compare td { min-width: 9em; }
/* station services box: roomier neighbour columns */
.infobox.ib-station { width: 28em; }
.ibs-svc td.svc { width: 4.4em; padding-left: 2px; padding-right: 2px; }
.ibs-svc td.svc img.chip-img.big { width: 2.2em; height: 2.2em; }
.ibs-svc td.stripe { width: 5px; }
.ibs-svc td.nb { padding: 6px 5px; }
.ibs-svc .nb-name { font-size: .82rem; }
.ibs-svc .nb-chips img.chip-img { width: 15px; height: 15px; }
.ibs-svc .nb-to { font-size: .72rem; line-height: 1.3; margin-top: 2px; color: var(--muted); }
.ibs-svc .nb-to a { color: var(--link); }
.ibs-svc th.nb-h { width: 40%; }
