/* Mobile sheet owner: sheet MOTION (snap transform, drag, settle), map-state
   peek, heading/actions, collapsed summary, search, and mobile primary cards.
   The sheet SHELL (position, size, paper, border, shadow) is owned by
   mobile-panel-system.css — do not restate shell properties here. */

@media (max-width: 980px) {
.mobile-sheet > section[hidden],
  .mobile-sheet > form[hidden],
  .mobile-sheet > div[hidden],
  .mobile-sheet > section[data-panel-visible="false"],
  .mobile-sheet > form[data-panel-visible="false"],
  .mobile-sheet > div[data-panel-visible="false"] {
    display: none;
  }

.mobile-sheet-handle {
    appearance: none;
    border: 0;
    padding: 0;
    justify-self: center;
    width: 58px;
    height: 24px;
    background: transparent;
    cursor: pointer;
  }

.mobile-sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    order: 1;
  }

.mobile-sheet-actions {
    display: grid;
    flex: 0 0 auto;
    gap: 6px;
    justify-items: end;
  }

.mobile-collapsed-control-bar .mobile-collapsed-poster-button {
    display: inline-grid;
    align-items: center;
    justify-items: center;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 0 6px 3px;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.54rem;
    font-weight: 780;
    letter-spacing: 0.04em;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

.mobile-sheet-handle {
    order: 0;
  }

.mobile-sheet-handle::before {
    content: "";
    display: block;
    width: 58px;
    height: 5px;
    margin: 9px auto 0;
    background: rgba(12, 12, 12, 0.24);
  }

.mobile-sheet-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1.02rem;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.08;
    text-transform: none;
  }

.mobile-sheet p {
    margin: 6px 0 0;
    color: var(--ink-soft);
    font-family: var(--font-serif);
    font-size: 0.86rem;
    line-height: 1.34;
  }

.mobile-primary-summary {
    order: 2;
  }

.mobile-primary-card {
    display: grid;
    gap: 4px;
    padding: 9px 11px 10px;
    border: 1px solid rgba(17, 16, 14, 0.24);
    background: rgba(255, 253, 247, 0.62);
  }

.mobile-primary-card > strong {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 850;
    line-height: 1.06;
  }

.mobile-primary-card.is-result > strong {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: clamp(2rem, 9vw, 2.65rem);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    line-height: 0.94;
    white-space: nowrap;
  }

.mobile-primary-card p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.25;
  }

.mobile-primary-card .mobile-field-note {
    margin-top: 4px;
    border-top: 1px solid rgba(17, 16, 14, 0.14);
    padding-top: 6px;
    color: rgba(17, 16, 14, 0.66);
    font-family: var(--font-serif);
    font-size: 0.76rem;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.24;
    text-transform: none;
  }

.mobile-primary-card.is-result .mobile-field-note {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

.mobile-primary-card .mobile-field-note b {
    display: inline;
    margin-right: 4px;
    color: #11100e;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 850;
    letter-spacing: 0.065em;
    text-transform: uppercase;
  }

.mobile-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

.mobile-primary-card .origin-metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 3px;
  }

.mobile-primary-card .origin-metric {
    padding: 6px 6px 7px;
    background: rgba(255, 253, 247, 0.5);
  }

.mobile-primary-card .origin-metric em,
  .mobile-primary-card .origin-metric small {
    font-size: 0.52rem;
    letter-spacing: 0.04em;
  }

.mobile-primary-card .origin-metric strong {
    font-size: 0.86rem;
  }

.mobile-sheet[data-snap="collapsed"] {
    overflow: hidden;
    gap: 9px;
    padding-top: 8px;
    background: rgba(247, 245, 236, 0.98);
    box-shadow: 0 -8px 24px rgba(36, 30, 20, 0.08);
  }

.mobile-sheet[data-snap="collapsed"] .mobile-sheet-head {
    align-items: start;
    min-height: 38px;
    margin: -2px 0 0;
  }

.mobile-sheet[data-snap="collapsed"] .mobile-sheet-head > div {
    display: grid;
    gap: 3px;
    align-content: center;
    min-width: 0;
  }

.mobile-sheet[data-snap="collapsed"] .mobile-sheet-head p {
    display: none;
  }

.mobile-sheet[data-snap="collapsed"] .mobile-sheet-head h3 {
    overflow: hidden;
    font-size: 0.94rem;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] #mobileStatusText {
    display: block;
    max-width: min(38ch, calc(100vw - 132px));
    margin: 0;
    overflow: hidden;
    color: rgba(17, 16, 14, 0.58);
    font-family: var(--font-main);
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.005em;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

.mobile-sheet[data-snap="collapsed"] .mobile-sheet-actions {
    align-self: start;
    margin-top: 1px;
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-summary {
    display: block;
    min-width: 0;
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card {
    align-content: center;
    gap: 3px;
    min-height: 64px;
    padding: 8px 10px;
    background: rgba(255, 253, 247, 0.74);
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card p,
body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card .mobile-field-note,
body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card .origin-metric-strip{
    display: none;
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card span {
    overflow: hidden;
    font-size: 0.54rem;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card > strong {
    margin: 0;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: clamp(1.18rem, 5.4vw, 1.42rem);
    font-weight: 580;
    line-height: 0.96;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card[data-collapsed-meta]::after {
    content: attr(data-collapsed-meta);
    overflow: hidden;
    color: rgba(17, 16, 14, 0.58);
    font-family: var(--font-main);
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

.mobile-sheet[data-snap="full"] {
    overflow-y: auto;
  }
}

@media (max-width: 980px) {
.mobile-sheet {
    border-top-color: rgba(17, 16, 14, 0.46);
    background:
      linear-gradient(180deg, rgba(251, 250, 244, 0.97), rgba(241, 236, 224, 0.95)),
      linear-gradient(90deg, rgba(17, 16, 14, 0.03) 1px, transparent 1px);
    background-size: auto, 38px 38px;
    box-shadow: 0 -24px 60px rgba(36, 30, 20, 0.18);
  }

.mobile-sheet-handle {
    height: 24px;
    background: transparent;
  }

.mobile-sheet-handle::before {
    height: 4px;
    background: rgba(17, 16, 14, 0.26);
  }

.mobile-sheet-head h3 {
    font-size: 1rem;
  }

.mobile-sheet p {
    color: rgba(17, 16, 14, 0.62);
  }

}

@media (max-width: 980px) {
.mobile-sheet {
    background: var(--panel-bg);
    background-size: auto;
    box-shadow: none;
  }
}

.mobile-primary-card.is-result > strong {
  font-family: var(--font-serif);
  font-weight: 400;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0;
  line-height: 0.96;
}

.mobile-sheet {
  transition:
    transform var(--duration-slow) var(--motion-soft),
    box-shadow var(--duration-slow) var(--motion-soft),
    background-color var(--duration-slow) var(--motion-soft);
}

.mobile-sheet-handle::before {
  transition:
    background-color var(--duration-base) var(--motion-snap),
    transform var(--duration-base) var(--motion-snap),
    width var(--duration-base) var(--motion-snap);
}

.mobile-sheet[data-snap="full"] .mobile-sheet-handle::before {
  width: 46px;
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: no-preference) {
  .mobile-sheet[data-snap="full"] {
    box-shadow: 0 -18px 42px rgba(36, 30, 20, 0.12);
  }
}

@media (max-width: 980px) {
.mobile-sheet {
    --panel-label-size: 0.6rem;
    --panel-caption-size: 0.74rem;
    --panel-body-size: 0.86rem;
    --panel-body-line: 1.34;
  }

.mobile-sheet-head h3 {
    font-size: 1.04rem;
    font-weight: 820;
    line-height: 1.1;
  }

.mobile-sheet-eyebrow {
    font-size: 0.58rem;
  }
}

@media (max-width: 980px) {
  .mobile-collapsed-summary {
    display: none;
    margin: 2px 0 0;
    overflow: hidden;
    color: rgba(17, 16, 14, 0.62);
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 720;
    letter-spacing: 0;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-collapsed-line-logo {
    display: none;
    min-width: 0;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-summary {
    display: block;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-logo:not([hidden]) {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 23px;
    margin: 0 0 2px;
    overflow: visible;
    z-index: 8;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip {
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
    max-width: calc(100vw - 40px);
    min-width: 0;
    overflow: hidden;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip .station-sign-badge {
    flex: 0 1 auto;
    max-width: min(138px, calc(100vw - 40px));
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-eyebrow,
  .mobile-sheet[data-snap="collapsed"] #mobileStatusText,
  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-actions {
    display: none;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 60px;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-head > div {
    display: grid;
    align-content: center;
    gap: 1px;
    min-width: 0;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-head h3 {
    max-width: 100%;
    font-size: 0.96rem;
    line-height: 1.05;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-actions {
    align-items: center;
    justify-content: flex-end;
    min-width: max-content;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip {
    max-width: calc(100vw - 40px);
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip .station-sign-badge {
    flex: 0 0 auto;
    max-width: 94px;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip .station-sign-badge[hidden],
  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-overflow[hidden],
  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-popover[hidden] {
    display: none;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip .station-sign-badge b {
    min-width: 24px;
    height: 28px;
    padding-inline: 5px;
    font-size: 0.62rem;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-strip .station-sign-badge span {
    padding-inline: 6px;
    font-size: 0.52rem;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-overflow {
    flex: 0 0 auto;
    min-width: 32px;
    height: 28px;
    padding: 0 7px;
    border: 1px solid rgba(17, 16, 14, 0.34);
    border-radius: 0;
    background:
      linear-gradient(180deg, rgba(255, 253, 247, 0.74), rgba(226, 219, 203, 0.76));
    color: rgba(17, 16, 14, 0.74);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 850;
    line-height: 1;
    box-shadow: var(--material-inset);
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-collapsed-line-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 30;
    display: grid;
    gap: 7px;
    width: min(318px, calc(100vw - 22px));
    max-height: min(42dvh, 260px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid rgba(17, 16, 14, 0.38);
    background:
      linear-gradient(90deg, rgba(17, 16, 14, 0.028) 1px, transparent 1px),
      rgba(249, 246, 236, 0.98);
    background-size: 18px 18px, auto;
    box-shadow: 0 12px 24px rgba(17, 16, 14, 0.18), var(--material-inset);
  }

  .mobile-collapsed-line-popover-title {
    color: rgba(17, 16, 14, 0.56);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
  }

  .mobile-collapsed-line-popover-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    min-width: 0;
  }

  .mobile-collapsed-popover-badge {
    flex: 0 1 auto;
    max-width: 138px;
  }

  .mobile-sheet[data-snap="full"] .mobile-collapsed-summary,
  .mobile-sheet[data-snap="full"] .mobile-collapsed-line-logo {
    display: none;
  }
}

@media (max-width: 760px) {
body.is-inspect-mode .mobile-sheet[data-snap="collapsed"] #mobileStatusText {
    display: block;
    max-width: min(38ch, calc(100vw - 132px));
    margin: 0;
    overflow: hidden;
    color: rgba(17, 16, 14, 0.58);
    font-family: var(--font-main);
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.005em;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Mobile sheet shell, snap, and drag mechanics owned by the sheet layer;
   feature owners keep their panel content rules. */
@media (max-width: 980px) {
  body {
    --mobile-sheet-open-progress: 0;
  }

  body.is-mobile-sheet-expanded {
    --mobile-sheet-open-progress: 1;
  }

  :root,
  body.is-reach-mode.has-origin {
    --mobile-sheet-peek: clamp(104px, 13dvh, 112px);
  }

  body.is-map-active.is-reach-mode.has-origin,
  body.is-map-active.is-route-mode,
  body.is-map-active.is-inspect-mode {
    --mobile-sheet-peek: clamp(104px, 13dvh, 112px);
    --mobile-map-bottom-clearance: calc(env(safe-area-inset-bottom) + var(--mobile-sheet-peek) + 8px);
  }

  body.is-time-rings-view.is-map-active.is-reach-mode.has-origin {
    --mobile-sheet-peek: clamp(104px, 13dvh, 112px);
    --mobile-map-bottom-clearance: calc(env(safe-area-inset-bottom) + var(--mobile-sheet-peek) + 10px);
  }

  /* Sheet motion only — the visual shell lives in mobile-panel-system.css. */
  .mobile-sheet {
    --mobile-sheet-rest-y: 0px;
    --mobile-sheet-drag-y: 0px;
    --mobile-sheet-settle-ms: 470ms;
    transform: translate3d(0, calc(var(--mobile-sheet-rest-y) + var(--mobile-sheet-drag-y)), 0);
    transition:
      transform var(--mobile-sheet-settle-ms) cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 360ms cubic-bezier(0.18, 0.82, 0.22, 1),
      background-color 360ms cubic-bezier(0.18, 0.82, 0.22, 1),
      border-color 360ms cubic-bezier(0.18, 0.82, 0.22, 1);
    will-change: transform;
  }

  .mobile-sheet::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 253, 247, 0.72), transparent);
    opacity: 0.22;
    pointer-events: none;
    transition: opacity 260ms cubic-bezier(0.22, 0.68, 0.24, 1);
  }

  .mobile-sheet-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(17, 16, 14, 0.16);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .mobile-sheet-head h3 {
    font-size: 0.96rem;
  }

  .mobile-sheet p {
    font-size: 0.8rem;
    line-height: 1.28;
  }

  .mobile-sheet-actions {
    max-width: 126px;
  }

  .mobile-sheet[data-snap="collapsed"] {
    --mobile-sheet-rest-y: calc(86dvh - var(--mobile-sheet-peek));
    --mobile-sheet-open-progress: 0;
    gap: 0;
    overflow: visible;
  }

  body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] {
    z-index: 80;
    padding-top: 6px;
  }

  body:is(.is-route-mode, .is-inspect-mode) .mobile-sheet[data-snap="collapsed"] {
    z-index: 80;
    overflow: visible;
  }

  body.is-map-active.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"],
  body.is-map-active.is-route-mode .mobile-sheet[data-snap="collapsed"],
  body.is-map-active.is-inspect-mode .mobile-sheet[data-snap="collapsed"] {
    --mobile-sheet-rest-y: calc(86dvh - var(--mobile-sheet-peek));
  }

  body.is-time-rings-view.is-map-active.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] {
    --mobile-sheet-rest-y: calc(86dvh - var(--mobile-sheet-peek));
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-primary-summary,
  body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-summary,
  .mobile-sheet[data-snap="collapsed"] .mobile-search-form,
  .mobile-sheet[data-snap="collapsed"] .mobile-mode-control,
  .mobile-sheet[data-snap="collapsed"] .mobile-surface-story-toggle,
  .mobile-sheet[data-snap="collapsed"] .mobile-adjust-map,
  .mobile-sheet[data-snap="collapsed"] .mobile-inspector,
  .mobile-sheet[data-snap="collapsed"] .mobile-reach-details,
  .mobile-sheet[data-snap="collapsed"] .mobile-route-card{
    display: none;
  }

  .mobile-sheet[data-snap="full"] {
    --mobile-sheet-rest-y: 0px;
    --mobile-sheet-open-progress: 1;
    gap: 10px;
    overflow-y: auto;
    padding-bottom: calc(max(18px, env(safe-area-inset-bottom)) + 18px);
    scroll-padding-top: 84px;
  }

  .mobile-sheet[data-snap="full"] > #mobileInspector[data-panel-visible="true"] {
    display: block;
    order: 2;
  }

  .mobile-sheet[data-snap="full"] > #mobilePrimarySummary {
    display: block;
    order: 3;
  }

  .mobile-sheet[data-snap="full"] > #mobileReachDetails[data-panel-visible="true"] {
    display: block;
    order: 6;
  }

  .mobile-sheet[data-snap="full"] > .mobile-route-card[data-panel-visible="true"] {
    display: block;
    order: 7;
  }

  .mobile-sheet[data-snap="full"] > .mobile-search-form[data-panel-visible="true"] {
    display: grid;
    order: 7;
  }

  .mobile-sheet[data-snap="full"] > .mobile-mode-control {
    display: grid;
    order: 4;
  }

  .mobile-sheet[data-snap="full"] > .mobile-surface-story-toggle {
    display: flex;
    order: 5;
  }

  .mobile-sheet[data-snap="full"] > .mobile-adjust-map {
    display: grid;
    order: 8;
  }

  .mobile-sheet[data-snap="full"] .mobile-sheet-handle,
  .mobile-sheet[data-snap="full"] .mobile-sheet-head {
    position: sticky;
    background:
      linear-gradient(180deg, rgba(247, 245, 236, 0.98), rgba(247, 245, 236, 0.92));
  }

  .mobile-sheet[data-snap="full"] .mobile-sheet-handle {
    top: 0;
    z-index: 24;
    justify-self: center;
    width: min(128px, calc(100vw - 28px));
    height: 32px;
    min-height: 32px;
    margin: 0 auto -8px;
    border-bottom: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-sheet[data-snap="full"] .mobile-sheet-head {
    top: 32px;
    z-index: 23;
    isolation: isolate;
    margin-inline: -10px;
    padding: 6px 10px 8px;
    border-bottom: 1px solid rgba(17, 16, 14, 0.2);
    background: linear-gradient(180deg, rgba(250, 248, 241, 0.995), rgba(247, 245, 236, 0.985));
    background-size: auto;
    box-shadow:
      0 -32px 0 rgba(247, 245, 236, 0.985),
      0 10px 18px rgba(17, 16, 14, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mobile-sheet[data-snap="full"] .mobile-sheet-head::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    z-index: -1;
    height: 32px;
    background: rgba(247, 245, 236, 0.985);
    pointer-events: none;
  }

  .mobile-sheet-handle {
    position: relative;
    z-index: 30;
    display: grid;
    place-items: center;
    justify-self: center;
    width: min(128px, calc(100vw - 28px));
    height: 44px;
    min-height: 44px;
    margin-inline: auto;
    padding: 10px 0;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
  }

  .mobile-sheet-handle::before,
  .mobile-sheet[data-snap="full"] .mobile-sheet-handle::before {
    width: 98px;
    height: 8px;
    margin: 0;
    border: 1px solid rgba(0, 0, 0, 0.84);
    background-color: var(--material-black-key);
    background-image:
      linear-gradient(180deg, rgba(255, 253, 247, 0.1), rgba(255, 253, 247, 0));
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 247, 0.14),
      inset 0 -1px 0 rgba(0, 0, 0, 0.42);
    pointer-events: none;
    transform: none;
    transform-origin: center;
    transition:
      background-color var(--motion-duration-base) var(--motion-ease-emphasized),
      box-shadow var(--motion-duration-base) var(--motion-ease-emphasized),
      transform var(--motion-duration-slow) var(--motion-ease-enter),
      width var(--motion-duration-slow) var(--motion-ease-enter);
  }

  .mobile-sheet-handle::after {
    content: "";
    width: 46px;
    height: 3px;
    margin-top: -2px;
    border-radius: 999px;
    background: rgba(255, 253, 247, 0.46);
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-sheet-handle::before {
    transform: translateY(1px) scaleX(1);
  }

  .mobile-sheet[data-snap="full"] .mobile-sheet-handle::before {
    transform: translateY(-1px) scaleX(0.64);
  }

  body.is-mobile-sheet-dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
  }

  body.is-mobile-sheet-dragging .mobile-sheet.mobile-sheet {
    border-top-color: rgba(17, 16, 14, 0.74);
    box-shadow: 0 -22px 54px rgba(12, 12, 12, 0.18);
    cursor: grabbing;
    transition: none;
  }

  body.is-mobile-sheet-dragging .mobile-sheet::before {
    opacity: 0.42;
  }

  body.is-mobile-sheet-dragging .mobile-sheet-handle {
    cursor: grabbing;
  }

  body.is-mobile-sheet-dragging .mobile-sheet[data-snap] .mobile-sheet-handle::before {
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 247, 0.18),
      inset 0 -1px 0 rgba(0, 0, 0, 0.5),
      0 3px 10px rgba(12, 12, 12, 0.16);
    transform: translateY(-2px) scaleX(1.04);
  }

  body.is-mobile-sheet-dragging .mobile-sheet-head,
  body.is-mobile-sheet-settling .mobile-sheet-head {
    transition:
      opacity 220ms cubic-bezier(0.22, 0.68, 0.24, 1),
      transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.is-mobile-sheet-dragging .mobile-sheet-head {
    opacity: 0.92;
    transform: translateY(-1px);
  }

  body.is-mobile-sheet-settling .mobile-sheet {
    transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* The paper must reach the bottom of the screen for the whole journey. The
     half snap trims its box to the task height only once it rests; while a
     drag or settle moves the sheet it keeps the full panel height so the map
     never shows through beneath its lower edge and the content below the
     task fold is already visible on the way up. */
  html body.is-map-active:is(.is-mobile-sheet-dragging, .is-mobile-sheet-settling)
    #mobileSheet.mobile-sheet[data-snap="half"] {
    height: var(--mobile-panel-height);
    max-height: var(--mobile-panel-height);
  }

  body.is-mobile-sheet-settling .map-frame {
    transition: filter 320ms cubic-bezier(0.18, 0.82, 0.22, 1);
  }
}

@media (max-width: 980px) and (prefers-reduced-motion: reduce) {
  html:not(#reduced-motion-owner) .mobile-sheet,
  html:not(#reduced-motion-owner) .mobile-sheet-handle::before,
  html:not(#reduced-motion-owner) .mobile-sheet-head {
    transition-duration: 1ms;
  }
}

body .mobile-sheet > section[hidden],
body .mobile-sheet > form[hidden],
body .mobile-sheet > div[hidden],
body .mobile-sheet > section[data-panel-visible="false"],
body .mobile-sheet > form[data-panel-visible="false"],
body .mobile-sheet > div[data-panel-visible="false"] {
  display: none;
}

/* Mobile sheet search, summary, and compact card refinements.
   Split mechanically from mobile-refinements.css; keep before feature-specific reach/route/station owners. */

@media (max-width: 980px) {
  .mobile-primary-card p,
  .mobile-metric-card small {
    font-family: var(--font-main);
    letter-spacing: 0;
  }
  .mobile-search-form {
    order: 2;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 3px;
    border-color: rgba(17, 16, 14, 0.22);
    background:
      linear-gradient(90deg, rgba(17, 16, 14, 0.02) 1px, transparent 1px),
      linear-gradient(180deg, rgba(255, 253, 247, 0.78), rgba(235, 229, 214, 0.58));
    background-size: 18px 18px, auto;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 247, 0.74),
      inset 0 -1px 0 rgba(17, 16, 14, 0.08);
  }
  .mobile-search-form label {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 760;
    letter-spacing: 0.08em;
    line-height: 1;
  }
  .mobile-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 6px;
    align-items: stretch;
  }
  .mobile-search-row input {
    min-height: 38px;
    height: 38px;
    padding: 0 9px;
    border-radius: 2px;
    font-size: 16px;
    line-height: 38px;
  }
  .mobile-search-row button {
    min-width: 0;
    min-height: 38px;
    height: 38px;
    padding: 0 8px;
    border-radius: 2px;
    font-size: 0.66rem;
    line-height: 1;
    white-space: nowrap;
  }
  .mobile-search-form .text-button {
    display: none;
  }
  .mobile-search-form .search-results {
    margin-top: 3px;
    max-height: min(216px, 38vh);
  }
  .mobile-primary-summary {
    order: 3;
  }
  .mobile-primary-card {
    display: grid;
    gap: 5px;
    min-height: 0;
    padding: 8px 9px;
    border-radius: 3px;
    background:
      linear-gradient(90deg, rgba(17, 16, 14, 0.026) 1px, transparent 1px),
      linear-gradient(180deg, rgba(255, 253, 247, 0.82), rgba(238, 232, 218, 0.64));
    background-size: 18px 18px, auto;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 247, 0.82),
      inset 0 -1px 0 rgba(17, 16, 14, 0.1);
  }
  .mobile-primary-card span,
  .mobile-reach-details h3,
  .mobile-adjust-map h3{
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 760;
    letter-spacing: 0.08em;
    line-height: 1;
  }
  .mobile-primary-card > strong {
    font-family: var(--font-main);
    font-size: clamp(1.22rem, 5vw, 1.64rem);
    font-weight: 820;
    line-height: 1.02;
    letter-spacing: 0;
  }
  .mobile-primary-card.is-result > strong {
    font-size: clamp(2rem, 10vw, 2.85rem);
    font-weight: 860;
  }
  .mobile-primary-card p {
    margin: 0;
    color: rgba(17, 16, 14, 0.7);
    font-size: 0.79rem;
    font-weight: 600;
    line-height: 1.28;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .mobile-primary-card .origin-metric-strip,
  .mobile-primary-card .mobile-field-note,
  .mobile-primary-card.is-result .mobile-field-note{
    display: none;
  }
  .mobile-primary-card .mobile-origin-sign-strip {
    margin: 0 0 1px;
    gap: 4px;
  }
  .mobile-primary-card .mobile-origin-sign-strip .station-sign-badge {
    min-height: 22px;
    padding: 3px 5px;
  }
  .mobile-reach-details {
    order: 4;
    padding: 8px;
    border-radius: 3px;
  }
  .mobile-reach-details h3 {
    margin-bottom: 6px;
  }
  .mobile-metric-grid {
    gap: 6px;
  }
  .mobile-metric-card {
    min-height: 64px;
    padding: 7px;
    border-radius: 3px;
  }
  .mobile-metric-card span {
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.07em;
    line-height: 1.05;
  }
  .mobile-metric-card strong {
    font-family: var(--font-main);
    font-size: clamp(1.18rem, 5vw, 1.5rem);
    line-height: 1;
  }
  .mobile-metric-card small {
    font-size: 0.7rem;
    line-height: 1.2;
  }
  .mobile-mode-control {
    order: 5;
  }
  .mobile-surface-story-toggle {
    order: 6;
  }
  .mobile-adjust-map {
    order: 8;
  }
  .mobile-sheet[data-snap="collapsed"] .mobile-search-form,
  .mobile-sheet[data-snap="collapsed"] .mobile-reach-details {
    display: none;
  }
  .mobile-sheet[data-snap="full"] .mobile-search-form {
    order: 2;
  }
  .mobile-sheet[data-snap="full"] .mobile-primary-summary {
    order: 3;
  }
  .mobile-sheet[data-snap="full"] .mobile-reach-details {
    order: 4;
  }
  .mobile-sheet[data-snap="full"] .mobile-mode-control {
    order: 5;
  }
  .mobile-sheet[data-snap="full"] .mobile-surface-story-toggle {
    order: 6;
  }
  .mobile-sheet[data-snap="full"] .mobile-adjust-map {
    order: 8;
  }
}

@media (max-width: 980px) {
  .mobile-search-form {
    order: 2;
    position: relative;
    display: grid;
    gap: 6px;
    padding: 8px;
    overflow: visible;
    border: 1px solid rgba(17, 16, 14, 0.3);
    border-radius: 3px;
    background:
      linear-gradient(90deg, rgba(17, 16, 14, 0.024) 1px, transparent 1px),
      linear-gradient(180deg, rgba(255, 253, 247, 0.68), rgba(228, 221, 205, 0.5));
    background-size: 18px 18px, auto;
    box-shadow:
      inset 0 2px 0 rgba(17, 16, 14, 0.62),
      inset 0 0 0 1px rgba(255, 253, 247, 0.36);
  }
  .mobile-search-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .mobile-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 6px;
    align-items: stretch;
  }
  .mobile-search-row input {
    min-width: 0;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid rgba(17, 16, 14, 0.32);
    background:
      linear-gradient(90deg, rgba(17, 16, 14, 0.028) 1px, transparent 1px),
      rgba(255, 253, 247, 0.74);
    background-size: 14px 100%, auto;
    box-shadow: var(--material-inset);
    color: var(--ink);
    font-size: 0.82rem;
  }
  .mobile-search-row button {
    min-width: 0;
    min-height: 40px;
    padding: 0 8px;
    border-color: var(--material-black-key-edge);
    background:
      linear-gradient(180deg, rgba(255, 253, 247, 0.08), rgba(255, 253, 247, 0)),
      var(--material-black-key);
    color: var(--material-black-key-text);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.04em;
  }
  .mobile-search-form .text-button {
    justify-self: start;
    min-height: 24px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: rgba(17, 16, 14, 0.58);
    font-size: 0.68rem;
  }
  .mobile-search-form .search-results {
    max-height: min(28dvh, 210px);
    overflow: auto;
  }
  .mobile-search-form:focus-within {
    border-color: rgba(201, 53, 43, 0.58);
    box-shadow:
      inset 0 2px 0 rgba(17, 16, 14, 0.62),
      0 0 0 2px rgba(201, 53, 43, 0.12);
  }
  .mobile-sheet[data-snap="collapsed"] .mobile-search-form {
    display: none;
  }
  .mobile-sheet[data-snap="full"] .mobile-search-form {
    display: grid;
    order: 2;
  }
  .mobile-sheet[data-snap="full"] .mobile-adjust-map {
    order: 5;
  }
}

@media (max-width: 980px) {
  .mobile-search-form {
    order: 2;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 3px;
  }
  .mobile-search-form label,
  .mobile-primary-card span,
  .mobile-reach-details h3,
  .mobile-metric-card span {
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
  }
  .mobile-search-form label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    color: rgba(17, 16, 14, 0.62);
    font-size: 0.58rem;
    font-weight: 820;
    line-height: 1;
    text-transform: uppercase;
    white-space: normal;
  }
  .mobile-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 6px;
  }
  .mobile-search-row input,
  .mobile-search-row button:not([type="submit"]) {
    min-height: 38px;
    height: 38px;
    border-radius: 2px;
  }
  .mobile-search-form .text-button {
    display: none;
  }
  .mobile-primary-card {
    min-height: 0;
    gap: 5px;
    border-radius: 3px;
  }
  .mobile-sheet:not([data-snap="full"]) .mobile-primary-card {
    padding: 8px 9px;
  }
  body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card {
    padding: 8px 9px;
  }
  .mobile-primary-card > strong,
  .mobile-metric-card strong {
    font-family: var(--font-main);
    letter-spacing: 0;
    line-height: 1.02;
  }
  .mobile-primary-card.is-result > strong {
    font-size: clamp(2rem, 10vw, 2.85rem);
  }
  .mobile-primary-card p {
    margin: 0;
    font-family: var(--font-main);
    font-size: 0.79rem;
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: 0;
    color: rgba(17, 16, 14, 0.7);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .mobile-primary-card .origin-metric-strip,
  .mobile-primary-card .mobile-field-note,
  .mobile-primary-card.is-result .mobile-field-note{
    display: none;
  }
  .mobile-reach-details {
    order: 4;
    padding: 8px;
    border-radius: 3px;
  }
  .mobile-metric-grid {
    gap: 6px;
  }
  .mobile-metric-card {
    min-height: 64px;
    padding: 7px;
    border-radius: 3px;
  }
  .mobile-metric-card strong {
    font-size: clamp(1.18rem, 5vw, 1.5rem);
    line-height: 1;
  }
  .mobile-sheet[data-snap="collapsed"] .mobile-search-form,
  .mobile-sheet[data-snap="collapsed"] .mobile-reach-details {
    display: none;
  }
  .mobile-sheet[data-snap="full"] .mobile-primary-summary {
    order: 3;
  }
  .mobile-sheet[data-snap="full"] .mobile-reach-details {
    order: 4;
  }
  .mobile-sheet[data-snap="full"] .mobile-mode-control {
    order: 5;
  }
  .mobile-sheet[data-snap="full"] .mobile-surface-story-toggle {
    order: 6;
  }
  .mobile-sheet[data-snap="full"] .mobile-adjust-map {
    order: 8;
  }
}

/* Late mobile sheet order and compact-card refinements moved out of the
   adapter once mobile-sheet became the explicit owner. */
.mobile-primary-card .mobile-origin-sign-strip {
  gap: 4px;
  margin: 1px 0 0;
}

.mobile-primary-card .mobile-origin-sign-strip .station-sign-badge {
  flex: 0 1 auto;
  max-width: 132px;
}

.mobile-primary-card .mobile-origin-sign-strip .station-sign-badge b {
  min-width: 24px;
  height: 24px;
  font-size: 0.64rem;
}

.mobile-primary-card .mobile-origin-sign-strip .station-sign-badge span {
  padding-inline: 6px;
  font-size: 0.54rem;
}

body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-card .mobile-origin-sign-strip {
  display: flex;
  margin-top: 2px;
}

@media (max-width: 980px) {
  .mobile-primary-summary {
    order: 2;
  }

  .mobile-adjust-map {
    order: 3;
  }

  .mobile-mode-control {
    order: 4;
  }

  .mobile-surface-story-toggle {
    order: 5;
  }

  .mobile-reach-details {
    order: 7;
  }

  .mobile-search-form,
  .mobile-route-card,
  .mobile-inspector {
    order: 8;
  }

  .mobile-adjust-map {
    padding: 8px;
  }

  .mobile-adjust-map h3 {
    display: none;
  }

  .mobile-control-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .mobile-control-grid .toggle-control,
  .mobile-control-grid .select-control{
    display: none;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-adjust-map,
  .mobile-sheet[data-snap="collapsed"] .mobile-mode-control,
  .mobile-sheet[data-snap="collapsed"] .mobile-surface-story-toggle {
    display: none;
  }
}

@media (max-width: 980px) {
  .mobile-primary-summary {
    padding-top: 2px;
  }

  .mobile-primary-card {
    border-color: rgba(17, 16, 14, 0.22);
    background: rgba(255, 253, 247, 0.52);
    background-size: auto;
  }

  .mobile-adjust-map {
    border-color: rgba(17, 16, 14, 0.28);
    background:
      linear-gradient(90deg, rgba(17, 16, 14, 0.024) 1px, transparent 1px),
      linear-gradient(180deg, rgba(245, 239, 226, 0.92), rgba(221, 213, 196, 0.86));
    background-size: 28px 28px, auto;
  }

  .mobile-adjust-map h3 {
    display: block;
    margin: 0 0 6px;
    color: rgba(17, 16, 14, 0.52);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  body.is-reach-mode.has-origin .mobile-sheet[data-snap="collapsed"] .mobile-primary-summary {
    display: block;
  }

  .mobile-sheet[data-snap="collapsed"] .mobile-adjust-map,
  .mobile-sheet[data-snap="collapsed"] .mobile-mode-control,
  .mobile-sheet[data-snap="collapsed"] .mobile-surface-story-toggle,
  .mobile-sheet[data-snap="collapsed"] .mobile-search-form,
  .mobile-sheet[data-snap="collapsed"] .mobile-reach-details{
    display: none;
  }

  .mobile-sheet[data-snap="full"] .mobile-reach-details,
  .mobile-sheet[data-snap="full"] .mobile-search-form,
  .mobile-sheet[data-snap="full"] .mobile-route-card,
  .mobile-sheet[data-snap="full"] .mobile-inspector {
    border-color: rgba(17, 16, 14, 0.2);
    background: rgba(255, 253, 247, 0.52);
  }
}

/* Shared mobile sheet content surface retired from mobile-refinements.css. */
@media (max-width: 980px) {
  body .mobile-search-form,
  body .mobile-route-card,
  body .mobile-inspector,
  body .mobile-reach-details,
  body .mobile-adjust-map {
    padding: 10px;
    border: 1px solid rgba(17, 16, 14, 0.18);
    background: rgba(255, 253, 247, 0.42);
    box-shadow: var(--material-inset);
  }
}

@media (max-width: 480px) {
  .mobile-sheet[data-snap="full"] .mobile-search-row {
    grid-template-columns: minmax(0, 1fr) minmax(86px, max-content);
  }

  .mobile-sheet[data-snap="full"] .mobile-search-row button:not([type="submit"]) {
    overflow: visible;
    padding-inline: 7px;
    font-size: 0.62rem;
    letter-spacing: 0.02em;
    text-overflow: clip;
    white-space: nowrap;
  }
}

/* Mobile sheet flat search controls. */
.mobile-search-row button:not([type="submit"]) {
  position: relative;
  text-shadow: none;
  transform: none;
  animation: none;
}

.mobile-search-row button:not([type="submit"]) {
  border-color: var(--button-flat-border);
  background: var(--button-flat-bg);
  box-shadow: none;
  color: var(--ink);
}

.mobile-search-row button:not([type="submit"]) {
  background: var(--button-flat-active);
  color: var(--paper);
}

.mobile-search-row button:not([type="submit"]):hover {
  border-color: var(--ink);
  background: var(--button-flat-bg-hover);
  color: var(--ink);
  box-shadow: none;
  transform: none;
  animation: none;
}

.mobile-search-row button:not([type="submit"]):hover {
  background: var(--button-flat-active);
  color: var(--paper);
}

.mobile-sheet .mobile-surface-story-toggle {
  display: none;
}

.mobile-line-focus-card {
  position: relative;
  gap: 9px;
  border-left: 3px solid var(--accent);
}

.mobile-line-focus-card > p {
  margin: 0;
}

.mobile-line-details-panel {
  min-width: 0;
}

.mobile-line-details-panel:empty::before {
  content: "Loading line guide\2026";
  color: var(--muted);
  font: 0.68rem/1.3 var(--font-mono);
}

.mobile-line-details-panel .line-detail {
  gap: 10px;
}

.mobile-line-details-panel .line-fact-grid {
  margin-top: 0;
}

.mobile-line-details-panel .detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mobile-line-details-panel .detail-action {
  min-width: 0;
}
