/* Murtahil, every city. Tokens and rules: Murtahil identity (Istanbul-Transport/frontend/brand/DESIGN.md).
 * Desktop: 64 px top bar, 440 px planning panel on the leading edge, the map fills the rest.
 * Below 768 px: full-screen map, the panel becomes a bottom sheet over a tab bar.
 * Logical properties throughout so the Arabic layout mirrors by itself. */

:root {
    --forest: #063400;
    --route: #59C52B;
    --route-deep: #287A10;
    --harbor: #2B5289;
    --signal: #0092E3;
    --signal-deep: #0A6FB0;
    --sky: #2FB1E9;
    --ice: #F0FEFF;

    --canvas: #F4F7F4;
    --surface: #FFFFFF;
    --surface-2: #EEF3EE;
    --ink: #0F1A12;
    --ink-2: #4A5A4E;
    --ink-3: #7A877D;
    --line: rgba(15, 26, 18, 0.09);
    --line-2: rgba(15, 26, 18, 0.16);
    --alert: #B3462E;
    --alert-tint: rgba(179, 70, 46, 0.08);
    --route-tint: rgba(89, 197, 43, 0.14);
    --glass: rgba(255, 255, 255, 0.92);
    --float-shadow: 0 12px 40px rgba(6, 52, 0, 0.14), inset 0 0 0 1px rgba(15, 26, 18, 0.06);
    --walk: #4A5A4E;

    --sans: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
    --arabic: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
    --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --topbar-h: 64px;
    --panel-w: 440px;
    --tabbar-h: 64px;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
    --canvas: #071F08;
    --surface: #0D2E0F;
    --surface-2: #12391A;
    --ink: #EEF5EE;
    --ink-2: #A9BBAC;
    --ink-3: #83958A;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.16);
    --alert: #D9603F;
    --alert-tint: rgba(217, 96, 63, 0.14);
    --route-tint: rgba(89, 197, 43, 0.18);
    --route-deep: #59C52B;           /* green may carry text on dark */
    --signal-deep: #0092E3;
    --harbor: #0092E3;
    --glass: rgba(13, 46, 15, 0.92);
    --float-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    --walk: #A9BBAC;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    text-wrap: pretty;
}
html[lang="ar"] body { font-family: var(--arabic); line-height: 1.62; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--signal-deep); text-decoration: none; }
a:hover { color: var(--harbor); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { direction: ltr; unicode-bidi: isolate; }
svg.ic { flex: none; display: block; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- frame */
.app {
    display: grid;
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
}
.layout {
    display: grid;
    grid-template-columns: var(--panel-w) minmax(0, 1fr);
    min-height: 0;
}

/* ---------------------------------------------------------------- top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 1100;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 28px; height: auto; display: block; }
.brand-text { display: flex; flex-direction: column; gap: 5px; line-height: 1; }
.brand-name { font-size: 18px; font-weight: 600; letter-spacing: -0.03em; font-family: "IBM Plex Sans", var(--sans); }
.brand-name-ar { font-size: 12px; font-weight: 500; font-family: var(--arabic); line-height: 1.15; }
html[dir="rtl"] .brand-text { flex-direction: column-reverse; }
html[dir="rtl"] .brand-name { font-size: 12px; font-weight: 600; color: var(--harbor); }
html[dir="rtl"] .brand-name-ar { font-size: 19px; font-weight: 600; }
.brand-city {
    margin-inline-start: 6px;
    padding-inline-start: 12px;
    border-inline-start: 1px solid var(--line-2);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
}

.tabs { display: flex; align-items: center; gap: 6px; }
.tab {
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--ink); background: var(--surface-2); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px var(--line-2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    direction: ltr;
}
.lang-toggle:hover { background: var(--surface-2); }
.lang-opt { color: var(--ink-3); }
.lang-opt.is-active { color: var(--ink); font-weight: 600; }
.lang-opt[data-lang="ar"] { font-family: var(--arabic); font-size: 15px; }
.lang-sep { color: var(--ink-3); opacity: 0.6; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    color: var(--ink-2);
    box-shadow: inset 0 0 0 1px var(--line-2);
    transition: transform 0.2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn--small { width: 32px; height: 32px; box-shadow: none; }

/* ---------------------------------------------------------------- panel */
.panel {
    position: relative;
    background: var(--canvas);
    border-inline-end: 1px solid var(--line);
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    z-index: 1000;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}
.sheet-grip { display: none; }
.view { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.view-head { display: flex; align-items: flex-start; gap: 12px; }
.view-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
html[lang="ar"] .view-head h2 { letter-spacing: 0; }
.view-head .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--ink);
}
.back-btn:hover { background: var(--surface-2); }
html[dir="rtl"] .back-btn svg, html[dir="rtl"] .flip-rtl svg, html[dir="rtl"] svg.flip-rtl { transform: scaleX(-1); }

.label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
html[lang="ar"] .label { letter-spacing: 0; text-transform: none; font-size: 13px; }

/* ---------------------------------------------------------------- plan form */
.plan-title { font-size: 28px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
html[lang="ar"] .plan-title { letter-spacing: 0; line-height: 1.3; }
.plan-form { display: flex; flex-direction: column; gap: 14px; }
.od { position: relative; display: flex; flex-direction: column; gap: 10px; }
.field { position: relative; }
.field-label {
    position: absolute;
    width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.input-wrap {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-inline: 16px 8px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-2);
    transition: box-shadow 0.2s var(--ease);
}
.field[data-end] .input-wrap { padding-inline-end: 52px; }
.input-wrap:focus-within { box-shadow: inset 0 0 0 2px var(--signal); }
.input-wrap input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 16px;
}
.input-wrap input::placeholder { color: var(--ink-3); }
.input-icon { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; }
.input-icon--from::before {
    content: '';
    width: 12px; height: 12px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 3px var(--ink);
}
.input-icon--to::before {
    content: '';
    width: 12px; height: 12px;
    border-radius: 3px;
    background: var(--forest);
    box-shadow: inset 0 0 0 3.5px var(--route);
}
:root[data-theme="dark"] .input-icon--to::before { background: var(--route); box-shadow: inset 0 0 0 3.5px var(--forest); }
.input-clear {
    width: 28px; height: 28px;
    border-radius: 999px;
    color: var(--ink-3);
}
.input-clear:hover { color: var(--ink); background: var(--surface-2); }
.swap-btn {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 3px rgba(6, 52, 0, 0.08);
    color: var(--ink-2);
    z-index: 2;
    transition: transform 0.25s var(--ease);
}
.swap-btn:hover { color: var(--ink); }
.swap-btn:active { transform: translateY(-50%) scale(0.94); }

.plan-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 10px;
    margin-inline-start: -10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
}
.ghost-btn:hover { color: var(--ink); background: var(--surface-2); }
.primary-btn {
    height: 48px;
    padding-inline: 20px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-size: 15px;
    font-weight: 600;
    background: var(--route);
    color: var(--forest);
    white-space: nowrap;
    transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.primary-btn:hover { background: #63D234; }
.primary-btn:active { transform: scale(0.98); }
.primary-btn[disabled] { background: rgba(15, 26, 18, 0.06); color: var(--ink-3); cursor: default; }
.btn-well {
    width: 28px; height: 28px;
    border-radius: 999px;
    background: rgba(6, 52, 0, 0.14);
}
html[dir="rtl"] .btn-well svg { transform: scaleX(-1); }
.secondary-btn {
    height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    background: var(--surface);
    box-shadow: inset 0 0 0 1.5px var(--line-2);
    color: var(--ink);
    transition: transform 0.2s var(--ease);
}
.secondary-btn:hover { background: var(--surface-2); }
.secondary-btn:active { transform: scale(0.98); }
.text-btn { font-size: 14px; font-weight: 600; color: var(--route-deep); }
.text-btn:hover { text-decoration: underline; }

/* popovers */
.popover-anchor { position: relative; }
.popover {
    position: absolute;
    z-index: 1200;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--float-shadow);
    padding: 14px;
}
.time-popover { top: calc(100% + 6px); inset-inline-start: -10px; width: 300px; display: flex; flex-direction: column; gap: 12px; }
.segmented { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); }
.segmented button {
    flex: 1;
    height: 34px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(6, 52, 0, 0.12); }
:root[data-theme="dark"] .segmented button[aria-checked="true"] { background: #1a4a22; }
.time-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-2); }
.time-field input {
    height: 40px;
    padding: 0 10px;
    border-radius: 10px;
    border: 0;
    box-shadow: inset 0 0 0 1px var(--line-2);
    background: var(--surface);
    font-family: var(--mono);
}
.time-field input:disabled { opacity: 0.45; }

/* suggestions */
.suggestions {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline: 0;
    z-index: 1300;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--float-shadow);
    padding: 6px;
    max-height: 340px;
    overflow-y: auto;
}
.sugg {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
}
.sugg[aria-selected="true"], .sugg:hover { background: var(--surface-2); }
.sugg-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 9px;
    flex: none;
    background: var(--surface-2);
    color: var(--ink-2);
}
.sugg-icon--stop { color: var(--route-deep); background: var(--route-tint); }
.sugg-icon--here { color: var(--signal-deep); background: rgba(0, 146, 227, 0.12); }
.sugg-text { min-width: 0; display: flex; flex-direction: column; }
.sugg-main { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-head { padding: 8px 10px 4px; }

/* ---------------------------------------------------------------- results */
.results { display: flex; flex-direction: column; gap: 12px; }
.results:empty { display: none; }
.hint { font-size: 14px; color: var(--ink-3); }
.route-card {
    text-align: start;
    width: 100%;
    background: var(--surface);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: inset 0 0 0 1px var(--line);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow 0.25s var(--ease), transform 0.2s var(--ease);
    opacity: 0;
    animation: card-in 0.3s var(--ease) forwards;
}
.route-card:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.route-card.is-selected { box-shadow: inset 0 0 0 1.5px var(--route); }
.route-card:active { transform: scale(0.99); }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rc-duration { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-family: "IBM Plex Sans", var(--sans); }
.rc-duration small { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-inline-start: 4px; letter-spacing: 0; font-family: var(--sans); }
.rc-times { font-size: 14px; color: var(--ink-2); }
.rc-times .dim { opacity: 0.5; }
.rc-tag { font-size: 12px; font-weight: 600; color: var(--route-deep); }
.rc-context { font-size: 13px; color: var(--ink-2); }
.legs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.leg-sep { color: var(--ink-3); opacity: 0.7; }
html[dir="rtl"] .leg-sep svg { transform: scaleX(-1); }
.walk-chip { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.badge {
    height: 28px;
    min-width: 43px;
    padding: 0 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--route-deep);
    white-space: nowrap;
    direction: ltr;
}
.badge--lg { height: 36px; min-width: 55px; font-size: 15px; }
.badge.on-light { color: var(--forest); }

/* ---------------------------------------------------------------- route detail */
.route-head { display: flex; flex-direction: column; gap: 10px; }
.route-head .to { font-size: 13px; color: var(--ink-3); }
.route-head .big { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.route-head .big .dur { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-family: "IBM Plex Sans", var(--sans); }
.route-head .big .dur small { font-size: 16px; font-weight: 500; color: var(--ink-2); margin-inline-start: 5px; letter-spacing: 0; font-family: var(--sans); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.facts b { font-weight: 600; color: var(--ink); }
.notice {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--alert-tint);
    box-shadow: inset 0 0 0 1px var(--alert);
    font-size: 13px;
    color: var(--ink);
}
.notice svg { color: var(--alert); margin-top: 2px; }
.timeline {
    background: var(--surface);
    border-radius: 16px;
    padding: 18px 16px 2px;
    box-shadow: inset 0 0 0 1px var(--line);
}
.step { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.step::before {
    content: '';
    position: absolute;
    inset-inline-start: 13px;
    top: 30px;
    bottom: -2px;
    width: 3px;
    border-radius: 2px;
    background: var(--c, var(--walk));
}
.step--walk::before { width: 0; border-inline-start: 3px dotted var(--walk); background: none; opacity: 0.6; }
.step:last-child::before { display: none; }
.step-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 999px;
    flex: none;
    background: var(--c, var(--walk));
    color: #fff;
    z-index: 1;
}
.step-dot.on-light { color: var(--forest); }
.step--end .step-dot { background: var(--forest); color: var(--route); }
:root[data-theme="dark"] .step--end .step-dot { background: var(--route); color: var(--forest); }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.step-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.step-sub { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.step-note { font-size: 12px; color: var(--ink-2); line-height: 1.45; display: flex; gap: 6px; margin-top: 2px; }
.step-note svg { margin-top: 2px; color: var(--ink-3); }
.step-time { font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.step-stops { margin-top: 6px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); }
.step-stops li { display: flex; align-items: center; gap: 8px; }
.step-stops li::before { content: ''; width: 5px; height: 5px; border-radius: 999px; background: var(--c); opacity: 0.8; flex: none; }
.more-btn { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--signal-deep); margin-top: 2px; }
.more-btn:hover { text-decoration: underline; }
.fare-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; }
.fare-row .amount { font-size: 16px; font-weight: 600; }
.fare-note { font-size: 12px; color: var(--ink-3); margin-top: -10px; padding-inline: 4px; }

/* ---------------------------------------------------------------- stops */
.list-card { background: var(--surface); border-radius: 16px; padding: 0 16px; box-shadow: inset 0 0 0 1px var(--line); }
.row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 0;
    text-align: start;
    border-top: 1px solid var(--line);
    transition: background 0.2s var(--ease);
}
.row:first-child { border-top: 0; }
.row:hover .row-main { color: var(--harbor); }
.row-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; flex: none; background: var(--route-tint); color: var(--route-deep); }
.row-icon--point { background: var(--surface-2); color: var(--ink-2); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s var(--ease); }
.row-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-trail { font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.row-trail.soon { color: var(--route-deep); }
.mini-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; flex: none; max-width: 60%; }
.row-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-badges .badge { height: 20px; min-width: 0; padding: 0 5px; font-size: 11px; border-radius: 6px; }

.stop-head { display: flex; flex-direction: column; gap: 4px; }
.stop-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
html[lang="ar"] .stop-head h2 { letter-spacing: 0; }
.stop-head .alt { font-size: 14px; color: var(--ink-3); }
.pill-note { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.pill-note svg { margin-top: 2px; color: var(--ink-3); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ---------------------------------------------------------------- lines */
.lines-head { display: flex; flex-direction: column; gap: 12px; }
.search-wrap {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--ink-3);
}
.search-wrap:focus-within { box-shadow: inset 0 0 0 2px var(--signal); }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.search-wrap input::-webkit-search-cancel-button { filter: grayscale(1); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: inset 0 0 0 1px var(--line-2);
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--forest); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--route); color: var(--forest); }
.lines-list { display: flex; flex-direction: column; gap: 8px; }
.count { font-size: 13px; color: var(--ink-3); padding: 0 2px; }
.line-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    text-align: start;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    transition: box-shadow 0.2s var(--ease);
    opacity: 0;
    animation: card-in 0.3s var(--ease) forwards;
}
.line-row:hover { box-shadow: inset 0 0 0 1.5px var(--line-2); }

.line-head { display: flex; align-items: center; gap: 12px; }
.line-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
html[lang="ar"] .line-head h2 { letter-spacing: 0; }
.dir-switch { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.dir-switch .dir-label { flex: 1; min-width: 0; }
.dir-switch .dir-label b { display: block; font-size: 15px; font-weight: 600; }
.dir-switch .dir-label span { font-size: 12px; color: var(--ink-3); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-chip {
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink-2);
}
.meta-chip b { color: var(--ink); font-weight: 600; }
.stop-list { background: var(--surface); border-radius: 16px; padding: 10px 16px; box-shadow: inset 0 0 0 1px var(--line); }
.stop-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 40px;
    text-align: start;
    font-size: 14px;
}
.stop-item::before {
    content: '';
    position: absolute;
    inset-inline-start: 8px;
    top: 0; bottom: 0;
    width: 4px;
    background: var(--c);
}
.stop-item:first-child::before { top: 50%; }
.stop-item:last-child::before { bottom: 50%; }
.stop-mark {
    position: relative;
    z-index: 1;
    width: 20px; height: 20px;
    flex: none;
    display: flex; align-items: center; justify-content: center;
}
.stop-mark::after {
    content: '';
    width: 10px; height: 10px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: inset 0 0 0 2.5px var(--c);
}
.stop-item--stop .stop-mark::after { width: 14px; height: 14px; background: var(--surface); box-shadow: inset 0 0 0 4px var(--c); }
.stop-item--end .stop-mark::after { width: 16px; height: 16px; background: var(--c); box-shadow: inset 0 0 0 3px var(--c), 0 0 0 3px var(--surface); }
.stop-item .name { flex: 1; min-width: 0; padding: 8px 0; color: var(--ink-2); }
.stop-item--stop .name, .stop-item--end .name { color: var(--ink); font-weight: 600; }
.stop-item:hover .name { color: var(--harbor); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 999px; display: inline-block; }
.legend .l-stop { box-shadow: inset 0 0 0 3.5px var(--ink-2); }
.legend .l-point { width: 9px; height: 9px; box-shadow: inset 0 0 0 2px var(--ink-3); }
.source { font-size: 12px; color: var(--ink-3); }

/* ---------------------------------------------------------------- empty / error / skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 12px; }
.empty .well { width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--ink-2); }
.empty b { font-size: 15px; font-weight: 600; }
.empty p { font-size: 14px; color: var(--ink-2); max-width: 32ch; }
.empty--error .well { background: var(--alert-tint); color: var(--alert); }
.skel { display: block; background: var(--surface-2); border-radius: 6px; position: relative; overflow: hidden; }
.skel::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(15, 26, 18, 0.05), transparent);
    animation: sweep 1.4s var(--ease) infinite;
}
:root[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent); }
@keyframes sweep { to { transform: translateX(100%); } }
.skel-card { background: var(--surface); border-radius: 16px; padding: 16px 18px; box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 12px; }
.skel-line { display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- map */
.map-area { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--canvas); z-index: 1; }
.leaflet-container { font-family: var(--sans); background: var(--canvas); }
/* OpenStreetMap fallback tiles: quieter on light, inverted into a dark basemap on dark. */
.osm-tiles { filter: saturate(0.75) contrast(0.95); }
.osm-tiles--dark { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.45); }
.map-controls {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.map-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--float-shadow);
    color: var(--ink);
    transition: transform 0.2s var(--ease);
}
.map-btn:hover { background: var(--surface); }
.map-btn:active { transform: scale(0.96); }
.map-btn.is-active { color: var(--signal-deep); }
/* Map data, basemap and place-search credits live in Settings. The MapTiler layer needs
   Leaflet's attribution control to exist, so it is hidden rather than switched off; its
   logo is a plain link the plugin appends to the map container. */
.maplibregl-ctrl-logo, .maplibregl-ctrl-attrib, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right,
.leaflet-control-attribution, #map > a[href^="https://www.maptiler.com"] { display: none !important; }
.leaflet-control-attribution {
    font-size: 10px !important;
    background: var(--glass) !important;
    color: var(--ink-3) !important;
    border-radius: 6px 0 0 0;
}
html[dir="rtl"] .leaflet-control-attribution { border-radius: 0 6px 0 0; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-popup-content-wrapper {
    background: var(--surface);
    color: var(--ink);
    border-radius: 14px;
    box-shadow: var(--float-shadow);
}
.leaflet-popup-tip { background: var(--surface); box-shadow: none; }
.leaflet-popup-content { margin: 12px 12px; font-size: 14px; line-height: 1.4; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-3); }
.map-pop { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.map-pop .coords { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding: 0 4px 2px; direction: ltr; }
.map-pop-title { font-weight: 600; padding: 0 4px; }
.map-pop button {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    text-align: start;
    font-size: 14px;
    font-weight: 500;
    display: flex; align-items: center; gap: 8px;
}
.map-pop button:hover { background: var(--surface-2); }
.map-pop button.go { background: var(--route); color: var(--forest); font-weight: 600; }
.map-pop button.go:hover { background: #63D234; }

.pin-end { position: relative; width: 28px; height: 36px; }
.pin-end svg { display: block; filter: drop-shadow(0 3px 6px rgba(6, 52, 0, 0.3)); }
.pin-start {
    width: 18px; height: 18px;
    border-radius: 999px;
    background: var(--canvas);
    box-shadow: inset 0 0 0 4px var(--ink), 0 2px 6px rgba(6, 52, 0, 0.3);
}
.here-dot {
    width: 16px; height: 16px;
    border-radius: 999px;
    background: var(--signal);
    box-shadow: 0 0 0 4px rgba(0, 146, 227, 0.25), 0 0 0 1.5px #fff inset;
}

.next-card {
    position: absolute;
    inset-inline-end: 24px;
    bottom: 32px;
    width: 340px;
    z-index: 900;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow: var(--float-shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: card-in 0.3s var(--ease) forwards;
}
.next-card .nc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.next-card .nc-head b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.next-card .nc-head span { font-size: 13px; color: var(--ink-2); }
.next-card .nc-step { display: flex; gap: 14px; align-items: center; }
.next-card .nc-step .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.next-card .nc-step .t b { font-size: 15px; font-weight: 600; line-height: 1.35; }
.next-card .nc-step .t span { font-size: 13px; color: var(--ink-3); }
.next-card .nc-step .when { font-size: 20px; font-weight: 500; color: var(--route-deep); white-space: nowrap; }

/* ---------------------------------------------------------------- settings */
.settings {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    inset-inline-end: 16px;
    z-index: 2000;
    width: 340px;
}
.settings-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--float-shadow);
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100dvh - var(--topbar-h) - 24px);
    overflow-y: auto;
}
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-head h2 { font-size: 17px; font-weight: 600; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-2); }
.settings-row select {
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 0;
    background: var(--surface-2);
    color: var(--ink);
    min-width: 150px;
}
.settings-about { font-size: 13px; color: var(--ink-2); padding-top: 12px; border-top: 1px solid var(--line); }
.settings-section { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.settings-section h3 { font-size: 13px; font-weight: 600; color: var(--ink); }
.settings-note { font-size: 12px; color: var(--ink-3); }
.credits { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); }

/* ---------------------------------------------------------------- phones */
.tabbar { display: none; }

@media (max-width: 767px) {
    .app { display: block; }
    .topbar {
        position: fixed;
        top: 0;
        inset-inline: 0;
        height: auto;
        padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
        background: none;
        border: 0;
        pointer-events: none;
    }
    .topbar > * { pointer-events: auto; }
    .brand {
        height: 44px;
        padding: 0 14px 0 10px;
        border-radius: 999px;
        background: var(--glass);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: var(--float-shadow);
    }
    .brand-mark { width: 22px; }
    .brand-name { font-size: 15px; }
    .brand-name-ar { font-size: 11px; }
    html[dir="rtl"] .brand-name-ar { font-size: 16px; }
    html[dir="rtl"] .brand-name { font-size: 10px; }
    .brand-city { font-size: 13px; padding-inline-start: 10px; }
    .tabs { display: none; }
    #settings-btn { display: none; }
    .lang-toggle { height: 44px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--float-shadow); }

    .layout { display: block; }
    .map-area { position: fixed; inset: 0; }
    .map-controls { top: calc(env(safe-area-inset-top, 0px) + 66px); inset-inline-end: 12px; }
    .next-card { display: none; }

    .panel {
        position: fixed;
        inset-inline: 0;
        bottom: calc(var(--tabbar-h) + var(--safe-b));
        height: var(--sheet-h, 52dvh);
        border-radius: 24px 24px 0 0;
        border: 0;
        box-shadow: 0 -8px 30px rgba(6, 52, 0, 0.12);
        transition: height 0.3s var(--ease);
        padding-top: 18px;
    }
    :root[data-theme="dark"] .panel { box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5); }
    .panel[data-sheet="min"] { --sheet-h: 148px; }
    .panel[data-sheet="mid"] { --sheet-h: 52dvh; }
    .panel[data-sheet="max"] { --sheet-h: calc(100dvh - var(--tabbar-h) - var(--safe-b) - 64px); }
    .panel.is-dragging { transition: none; }
    .sheet-grip {
        display: flex;
        justify-content: center;
        position: sticky;
        top: -18px;
        margin: -18px 0 0;
        padding: 8px 0 4px;
        width: 100%;
        background: var(--canvas);
        z-index: 5;
        touch-action: none;
        cursor: grab;
    }
    .sheet-grip span { width: 36px; height: 4px; border-radius: 999px; background: var(--line-2); }
    .view { padding: 8px 20px 24px; gap: 16px; }
    .plan-title { font-size: 26px; }
    .time-popover { width: min(300px, calc(100vw - 40px)); }

    .tabbar {
        display: flex;
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        height: calc(var(--tabbar-h) + var(--safe-b));
        padding: 8px 8px calc(6px + var(--safe-b));
        background: var(--surface);
        border-top: 1px solid var(--line);
        z-index: 1100;
    }
    .tabbar-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 11px;
        font-weight: 500;
        color: var(--ink-3);
    }
    .tabbar-btn[aria-selected="true"] { color: var(--forest); font-weight: 600; }
    :root[data-theme="dark"] .tabbar-btn[aria-selected="true"] { color: var(--route); }

    .settings {
        top: auto;
        bottom: 0;
        inset-inline: 0;
        width: auto;
        padding: 0;
        background: rgba(6, 52, 0, 0.28);
        height: 100dvh;
        display: flex;
        align-items: flex-end;
    }
    :root[data-theme="dark"] .settings { background: rgba(0, 0, 0, 0.55); }
    .settings-card {
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 18px 20px calc(24px + var(--safe-b));
        max-height: 85dvh;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
    .route-card, .line-row, .next-card { opacity: 1; }
}

/* ================================================================ every city
 * What the unified app adds to the Damascus stylesheet: the city switcher and its landmark art,
 * departure boards, timetables, live tags and service alerts. */

:root {
    /* Landmark illustration (the selected city). Illustration may use Sky; UI surfaces may not. */
    --lm-sky: #DDF1FA;
    --lm-far: #BFD8C7;
    --lm-stone: #E8D9BC;
    --lm-stone-2: #D6C3A0;
    --lm-green: #1F8A4C;
    --lm-gold: #D4A72C;
    --lm-glass: #7DB3D1;
    --lm-water: #2FB1E9;
    --lm-spray: #8FC2DC;
    --lm-white: #F7F4EC;
    --lm-glass-dark: #3F5A6E;
    --lm-metal: #D8CCB0;
    --lm-red: #C62B2B;
    --lm-cream: #F2E7C9;
    --lm-trees: #6FA35A;
    --lm-c1: #D93A2B; --lm-c2: #F28C28; --lm-c3: #2E4FB3; --lm-c4: #F3C534; --lm-c5: #3DA35A;
    --lm-wood: #7A4B2A;
    --lm-timber: #8A5A33;
    --lm-tower: #DCC0AA;
    --lm-tower-2: #C4A08A;
    --lm-tower-3: #F8F2EA;
    --lm-rib: #FBF6EF;
    --lm-glow: transparent;
    --lm-steel: #C5CBD0;             /* Ithra's brushed stainless steel */
    --lm-steel-2: #A9B0B7;
    --lm-steel-hi: #E2E6E9;
    --lm-steel-edge: #8D959C;
    --lm-band: #43494F;
    /* Bahrain by day: the Sakhir Tower's LED bands lit in colour; green glass sails with the sun on them;
       the World Trade Center's pale louvres and blue glass; the Four Seasons' champagne and bronze. */
    --lm-led-1: #4FD6F2; --lm-led-2: #F25CB8; --lm-led-3: #9C6CF2;
    --lm-bic-glass: #26324C;
    --lm-bic-mark: rgba(255, 255, 255, 0.45);
    --lm-bfh: #1FA06C;
    --lm-bfh-2: #12784F;
    --lm-bfh-hi: #EFC65C;
    --lm-bfh-line: rgba(10, 80, 52, 0.55);
    --lm-bfh-led: #E6CF86;
    --lm-wtc: #E9ECEB;
    --lm-wtc-glass: #3F88C8;
    --lm-wtc-line: #9BB2C6;
    --lm-wtc-edge: #FBFCFB;
    --lm-fs: #DCC7A4;
    --lm-fs-2: #C3A882;
    --lm-fs-fin: #7E6644;
    --lm-fs-rib: #9A7F55;
    --lm-fs-glass: #3A3330;
    --lm-fs-hall: #EDE4D3;
    --lm-lights: transparent;
    --lm-glow-v: transparent;
    --lm-glow-w: transparent;
    /* Ankara by day: YDA Center's blue-grey glass ribbed with pale fins; Atakule's white concrete and
       sky-blue dome; Kocatepe's white stone under lead domes; the Clock Tower's sandstone; tiled roofs. */
    --lm-yda: #8197AD;
    --lm-yda-2: #637790;
    --lm-yda-fin: rgba(234, 241, 247, 0.5);
    --lm-yda-lit: transparent;
    --lm-yda-led: #E9EEF2;
    --lm-ata: #F2F0EB;
    --lm-ata-2: #CCC8BF;
    --lm-ata-glass: #3D5064;
    --lm-ata-dome: #9CC0D9;
    --lm-ata-lattice: #F5F8FA;
    --lm-ata-led: rgba(255, 255, 255, 0.35);
    --lm-ata-screen: #41546A;
    --lm-koc: #F1ECE1;
    --lm-koc-2: #D9D0BE;
    --lm-koc-dome: #6D8496;
    --lm-clk: #E3D3B4;
    --lm-clk-2: #C9B793;
    --lm-roof: #B4583A;
    /* Cairo by day: the pyramids' limestone in the sun and in shade; the Cairo Tower's pale concrete
       lattice over dark openings; Al-Azhar's sandstone, silver dome, blue tiles and red bands; the Baron
       Palace's ochre stone. */
    --lm-pyr: #E4C48C;
    --lm-pyr-2: #C49C5E;
    --lm-pyr-line: rgba(122, 88, 42, 0.32);
    --lm-sand: #EBD3A2;
    --lm-ctw: #DCC8A2;
    --lm-ctw-2: #BFA77F;
    --lm-ctw-hole: #5C4A35;
    --lm-ctw-glass: #3F5A6E;
    --lm-azh: #E6C78F;
    --lm-azh-2: #C9A468;
    --lm-azh-dome: #D6D1C6;
    --lm-azh-tile: #2F80A6;
    --lm-azh-red: #B9653F;
    --lm-brn: #DDB67C;
    --lm-brn-2: #BF975D;
    --lm-brn-3: #EED3A1;
    --lm-slate: #55636F;
    --lm-detail: rgba(74, 58, 36, 0.55);
    --lm-line: #8C7A5E;
    --lm-silhouette: var(--route-deep);
}
:root[data-theme="dark"] {
    /* The same scene by night: warm-lit stone, lit windows. */
    --lm-sky: #0B2433;
    --lm-far: #173F2A;
    --lm-stone: #C2AE86;
    --lm-stone-2: #8E7C5B;
    --lm-green: #3FAE62;
    --lm-gold: #E6BE4A;
    --lm-glass: #3F7EA3;
    --lm-water: #1D6F95;
    --lm-spray: #E6F3FA;
    --lm-white: #EDE8DC;
    --lm-glass-dark: #2B475C;
    --lm-metal: #BFB195;
    --lm-red: #D8403A;
    --lm-cream: #E8DCBC;
    --lm-trees: #2F6A3A;
    --lm-c1: #FF4B36; --lm-c2: #FF9A2E; --lm-c3: #3D63E0; --lm-c4: #FFD448; --lm-c5: #4CC46C;
    --lm-wood: #B07A4E;
    --lm-timber: #A8743F;
    --lm-tower: #2FBF66;              /* the Khobar Water Tower, floodlit green */
    --lm-tower-2: #2A97D2;
    --lm-tower-3: #9FE8BC;
    --lm-rib: #C9F7DA;
    --lm-glow: rgba(47, 191, 102, 0.4);
    --lm-steel: #939CA4;
    --lm-steel-2: #7A838B;
    --lm-steel-hi: #B3BBC1;
    --lm-steel-edge: #5E666D;
    --lm-band: #2C3238;
    /* Bahrain by night: the Sakhir Tower's bands silver with a dark pattern over warm-lit floors; the
       sails dark with lit floors and purple edges; the World Trade Center's bands lit gold, edged in
       violet; the Four Seasons floodlit amber, its dark glass dotted with lit windows, the island
       strung with lights. */
    --lm-led-1: #ECEEF2; --lm-led-2: #DFE2E8; --lm-led-3: #D2D6DE;
    --lm-bic-glass: #B98142;
    --lm-bic-mark: #33373F;
    --lm-bfh: #2A2E38;
    --lm-bfh-2: #20232B;
    --lm-bfh-hi: #20232B;
    --lm-bfh-line: #FFE7A6;
    --lm-bfh-led: #B97CFF;
    --lm-wtc: #E7A84C;
    --lm-wtc-glass: #2E2A4E;
    --lm-wtc-line: #7A4E1E;
    --lm-wtc-edge: #A57BFF;
    --lm-fs: #DB9A40;
    --lm-fs-2: #F4C870;
    --lm-fs-fin: #1C1714;
    --lm-fs-rib: #1C1714;
    --lm-fs-glass: #1A1512;
    --lm-fs-hall: #EBB25A;
    --lm-lights: #FFD98A;
    --lm-glow-v: rgba(165, 123, 255, 0.45);
    --lm-glow-w: rgba(255, 184, 84, 0.55);
    /* Ankara by night: YDA Center dark, its floors lit and its roofline traced in blue; Atakule
       floodlit pink, its dome glowing and a band of lit text round the drum; Kocatepe floodlit white;
       the Clock Tower lit pale, its faces glowing. */
    --lm-yda: #1D2A45;
    --lm-yda-2: #151E33;
    --lm-yda-fin: transparent;
    --lm-yda-lit: #FFE3A3;
    --lm-yda-led: #49A6FF;
    --lm-ata: #F4BFAA;
    --lm-ata-2: #D9917A;
    --lm-ata-glass: #2E2530;
    --lm-ata-dome: #F0CDB0;
    --lm-ata-lattice: #FFF5EA;
    --lm-ata-led: #FFF1DD;
    --lm-ata-screen: #F3EEF9;
    --lm-koc: #EEF1F6;
    --lm-koc-2: #B9C3D1;
    --lm-koc-dome: #8DA0BA;
    --lm-clk: #F0EADF;
    --lm-clk-2: #CFC6B5;
    --lm-roof: #7E3F2E;
    /* Cairo by night: the pyramids floodlit; the Cairo Tower lit gold, its decks glowing; Al-Azhar
       floodlit white; the Baron Palace floodlit amber. */
    --lm-pyr: #D7A75E;
    --lm-pyr-2: #8F693B;
    --lm-pyr-line: rgba(70, 44, 14, 0.35);
    --lm-sand: #7A6646;
    --lm-ctw: #F3C45B;
    --lm-ctw-2: #CB8F2F;
    --lm-ctw-hole: #3A230D;
    --lm-ctw-glass: #FFE3A3;
    --lm-azh: #F2E6CB;
    --lm-azh-2: #CDBB97;
    --lm-azh-dome: #E9E2D3;
    --lm-azh-tile: #6FB3CF;
    --lm-azh-red: #D39272;
    --lm-brn: #F0B75A;
    --lm-brn-2: #C6853A;
    --lm-brn-3: #FFD88E;
    --lm-slate: #6E7F8C;
    --lm-detail: #FFD98A;
    --lm-line: #D9C7A0;
    --lm-silhouette: var(--route);
}

/* ---------------------------------------------------------------- landmarks */
.lm { display: block; width: 100%; height: 100%; overflow: visible; color: var(--lm-silhouette); }
.lm * { transition: fill 0.5s var(--ease), stroke 0.5s var(--ease), opacity 0.5s var(--ease); }
/* Silhouette: one flat colour, no sky, no details. */
.lm .lm-sky { fill: transparent; }
.lm :where([class^="lm-"]:not(.lm-sky, .lm-wood, .lm-line)) { fill: currentColor; }
.lm .lm-far { opacity: 0.45; }
.lm .lm-water { opacity: 0.55; }
.lm .lm-wood { fill: none; stroke: currentColor; stroke-width: 1.6; }
.lm .lm-wood circle:last-child { fill: currentColor; }
.lm .lm-line { fill: none; stroke: currentColor; stroke-width: 0.9; }
.lm .lm-line-fill { fill: currentColor; }
.lm .lm-detail { opacity: 0; }
.lm .lm-rib { fill: none; stroke: currentColor; stroke-width: 0.6; }
.lm .lm-glow { opacity: 0; }
.lm .lm-steel-edge { fill: none; stroke: currentColor; stroke-width: 0.5; }
.lm .lm-band { fill: none; stroke: currentColor; opacity: 0; }
.lm :is(.lm-bic-mark, .lm-bfh-line, .lm-bfh-led, .lm-wtc-line, .lm-wtc-edge) { fill: none; stroke: currentColor; opacity: 0; }
.lm .lm-bfh-led, .lm .lm-wtc-edge { stroke-width: 0.6; }
.lm :is(.lm-glow-v, .lm-glow-w, .lm-lights) { opacity: 0; }
.lm :is(.lm-yda-fin, .lm-yda-lit, .lm-yda-led, .lm-ata-lattice, .lm-ata-led) { fill: none; stroke: currentColor; opacity: 0; }
.lm .lm-pyr-line { fill: none; stroke: currentColor; opacity: 0; }
/* Shown: the landmarks in colour. */
.lm.is-shown .lm-sky { fill: var(--lm-sky); }
.lm.is-shown .lm-far { fill: var(--lm-far); opacity: 1; }
.lm.is-shown .lm-stone { fill: var(--lm-stone); }
.lm.is-shown .lm-stone-2 { fill: var(--lm-stone-2); }
.lm.is-shown .lm-green { fill: var(--lm-green); }
.lm.is-shown .lm-gold { fill: var(--lm-gold); }
.lm.is-shown .lm-glass { fill: var(--lm-glass); }
.lm.is-shown .lm-water { fill: var(--lm-water); opacity: 1; }
.lm.is-shown .lm-spray { fill: var(--lm-spray); }
.lm.is-shown .lm-white { fill: var(--lm-white); }
.lm.is-shown .lm-glass-dark { fill: var(--lm-glass-dark); }
.lm.is-shown .lm-metal { fill: var(--lm-metal); }
.lm.is-shown .lm-red { fill: var(--lm-red); }
.lm.is-shown .lm-cream { fill: var(--lm-cream); }
.lm.is-shown .lm-trees { fill: var(--lm-trees); }
.lm.is-shown .lm-c1 { fill: var(--lm-c1); }
.lm.is-shown .lm-c2 { fill: var(--lm-c2); }
.lm.is-shown .lm-c3 { fill: var(--lm-c3); }
.lm.is-shown .lm-c4 { fill: var(--lm-c4); }
.lm.is-shown .lm-c5 { fill: var(--lm-c5); }
.lm.is-shown .lm-slate { fill: var(--lm-slate); }
.lm.is-shown .lm-timber { fill: var(--lm-timber); }
.lm.is-shown .lm-tower { fill: var(--lm-tower); }
.lm.is-shown .lm-tower-2 { fill: var(--lm-tower-2); }
.lm.is-shown .lm-tower-3 { fill: var(--lm-tower-3); }
.lm.is-shown .lm-rib { stroke: var(--lm-rib); }
.lm.is-shown .lm-glow { fill: var(--lm-glow); opacity: 1; }
.lm.is-shown .lm-steel { fill: var(--lm-steel); }
.lm.is-shown .lm-steel-2 { fill: var(--lm-steel-2); }
.lm.is-shown .lm-steel-hi { fill: var(--lm-steel-hi); }
.lm.is-shown .lm-steel-edge { stroke: var(--lm-steel-edge); }
.lm.is-shown .lm-band { stroke: var(--lm-band); opacity: 1; }
.lm.is-shown .lm-led-1 { fill: var(--lm-led-1); }
.lm.is-shown .lm-led-2 { fill: var(--lm-led-2); }
.lm.is-shown .lm-led-3 { fill: var(--lm-led-3); }
.lm.is-shown .lm-bic-glass { fill: var(--lm-bic-glass); }
.lm.is-shown .lm-bic-mark { stroke: var(--lm-bic-mark); opacity: 1; }
.lm.is-shown .lm-bfh { fill: var(--lm-bfh); }
.lm.is-shown .lm-bfh-2 { fill: var(--lm-bfh-2); }
.lm.is-shown .lm-bfh-hi { fill: var(--lm-bfh-hi); }
.lm.is-shown .lm-bfh-line { stroke: var(--lm-bfh-line); opacity: 1; }
.lm.is-shown .lm-bfh-led { stroke: var(--lm-bfh-led); opacity: 1; }
.lm.is-shown .lm-wtc { fill: var(--lm-wtc); }
.lm.is-shown .lm-wtc-glass { fill: var(--lm-wtc-glass); }
.lm.is-shown .lm-wtc-line { stroke: var(--lm-wtc-line); opacity: 1; }
.lm.is-shown .lm-wtc-edge { stroke: var(--lm-wtc-edge); opacity: 1; }
.lm.is-shown .lm-fs { fill: var(--lm-fs); }
.lm.is-shown .lm-fs-2 { fill: var(--lm-fs-2); }
.lm.is-shown .lm-fs-fin { fill: var(--lm-fs-fin); }
.lm.is-shown .lm-fs-rib { fill: var(--lm-fs-rib); }
.lm.is-shown .lm-fs-glass { fill: var(--lm-fs-glass); }
.lm.is-shown .lm-fs-hall { fill: var(--lm-fs-hall); }
.lm.is-shown .lm-lights { fill: var(--lm-lights); opacity: 1; }
.lm.is-shown .lm-glow-v { fill: var(--lm-glow-v); opacity: 1; }
.lm.is-shown .lm-glow-w { fill: var(--lm-glow-w); opacity: 1; }
.lm.is-shown .lm-yda { fill: var(--lm-yda); }
.lm.is-shown .lm-yda-2 { fill: var(--lm-yda-2); }
.lm.is-shown .lm-yda-fin { stroke: var(--lm-yda-fin); opacity: 1; }
.lm.is-shown .lm-yda-lit { stroke: var(--lm-yda-lit); opacity: 1; }
.lm.is-shown .lm-yda-led { stroke: var(--lm-yda-led); opacity: 1; }
.lm.is-shown .lm-ata { fill: var(--lm-ata); }
.lm.is-shown .lm-ata-2 { fill: var(--lm-ata-2); }
.lm.is-shown .lm-ata-glass { fill: var(--lm-ata-glass); }
.lm.is-shown .lm-ata-dome { fill: var(--lm-ata-dome); }
.lm.is-shown .lm-ata-lattice { stroke: var(--lm-ata-lattice); opacity: 1; }
.lm.is-shown .lm-ata-led { stroke: var(--lm-ata-led); opacity: 1; }
.lm.is-shown .lm-ata-screen { fill: var(--lm-ata-screen); }
.lm.is-shown .lm-koc { fill: var(--lm-koc); }
.lm.is-shown .lm-koc-2 { fill: var(--lm-koc-2); }
.lm.is-shown .lm-koc-dome { fill: var(--lm-koc-dome); }
.lm.is-shown .lm-clk { fill: var(--lm-clk); }
.lm.is-shown .lm-clk-2 { fill: var(--lm-clk-2); }
.lm.is-shown .lm-roof { fill: var(--lm-roof); }
.lm.is-shown .lm-pyr { fill: var(--lm-pyr); }
.lm.is-shown .lm-pyr-2 { fill: var(--lm-pyr-2); }
.lm.is-shown .lm-pyr-line { stroke: var(--lm-pyr-line); opacity: 1; }
.lm.is-shown .lm-sand { fill: var(--lm-sand); }
.lm.is-shown .lm-ctw { fill: var(--lm-ctw); }
.lm.is-shown .lm-ctw-2 { fill: var(--lm-ctw-2); }
.lm.is-shown .lm-ctw-hole { fill: var(--lm-ctw-hole); }
.lm.is-shown .lm-ctw-glass { fill: var(--lm-ctw-glass); }
.lm.is-shown .lm-azh { fill: var(--lm-azh); }
.lm.is-shown .lm-azh-2 { fill: var(--lm-azh-2); }
.lm.is-shown .lm-azh-dome { fill: var(--lm-azh-dome); }
.lm.is-shown .lm-azh-tile { fill: var(--lm-azh-tile); }
.lm.is-shown .lm-azh-red { fill: var(--lm-azh-red); }
.lm.is-shown .lm-brn { fill: var(--lm-brn); }
.lm.is-shown .lm-brn-2 { fill: var(--lm-brn-2); }
.lm.is-shown .lm-brn-3 { fill: var(--lm-brn-3); }
.lm.is-shown .lm-wood { stroke: var(--lm-wood); }
.lm.is-shown .lm-wood circle:last-child { fill: var(--lm-wood); }
.lm.is-shown .lm-detail { fill: var(--lm-detail); opacity: 1; }
.lm.is-shown .lm-line { stroke: var(--lm-line); }
.lm.is-shown .lm-line-fill { fill: #8A8F95; }
.lm.is-shown .lm-detail g, .lm.is-shown g.lm-detail > * { fill: var(--lm-detail); }

.flag { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px var(--line-2); }

/* ---------------------------------------------------------------- city switcher */
.brand-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.city-anchor { position: relative; }
.city-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding-inline: 10px 10px;
    border-radius: 12px;
    overflow: hidden;
    isolation: isolate;
    box-shadow: inset 0 0 0 1px var(--line-2);
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.city-btn:hover { box-shadow: inset 0 0 0 1.5px var(--route); }
.city-btn:active { transform: scale(0.98); }
.city-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 2px var(--route); }
.city-btn-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.22;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}
.city-btn:hover .city-btn-art { opacity: 0.34; }
.city-btn-flag { width: 21px; height: 14px; flex: none; }
.city-btn-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; text-shadow: 0 0 6px var(--surface), 0 0 2px var(--surface); }
.city-btn-chev { color: var(--ink-2); transition: transform 0.25s var(--ease); }
.city-btn[aria-expanded="true"] .city-btn-chev { transform: rotate(180deg); }

.city-menu {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    inset-inline-start: var(--city-menu-x, 16px);   /* under the city button: set by app.js */
    z-index: 2100;
    width: 400px;
}
.city-menu-card {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--float-shadow);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100dvh - var(--topbar-h) - 32px);
    overflow-y: auto;
    animation: card-in 0.25s var(--ease) forwards;
}
.city-menu-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px 0; }
.city-menu-head h2 { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; }
/* Back from a country's cities to the countries; hidden on the countries. */
.city-menu-head #city-back { margin-inline-start: -6px; color: var(--ink); }
.city-list { display: flex; flex-direction: column; gap: 8px; }
.city-opt {
    position: relative;
    display: block;
    width: 100%;
    height: 118px;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    isolation: isolate;
    text-align: start;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
    transition: box-shadow 0.25s var(--ease), transform 0.2s var(--ease), background 0.5s var(--ease);
}
.city-opt:hover { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.city-opt:active { transform: scale(0.99); }
.city-opt:focus-visible { outline-offset: -2px; }
.city-opt.is-selected { box-shadow: inset 0 0 0 2px var(--route); background: var(--lm-sky); }
/* The landmarks stand below the name; their sky runs up behind it (the SVG does not clip). */
.city-opt-art { position: absolute; inset: 36px 0 0; z-index: -1; opacity: 0.22; transition: opacity 0.5s var(--ease); pointer-events: none; }
.city-opt:hover .city-opt-art { opacity: 0.34; }
.city-opt.is-selected .city-opt-art { opacity: 1; }
.city-opt-body { position: absolute; top: 9px; inset-inline: 14px 44px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.city-opt-flag { width: 27px; height: 18px; flex: none; }
.city-opt-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; line-height: 1.3; }
.city-opt-text b { flex: 0 0 auto; max-width: 100%; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city-opt-text small { flex: 0 100 auto; min-width: 0; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city-opt-check {
    position: absolute;
    top: 8px;
    inset-inline-end: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    border-radius: 999px;
    background: var(--route);
    color: var(--forest);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.city-opt.is-selected .city-opt-check { opacity: 1; transform: none; }

.city-loading {
    position: absolute;
    top: 16px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--float-shadow);
    font-size: 14px;
    font-weight: 500;
}
html[dir="rtl"] .city-loading { transform: translateX(50%); }
.spinner {
    width: 16px; height: 16px;
    border-radius: 999px;
    border: 2px solid var(--line-2);
    border-top-color: var(--route);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- live and schedule tags */
.eta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 20px;
    padding: 0 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: middle;
    background: var(--surface-2);
    color: var(--ink-2);
}
.eta--live { background: var(--route-tint); color: var(--route-deep); }
.eta--predicted { background: rgba(0, 146, 227, 0.12); color: var(--signal-deep); }
.eta--estimated { background: var(--surface-2); color: var(--ink-3); }
.ic-live .w1 { animation: live-wave 1.5s steps(1) infinite; }
.ic-live .w2 { animation: live-wave 1.5s steps(1) infinite 0.5s; }
/* The three frames of the Riyadh / Istanbul "signal" icon: dot, first wave, both waves. */
@keyframes live-wave { 0% { opacity: 0; } 33% { opacity: 1; } 100% { opacity: 1; } }
.step-time { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.step-time .eta { padding: 0 4px; }
.day-plus { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--alert); margin-inline-start: 2px; }
.next-card .nc-step .when { display: flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- departures */
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-note { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.dep-row .row-trail { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); }
.dep-row .row-trail.soon { color: var(--route-deep); font-weight: 600; }
.dep-now { font-family: var(--sans); font-weight: 600; color: var(--route-deep); }
.dep-row .badge { flex: none; }

/* ---------------------------------------------------------------- timetable */
.line-head .sub { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-select { display: flex; flex-direction: column; gap: 6px; }
.tt-select select, .time-field select {
    height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    border: 0;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--ink);
    width: 100%;
}
.time-field select { height: 40px; width: auto; min-width: 150px; border-radius: 10px; }
.tt-days { overflow-x: auto; scrollbar-width: none; }
.tt-days button { flex: 1 0 auto; padding: 0 10px; white-space: nowrap; }
.tt-grid { background: var(--surface); border-radius: 16px; padding: 6px 14px; box-shadow: inset 0 0 0 1px var(--line); }
.tt-row { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.tt-row:first-child { border-top: 0; }
.tt-hour { width: 28px; flex: none; font-size: 15px; font-weight: 600; color: var(--ink); padding-top: 3px; }
.tt-mins { display: flex; flex-wrap: wrap; gap: 4px 6px; direction: ltr; }
html[dir="rtl"] .tt-mins { justify-content: flex-end; }
.tt-min { min-width: 30px; height: 26px; padding: 0 4px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-2); }
.tt-min--past { color: var(--ink-3); opacity: 0.6; }
.tt-min--next { background: var(--c); color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- alerts */
.alerts-btn { position: relative; }
.alerts-dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 999px; background: var(--alert); box-shadow: 0 0 0 2px var(--surface); }
.alerts-popover { top: calc(100% + 10px); inset-inline-end: -8px; width: 340px; display: flex; flex-direction: column; gap: 10px; max-height: 70dvh; overflow-y: auto; }
.alerts-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item { padding: 12px 14px; border-radius: 12px; background: var(--alert-tint); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.alert-head { display: flex; gap: 8px; align-items: center; }
.alert-icon { color: var(--alert); display: inline-flex; }
.alert-item p { color: var(--ink-2); }
.alert-item time { font-size: 11px; color: var(--ink-3); }

.lang-toggle { gap: 5px; }

/* ---------------------------------------------------------------- tablets: keep the bar on one row */
@media (max-width: 1080px) and (min-width: 768px) {
    .brand-text { display: none; }
    .tab { padding: 0 11px; }
}

@media (max-width: 767px) {
    .brand-group {
        height: 44px;
        gap: 8px;
        padding: 0 4px 0 10px;
        border-radius: 999px;
        background: var(--glass);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: var(--float-shadow);
        min-width: 0;
    }
    html[dir="rtl"] .brand-group { padding: 0 10px 0 4px; }
    .brand, html[dir="rtl"] .brand { height: auto; padding: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 0; }
    .city-btn { height: 36px; border-radius: 999px; padding-inline: 8px 8px; font-size: 13px; background: var(--surface); min-width: 0; }
    .city-anchor { min-width: 0; }
    .city-btn-name { max-width: 34vw; }
    .city-btn-flag { width: 18px; height: 12px; }
    .topbar-actions { gap: 8px; }
    .alerts-btn { width: 44px; height: 44px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--float-shadow); }
    .alerts-popover {
        position: fixed;
        top: auto; bottom: 0; inset-inline: 0;
        width: auto;
        max-height: 80dvh;
        border-radius: 24px 24px 0 0;
        padding: 18px 20px calc(24px + var(--safe-b));
    }
    .city-menu {
        position: fixed;
        top: 0; bottom: 0; inset-inline: 0;
        --city-menu-x: 0px;
        width: auto;
        height: 100dvh;
        display: flex;
        align-items: flex-end;
        background: rgba(6, 52, 0, 0.28);
    }
    :root[data-theme="dark"] .city-menu { background: rgba(0, 0, 0, 0.55); }
    .city-menu-card {
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 18px 16px calc(20px + var(--safe-b));
        max-height: 88dvh;
    }
    .city-opt { height: 112px; }
    .city-loading { top: calc(env(safe-area-inset-top, 0px) + 64px); }
}
@media (max-width: 400px) {
    .brand-text { display: none; }
    .lang-toggle { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .ic-live .w1, .ic-live .w2 { animation: none; opacity: 1; }
    .spinner { animation-duration: 2s; }
}
