/* dot-matrix face, only for the destination sign on a train (it imitates the train's LED display) */
@font-face { font-family: 'FPja'; src: url(../assets/fonts/fusion-pixel-ja.woff2) format('woff2'); font-display: swap; }

/* ---------- tokens (night is the default, day overrides) ---------- */
:root {
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --sans-ja: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', 'PingFang SC', sans-serif;
  --led: 'FPja', ui-monospace, monospace;
  --spring: cubic-bezier(.3, 1.55, .5, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --r-sheet: 26px;
  --pad: 14px;
  --r-card: calc(var(--r-sheet) - var(--pad));      /* concentric with the sheet around it */
  --green: #34c759;
  --screen: #050608;

  --bg: #0d0f14;
  --loading-bg: radial-gradient(1100px 700px at 30% 20%, #1c2433, #0b0d12);
  --ink: #f4f6fa;
  --ink2: rgba(240, 244, 250, .76);
  --mute: rgba(235, 240, 250, .55);
  --dim: rgba(235, 240, 250, .32);
  --fill: rgba(255, 255, 255, .07);
  --fill2: rgba(255, 255, 255, .13);
  --fill3: rgba(255, 255, 255, .2);
  --hair: rgba(255, 255, 255, .09);
  --thumb: rgba(255, 255, 255, .2);
  --thumb-edge: rgba(255, 255, 255, .3);
  --rim-hi: rgba(255, 255, 255, .46);
  --rim-mid: rgba(255, 255, 255, .28);
  --rim-lo: rgba(255, 255, 255, .06);
  --sheen: rgba(255, 255, 255, .06);
  --shadow: 0 22px 48px -16px rgba(0, 0, 0, .72), 0 6px 16px -4px rgba(0, 0, 0, .45);
  --glass: rgba(30, 34, 44, .46);
  --glass-dense: rgba(26, 30, 39, .66);
  --glass-clear: rgba(30, 34, 44, .2);
  --blur: 18px;
  --sat: 1.8;
  --bri: .92;
  --inner: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(255, 255, 255, .04), inset 0 0 18px rgba(255, 255, 255, .04);
  --fallback: rgba(26, 30, 39, .94);
  --dot-bg: #1b1f28;
  --accent: #0a84ff;
}
:root[data-theme=day] {
  --bg: #e9ebe7;
  --loading-bg: radial-gradient(1100px 700px at 30% 20%, #f8faf7, #e3edf3);
  --ink: #101318;
  --ink2: rgba(16, 19, 24, .76);
  --mute: rgba(16, 19, 24, .52);
  --dim: rgba(16, 19, 24, .3);
  --fill: rgba(30, 40, 60, .055);
  --fill2: rgba(30, 40, 60, .1);
  --fill3: rgba(30, 40, 60, .16);
  --hair: rgba(30, 40, 60, .1);
  --thumb: rgba(255, 255, 255, .96);
  --thumb-edge: rgba(255, 255, 255, 1);
  --rim-hi: rgba(255, 255, 255, .8);
  --rim-mid: rgba(255, 255, 255, .65);
  --rim-lo: rgba(255, 255, 255, .2);
  --sheen: rgba(255, 255, 255, .24);
  --shadow: 0 20px 44px -16px rgba(40, 52, 72, .45), 0 4px 14px -4px rgba(40, 52, 72, .2);
  --glass: rgba(255, 255, 255, .5);
  --glass-dense: rgba(250, 251, 253, .74);
  --glass-clear: rgba(255, 255, 255, .22);
  --blur: 18px;
  --sat: 1.7;
  --bri: 1.04;
  --inner: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(255, 255, 255, .35), inset 0 0 18px rgba(255, 255, 255, .25);
  --fallback: rgba(246, 247, 249, .96);
  --dot-bg: #ffffff;
  --accent: #007aff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ja { font-family: var(--sans-ja); }
.pi { display: block; flex: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pi .f { fill: currentColor; stroke: none; }
.hint { color: var(--mute); font-size: 12px; }
.tyb { display: inline-block; padding: 0 6px; border-radius: 6px; color: #111; font-size: 11.5px; font-weight: 700; line-height: 18px; vertical-align: 1px; }

#stage { position: fixed; inset: 0; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#map { cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#ov { pointer-events: none; }

/* ---------- glass ----------
 * With WebGL, js/glass.js paints .gl-bg: the map under the element, bent at the rim like the edge of
 * a thick lens, frosted in the middle, tinted, with a soft upper-left specular rim. Without it,
 * backdrop-filter gives a plain frost. ::after adds fixed inner highlights and a soft sheen;
 * ::before adds a hairline rim. The lighting stays steady as the pointer moves. */
.glass {
  position: fixed;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--r, 22px);
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat)) brightness(var(--bri));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat)) brightness(var(--bri));
  box-shadow: var(--shadow);
}
.glass.sheet { --glass: var(--glass-dense); --blur: 28px; }
body.glass-clear .glass:not(.sheet) { --glass: var(--glass-clear); --blur: 5px; --sat: 2; }
.gl-bg { position: absolute; left: 0; top: 0; z-index: -1; display: none; pointer-events: none; }
body.gl .glass { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
body.gl .gl-bg { display: block; }
body.glass-opaque .glass { background: var(--fallback); -webkit-backdrop-filter: none; backdrop-filter: none; }
body.glass-opaque .gl-bg { display: none; }
.glass::after {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: var(--inner);
  background:
    radial-gradient(240px 150px at 25% -40%, var(--sheen), transparent 72%),
    linear-gradient(180deg, var(--sheen), transparent 36%);
}
.glass::before {
  content: ''; position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
  padding: 1px;
  background: linear-gradient(-30deg, var(--rim-mid), var(--rim-lo) 30%, var(--rim-lo) 68%, var(--rim-hi));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.capsule { --r: 999px; }

/* controls on glass: they light up and swell a little when pressed, then spring back */
.tb, .round, .pill, .tag, .close, .chip, .btn, #zoomCtl button {
  transition: transform .5s var(--spring), background-color .2s, color .2s, opacity .2s;
}
.tb:active, .round:active, .pill:active, .tag:active, .close:active, .chip:active, .btn:active, #zoomCtl button:active {
  transform: scale(1.1);
  transition-duration: .12s;
}

/* ---------- top-left: clock island — click it and it grows into the time controls ---------- */
#island { left: 16px; top: 16px; --r: 24px; min-width: 214px; z-index: 9; }
#island.open { width: 336px; }
.face { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 13px 16px 12px; text-align: left; border-radius: inherit; }
.face > span { display: flex; }
#island .brand { font-size: 11px; line-height: 12px; font-weight: 700; letter-spacing: .14em; color: var(--mute); }
#island .clock {
  font-size: 38px; line-height: 38px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  margin: 7px 0 6px; white-space: nowrap; transition: transform .45s var(--spring); transform-origin: left center;
}
.face:hover .clock { transform: scale(1.03); }
.face:active .clock { transform: scale(.97); transition-duration: .1s; }
#island #clkSec { font-size: 22px; line-height: 28px; font-weight: 500; color: var(--mute); margin-left: 1px; align-self: flex-end; letter-spacing: 0; }
#island .meta { align-items: center; gap: 6px; color: var(--ink2); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--fill2); font-size: 12px; font-weight: 600; }
.tag.mode { display: none; background: var(--accent); color: #fff; }
.tag.mode.show { display: inline-flex; }
#island .live { align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, .25); animation: pulse 2s ease-in-out infinite; flex: none; }
.pulse.off { background: var(--dim); box-shadow: none; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); } }
.tc { display: none; margin: 0 6px; padding: 10px 8px 12px; border-top: 1px solid var(--hair); }
#island.open .tc { display: block; }
.tc-row { display: flex; align-items: center; gap: 10px; }
.tc-row + .tc-row { margin-top: 10px; }
.tc-row .pill { margin-left: auto; }
.tc-k { font-size: 12px; font-weight: 600; color: var(--mute); }
.tc-row .seg.mini { margin-left: auto; }
/* the expanded island pushes the train / station card below it down instead of covering it */
@media (min-width: 701px) {
  #detailPanel { transition: transform .55s var(--spring), max-height .55s var(--ease); }
  body.time-open #detailPanel { transform: translateY(var(--push, 0px)); max-height: calc(100% - 180px - var(--push, 0px)); }
}

/* ---------- top-right: toolbar ---------- */
#toolbar { right: 16px; top: 16px; display: flex; gap: 2px; padding: 4px; z-index: 8; }
.tb { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 13px 0 9px; border-radius: 999px; font-weight: 600; color: var(--ink2); }
.tb .pi { width: 18px; height: 18px; }
.tb:hover { background: var(--fill); color: var(--ink); }
.tb.on { background: var(--thumb); color: var(--ink); box-shadow: inset 0 0 0 .5px var(--thumb-edge), 0 2px 8px -2px rgba(0, 0, 0, .28); }

/* ---------- time controls ---------- */
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fill2); flex: none; }
.round .pi { width: 18px; height: 18px; }
.round:hover { background: var(--fill3); }
.scrub { position: relative; flex: 1; min-width: 90px; height: 40px; }
.scrub input { position: absolute; left: 0; right: 0; top: 3px; width: 100%; }
.ticks { position: absolute; left: 0; right: 0; bottom: 1px; height: 12px; font-size: 10px; line-height: 12px; color: var(--mute); pointer-events: none; font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; transform: translateX(-50%); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 13px 0 9px; border-radius: 999px; background: var(--fill2); font-weight: 600; flex: none; }
.pill .pi { width: 18px; height: 18px; }
.pill:hover { background: var(--fill3); }

input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; margin: 0; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) 0 var(--p, 50%), var(--fill3) var(--p, 50%));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 16px; margin-top: -5px; border-radius: 999px;
  background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .08);
  transition: transform .45s var(--spring);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.35, 1.55); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--fill3); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 26px; height: 16px; border: 0; border-radius: 999px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }

/* segmented control: a glass thumb slides (and squishes) between the options */
.seg { position: relative; display: inline-flex; flex: none; padding: 3px; border-radius: 999px; background: var(--fill); }
.seg button { position: relative; z-index: 1; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; transition: color .2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { color: var(--ink); }
.seg .thumb {
  position: absolute; left: 0; top: 3px; bottom: 3px; width: 0; border-radius: 999px;
  background: var(--thumb); box-shadow: inset 0 0 0 .5px var(--thumb-edge), 0 2px 8px -2px rgba(0, 0, 0, .3);
  transition: transform .55s var(--spring), width .55s var(--spring);
}
.seg.mini button { height: 24px; padding: 0 9px; font-size: 12px; }

/* ---------- zoom ---------- */
#zoomCtl { right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 2px; padding: 4px; z-index: 5; transition: right .55s var(--spring), bottom .55s var(--spring); }
#zoomCtl button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink2); }
#zoomCtl .pi { width: 18px; height: 18px; }
#zoomCtl button:hover { background: var(--fill); color: var(--ink); }
body.side-open #zoomCtl { right: 376px; }

#attr { position: fixed; left: 50%; bottom: 2px; transform: translateX(-50%); z-index: 3; font-size: 10px; line-height: 12px; color: var(--mute); pointer-events: none; white-space: nowrap; }

/* ---------- sheets ---------- */
.sheet { --r: var(--r-sheet); display: none; flex-direction: column; z-index: 7; }
.sheet.open { display: flex; }
.sheet.closing { pointer-events: none; }
.side { right: 16px; top: 72px; bottom: 16px; width: 348px; }
#detailPanel { left: 16px; top: 164px; width: 336px; max-height: calc(100% - 180px); z-index: 6; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 12px 6px 18px; flex: none; }
.sheet-h h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.close { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--fill2); color: var(--ink2); flex: none; }
.close .pi { width: 16px; height: 16px; }
.close:hover { background: var(--fill3); color: var(--ink); }
.sheet-b { padding: 6px var(--pad) var(--pad); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--fill3) transparent; }
.note { color: var(--mute); font-size: 12px; margin: 14px 4px 0; line-height: 1.5; }

.sec-t { display: flex; align-items: center; gap: 8px; margin: 16px 4px 8px; font-size: 12px; font-weight: 600; color: var(--mute); }
.sec-t .hint { font-weight: 400; }
.sec-t .seg { margin-left: auto; }

/* Settings have explicit row gaps so the segmented thumbs never touch the switch cards. */
#settingsPanel .sheet-b { padding-top: 16px; }
.settings-section { display: grid; gap: 12px; }
.settings-section + .settings-section { margin-top: 24px; }
.settings-section .sec-t { margin: 0 4px; }
.settings-section > .seg { justify-self: start; }
@media (min-width: 701px) {
  #settingsPanel { bottom: auto; max-height: calc(100% - 88px); }
}

.search { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px 0 11px; border-radius: 999px; background: var(--fill2); color: var(--mute); transition: box-shadow .2s; }
.search .pi { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--ink); font-size: 14px; }
.search input::placeholder { color: var(--dim); }
.search:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
.search-res { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.search-res:empty { display: none; }
.search-res .it { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border-radius: 12px; cursor: pointer; }
.search-res .it:hover { background: var(--fill2); }
.search-res .k { margin-left: auto; color: var(--mute); font-size: 12px; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--fill); font-size: 12.5px; font-weight: 500; }
.chip:hover { background: var(--fill2); }
.chip.on { background: var(--thumb); box-shadow: inset 0 0 0 .5px var(--thumb-edge), 0 2px 6px -2px rgba(0, 0, 0, .28); }
.chip.off { opacity: .45; }
.chip .cnt { color: var(--mute); font-variant-numeric: tabular-nums; }
.gico { flex: none; }
.sw { display: inline-block; flex: none; width: 16px; height: 6px; border-radius: 3px; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .25); }
.stmk { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #2a2f38; }

/* grouped lists (operators, settings): rounded cards with hairline separators */
.group { border-radius: var(--r-card); background: var(--fill); overflow: hidden; }
.row-sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 10px 6px 14px; cursor: pointer; }
.row-sw + .row-sw { border-top: 1px solid var(--hair); }
.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--fill3); cursor: pointer; transition: background-color .3s; }
.switch::before {
  content: ''; position: absolute; left: 2px; top: 2px; width: 24px; height: 24px; border-radius: 999px;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform .55s var(--spring), width .25s var(--ease);
}
.switch:checked { background: var(--green); }
.switch:checked::before { transform: translateX(18px); }
.switch:active::before { width: 30px; }
.switch:checked:active::before { transform: translateX(12px); }

.grp-t { margin: 18px 6px 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--mute); }
.op { border-radius: var(--r-card); background: var(--fill); margin-bottom: 8px; overflow: hidden; }
.op-h { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 8px 0 8px; cursor: pointer; font-weight: 600; }
.op-h:hover { background: var(--fill); }
.op-h .arrow { color: var(--mute); transition: transform .45s var(--spring); }
.op-h .arrow .pi { width: 18px; height: 18px; }
.op.open .op-h .arrow { transform: rotate(90deg); }
.op-h .cnt { margin-left: auto; color: var(--mute); font-weight: 500; font-variant-numeric: tabular-nums; }
.opsw { height: 24px; padding: 0 9px; border-radius: 999px; background: var(--fill2); font-size: 11.5px; font-weight: 600; color: var(--ink2); flex: none; }
.opsw:hover { background: var(--fill3); color: var(--ink); }
.op-b { display: none; }
.op.open .op-b { display: block; }
.ln { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 6px 0 14px; border-top: 1px solid var(--hair); cursor: pointer; transition: opacity .2s; }
.ln:hover { background: var(--fill); }
.ln.off { opacity: .42; }
.ln > .ja { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln .cnt { margin-left: auto; color: var(--mute); font-variant-numeric: tabular-nums; }
.ln .focus { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--mute); opacity: 0; transition: opacity .15s, background-color .2s; }
.ln .focus .pi { width: 16px; height: 16px; }
.ln:hover .focus, .ln .focus.on { opacity: 1; }
.ln .focus:hover { background: var(--fill2); color: var(--ink); }
.ln .focus.on { color: var(--accent); }

/* ---------- detail ---------- */
/* the train's destination sign is the one dot-matrix element left: it is what the real LED looks like */
.rollsign {
  display: flex; align-items: stretch; margin-bottom: 12px; overflow: hidden;
  border-radius: var(--r-card); background: var(--screen);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .12);
  font-family: var(--led); -webkit-font-smoothing: none;
}
.st-head { display: flex; flex-direction: column; gap: 2px; margin: 0 4px 12px; }
.st-head .nm { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: .01em; }
.st-head .en { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.rollsign .ty { padding: 7px 10px; color: #050505; font-size: 24px; line-height: 24px; white-space: nowrap; }
.rollsign .dst { flex: 1; padding: 7px 10px; color: #ffe9a8; font-size: 24px; line-height: 24px; text-shadow: 0 0 8px rgba(255, 214, 120, .45); white-space: nowrap; overflow: hidden; }
.rollsign .dst small { font-size: 12px; color: #c9b98a; margin-left: 6px; }
.tr-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.ticon { width: 92px; height: 108px; flex: none; border-radius: var(--r-card); background-color: var(--fill); background-repeat: no-repeat; image-rendering: pixelated; box-shadow: inset 0 0 0 .5px var(--hair); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; min-width: 0; }
.kv .k { color: var(--mute); white-space: nowrap; }
.kv > span { min-width: 0; }
.btn-row { display: flex; gap: 8px; margin: 4px 0 10px; }
.btn { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 14px 0 10px; border-radius: 999px; background: var(--fill2); font-weight: 600; }
.btn .pi { width: 16px; height: 16px; }
.btn:hover { background: var(--fill3); }
.btn.on { background: var(--accent); color: #fff; }

.stops { position: relative; margin-top: 6px; padding: 4px 0; }
/* train details: header stays put, only the stop list scrolls */
#detailBody.train { display: flex; flex-direction: column; overflow: hidden; }
#detailBody.train > * { flex: none; }
#detailBody.train .stops { flex: 1 1 auto; min-height: 84px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--fill3) transparent; }
.stop { display: grid; grid-template-columns: 42px 18px 1fr; align-items: center; min-height: 28px; }
.stop .t { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.stop .dot { position: relative; align-self: stretch; }
.stop .dot::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); opacity: .55; }
.stop:first-child .dot::before { top: 50%; }
.stop:last-child .dot::before { bottom: 50%; }
.stop .dot::after {
  content: ''; position: absolute; left: 4px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  background: var(--dot-bg); box-shadow: inset 0 0 0 2.5px var(--line);
}
.stop.past { color: var(--dim); }
.stop.past .t { color: var(--dim); }
.stop.past .dot::after, .stop.past .dot::before { opacity: .3; }
.stop.cur { font-weight: 700; }
.stop.cur .dot::after { left: 2px; width: 14px; height: 14px; margin-top: -7px; background: var(--line); box-shadow: 0 0 0 3px var(--fill3); animation: beat 1.6s ease-in-out infinite; }
.stop.cur.moving .dot::after { top: 0; }
@keyframes beat { 50% { box-shadow: 0 0 0 6px transparent; } }

/* station departures: styled after the newer LCD boards (smooth type on black) */
.board {
  margin-top: 10px; padding: 8px 10px; border-radius: var(--r-card); background: var(--screen); color: #e8e8e8;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .1);
  font: 500 12.5px/18px var(--sans-ja); font-variant-numeric: tabular-nums;
}
.board .row { display: grid; grid-template-columns: 40px minmax(48px, max-content) 1fr 10px; gap: 8px; align-items: center; margin: 0 -4px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.board .row:hover { background: #17191e; }
.board .row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .row .tm { color: #ffb648; }
.board .row .dst { color: #ffe9a8; }
.board .row .ln-sw { width: 10px; height: 10px; border-radius: 2px; }
.board .empty { color: #776; padding: 4px 0; }
.board-h { display: flex; justify-content: space-between; color: #8a7a55; font-size: 11.5px; font-weight: 600; border-bottom: 1px solid #222; padding-bottom: 4px; margin-bottom: 4px; }

.clist { display: flex; flex-direction: column; gap: 2px; }
.clist .it { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-card); cursor: pointer; }
.clist .it:hover { background: var(--fill2); }
.clist .ico { width: 44px; height: 52px; flex: none; border-radius: 10px; background-color: var(--fill); background-repeat: no-repeat; image-rendering: pixelated; }
.clist .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.clist .meta .l2 { display: flex; align-items: center; gap: 6px; color: var(--mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.legend-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; }
.legend-row + .legend-row { border-top: 1px solid var(--hair); }
.legend-row canvas { flex: none; border-radius: 8px; }

/* ---------- tooltip & loading ---------- */
#tooltip {
  position: fixed; z-index: 30; display: none; pointer-events: none;
  padding: 7px 11px; border-radius: 12px; font-size: 12.5px; white-space: nowrap; color: var(--ink);
  background: var(--fallback); -webkit-backdrop-filter: blur(14px) saturate(1.6); backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: inset 0 0 0 .5px var(--rim-mid), var(--shadow);
}
#loading {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: var(--loading-bg);
  transition: opacity .6s, visibility 0s .6s;
}
#loading.done { opacity: 0; visibility: hidden; }
.load-box {
  width: 300px; padding: 22px 24px; border-radius: 26px; color: var(--ink);
  background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: inset 0 0 0 1px var(--rim-mid), var(--shadow);
}
.load-box .brand { font-size: 12px; line-height: 12px; letter-spacing: .16em; color: var(--ink2); }
.bar { height: 6px; margin: 16px 0 10px; border-radius: 3px; background: var(--fill2); overflow: hidden; }
.bar i { display: block; width: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #5ac8fa, var(--accent)); transition: width .3s var(--ease); }
#loadMsg { color: var(--mute); font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}

/* ---------- small screens: compact island, icon-only toolbar, bottom sheets ---------- */
@media (max-width: 700px) {
  #island { left: 10px; top: calc(10px + env(safe-area-inset-top)); --r: 20px; min-width: 0; z-index: 13; }
  #island.open { width: calc(100vw - 20px); }
  .face { padding: 9px 12px 9px; }
  #island .brand { display: none; }
  #island .clock { font-size: 24px; line-height: 24px; margin: 0 0 4px; }
  #island #clkSec { font-size: 12px; }
  #island .meta { font-size: 12px; gap: 6px; }
  #island .live { margin-top: 5px; font-size: 12px; }
  #toolbar { right: 10px; top: calc(10px + env(safe-area-inset-top)); }
  .tb { width: 40px; padding: 0; justify-content: center; }
  .tb span { display: none; }
  #zoomCtl, #attr { display: none; }
  .sheet, .side, #detailPanel {
    left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto; max-height: 64%; --r: 28px; z-index: 12;
  }
  .sheet-h { position: relative; padding-top: 18px; }
  .sheet-h::before { content: ''; position: absolute; left: 50%; top: 6px; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--fill3); }
}
