:root {
      --bg: #07101f;
      --panel: #101827;
      --panel-2: #172033;
      --panel-3: #1f2937;
      --text: #f8fafc;
      --muted: #aab7c9;
      --line: rgba(255,255,255,0.13);
      --accent: #38bdf8;
      --good: #22c55e;
      --warn: #f59e0b;
      --danger: #fb7185;
      --radius: 18px;
      color-scheme: dark;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    * { box-sizing: border-box; }

    html {
      scroll-behavior: smooth;
      width: 100%;
      max-width: 100%;
      overflow-x: hidden;
    }

    body {
      margin: 0;
      width: 100%;
      max-width: 100%;
      min-height: 100vh;
      overflow-x: hidden;
      background: radial-gradient(circle at top, #172554 0%, var(--bg) 42%, #050812 100%);
      color: var(--text);
    }

    .app-header {
      width: 100%;
      max-width: 100%;
      overflow: hidden;
      padding: max(14px, env(safe-area-inset-top)) 16px 11px;
      position: sticky;
      top: 0;
      z-index: 10;
      background: rgba(7,16,31,0.94);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .header-copy {
      min-width: 0;
      flex: 1 1 auto;
    }

    .header-logo {
      width: clamp(44px, 12vw, 58px);
      height: clamp(44px, 12vw, 58px);
      flex: 0 0 auto;
      border-radius: 14px;
      object-fit: cover;
      box-shadow: 0 8px 24px rgba(0,0,0,0.28), 0 0 0 1px rgba(56,189,248,0.28);
    }

    h1, h2, h3, p { margin: 0; }
    h1 { font-size: clamp(1.5rem, 7.4vw, 2.25rem); line-height: 1.02; overflow-wrap: anywhere; }
    h2 { font-size: clamp(1.25rem, 5.4vw, 1.75rem); line-height: 1.12; }
    h3 { font-size: 1.05rem; margin-bottom: 10px; }

    main {
      width: min(920px, 100%);
      max-width: 100%;
      overflow-x: hidden;
      margin: 0 auto;
      padding: 12px 14px 32px;
    }

    .card {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      overflow-x: hidden;
      background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.035));
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: 0 16px 40px rgba(0,0,0,0.25);
      padding: 14px;
      margin-bottom: 12px;
    }

    .controls {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }


    .browser-toggle {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
    }

    .browser-pill {
      border-radius: 999px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 9px 12px;
      font-size: .86rem;
      font-weight: 950;
    }

    .browser-pill.active {
      background: rgba(56,189,248,0.18);
      border-color: rgba(56,189,248,0.58);
      color: #e0f2fe;
    }

    select[hidden] { display: none !important; }

    .direction-button {
      background: rgba(56,189,248,0.11);
      border-color: rgba(56,189,248,0.34);
    }

    .service-button {
      background: rgba(34,197,94,0.10);
      border-color: rgba(34,197,94,0.34);
    }

    label {
      color: var(--muted);
      font-size: 0.78rem;
      display: grid;
      gap: 5px;
    }

    select, input, button {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: var(--panel);
      color: var(--text);
      padding: 11px 12px;
      font-size: 1rem;
    }

    button {
      cursor: pointer;
      background: linear-gradient(135deg, #0284c7, #0369a1);
      border: 0;
      font-weight: 800;
      touch-action: manipulation;
    }

    button.secondary {
      background: rgba(255,255,255,0.08);
      border: 1px solid var(--line);
    }

    .stand-shortcuts {
      grid-column: 1 / -1;
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding: 2px 0 12px;
      scrollbar-width: thin;
      scrollbar-color: rgba(148,163,184,0.55) rgba(255,255,255,0.06);
    }

    .stand-shortcuts::-webkit-scrollbar {
      height: 4px;
    }

    .stand-shortcuts::-webkit-scrollbar-track {
      background: rgba(255,255,255,0.06);
      border-radius: 999px;
    }

    .stand-shortcuts::-webkit-scrollbar-thumb {
      background: rgba(148,163,184,0.55);
      border-radius: 999px;
    }

    .stand-button {
      width: auto;
      min-width: max-content;
      padding: 8px 11px;
      border-radius: 999px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      color: var(--text);
      font-size: .84rem;
      font-weight: 900;
      margin-bottom: 3px;
    }

    .stand-button.active {
      background: rgba(56,189,248,0.18);
      border-color: rgba(56,189,248,0.58);
      color: #e0f2fe;
    }

    .eyebrow {
      color: var(--accent);
      font-size: 0.7rem;
      letter-spacing: .09em;
      text-transform: uppercase;
      font-weight: 900;
      margin-bottom: 5px;
    }

    .muted { color: var(--muted); margin-top: 6px; }

    .day-warning {
      margin-top: 8px;
      color: #fde68a;
      background: rgba(245,158,11,0.12);
      border: 1px solid rgba(245,158,11,0.28);
      border-radius: 12px;
      padding: 8px 10px;
      font-size: .82rem;
      font-weight: 850;
      line-height: 1.25;
    }

    .day-warning[hidden] { display: none; }

    .smart-card {
      padding: 12px 14px;
    }

    .smart-top {
      display: flex;
      min-width: 0;
      justify-content: space-between;
      align-items: flex-start;
      gap: 10px;
      margin-bottom: 10px;
    }

    .smart-title {
      min-width: 0;
      font-size: clamp(1.05rem, 4.8vw, 1.45rem);
      font-weight: 950;
      line-height: 1.1;
    }

    .smart-time {
      color: var(--muted);
      font-size: .83rem;
      margin-top: 4px;
    }

    .smart-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 7px;
      margin-top: 10px;
    }

    .smart-box {
      background: rgba(15,23,42,0.85);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 9px 10px;
      min-height: 54px;
      display: grid;
      grid-template-columns: minmax(92px, 1.05fr) minmax(0, .72fr) minmax(0, .55fr);
      align-items: center;
      column-gap: 8px;
      max-width: 100%;
      min-width: 0;
      overflow: hidden;
    }

    .smart-label {
      color: var(--muted);
      font-size: .7rem;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: .05em;
      line-height: 1.15;
    }

    .smart-value {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: clamp(1.1rem, 4.95vw, 1.42rem);
      font-weight: 950;
      line-height: 1.08;
      white-space: nowrap;
    }

    .smart-value.is-text {
      font-size: clamp(.98rem, 4.4vw, 1.18rem);
      line-height: 1.15;
      white-space: normal;
    }

    .smart-route {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--text);
      font-size: clamp(1.15rem, 5.3vw, 1.42rem);
      font-weight: 950;
      letter-spacing: .01em;
      text-align: right;
      white-space: nowrap;
    }

    .smart-tools {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 9px;
    }

    .mini-action {
      width: auto;
      min-width: 92px;
      padding: 7px 11px;
      border-radius: 999px;
      border: 1px solid rgba(56,189,248,0.35);
      background: rgba(56,189,248,0.12);
      color: var(--text);
      font-size: .76rem;
      font-weight: 950;
      white-space: nowrap;
    }

    .time-picker-button {
      min-height: 54px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      text-align: left;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 10px 12px;
    }

    .time-picker-main {
      font-size: 1.35rem;
      font-weight: 950;
      letter-spacing: .01em;
    }

    .time-picker-sub {
      color: var(--accent);
      font-size: .68rem;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .checker-controls {
      display: grid;
      grid-template-columns: minmax(160px, 1fr) minmax(120px, auto) minmax(120px, auto);
      gap: 10px;
      margin-bottom: 12px;
      align-items: end;
    }

    .time-picker-wrap {
      padding: 13px 15px 15px;
      display: grid;
      gap: 12px;
    }

    .time-preview {
      border-radius: 18px;
      background: rgba(15,23,42,0.88);
      border: 1px solid rgba(255,255,255,0.12);
      padding: 14px 12px;
      text-align: center;
      font-size: clamp(2.2rem, 15vw, 4rem);
      font-weight: 950;
      line-height: 1;
      letter-spacing: -0.04em;
    }

    .time-wheel-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .time-wheel-box {
      min-width: 0;
      display: grid;
      gap: 7px;
    }

    .time-wheel-label {
      color: var(--accent);
      font-size: .7rem;
      font-weight: 950;
      letter-spacing: .09em;
      text-transform: uppercase;
      padding-left: 3px;
    }

    .time-wheel {
      height: min(32vh, 260px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: 0 3px;
      scroll-snap-type: y mandatory;
      overscroll-behavior: contain;
      touch-action: pan-y;
      scrollbar-width: none;
      border-radius: 16px;
      background:
        linear-gradient(to bottom, rgba(15,23,42,0.95), rgba(15,23,42,0.16) 31%, rgba(15,23,42,0.16) 69%, rgba(15,23,42,0.95)),
        linear-gradient(to bottom, transparent calc(50% - 31px), rgba(56,189,248,0.10) calc(50% - 31px), rgba(56,189,248,0.10) calc(50% + 31px), transparent calc(50% + 31px));
    }

    .time-wheel::-webkit-scrollbar {
      width: 0;
      height: 0;
    }

    .time-option {
      height: 58px;
      margin-bottom: 8px;
      border-radius: 14px;
      background: rgba(255,255,255,0.065);
      border: 1px solid rgba(255,255,255,0.09);
      padding: 11px 8px;
      font-size: 1.08rem;
      font-weight: 950;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      scroll-snap-align: center;
      opacity: .58;
      transform: scale(.96);
      transition: opacity .12s ease, transform .12s ease, background .12s ease, border-color .12s ease;
    }

    .time-option.wheel-spacer {
      height: 100px;
      margin-bottom: 0;
      padding: 0;
      background: transparent;
      border: 0;
      pointer-events: none;
      opacity: 0;
      scroll-snap-align: none;
    }

    .time-option.active {
      background: rgba(56,189,248,0.2);
      border-color: rgba(56,189,248,0.65);
      color: #e0f2fe;
      box-shadow: inset 0 0 0 1px rgba(56,189,248,0.2);
      opacity: 1;
      transform: scale(1);
    }

    .time-modal-actions {
      display: grid;
      grid-template-columns: 1fr 1fr 1.2fr;
      gap: 8px;
    }

    .time-modal-card {
      max-height: min(88vh, 760px);
      overscroll-behavior: contain;
    }

    .list-header {
      display: flex;
      min-width: 0;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 12px;
    }

    .list-header > div:first-child {
      min-width: 0;
      max-width: 100%;
    }

    .list-header h2, .list-header .muted {
      overflow-wrap: anywhere;
    }

    .pill {
      border-radius: 999px;
      padding: 7px 10px;
      font-size: 0.76rem;
      font-weight: 900;
      background: rgba(56,189,248,0.15);
      border: 1px solid rgba(56,189,248,0.35);
      white-space: nowrap;
    }


    .list-actions {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 8px;
      flex: 0 0 auto;
    }

    .mode-toggle {
      display: flex;
      gap: 6px;
      justify-content: flex-end;
      flex-wrap: wrap;
      max-width: 196px;
    }

    .mode-toggle[hidden] { display: none; }

    .toggle-pill {
      width: auto;
      min-width: 84px;
      padding: 7px 10px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.13);
      background: rgba(255,255,255,0.07);
      color: var(--text);
      font-size: 0.76rem;
      font-weight: 950;
      white-space: nowrap;
    }

    .toggle-pill.active {
      border-color: rgba(56,189,248,0.55);
      background: rgba(56,189,248,0.18);
      color: #e0f2fe;
    }

    .table-view-button {
      width: auto;
      min-width: 104px;
      padding: 7px 10px;
      border-radius: 999px;
      border: 1px solid rgba(56,189,248,0.35);
      background: rgba(56,189,248,0.11);
      color: var(--text);
      font-size: 0.76rem;
      font-weight: 950;
      white-space: nowrap;
    }

    .jump-list-button {
      width: auto;
      min-width: 104px;
      padding: 7px 10px;
      border-radius: 999px;
      border: 1px solid rgba(245,158,11,0.38);
      background: rgba(245,158,11,0.12);
      color: var(--text);
      font-size: 0.76rem;
      font-weight: 950;
      white-space: nowrap;
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 50;
      background: rgba(2,6,23,0.74);
      backdrop-filter: blur(9px);
      padding: max(16px, env(safe-area-inset-top)) 13px max(16px, env(safe-area-inset-bottom));
      display: grid;
      place-items: center;
    }

    .modal-backdrop[hidden] { display: none; }

    body.modal-open { overflow: hidden; }

    .modal-card {
      width: min(720px, 100%);
      max-height: min(86vh, 820px);
      overflow: hidden;
      background: linear-gradient(180deg, rgba(23,32,51,0.98), rgba(15,23,42,0.98));
      border: 1px solid rgba(255,255,255,0.17);
      border-radius: 22px;
      box-shadow: 0 24px 70px rgba(0,0,0,0.5);
      display: grid;
      grid-template-rows: auto 1fr;
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: flex-start;
      padding: 15px 15px 12px;
      border-bottom: 1px solid rgba(255,255,255,0.11);
    }

    .modal-header h2 {
      font-size: clamp(1.15rem, 5vw, 1.55rem);
    }

    .modal-close {
      width: auto;
      min-width: 76px;
      padding: 8px 11px;
      border-radius: 999px;
      font-size: .82rem;
      background: rgba(255,255,255,0.08);
      border: 1px solid var(--line);
    }

    .stand-table-wrap {
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 12px 15px 15px;
    }

    .stand-table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0 8px;
      font-size: .95rem;
    }

    .stand-table th {
      position: sticky;
      top: 0;
      z-index: 1;
      text-align: left;
      color: var(--accent);
      background: rgba(15,23,42,0.98);
      padding: 8px 10px;
      font-size: .72rem;
      text-transform: uppercase;
      letter-spacing: .08em;
    }

    .stand-table td {
      background: rgba(255,255,255,0.06);
      border-top: 1px solid rgba(255,255,255,0.08);
      border-bottom: 1px solid rgba(255,255,255,0.08);
      padding: 11px 10px;
      vertical-align: middle;
    }

    .stand-table td:first-child {
      border-left: 1px solid rgba(255,255,255,0.08);
      border-radius: 13px 0 0 13px;
      font-size: 1.28rem;
      font-weight: 950;
      white-space: nowrap;
      width: 34%;
    }

    .stand-table td:nth-child(2) {
      font-size: 1.18rem;
      font-weight: 950;
    }

    .stand-table td:last-child {
      border-right: 1px solid rgba(255,255,255,0.08);
      border-radius: 0 13px 13px 0;
      color: var(--muted);
      width: 28%;
    }

    .stand-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      align-items: stretch;
    }

    .stand-grid-card {
      min-height: 88px;
      border-radius: 18px;
      background: rgba(255,255,255,0.065);
      border: 1px solid rgba(255,255,255,0.09);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
      padding: 12px 8px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    }

    .stand-grid-time {
      font-size: clamp(1.4rem, 7vw, 2rem);
      line-height: 1;
      font-weight: 950;
      letter-spacing: -0.03em;
      white-space: nowrap;
    }

    .stand-grid-route {
      margin-top: 7px;
      font-size: clamp(1.06rem, 5.4vw, 1.55rem);
      line-height: 1.05;
      font-weight: 950;
      white-space: normal;
      overflow-wrap: anywhere;
    }

    .stand-grid-note {
      margin-top: 7px;
      max-width: 100%;
      border-radius: 999px;
      padding: 3px 7px;
      color: var(--muted);
      background: rgba(255,255,255,0.06);
      font-size: .68rem;
      font-weight: 800;
      line-height: 1.15;
      overflow-wrap: anywhere;
    }

    .table-view-tools {
      display: grid;
      gap: 10px;
      margin-bottom: 12px;
    }

    .stand-route-filter {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      margin: 10px 0 12px;
    }

    .stand-route-filter[hidden] { display: none; }

    .route-filter-pill {
      width: auto;
      min-width: 54px;
      padding: 7px 11px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.13);
      background: rgba(255,255,255,0.07);
      color: var(--text);
      font-size: .76rem;
      font-weight: 950;
      line-height: 1;
      white-space: nowrap;
    }

    .route-filter-pill.active {
      border-color: rgba(56,189,248,0.6);
      background: rgba(56,189,248,0.18);
      box-shadow: inset 0 0 0 1px rgba(56,189,248,0.16);
      color: #e0f2fe;
    }

    .table-filter-toolbar {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 2px;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }

    .table-filter-toolbar::-webkit-scrollbar { display: none; }

    .table-filter-pill {
      width: auto;
      min-width: fit-content;
      border-radius: 999px;
      padding: 8px 13px;
      border: 1px solid rgba(255,255,255,0.13);
      background: rgba(255,255,255,0.065);
      color: var(--text);
      font-size: .78rem;
      font-weight: 950;
      line-height: 1;
    }

    .table-filter-pill.active {
      border-color: rgba(56,189,248,0.62);
      background: rgba(56,189,248,0.16);
      color: #e0f2fe;
    }

    .table-next-strip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-radius: 16px;
      padding: 10px 12px;
      background: rgba(34,197,94,0.11);
      border: 1px solid rgba(34,197,94,0.36);
      box-shadow: inset 0 0 0 1px rgba(34,197,94,0.08);
    }

    .table-next-label {
      color: var(--muted);
      font-size: .67rem;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .table-next-main {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      min-width: 0;
      font-size: 1.02rem;
      font-weight: 950;
      text-align: right;
    }

    .table-hour-group {
      display: grid;
      gap: 8px;
      margin-top: 10px;
    }

    .table-hour-heading {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      padding: 5px 3px 1px;
      color: var(--accent);
      font-size: .78rem;
      font-weight: 950;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    .table-hour-count {
      color: var(--muted);
      font-size: .68rem;
      letter-spacing: .04em;
    }

    .stand-grid-card.next-service {
      border-color: rgba(34,197,94,0.76);
      background: rgba(34,197,94,0.13);
      box-shadow: inset 0 0 0 1px rgba(34,197,94,0.26);
    }

    .stand-grid-card.next-service::before {
      content: 'NEXT';
      position: absolute;
      top: 7px;
      right: 8px;
      border-radius: 999px;
      padding: 2px 6px;
      background: rgba(34,197,94,0.18);
      border: 1px solid rgba(34,197,94,0.36);
      color: #bbf7d0;
      font-size: .55rem;
      font-weight: 950;
      letter-spacing: .08em;
    }

    .stand-grid-card.last-service-card {
      border-color: rgba(239,68,68,0.82);
      background: rgba(127,29,29,0.18);
      box-shadow: inset 0 0 0 1px rgba(239,68,68,0.28);
    }

    .stand-grid-card.last-service-card::after {
      content: 'LAST';
      position: absolute;
      top: 7px;
      left: 8px;
      border-radius: 999px;
      padding: 2px 6px;
      background: rgba(239,68,68,0.18);
      border: 1px solid rgba(239,68,68,0.36);
      color: #fecaca;
      font-size: .55rem;
      font-weight: 950;
      letter-spacing: .08em;
    }

    .stand-grid-card { position: relative; }

    .today-pill {
      min-width: 74px;
      padding: 7px 10px 6px;
      text-align: center;
      line-height: 1.05;
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
    }

    .today-pill-main {
      font-size: .76rem;
      font-weight: 950;
    }

    .today-pill-date {
      color: var(--muted);
      font-size: .56rem;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .departure-list { display: grid; gap: 8px; }

    #fullList {
      max-height: clamp(290px, 45vh, 560px);
      overflow-y: auto;
      overscroll-behavior-y: auto;
      -webkit-overflow-scrolling: touch;
      padding-right: 3px;
      scrollbar-width: thin;
      scrollbar-gutter: stable;
      touch-action: pan-y;
    }

    #beforeList, #afterList {
      max-height: none;
      overflow: visible;
      overscroll-behavior: auto;
      -webkit-overflow-scrolling: auto;
    }

    .departure-row {
      display: grid;
      grid-template-columns: minmax(70px, .72fr) minmax(0, 1.2fr) minmax(0, auto);
      max-width: 100%;
      min-width: 0;
      gap: 10px;
      align-items: center;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 15px;
      padding: 11px 11px;
      min-height: 54px;
    }

    .departure-row.nearest-before {
      border-color: var(--warn);
      box-shadow: inset 0 0 0 1px rgba(245,158,11,0.45);
      background: rgba(245,158,11,0.13);
    }

    .departure-row.nearest-after {
      border-color: var(--good);
      box-shadow: inset 0 0 0 1px rgba(34,197,94,0.45);
      background: rgba(34,197,94,0.12);
    }

    .departure-row.last-service-row {
      border-color: rgba(239,68,68,0.88);
      box-shadow: inset 0 0 0 1px rgba(239,68,68,0.45), 0 0 0 1px rgba(239,68,68,0.15);
      background: rgba(127,29,29,0.20);
    }

    .time {
      font-size: clamp(1.25rem, 7vw, 1.65rem);
      font-weight: 950;
      letter-spacing: .01em;
    }

    .route {
      display: flex;
      max-width: 100%;
      flex-wrap: wrap;
      gap: 5px;
      align-items: center;
      min-width: 0;
    }

    .route-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      padding: 5px 9px;
      min-width: 45px;
      background: rgba(56,189,248,0.13);
      border: 1px solid rgba(56,189,248,0.28);
      color: #e0f2fe;
      font-size: clamp(0.98rem, 4.8vw, 1.24rem);
      font-weight: 950;
      line-height: 1;
      white-space: nowrap;
    }

    .route-chip.last-service-chip {
      border-color: rgba(239,68,68,0.9);
      background: rgba(127,29,29,0.35);
      color: #fee2e2;
      box-shadow: inset 0 0 0 1px rgba(239,68,68,0.28), 0 0 0 1px rgba(239,68,68,0.08);
    }

    .stand-grid-route .route-chip {
      min-width: 48px;
      padding: 5px 8px;
      font-size: clamp(.95rem, 4.5vw, 1.23rem);
    }

    .tag {
      justify-self: end;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--muted);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 999px;
      padding: 4px 8px;
      font-size: .78rem;
      min-width: 0;
    }

    details > summary {
      list-style: none;
      cursor: pointer;
      font-size: 1.08rem;
      font-weight: 950;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    details > summary::-webkit-details-marker { display: none; }

    details > summary::after {
      content: 'Open';
      color: var(--accent);
      font-size: .78rem;
      border: 1px solid rgba(56,189,248,0.4);
      border-radius: 999px;
      padding: 5px 9px;
      flex: 0 0 auto;
    }

    details[open] > summary::after { content: 'Close'; }

    .details-body { margin-top: 12px; }


    .grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .notes-list { display: grid; gap: 8px; }

    .note-item, .empty {
      background: rgba(255,255,255,0.055);
      border-radius: 12px;
      padding: 10px;
      color: var(--muted);
    }

    .admin-card summary {
      color: var(--muted);
      font-size: .98rem;
    }

    .data-check {
      display: grid;
      gap: 8px;
    }

    .data-summary {
      color: var(--muted);
      font-size: .88rem;
      line-height: 1.35;
    }

    .data-row {
      display: grid;
      grid-template-columns: 72px 1fr 78px 78px;
      gap: 8px;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.045);
      border-radius: 12px;
      padding: 9px 10px;
      font-size: .86rem;
    }

    .data-row strong { color: var(--text); }
    .data-row span { color: var(--muted); }

    footer {
      color: var(--muted);
      text-align: center;
      padding: 6px 18px 28px;
      font-size: .82rem;
    }

    .app-version-label {
      margin: 0 0 8px;
      color: rgba(76, 195, 255, 0.84);
      font-size: .76rem;
      font-weight: 800;
      letter-spacing: .09em;
      text-transform: uppercase;
    }

    footer p {
      margin: 0;
    }

    @media (max-width: 720px) {
      main { padding-left: 13px; padding-right: 13px; }
      .app-header { padding-left: 13px; padding-right: 13px; }
      .controls, .grid, .checker-controls { grid-template-columns: 1fr; }
      .smart-box { grid-template-columns: minmax(86px, .95fr) minmax(0, .76fr) minmax(0, .55fr); column-gap: 6px; }
      .smart-label { font-size: .64rem; }
      .smart-value, .smart-route { font-size: clamp(1.03rem, 4.6vw, 1.32rem); }
      .departure-row { grid-template-columns: minmax(72px, .68fr) minmax(0, 1fr) minmax(0, auto); gap: 8px; }
      .list-header { gap: 8px; }
      .mode-toggle { max-width: 176px; gap: 5px; }
      .toggle-pill { min-width: 78px; }
      .table-view-button, .toggle-pill, .pill { font-size: .72rem; }
      .stand-route-filter .route-filter-pill { font-size: .72rem; padding: 7px 10px; }
      .modal-backdrop { place-items: end center; padding-left: 10px; padding-right: 10px; }
      .modal-card { width: 100%; max-height: 88vh; border-radius: 22px 22px 16px 16px; }
      .stand-table td:first-child { font-size: 1.16rem; width: 31%; }
      .stand-table td:nth-child(2) { font-size: 1.08rem; }
      .stand-table td:last-child { width: 24%; }
      .stand-grid { gap: 9px; }
      .stand-grid-card { min-height: 82px; border-radius: 16px; padding: 11px 6px; }
      .data-row { grid-template-columns: 64px 1fr 58px 58px; font-size: .78rem; }
    }


    @media (max-width: 390px) {
      h1 { font-size: clamp(1.42rem, 7vw, 1.9rem); }
      .app-header { gap: 9px; }
      .header-logo { width: 42px; height: 42px; border-radius: 12px; }
      .eyebrow { font-size: .62rem; }
      .card { padding: 12px; }
      .smart-box { grid-template-columns: minmax(78px, .9fr) minmax(0, .72fr) minmax(0, .5fr); }
      .smart-label { font-size: .58rem; letter-spacing: .035em; }
      .smart-value, .smart-route { font-size: clamp(.96rem, 4.35vw, 1.18rem); }
      .departure-row { grid-template-columns: minmax(68px, .65fr) minmax(0, 1fr); }
      .departure-row .tag { display: none; }
    }

.startup-error { padding-top: 18px; }
.muted { color: var(--muted); margin-top: 10px; }


    .service-clickable {
      cursor: pointer;
      -webkit-tap-highlight-color: rgba(56,189,248,0.18);
    }

    .service-clickable:active {
      transform: scale(0.992);
      border-color: rgba(56,189,248,0.36);
    }

    .service-detail-body {
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 14px 15px 15px;
      display: grid;
      gap: 12px;
    }

    .service-summary-card {
      border-radius: 18px;
      padding: 14px;
      background: rgba(15,23,42,0.78);
      border: 1px solid rgba(255,255,255,0.10);
      display: grid;
      gap: 10px;
    }

    .service-summary-main {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .service-detail-time {
      font-size: clamp(2rem, 13vw, 3.4rem);
      line-height: .95;
      font-weight: 950;
      letter-spacing: -0.04em;
    }

    .service-direction {
      color: var(--muted);
      line-height: 1.35;
      font-size: .96rem;
    }

    .service-meta-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
    }

    .service-meta-item {
      border-radius: 14px;
      padding: 9px;
      background: rgba(255,255,255,0.055);
      border: 1px solid rgba(255,255,255,0.08);
      min-width: 0;
    }

    .service-meta-label {
      color: var(--muted);
      font-size: .62rem;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
      margin-bottom: 4px;
    }

    .service-meta-value {
      font-weight: 950;
      overflow-wrap: anywhere;
    }

    .route-detail-list {
      display: grid;
      gap: 9px;
    }

    .route-detail-card {
      border-radius: 16px;
      padding: 12px;
      background: rgba(255,255,255,0.055);
      border: 1px solid rgba(255,255,255,0.09);
      display: grid;
      gap: 9px;
    }

    .route-detail-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .legend-badge {
      border-radius: 999px;
      padding: 5px 9px;
      color: #fef3c7;
      background: rgba(245,158,11,0.14);
      border: 1px solid rgba(245,158,11,0.42);
      font-size: .7rem;
      font-weight: 950;
      letter-spacing: .04em;
      white-space: nowrap;
    }

    .legend-text {
      color: var(--text);
      line-height: 1.35;
      font-size: .94rem;
    }

    .no-legend-text {
      color: var(--muted);
      line-height: 1.35;
      font-size: .92rem;
    }

    @media (max-width: 390px) {
      .service-meta-grid { grid-template-columns: 1fr; }
      .service-summary-main { align-items: flex-start; flex-direction: column; }
    }


/* v37 update prompt */
.update-available {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  z-index: 80;
  width: auto;
  max-width: calc(100vw - 20px);
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.55);
  background: rgba(29, 78, 216, 0.94);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.update-available:active {
  transform: translateY(1px);
}

.update-available:disabled {
  opacity: 0.82;
}

@media (max-width: 420px) {
  .update-available {
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    padding: 8px 10px;
    font-size: 0.72rem;
  }
}


/* centred update confirmation pop-out */
.version-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 95;
  width: min(420px, calc(100vw - 38px));
  max-height: min(74vh, 620px);
  overflow-y: auto;
  padding: 18px 18px 16px;
  border-radius: 24px;
  border: 1px solid rgba(34, 197, 94, 0.55);
  background: linear-gradient(135deg, rgba(5, 46, 22, 0.98), rgba(12, 74, 110, 0.97));
  color: #fff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.version-toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.version-toast strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.version-toast span {
  display: block;
  margin-top: 4px;
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.82rem;
  font-weight: 700;
}

.version-toast .version-toast-whats-new-label {
  margin-top: 14px;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 900;
}

.version-toast .version-toast-whats-new {
  margin-top: 5px;
  color: #dbeafe;
  font-size: 0.85rem;
  line-height: 1.38;
  font-weight: 800;
}

.version-toast-history {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.version-toast-change {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  background: rgba(15, 23, 42, 0.28);
}

.version-toast-change strong {
  font-size: 0.78rem;
  line-height: 1.3;
  color: #bfdbfe;
}

.version-toast-change span {
  margin-top: 0;
  color: #dbeafe;
  font-size: 0.8rem;
  line-height: 1.32;
  font-weight: 750;
}

.version-toast-ok {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(14, 165, 233, 0.26);
  color: #fff;
  font-weight: 900;
}

.version-toast-ok:active {
  transform: translateY(1px);
}

@media (max-width: 420px) {
  .version-toast {
    width: min(350px, calc(100vw - 28px));
    padding: 16px 16px 14px;
  }
}
