/* Webová aplikace: na desktopu panel + mapa vedle sebe, na mobilu záložky Spoje / Mapa. */
html, body { height: 100%; overflow: hidden; }
body { overscroll-behavior: none; }

.shell { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; position: relative; }
.panel, .mapwrap { grid-row: 1; grid-column: 1; min-height: 0; }
.panel { min-width: 0; display: flex; flex-direction: column; background: var(--bg); position: relative; z-index: 2; }
.mapwrap { position: relative; overflow: hidden; background: var(--brand-50); }
.shell[data-tab="search"] .mapwrap { visibility: hidden; }
.shell[data-tab="map"] .panel { display: none; }
#map { position: absolute; inset: 0; }

@media (min-width: 960px) {
  .shell { grid-template-columns: minmax(400px, 450px) 1fr; grid-template-rows: 1fr; }
  .panel { grid-column: 1; border-right: 1px solid var(--line); box-shadow: 6px 0 30px rgba(29, 108, 178, .07); }
  .mapwrap { grid-column: 2; }
  .shell[data-tab] .mapwrap { visibility: visible; }
  .shell[data-tab="map"] .panel { display: flex; }
  .tabbar { display: none !important; }
}

/* ───── hlavička ───── */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + .9rem) 1.1rem .6rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.brand img { border-radius: 12px; box-shadow: 0 4px 12px rgba(61, 157, 232, .35); }
.brand strong { display: block; font-size: 1.35rem; line-height: 1.1; letter-spacing: -.02em; font-weight: 750; }
.brand small { display: block; color: var(--muted); font-size: .85rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink-2); display: grid; place-items: center; box-shadow: var(--shadow-1); }
.icon-btn:hover { color: var(--brand-600); }

.scroll { flex: 1; overflow-x: hidden; overflow-y: auto; padding: .3rem 1rem 1.2rem; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.card { background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-1); border: 1px solid var(--line); }

/* ───── načítání ───── */
.loading { display: grid; place-items: center; gap: 1rem; padding: 4rem 1rem; color: var(--ink-2); text-align: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--brand-100); border-top-color: var(--brand); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── formulář ───── */
.search { padding: 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .25rem; }
.field { position: relative; }
.field label { position: absolute; left: 3.1rem; top: -.55rem; padding: 0 .35rem; background: var(--surface); font-size: .76rem; font-weight: 650; color: var(--muted); z-index: 1; letter-spacing: .02em; }
.input-wrap { display: flex; align-items: center; gap: .4rem; border: 1.5px solid var(--line); border-radius: 16px; padding: 0 .5rem 0 .9rem; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.input-wrap .lead { color: var(--brand-600); }
.input-wrap input { flex: 1; min-width: 0; height: 54px; border: 0; background: transparent; font-size: 1.05rem; outline: none; }
.input-wrap input::placeholder { color: var(--muted); opacity: .8; }
.mini { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; }
.mini:hover { background: var(--brand-50); color: var(--brand-600); }
.mini[hidden] { display: none; }

.swap-row { display: flex; align-items: center; gap: .6rem; margin: .1rem 0; }
.rule { flex: 1; height: 1px; background: var(--line); }
.swap { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--brand-600); display: grid; place-items: center; transition: transform .25s; }
.swap:hover { background: var(--brand-50); }
.swap:active { transform: rotate(180deg); }

.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: .35rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2); max-height: min(52vh, 380px); overflow-y: auto; }
.suggest li { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 12px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--brand-100); }
.suggest .ico { color: var(--brand-600); }
.suggest .txt { flex: 1; min-width: 0; }
.suggest .name, .suggest .sub { display: block; }
.suggest .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .sub { font-size: .82rem; color: var(--muted); }
.suggest .meta { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.suggest .forget { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.suggest .forget:hover { background: var(--late-bg); color: var(--late); }
.suggest .hint { cursor: default; color: var(--muted); font-size: .9rem; }
.suggest .hint:hover { background: transparent; }

.opts { display: flex; flex-wrap: wrap; gap: .6rem; margin: .7rem 0 .2rem; }
.seg { display: inline-flex; padding: 3px; background: var(--brand-50); border: 1px solid var(--line); border-radius: 999px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: .42rem .9rem; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 4px rgba(10, 37, 64, .12); }
.when { display: flex; gap: .7rem; margin: .5rem 0 .1rem; }
.when label { flex: 1; min-width: 0; font-size: .78rem; font-weight: 650; color: var(--muted); display: grid; gap: .2rem; }
.when input { width: 100%; height: 46px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 .7rem; font-size: 1rem; min-width: 0; }
.go { margin-top: .8rem; width: 100%; min-height: 54px; font-size: 1.05rem; }
.form-msg { margin-top: .6rem; padding: .6rem .8rem; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: .92rem; }

/* ───── výsledky ───── */
.results { margin-top: 1.4rem; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 .3rem .7rem; }
.results-head h2 { font-size: 1.5rem; letter-spacing: -.02em; font-weight: 700; }
.results-tools { display: flex; align-items: center; gap: .9rem; color: var(--muted); font-size: .9rem; }
.link-btn { border: 0; background: transparent; color: var(--brand-600); font-weight: 650; display: inline-flex; align-items: center; gap: .25rem; padding: .3rem .1rem; }
.link-btn:disabled { opacity: .45; cursor: default; }
.journeys { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.journey { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 1.05rem 1.1rem; box-shadow: var(--shadow-1); animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.journeys:not(.fresh) .journey { animation: none; }
.j-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.j-times { display: flex; align-items: baseline; gap: .55rem; font-size: 1.9rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.j-times .icon { width: 1.1rem; height: 1.1rem; color: var(--muted); align-self: center; }
.j-times s { text-decoration: none; }
.j-times .shifted { color: var(--late); }
.j-rel { color: var(--brand-600); font-weight: 650; margin-top: .2rem; }
.j-dur { color: var(--ink-2); }
.j-actions { display: flex; gap: .4rem; flex-direction: column; align-items: flex-end; }
.pill-btn { border: 0; border-radius: 999px; background: var(--brand-100); color: var(--brand-700); font-weight: 650; padding: .55rem 1rem; display: inline-flex; align-items: center; gap: .4rem; }
.pill-btn:hover { background: color-mix(in srgb, var(--brand-100) 75%, var(--brand)); }
.j-lines { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .8rem 0 .5rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; min-width: 2.2rem; justify-content: center; padding: .18rem .6rem; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 750; font-size: 1.05rem; }
:root[data-theme="dark"] .badge { color: #04243d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: #04243d; } }
.badge.train { background: var(--train); }
.badge .icon { width: 1rem; height: 1rem; }
.sep { color: var(--muted); }
.tag { display: inline-flex; align-items: center; padding: .2rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 650; background: var(--brand-100); color: var(--brand-700); }
.tag.late { background: var(--late-bg); color: var(--late); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.j-meta { color: var(--ink-2); font-size: .95rem; }
.j-sub { color: var(--muted); font-size: .86rem; margin-top: .25rem; }
.transfer { margin-top: .45rem; padding: .5rem .7rem; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); font-size: .9rem; color: var(--ink-2); }
.toggle { margin-top: .7rem; border: 0; background: transparent; color: var(--brand-600); font-weight: 650; padding: .2rem 0; display: inline-flex; align-items: center; gap: .3rem; }
.toggle .icon { transition: transform .2s; }
.toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.timeline { margin: .7rem 0 0; padding: 0; list-style: none; border-left: 3px solid var(--brand-100); margin-left: .6rem; }
.timeline li { position: relative; padding: 0 0 .75rem 1.1rem; }
.timeline li::before { content: ""; position: absolute; left: -8.5px; top: .4rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline li.mid::before { width: 8px; height: 8px; left: -6.5px; top: .5rem; border-width: 2px; border-color: var(--brand-300); }
.timeline .t { font-variant-numeric: tabular-nums; font-weight: 700; margin-right: .45rem; }
.timeline .leg { color: var(--muted); font-size: .86rem; padding: .1rem 0 .4rem; }
.timeline details summary { cursor: pointer; color: var(--muted); font-size: .86rem; list-style: none; }
.timeline details summary::-webkit-details-marker { display: none; }
.timeline details ul { margin: .3rem 0 0; padding-left: 0; list-style: none; font-size: .88rem; color: var(--ink-2); }
.more { text-align: center; padding: 1rem 0 .4rem; }
.more[hidden] { display: none; }
.empty { margin-top: 1.4rem; padding: 1.6rem; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: 22px; }
.empty strong { display: block; font-size: 1.1rem; color: var(--ink); margin-bottom: .3rem; }

.legal { margin-top: 1.8rem; padding: 0 .4rem 1rem; color: var(--muted); font-size: .78rem; line-height: 1.5; display: grid; gap: .5rem; }
.legal a { color: var(--brand-600); }

/* ───── mapa ───── */
.map { position: absolute; inset: 0; overflow: hidden; outline: none; }
.map-marker { cursor: pointer; }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted) !important; border-radius: 6px; font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { background-color: transparent !important; }
.map-controls { position: absolute; right: 12px; bottom: 76px; display: grid; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-2); background: var(--surface); z-index: 3; }
.map-controls button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.4rem; color: var(--ink-2); line-height: 1; }
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover { background: var(--brand-50); color: var(--brand-600); }
@media (min-width: 960px) { .map-controls { bottom: 24px; } .fab { bottom: 140px !important; } }

.veh { transform: translate(-50%, -50%); display: grid; place-items: center; min-width: 34px; height: 26px; padding: 0 8px; border-radius: 999px; background: #2f9e5b; color: #fff; font-weight: 750; font-size: 13px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); cursor: pointer; letter-spacing: -.01em; white-space: nowrap; transition: transform .12s, box-shadow .12s; }
.veh:hover { transform: translate(-50%, -50%) scale(1.12); }
.veh.train { background: var(--train); }
.veh.late { background: #d6383e; }
.veh.stale { opacity: .6; }
.veh.sel { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 55%, transparent), 0 2px 8px rgba(0, 0, 0, .4); transform: translate(-50%, -50%) scale(1.2); }
.map-marker:has(.veh.sel) { z-index: 50 !important; }
.stopdot { transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-600); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.stopdot.mid { width: 9px; height: 9px; border-width: 2px; }
.stopdot.next { border-color: #d6383e; width: 16px; height: 16px; }
.endpoint { transform: translate(-50%, -100%); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; rotate: -45deg; background: var(--brand-600); color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.endpoint .icon { rotate: 45deg; width: 15px; height: 15px; }
.endpoint.to { background: #d6383e; }
.stop-label { transform: translate(10px, -50%); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 8px; box-shadow: 0 1px 5px rgba(0, 0, 0, .25); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.me { transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26, 115, 232, .25); }

.chip { position: absolute; z-index: 4; display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-radius: 20px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-2); border: 1px solid var(--line); }
.chip.status { left: 12px; top: calc(env(safe-area-inset-top) + 12px); color: var(--ink); }
.chip.status .icon { color: var(--brand-600); width: 1.5rem; height: 1.5rem; }
.chip.status strong { display: block; line-height: 1.2; }
.chip.status small { color: var(--muted); font-size: .82rem; }
.chip.warn { left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 76px); background: var(--warn-bg); color: var(--warn); font-size: .88rem; border-color: transparent; max-width: 460px; }
.chip.clear-route { right: 12px; top: calc(env(safe-area-inset-top) + 12px); padding: .6rem 1.1rem; color: var(--ink); font-weight: 650; cursor: pointer; }
.chip[hidden] { display: none; }
.fab { position: absolute; z-index: 4; right: 12px; bottom: 140px; width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-2); display: grid; place-items: center; }

.sheet { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; max-height: 72%; overflow-y: auto; background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: 0 -10px 40px rgba(10, 37, 64, .22); padding: 1.1rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); animation: slide .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide { from { transform: translateY(40px); opacity: 0; } }
.sheet[hidden] { display: none; }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -.4rem auto .8rem; }
.sheet-close { position: absolute; right: .8rem; top: .8rem; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--brand-50); color: var(--ink-2); display: grid; place-items: center; }
@media (min-width: 960px) { .sheet { left: 12px; right: auto; bottom: 12px; width: 400px; border-radius: 26px; max-height: calc(100% - 100px); } .sheet::before { display: none; } }
.sheet h3 { font-size: 1.05rem; color: var(--ink-2); font-weight: 650; margin-bottom: .6rem; }
.sheet .big-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .9rem; border-radius: 14px; background: #2f9e5b; color: #fff; font-size: 1.6rem; font-weight: 800; }
.sheet .big-badge.train { background: var(--train); } .sheet .big-badge.late { background: #d6383e; }
.sheet .big-badge .icon { width: 1.5rem; height: 1.5rem; }
.sheet dl { display: grid; gap: .45rem; margin: .9rem 0; }
.sheet dt { display: inline; font-weight: 700; margin-right: .35rem; } .sheet dd { display: inline; margin: 0; color: var(--ink-2); }
.sheet .age { color: var(--muted); font-size: .92rem; margin-top: .6rem; }
.sheet .chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.sheet .tag { gap: .35rem; padding: .35rem .8rem; }
.sheet .tag .icon { width: 1rem; height: 1rem; }
.sheet .btn { margin-top: 1rem; min-height: 46px; }

/* ───── spodní lišta (mobil) ───── */
.tabbar { grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-top: 1px solid var(--line); padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom)); z-index: 10; }
.tabbar button { border: 0; background: transparent; display: grid; justify-items: center; gap: .2rem; font-size: .8rem; font-weight: 650; color: var(--muted); padding: .1rem 0; }
.tabbar .pill { width: 64px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .2s; }
.tabbar button[aria-current="page"] { color: var(--brand-700); }
.tabbar button[aria-current="page"] .pill { background: var(--brand-100); }

/* ───── uvítací dialog (jen při prvním spuštění) ───── */
.welcome { border: 0; padding: 0; border-radius: 28px; max-width: min(440px, calc(100vw - 2rem)); width: 100%; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(10, 37, 64, .4); }
.welcome::backdrop { background: rgba(5, 17, 31, .55); backdrop-filter: blur(4px); }
.welcome[open] { animation: rise .35s ease both; }
.welcome form { display: grid; gap: .9rem; padding: 1.6rem 1.5rem 1.4rem; text-align: center; justify-items: center; }
.welcome img { border-radius: 18px; box-shadow: var(--shadow-1); }
.welcome h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.welcome .lead { margin: 0; color: var(--ink-2); }
.welcome-list { list-style: none; margin: .2rem 0; padding: 0; display: grid; gap: .7rem; text-align: left; width: 100%; }
.welcome-list li { display: flex; gap: .8rem; align-items: flex-start; padding: .7rem .8rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: .93rem; line-height: 1.4; }
.welcome-list .icon { flex: none; width: 22px; height: 22px; color: var(--brand-600); margin-top: 1px; }
.welcome-list strong { color: var(--ink); }
.welcome .fine { margin: 0; font-size: .76rem; color: var(--muted); line-height: 1.5; }
.welcome .btn { width: 100%; justify-content: center; }
.link-btn#about-btn { padding: 0; font-size: inherit; color: var(--brand-600); text-decoration: underline; }
