/* Pozor revize - vlastní vzhled: výstražná žlutá + barvy linek PID. */

:root {
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #ECEAE4;
  --text: #121316;
  --muted: #5B6068;
  --line: #DEDAD1;
  --accent: #FFD000;
  --accent-ink: #121316;
  --warn-bg: #FFF4C2;
  --warn-line: #F0C400;
  --ok: #138A4A;
  --ok-bg: #E3F4EA;
  --danger: #C8261B;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.06);
  --radius: 18px;

  /* Barvy linek (inspirované PID) */
  --metro-a: #1AA350; --metro-b: #F5B301; --metro-c: #E4032E;
  --tram: #7A0603; --bus: #0079C1; --trolleybus: #8A1F7A;
  --train: #1F2A6B; --ferry: #0098BF; --funicular: #7FAF1B;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0F12;
    --surface: #17191E;
    --surface-2: #22252C;
    --text: #F3F2EE;
    --muted: #9CA1A9;
    --line: #2B2F37;
    --accent: #FFD23F;
    --accent-ink: #121316;
    --warn-bg: #2B2410;
    --warn-line: #7A6212;
    --ok: #4ADE80;
    --ok-bg: #12261A;
    --danger: #FF6B5E;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --tram: #B3261E;
    --train: #4453B5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0F12; --surface: #17191E; --surface-2: #22252C; --text: #F3F2EE; --muted: #9CA1A9;
  --line: #2B2F37; --accent: #FFD23F; --warn-bg: #2B2410; --warn-line: #7A6212; --ok: #4ADE80;
  --ok-bg: #12261A; --danger: #FF6B5E; --tram: #B3261E; --train: #4453B5; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.locked { overflow: hidden; }

/* ---------- Hlavička ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.02em; white-space: nowrap; }
.geo-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; min-height: 40px;
}
.geo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.geo-pill.is-on .geo-dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.geo-pill.is-wait .geo-dot { background: var(--accent); animation: pulse 1s infinite; }

.wrap { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(120px + env(safe-area-inset-bottom)); }

/* ---------- Stav okolí ---------- */
.hero {
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
}
.hero-kicker { margin: 0 0 4px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hero-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.hero-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.hero-actions { margin-top: 12px; }
.hero--warn { background: var(--warn-bg); border-color: var(--warn-line); }
.hero--warn .hero-kicker { color: var(--text); display: flex; align-items: center; gap: 8px; }
.hero--warn .hero-kicker::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
.hero--calm .hero-kicker { color: var(--ok); }
.hero--neutral .hero-kicker { color: var(--muted); }
.hero--calm { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---------- Filtry ---------- */
.filters {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; min-height: 40px;
}
.chip.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Seznam hlášení ---------- */
.list-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 2px 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; box-shadow: var(--shadow);
}
.card.is-new { animation: arrive .5s ease-out; }
.card-row { display: flex; gap: 12px; align-items: flex-start; }
.card-main { flex: 1; min-width: 0; }
.card-stop { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.card-where { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.card-time { text-align: right; flex: none; }
.card-ago { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.card-ago small { font-size: 13px; font-weight: 700; }
.card-dist { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.card-meta { flex: 1; font-size: 13px; color: var(--muted); }
.still-btn {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 12px; font-weight: 800; font-size: 15px; min-height: 44px;
}
.still-btn:active { transform: scale(.97); }
.still-btn.is-done { background: var(--ok-bg); color: var(--ok); }
.still-btn[disabled] { cursor: default; }
.undo-btn {
  flex: none; border: 1px solid var(--line); background: transparent; padding: 10px 14px;
  border-radius: 12px; font-weight: 700; font-size: 14px; min-height: 44px;
}
.fresh { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width 1s linear; }
.card.is-old { opacity: .72; }
.card.is-old .fresh { background: var(--muted); }

/* ---------- Odznaky linek ---------- */
.badge {
  flex: none; display: inline-grid; place-items: center;
  min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px;
  color: #fff; font-weight: 900; font-size: 19px; letter-spacing: -.02em; line-height: 1;
}
.badge--sm { min-width: 30px; height: 26px; border-radius: 7px; font-size: 13px; padding: 0 6px; }
.badge svg { width: 24px; height: 24px; }
.badge--sm svg { width: 16px; height: 16px; }
.t-metro-A { background: var(--metro-a); }
.t-metro-B { background: var(--metro-b); color: #1a1400; }
.t-metro-C { background: var(--metro-c); }
.t-tram { background: var(--tram); }
.t-bus { background: var(--bus); }
.t-trolleybus { background: var(--trolleybus); }
.t-train { background: var(--train); }
.t-ferry { background: var(--ferry); }
.t-funicular { background: var(--funicular); color: #102000; }
.t-stop { background: var(--surface-2); color: var(--text); }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Prázdný stav ---------- */
.empty {
  text-align: center; padding: 28px 18px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

.updated { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; min-height: 1.4em; }
.foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 8px; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--text); font-size: 13px; }

/* ---------- Tlačítko Nahlásit ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  display: flex; justify-content: center;
}
.report-btn {
  width: 100%; max-width: 608px; min-height: 62px;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  border: 2.5px solid var(--accent-ink); border-radius: 18px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 20px; font-weight: 900; letter-spacing: -.01em;
  box-shadow: 0 6px 0 var(--accent-ink), 0 10px 30px rgba(0,0,0,.25);
  transition: transform .08s, box-shadow .08s;
}
.report-btn svg { width: 26px; height: 26px; }
.report-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--accent-ink), 0 6px 18px rgba(0,0,0,.2); }

/* ---------- Instalace na plochu ---------- */
.install {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 25;
  max-width: 608px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 10px 10px 10px 14px; font-size: 14px;
  box-shadow: var(--shadow);
}
.install span { flex: 1; }
.install-go { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; border-radius: 10px; padding: 8px 12px; min-height: 40px; }
.install-x { border: 0; background: none; color: var(--bg); font-size: 18px; min-width: 40px; min-height: 40px; }

/* ---------- Spodní panel ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 640px; margin: 0 auto; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.3);
  animation: rise .25s cubic-bezier(.2,.9,.3,1);
}
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; flex: none; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-step { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sheet-head h2:focus { outline: none; }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--surface-2); display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }

.search {
  position: relative; margin-bottom: 12px;
}
.search input {
  width: 100%; min-height: 52px; padding: 12px 14px 12px 44px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px;
}
.search input:focus { outline: none; border-color: var(--text); }
.search svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }

.sub-title { margin: 14px 2px 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pick {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; min-height: 60px;
}
.pick:active { background: var(--surface-2); }
.pick-main { flex: 1; min-width: 0; }
.pick-name { display: block; font-weight: 800; font-size: 17px; }
.pick-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.pick-dist { flex: none; font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick-arrow { flex: none; color: var(--muted); }

.big-choice {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent-ink); border-radius: 16px;
  padding: 14px 16px; min-height: 72px; font-weight: 900; font-size: 18px;
}
.big-choice small { display: block; font-weight: 600; font-size: 14px; opacity: .8; }
.big-choice .badge { background: var(--accent-ink); color: var(--accent); }

.line-group { margin-top: 6px; }
.line-group h4 { margin: 12px 2px 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.line-btn {
  border: 0; border-radius: 12px; min-height: 56px; font-weight: 900; font-size: 20px; color: #fff; padding: 0 6px;
}
.line-btn:active { transform: scale(.95); }

.chosen {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 12px;
}
.chosen b { font-size: 16px; }
.chosen span { color: var(--muted); font-size: 14px; }

.note { color: var(--muted); font-size: 14px; margin: 8px 2px; }
.btn-secondary {
  width: 100%; min-height: 52px; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 14px; font-weight: 800; font-size: 16px; margin-top: 10px;
}
.loading { padding: 20px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }

.prose { font-size: 15px; }
.prose h3 { font-size: 16px; margin: 18px 0 6px; }
.prose ul, .prose ol { padding-left: 20px; margin: 0; }
.prose li { margin: 6px 0; }
.steps li::marker { font-weight: 900; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; z-index: 60; bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 608px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 14px 12px 14px 16px;
  font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: rise .2s;
}
.toast span { flex: 1; }
.toast-act { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 8px 14px; font-weight: 900; min-height: 40px; }
.toast.is-error { background: var(--danger); color: #fff; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes arrive { from { transform: scale(.97); background: var(--warn-bg); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
