:root {
  color-scheme: dark;
  --paper: #333333;
  --white: #3d3d3d;
  --ink: #F26722;
  --ink-soft: #FF9B6B;
  --muted: #E0A080;
  --line: #38251a;
  --green-dark: #F26722;
  --map-ocean: #aad3df;
  --font-body: "DM Sans", sans-serif;
  --font-display: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--ink); background: var(--paper); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { position: relative; display: grid; grid-template-columns: 356px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); width: 100%; height: 100dvh; min-height: 520px; }
.sidebar { z-index: 500; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 30px 24px 18px; background: var(--paper); border-right: 1px solid #e5e6df; }
.app-shell.is-sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app-shell.is-sidebar-collapsed .sidebar { display: none; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 2px 25px; }
.brand-mark { display: flex; flex: 0 0 auto; align-items: center; width: auto; height: 42px; }
.brand-mark img { display: block; width: auto; height: 42px; object-fit: contain; }
.eyebrow, .section-label { margin: 0; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.25px; }
.route-count { display: grid; place-items: center; min-width: 29px; height: 25px; margin-left: auto; border: 1px solid #e3e5dd; border-radius: 7px; color: #626c66; font-size: 11px; font-weight: 700; }
.summary { padding: 18px 19px 15px; border: 1px solid #e9e8df; border-radius: 9px; background: #eeeee7; }
.summary-distance { display: flex; align-items: baseline; gap: 7px; padding-top: 8px; color: var(--green-dark); font: 700 34px/1.15 var(--font-display); letter-spacing: 0; }
.summary-distance .unit { color: #737d75; font: 600 13px var(--font-body); }
.summary-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; color: #78817b; font-size: 11px; }
.text-button { padding: 0; border: 0; background: none; color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer; }
.text-button span { padding-left: 3px; }
.list-heading { display: flex; justify-content: space-between; align-items: end; padding: 27px 1px 13px; }
.list-heading h2 { margin: 4px 0 0; font: 700 17px/1.25 var(--font-display); letter-spacing: 0; }
.icon-button { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: #66716a; font-size: 17px; cursor: pointer; }
.search-box { display: flex; align-items: center; gap: 9px; height: 39px; padding: 0 10px; border: 1px solid #e5e7e1; border-radius: 7px; background: var(--white); color: #87918b; }
.search-box > span { font-size: 22px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-box input::placeholder { color: #a0a7a1; }
.search-box kbd { padding: 2px 5px; border: 1px solid #e9ebe6; border-radius: 4px; color: #9da39e; font: 10px var(--font-body); }
.route-list { display: flex; flex: 1 1 0%; flex-direction: column; gap: 3px; min-height: 0; margin: 11px -8px 0; padding: 0 4px 5px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #d6d9d2 transparent; scrollbar-width: thin; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.route-item { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 50px; padding: 7px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.route-item:hover { background: #eeeee8; }.route-item:active { transform: scale(.99); }
.route-item.is-active { border-color: #e7e9e2; background: #fff; }
.route-item.is-multi-selected { border-color: #cddbd1; background: #eaf0eb; box-shadow: inset 3px 0 var(--ink); }
.route-item[aria-pressed="true"] .route-name { color: var(--green-dark); }
.route-swatch { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.route-name { overflow: hidden; color: #39423d; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.route-length { color: #929a94; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-state, .loading-state { display: flex; align-items: center; gap: 10px; padding: 20px 12px; color: #858e88; font-size: 12px; }
.spinner { width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 13px 2px 0; border-top: 1px solid #e7e8e1; color: #89918c; font-size: 10px; }
.sidebar-social-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
.sidebar-social-link svg { flex: 0 0 14px; width: 14px; height: 14px; }
.sidebar-social-link:hover { color: var(--ink-soft); }
.sidebar-social-link:focus-visible { border-radius: 2px; outline: 2px solid var(--ink); outline-offset: 3px; }
.sidebar-info-button { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; margin-left: auto; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.sidebar-info-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.about-dialog-close svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.sidebar-info-button:hover { color: var(--ink-soft); }
.sidebar-info-button:focus-visible, .about-dialog-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.about-dialog { width: min(620px, calc(100% - 32px)); max-height: min(780px, calc(100dvh - 32px)); margin: auto; padding: 20px 24px 24px; overflow: auto; border: 1px solid #59402e; border-radius: 9px; background: #333; color: var(--ink); box-shadow: 0 16px 48px #000b; }
.about-dialog::backdrop { background: #080706c9; backdrop-filter: blur(3px); }
.about-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.about-dialog-header h2 { margin: 0; color: var(--ink); font: 700 20px/1.2 var(--font-display); }
.about-dialog-close { display: grid; flex: 0 0 30px; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #59402e; border-radius: 6px; background: #3d3d3d; color: var(--ink-soft); cursor: pointer; }
.about-dialog-content > p { margin: 0 0 22px; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.about-dialog-content h3 { margin: 0 0 8px; color: var(--ink); font: 700 14px/1.3 var(--font-display); }
.about-history-columns { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 5.4rem; gap: 4px 14px; padding: 0 0 6px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.about-history-columns span:last-child { text-align: center; }
.about-history { display: flex; flex-direction: column; margin: 0; }
.history-year { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 5.4rem; gap: 4px 14px; padding: 8px 0; border-top: 1px solid #49301f; }
.history-year dt { grid-column: 1; grid-row: 1; color: var(--ink); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.history-year dd { display: grid; grid-column: 2 / 4; grid-template-columns: minmax(0, 1fr) 5.4rem; gap: 14px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.history-placeholder { display: flex; align-items: center; justify-content: center; }
.history-placeholder a { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.history-placeholder img { display: block; width: 16px; height: 16px; object-fit: contain; }
.map-panel { position: relative; grid-column: 2; min-width: 0; min-height: 0; overflow: hidden; background: var(--map-ocean); }
#map { position: absolute; inset: 0; z-index: 1; background: var(--map-ocean); }
.leaflet-container { font-family: var(--font-body); }.leaflet-control-zoom { margin: 78px 0 0 18px !important; border: 1px solid #e3e5df !important; border-radius: 8px !important; box-shadow: 0 3px 12px #29362b12 !important; overflow: hidden; }
.leaflet-control-zoom a { width: 34px !important; height: 34px !important; border-bottom-color: #e8eae5 !important; color: #53665b !important; line-height: 34px !important; }
.map-topline { position: absolute; z-index: 400; top: 17px; left: 20px; right: 20px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.map-location { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 13px; border: 1px solid #e6e8e2; border-radius: 7px; background: #fffffff2; box-shadow: 0 3px 15px #26342a0b; color: #4e5c53; font-size: 11px; font-weight: 600; backdrop-filter: blur(12px); }
.sidebar-toggle { position: absolute; z-index: 800; top: 50%; left: 356px; display: grid; place-items: center; width: 20px; height: 60px; padding: 0; border: 1px solid #e1e3dc; border-left: 0; border-radius: 0 12px 12px 0; background: #fff; color: #626b65; font-size: 24px; line-height: 1; cursor: pointer; backdrop-filter: blur(12px); transform: translateY(-50%); }
.app-shell.is-sidebar-collapsed .sidebar-toggle { top: 50%; left: 0; }
.app-shell.is-sidebar-collapsed .map-topline { left: 68px; }
.sidebar-toggle:hover { background: #f7f8f5; }
.sidebar-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.map-location { pointer-events: auto; }.location-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px var(--ink); }
.leaflet-control-layers { border: 1px solid #4a4a4a !important; border-radius: 7px !important; background: #3d3d3df2 !important; color: #f2a15a !important; box-shadow: 0 3px 15px #0008 !important; font: 11px var(--font-body); backdrop-filter: blur(12px); }
.leaflet-control-layers-toggle { width: 36px !important; height: 36px !important; border-radius: 6px; background-color: #3d3d3d !important; }
.leaflet-control-layers-expanded { padding: 8px 10px !important; }
.leaflet-control-layers label { margin: 4px 0; color: #f2a15a; }
.leaflet-control-layers-separator { border-top-color: #59402e !important; }
.map-legend { position: absolute; z-index: 400; right: 20px; bottom: 21px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 11px; border: 1px solid #e6e8e2; border-radius: 6px; background: #fffffff0; color: #657168; font-size: 10px; box-shadow: 0 3px 15px #26342a0b; backdrop-filter: blur(10px); }
.legend-line { width: 17px; height: 3px; border-radius: 3px; background: #34745b; }.legend-point { width: 7px; height: 7px; border: 2px solid #dc9b56; border-radius: 50%; }.legend-divider { width: 1px; height: 14px; margin: 0 3px; background: #e2e5df; }
.map-credit { position: absolute; z-index: 400; bottom: 4px; left: 6px; padding: 2px 4px; border-radius: 3px; background: #ffffffe0; color: #66716a; font-size: 9px; }.map-credit a { color: #526d5c; text-decoration: none; }
.route-detail { position: absolute; z-index: 410; top: 16px; left: 12px; right: 12px; width: min(225px, calc(100% - 24px)); margin: 0 auto; padding: 10px 12px; border: 1px solid #e7e9e3; border-radius: 7px; background: #fff; box-shadow: 0 8px 30px #1c30201a; animation: detail-enter .28s cubic-bezier(.2,.75,.3,1) both; }
@keyframes detail-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.detail-topline { display: flex; align-items: center; }
.detail-identity { min-width: 0; width: 100%; }
.detail-kicker { display: flex; align-items: center; gap: 7px; color: #849088; font-size: 9px; font-weight: 700; letter-spacing: 1px; }.detail-swatch { width: 8px; height: 8px; border-radius: 50%; }
.detail-summary { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.route-detail h2 { flex: 1 1 auto; min-width: 0; margin: 5px 0 0; overflow: hidden; font: 700 12px/1.2 var(--font-display); text-overflow: ellipsis; white-space: nowrap; }
.detail-distance { flex: 0 0 auto; color: var(--ink); font: 700 11px/1.2 var(--font-display); white-space: nowrap; }
.is-selected-route { stroke-dasharray: 1; stroke-dashoffset: 1; animation: route-draw 1.4s ease-out forwards; }
@keyframes route-draw { to { stroke-dashoffset: 0; } }

@media (max-width: 760px) {
  .app-shell { --drawer-height: max(260px, min(46dvh, 375px)); display: block; min-height: 0; }
  .map-panel { position: absolute; inset: 0; }
  .app-shell.is-mobile-sidebar-collapsed { --drawer-height: 64px; }
  .sidebar { position: absolute; z-index: 600; right: 0; bottom: 0; left: 0; height: var(--drawer-height); min-height: 260px; padding: 13px 17px max(12px, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid #e1e3dc; border-radius: 15px 15px 0 0; box-shadow: 0 -7px 25px #24342c0c; }
  .sidebar.is-collapsed { min-height: 64px; padding-bottom: 0; overflow: hidden; }
  .leaflet-control-container { z-index: 900; }
  .leaflet-top.leaflet-left { z-index: 900; }
  .leaflet-control-zoom { margin: 0 !important; }
  .sidebar.is-collapsed .summary, .sidebar.is-collapsed .list-heading, .sidebar.is-collapsed .search-box, .sidebar.is-collapsed .route-list { display: none; }
  .brand-row { gap: 8px; padding: 0 1px 12px; }.brand-mark { height: 34px; }.brand-mark img { height: 34px; }.eyebrow { font-size: 8px; }.route-count { height: 22px; min-width: 26px; font-size: 10px; }
  .summary { position: absolute; top: 12px; right: 17px; width: 151px; padding: 9px 11px 8px; border-radius: 7px; }.summary .section-label { font-size: 8px; }.summary-distance { gap: 5px; padding-top: 3px; font-size: 22px; }.summary-distance .unit { font-size: 10px; }.summary-footer { padding-top: 2px; font-size: 9px; }.summary-footer .text-button { font-size: 9px; }
  .list-heading { padding: 7px 1px 8px; }.list-heading .section-label { font-size: 8px; }.list-heading h2 { margin-top: 2px; font-size: 15px; }.icon-button { width: 25px; height: 25px; }
  .search-box { height: 34px; }.search-box input { font-size: 11px; }.route-list { margin-top: 6px; }.route-item { min-height: 39px; padding: 5px 9px; }.route-name { font-size: 11px; }.route-length { font-size: 9px; }.sidebar-footer { display: flex; padding-top: 8px; }.sidebar.is-collapsed .sidebar-footer { display: none; }
  #map { bottom: 0; }.map-topline { top: 12px; left: 12px; right: 12px; }.map-location { min-height: 35px; padding: 0 10px; font-size: 10px; }.leaflet-control-zoom { margin-top: 59px !important; margin-right: 0 !important; margin-left: 12px !important; }.map-legend { right: 12px; bottom: calc(var(--drawer-height) + 30px); height: 31px; font-size: 9px; }.map-credit { bottom: calc(var(--drawer-height) + 20px); }
  .map-topline { gap: 7px; }.sidebar-toggle { position: fixed; z-index: 800; top: auto; right: auto; bottom: calc(var(--drawer-height) - 20px); left: calc(50% - 10px); width: 20px; height: 60px; border: 1px solid #e1e3dc; border-left: 0; border-radius: 0 12px 12px 0; background: var(--paper); font-size: 24px; transform: rotate(-90deg); }
  .app-shell.is-mobile-sidebar-collapsed .map-legend { right: 12px; bottom: calc(var(--drawer-height) + 30px); z-index: 700; }
  .app-shell.is-mobile-sidebar-collapsed .map-credit { bottom: calc(var(--drawer-height) + 20px); left: 6px; z-index: 700; }
  .route-detail { top: 57px; }
  .about-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); padding: 16px; }
  .about-dialog-content > p { font-size: 12px; }
  .about-history-columns { grid-template-columns: 2.8rem minmax(0, 1fr) 4rem; gap: 4px 10px; }
  .history-year { grid-template-columns: 2.8rem minmax(0, 1fr) 4rem; gap: 4px 10px; }
  .history-year dd { grid-template-columns: minmax(0, 1fr) 4rem; gap: 8px; }
  .history-year dt, .history-year dd { font-size: 11px; }
}

@media (max-width: 360px) { .summary { width: 137px; }.summary-distance { font-size: 20px; }.summary-footer { font-size: 8px; }.summary-footer .text-button { font-size: 8px; }.sidebar { padding-right: 12px; padding-left: 12px; }.summary { right: 12px; } }

body { background: var(--paper); }
.sidebar { border-color: #392419; }
.route-count { border-color: #51321f; color: #f0a15e; }
.summary { border-color: #4a4a4a; background: #393939; }
.summary-distance { color: var(--ink); }
.summary-distance .unit, .summary-footer { color: var(--muted); }
.text-button, .detail-focus { color: var(--ink); }
.icon-button { border-color: #49301f; color: var(--ink-soft); }
.search-box { border-color: #4a4a4a; background: #3d3d3d; color: var(--ink-soft); }
.search-box input { color: var(--ink-soft); }
.search-box input::placeholder, .search-box kbd { color: var(--muted); }
.search-box kbd { border-color: #49301f; }
.route-list { scrollbar-color: #67401f transparent; }
.route-item:hover { background: #424242; }
.route-item.is-active { border-color: #5a351e; background: #3e3e3e; }
.route-item.is-multi-selected { border-color: #74431e; background: #454545; box-shadow: inset 3px 0 var(--ink); }
.route-item[aria-pressed="true"] .route-name, .route-name { color: var(--ink); }
.route-length, .empty-state, .loading-state { color: var(--muted); }
.spinner { border-color: #49301f; border-top-color: var(--ink); }
.sidebar-footer { border-color: #392419; color: var(--muted); }
.map-panel, #map { background: var(--map-ocean); }
.leaflet-control-zoom { border-color: #4a4a4a !important; background: #3d3d3d; box-shadow: 0 3px 12px #0009 !important; }
.leaflet-control-zoom a { border-bottom-color: #4a4a4a !important; background: #3d3d3d !important; color: var(--ink-soft) !important; }
.map-location, .map-legend { border-color: #4a4a4a; background: #3d3d3df2; color: var(--ink-soft); box-shadow: 0 3px 15px #0008; }
.sidebar-toggle { border-color: #4a4a4a; background: #333; color: var(--ink-soft); }
.sidebar-toggle::before { background: var(--ink); }
.sidebar-toggle:hover { background: #454545; }
.sidebar-toggle:focus-visible { outline-color: var(--ink); }
.location-pulse { background: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 15%, transparent); }
.legend-line { background: var(--ink); }
.legend-point { border-color: var(--ink-soft); }
.legend-divider { background: #51321f; }
.map-credit { background: #3d3d3de8; color: var(--muted); }
.map-credit a { color: var(--ink-soft); }
.route-detail { border-color: #4a4a4a; background: #3d3d3d; box-shadow: 0 8px 30px #0009; }
.detail-kicker { color: var(--muted); }
.detail-icon { background: #484848; color: #d59a6c; }
.detail-icon:hover { background: #535353; color: var(--ink-soft); }
.detail-icon:focus-visible { outline-color: var(--ink); }
.detail-focus { color: var(--ink); }
.detail-stats { border-color: #392419; }
.detail-stats div + div { border-color: #392419; }
.detail-stats strong { color: var(--ink-soft); }
.detail-stats span { color: var(--muted); }