/* Tokeny z systemu projektowego „Domowe aplikacje” — wspólne dla Centrum, Mojego bilansu, Treningów i Mojej muzyki.
   Wartości zmieniaj w systemie, nie tutaj. */
:root {
  --bg: #f6f3ef; --surface: #ffffff; --surface-2: #efebe5; --line: #e2dcd3; --line-strong: #8c8379;
  --text: #1d1a17; --muted: #6f675e; --scrim: rgba(0,0,0,0.45); --ok: #1d7a45; --warn: #9a6608; --bad: #c4473a;
  --treningi: #e8590c; --on-treningi: #1a0d04; --treningi-text: #c4510a; --t-easy: #3d9a6b; --t-long: #2f6fb0;
  --t-tempo: #d08a1e; --t-interval: #c4473a; --t-recovery: #7aa88f; --t-race: #8a3fb5; --t-strength: #6b6b6b;
  --t-cross: #4b8f9c; --t-rest: #a5a5a5; --t-other: #888888; --radius-xs: 4px; --radius-sm: 8px;
  --radius-md: 10px; --radius-lg: 14px; --radius-xl: 16px; --radius-pill: 999px;
  --font-display: "Bricolage Grotesque", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, ui-monospace, monospace; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110f; --surface: #1e1a17; --surface-2: #29241f; --line: #352e28; --line-strong: #776c61;
    --text: #f2ece5; --muted: #a39a8f; --scrim: rgba(0,0,0,0.6); --ok: #5cc28a; --warn: #e5a83a; --bad: #ef6f62;
    --treningi: #ff7a2f; --treningi-text: #ff7a2f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14110f; --surface: #1e1a17; --surface-2: #29241f; --line: #352e28; --line-strong: #776c61;
  --text: #f2ece5; --muted: #a39a8f; --scrim: rgba(0,0,0,0.6); --ok: #5cc28a; --warn: #e5a83a; --bad: #ef6f62;
  --treningi: #ff7a2f; --treningi-text: #ff7a2f; color-scheme: dark;
}
/* Akcent tej aplikacji i dawne nazwy zmiennych używane w stylach i skryptach */
:root {
  --accent: var(--treningi); --on-accent: var(--on-treningi); --accent-text: var(--treningi-text);
  --focus: var(--accent-text); --accent-ink: var(--on-accent); --radius: var(--radius-lg); --tabbar: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font-sans);
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}
.num, .big, td, .kpi b { font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg);
}
.top h1 { font-family: var(--font-display); font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
.badge { font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }

main { padding: 4px 16px 24px; max-width: 760px; margin: 0 auto; outline: none; }
section { margin: 0 0 18px; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 10px; }

/* hero: cel startowy */
.hero { position: relative; overflow: hidden; }
.hero .race-name { font-weight: 650; font-size: 1.05rem; }
.hero .race-meta { color: var(--muted); font-size: .88rem; }
.hero .count { display: flex; align-items: baseline; gap: 6px; margin: 10px 0 4px; }
.hero .big { font-family: var(--font-display); font-size: 3rem; font-weight: 750; line-height: 1; letter-spacing: -.03em; color: var(--accent-text); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.kpi { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.kpi span { display: block; font-size: .72rem; color: var(--muted); }
.kpi b { font-family: var(--font-mono); font-size: 1.02rem; font-weight: 500; white-space: nowrap; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* tydzień */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.week .d { text-align: center; font-size: .72rem; color: var(--muted); padding: 6px 0 4px; border-radius: 8px; border: 0; background: none; cursor: pointer; }
.week .d.today { background: var(--surface-2); color: var(--text); font-weight: 600; }
.week .dots { display: flex; justify-content: center; gap: 3px; margin-top: 4px; min-height: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--t-other)); display: inline-block; }
.dot.planned { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.dot.skipped { opacity: .35; }

/* listy treningów */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 0; cursor: pointer;
}
.item::before { content: ""; align-self: stretch; background: var(--c); border-radius: 0 4px 4px 0; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: .82rem; color: var(--muted); }
.item .r { text-align: right; font-size: .85rem; white-space: nowrap; }
.item.skipped { opacity: .55; } .item.skipped .t { text-decoration: line-through; }
.pill { display: inline-block; font-size: .7rem; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.link { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); font-size: .78rem; }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); font-size: .78rem; }
/* puste stany: ikona, tytuł, krótki tekst i najwyżej jeden przycisk — ten sam wygląd we wszystkich aplikacjach */
.empty,.pusto{display:grid;justify-items:center;text-align:center;gap:4px;padding:22px 14px;border:1px dashed var(--line);border-radius:14px;color:var(--muted);font-size:.9rem;line-height:1.45}
.empty::before,.pusto::before{content:"";width:44px;height:44px;border-radius:14px;margin-bottom:6px;background:color-mix(in srgb,var(--accent) 14%,transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8379' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13h4l1.5 3h5L16 13h4'/%3E%3Cpath d='M5.5 6h13L20 13v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-5z'/%3E%3C/svg%3E") center/22px no-repeat}
.empty strong,.pusto b{display:block;color:var(--text,var(--fg));font-size:1rem;font-weight:600;font-family:inherit;margin:0}
.empty .btn,.pusto .btn,.empty button,.pusto button{margin-top:8px}

/* kalendarz */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 1.05rem; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal .wd { font-size: .68rem; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal .c {
  min-height: 62px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
  padding: 3px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; text-align: left; min-width: 0;
}
.cal .c.out { opacity: .35; } .cal .c.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .c.sel { background: var(--surface-2); }
.cal .c.race { background: color-mix(in srgb, var(--t-race) 16%, var(--surface)); }
.cal .n { font-size: .72rem; font-weight: 600; }
.cal .bar { height: 5px; border-radius: 3px; background: var(--c); }
.cal .bar.planned { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.cal .bar.skipped { opacity: .3; }
.cal .km { font-size: .66rem; color: var(--muted); margin-top: auto; white-space: nowrap; overflow: hidden; }
.month-sum { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); margin: 10px 0 0; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: .74rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* przyciski i formularze */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; } .row > .btn { flex: 1 1 auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs svg circle { fill: currentColor; }
label.f { display: block; font-size: .8rem; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=date], input[type=number], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 200px; font-family: var(--font-mono); font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.msg { font-size: .85rem; padding: 8px 10px; border-radius: 10px; margin: 6px 0; }
.msg.err { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.hint { font-size: .82rem; color: var(--muted); }
pre.code { background: var(--surface-2); border-radius: 10px; padding: 10px; font-size: 12px; overflow-x: auto; white-space: pre; margin: 8px 0; }

/* arkusz szczegółów */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.sheet[hidden] { display: none; }
.sheet-bar { display: flex; align-items: center; gap: 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; border-bottom: 1px solid var(--line); }
.sheet-bar h2 { font-size: 1.05rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; padding: 14px 16px calc(28px + env(safe-area-inset-bottom)); flex: 1; width: 100%; max-width: 900px; margin: 0 auto; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { min-height: 38px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: .85rem; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* porównanie: wytyczne | Strava */
.vs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.vs .h { padding: 10px 12px; font-weight: 700; font-size: .82rem; background: var(--surface-2); display: flex; align-items: center; gap: 6px; min-width: 0; }
.vs .h.strava { color: var(--accent-text); }
.vs .h small { font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs .cell { padding: 9px 12px; border-top: 1px solid var(--line); min-width: 0; }
.vs .cell + .cell { border-left: 1px solid var(--line); }
.vs .lbl { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.vs .val { font-weight: 650; font-size: 1rem; overflow-wrap: anywhere; }
.st { font-size: .75rem; margin-left: 4px; }
.st.ok { color: var(--ok); } .st.off, .st.slow { color: var(--warn); } .st.fast { color: var(--t-long); }
.vs .full { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 10px 12px; }
.laps { width: 100%; border-collapse: collapse; font-size: .84rem; }
.laps th { text-align: left; font-size: .7rem; color: var(--muted); font-weight: 600; padding: 6px 4px; text-transform: uppercase; letter-spacing: .04em; }
.laps td { padding: 7px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.laps td.sep { border-left: 1px solid var(--line); padding-left: 8px; }
.laps .sub { display: block; color: var(--muted); font-size: .76rem; }
.desc { white-space: pre-wrap; }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.steps li:first-child { border-top: 0; }
.steps .rep { color: var(--accent-text); font-weight: 700; }
.steps .sub { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.steps .num { white-space: nowrap; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .7rem; }
.tabs a[aria-current="page"] { color: var(--accent-text); font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .88rem; opacity: 0;
  transition: .2s; pointer-events: none; z-index: 30; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 720px) {
  .cal .c { min-height: 84px; }
  .detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.sync-btn { margin-left: auto; color: var(--muted); }
.sync-btn.err { color: var(--warn); }
.sync-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* dieta */
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.macro span { display: block; font-size: .72rem; color: var(--muted); }
.macro b { font-size: .95rem; } .macro small { color: var(--muted); font-weight: 500; }
.progress.thin { height: 4px; margin-top: 4px; }
.diet-mini { display: block; color: inherit; text-decoration: none; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 6px; }
.add-grid svg { width: 20px; height: 20px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 8px; }
.grid4 input { padding: 10px 8px; }
.wbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 96px; align-items: end; }
.wbar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: .7rem; }
.wbar i { display: block; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.wbar.sel i { background: var(--accent); } .wbar.sel { color: var(--text); font-weight: 600; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.item.queue { cursor: default; } .item.queue .r { display: flex; align-items: center; gap: 2px; }
.item.queue .btn { min-height: 36px; padding: 0 10px; }
.photo-prev { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.reading { text-align: center; color: var(--muted); padding: 20px 8px; }
.reading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.linkish { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.tabs a span { white-space: nowrap; }

/* Garmin: przegląd, aktywności, zdrowie, plan */
.seg.g2 { grid-template-columns: 1fr 1fr; } .seg.g3 { grid-template-columns: repeat(3, 1fr); }
.ghead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gsync { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.gsync > div { min-width: 0; flex: 1 1 200px; }
.kpis.g { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.kpi small { display: block; font-size: .72rem; color: var(--muted); }
.kpis.g .kpi b { white-space: normal; overflow-wrap: anywhere; }
.kpi[style*="--c"] { border-left: 3px solid var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .82rem; cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip:disabled { opacity: .5; }
.gchart { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; margin-top: 10px;
  font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gchart-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; line-height: 1; }
.gchart-y span { transform: translateY(-1px); }
.gchart-plot { position: relative; min-width: 0; }
.gchart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.gchart .grid { stroke: var(--line); stroke-width: 1; }
.gchart .grid.dash { stroke-dasharray: 3 4; }
.gchart-x { grid-column: 2; display: flex; justify-content: space-between; margin-top: 5px; line-height: 1; }
.chart-unit { font-size: .72rem; color: var(--muted); text-align: right; }
.gmap { position: relative; aspect-ratio: 320 / 220; margin-top: 8px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.gmap-tiles { position: absolute; inset: 0; }
.gmap-tiles img { position: absolute; display: block; max-width: none; }
.gmap.dark .gmap-tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5); }
.gmap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gmap-attr { position: absolute; right: 6px; bottom: 5px; font-size: .62rem; padding: 1px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); text-decoration: none; }
.gbars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; margin-top: 10px; }
.gbar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; min-width: 0; }
.gbar i { display: block; border-radius: 4px 4px 1px 1px; min-height: 0; opacity: .85; }
.gbar span { font-size: .58rem; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.plan-week summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.plan-week summary::-webkit-details-marker { display: none; }
.plan-week[open] summary { margin-bottom: 2px; }
details.card + details.card { margin-top: 8px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface-2); border-top-color: var(--accent); display: inline-block; animation: spin .9s linear infinite; }

/* komputer: panel boczny zamiast dolnego paska, szerszy układ */
@media (min-width: 1000px) {
  body { padding-bottom: 0; padding-left: 220px; }
  .tabs { top: 0; bottom: 0; right: auto; width: 220px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 52px;
    align-content: start; padding: 72px 12px 12px; border-top: 0; border-right: 1px solid var(--line); gap: 4px; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; border-radius: 12px; font-size: .92rem; }
  .tabs a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .tabs::before { content: "Garmin · Treningi"; position: absolute; top: 22px; left: 26px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--text); }
  main { max-width: 1100px; padding: 4px 28px 32px; }
  .top { padding-left: 28px; padding-right: 28px; }
  .toast { bottom: 24px; left: calc(50% + 110px); }
  .sheet { left: 220px; }
}

/* dieta: kod kreskowy, kadrowanie etykiety, podgląd odczytu */
.add-grid .wide { grid-column: 1 / -1; }
.scan-box { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: var(--bad); box-shadow: 0 0 10px var(--bad); animation: scanline 1.8s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-60px); } 50% { transform: translateY(60px); } }
@media (prefers-reduced-motion: reduce) { .scan-line { animation: none; } }
.crop-wrap { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.crop-wrap canvas { display: block; width: 100%; height: auto; }
.crop-rect { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgb(0 0 0 / .5); cursor: move; }
.crop-rect i { position: absolute; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; }
.crop-rect i[data-h="nw"] { left: -15px; top: -15px; cursor: nwse-resize; }
.crop-rect i[data-h="ne"] { right: -15px; top: -15px; cursor: nesw-resize; }
.crop-rect i[data-h="sw"] { left: -15px; bottom: -15px; cursor: nesw-resize; }
.crop-rect i[data-h="se"] { right: -15px; bottom: -15px; cursor: nwse-resize; }
input.suspect { border-color: var(--bad) !important; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.transcript { margin: 8px 0 4px; font-size: .85rem; }
.transcript summary { cursor: pointer; color: var(--accent-text); }
.transcript pre { white-space: pre-wrap; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; background: var(--surface-2);
  padding: 8px 10px; border-radius: 8px; margin: 6px 0 0; max-height: 220px; overflow: auto; }
.code-tag { font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }

/* trasy */
.seg.g4 { grid-template-columns: repeat(4, 1fr); }
.rmap-slot { margin-top: 10px; }
.rmap { height: 56vh; min-height: 300px; border-radius: 12px; overflow: hidden; background: var(--surface-2); z-index: 0; }
.rmap.dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5); }
.rmap .leaflet-control-attribution { font-size: 10px; }
.route-card { margin-top: 10px; border-left: 4px solid var(--c); }
.route-card.sel { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.rmap svg { width: auto; height: auto; fill: initial; stroke: initial; stroke-width: initial; }
.rmap .leaflet-control-zoom a { color: #222; }

/* nowa wersja pobrana w tle */
.update-bar { position: fixed; left: 12px; right: 12px; top: calc(8px + env(safe-area-inset-top)); z-index: 40; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--text); color: var(--bg);
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 560px; margin: 0 auto; }
.update-bar .btn { min-height: 38px; padding: 0 14px; }
