/* Dziennik ciśnienia — style. Kolory jako zmienne; motyw ciemny niżej (data-theme z theme.js, domyślnie jasny). */
:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --text: #14161A;
  --muted: #5B616B;
  --faint: #8A9099;
  --line: #ECEEF1;
  --field: #F1F3F6;
  --seg: #E6E8EC;
  --accent: #1D4ED8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8EEFC;
  --sys: #1D4ED8;
  --dia: #D97706;
  --pulse: #B45309;
  --ok: #1D4ED8;
  --ok-soft: #E8EEFC;
  --high: #B45309;
  --high-soft: #FDF1E3;
  --severe: #B91C1C;
  --severe-soft: #FDECEC;
  --radius: 20px;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-line: rgba(15, 23, 42, 0.10);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1013;
  --card: #1A1D22;
  --text: #F2F3F5;
  --muted: #A3A9B3;
  --faint: #7D838C;
  --line: #2A2E35;
  --field: #24282E;
  --seg: #24282E;
  --accent: #5B8DEF;
  --accent-ink: #0E1013;
  --accent-soft: #1E2A44;
  --sys: #6E9BF2;
  --dia: #F0A040;
  --pulse: #F0A040;
  --ok: #8DB2F7;
  --ok-soft: #1E2A44;
  --high: #F5B25C;
  --high-soft: #3A2A14;
  --severe: #F58C8C;
  --severe-soft: #3D1A1A;
  --glass: rgba(32, 35, 41, 0.72);
  --glass-line: rgba(255, 255, 255, 0.10);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0E1013;
    --card: #1A1D22;
    --text: #F2F3F5;
    --muted: #A3A9B3;
    --faint: #7D838C;
    --line: #2A2E35;
    --field: #24282E;
    --seg: #24282E;
    --accent: #5B8DEF;
    --accent-ink: #0E1013;
    --accent-soft: #1E2A44;
    --sys: #6E9BF2;
    --dia: #F0A040;
    --pulse: #F0A040;
    --ok: #8DB2F7;
    --ok-soft: #1E2A44;
    --high: #F5B25C;
    --high-soft: #3A2A14;
    --severe: #F58C8C;
    --severe-soft: #3D1A1A;
    --glass: rgba(32, 35, 41, 0.72);
    --glass-line: rgba(255, 255, 255, 0.10);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Nagłówki */
.top { display: flex; justify-content: space-between; align-items: flex-end; padding-top: 12px; }
.eyebrow { font-size: 14px; color: var(--muted); font-weight: 500; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 700; }
.back { font-size: 17px; padding: 10px 0; align-self: flex-start; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding-top: 4px; }
.sheet-head h1 { font-size: 17px; font-weight: 600; letter-spacing: 0; }
.sheet-head > :last-child { justify-self: end; }
.sheet-head a, .link { font-size: 17px; padding: 10px 0; min-height: 44px; display: inline-flex; align-items: center; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; }
.strong { font-weight: 600; }

/* Karty */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-head a { font-size: 15px; font-weight: 600; padding: 10px 0; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section > h2 { padding-left: 4px; font-size: 17px; }

/* Ostatni pomiar */
.hero { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero-top span:first-child { font-size: 14px; color: var(--muted); font-weight: 500; }
.hero-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.hero-bp { font-size: 56px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.hero-bp .slash { color: var(--faint); font-weight: 500; }
.hero-pulse { display: flex; align-items: center; gap: 6px; font-size: 28px; font-weight: 700; justify-content: flex-end; }
.hero-pulse svg { color: var(--pulse); }
.unit { font-size: 14px; color: var(--muted); }
.right { text-align: right; }
.empty { text-align: center; padding: 28px 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.empty strong { color: var(--text); font-size: 17px; }

.chip { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip-ok { color: var(--ok); background: var(--ok-soft); }
.chip-high { color: var(--high); background: var(--high-soft); }
.chip-severe { color: var(--severe); background: var(--severe-soft); }
.alert { background: var(--severe-soft); color: var(--severe); border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 500; }

/* Przyciski */
.btn {
  min-height: 56px; border-radius: 16px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 17px; font-weight: 600; padding: 0 18px; width: 100%;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--card); color: var(--accent); border: 1.5px solid var(--accent); min-height: 52px; font-size: 16px; }
.btn.plain { background: var(--card); color: var(--accent); min-height: 48px; font-size: 16px; justify-content: flex-start; }
.btn.danger { color: var(--severe); }
.btn:disabled { opacity: 0.5; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text); cursor: pointer; flex-shrink: 0;
}
.icon-btn.small { width: 44px; height: 44px; background: transparent; color: var(--faint); }

/* Lista */
.list { list-style: none; margin: 0; padding: 4px 16px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.dot { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.dot-ok { background: var(--ok); }
.dot-high { background: var(--high); }
.dot-severe { background: var(--severe); }
.row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; padding: 8px 0; }
.bp { font-size: 16px; font-weight: 600; }
.bp small, .pulse small { font-size: 13px; color: var(--muted); font-weight: 400; }
.meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulse { font-size: 15px; font-weight: 600; white-space: nowrap; }
.pending { color: var(--high); }

/* Pasek synchronizacji */
.sync { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.sync a { font-weight: 600; }
.sync.error { color: var(--severe); }

/* Formularz */
form { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.hint { font-size: 13px; color: var(--muted); }
.field.big input {
  border: none; background: transparent; padding: 0; width: 100%;
  font-size: 48px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.field.inline { flex-direction: row; align-items: center; gap: 14px; }
.field.inline svg { color: var(--pulse); flex-shrink: 0; }
.field.inline .grow { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.field.inline input {
  border: none; background: transparent; padding: 0; width: 104px; text-align: right;
  font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); font-weight: 500; }
.field textarea { border: none; background: var(--field); border-radius: 10px; padding: 10px; font-size: 16px; resize: none; }
.field input:focus, .field textarea:focus, .group input:focus, .text-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.invalid { outline: 2px solid var(--severe) !important; outline-offset: 2px; border-radius: 6px; }

.group { padding: 4px 16px; display: flex; flex-direction: column; }
.group-row { display: flex; justify-content: space-between; align-items: center; min-height: 52px; gap: 12px; border-bottom: 1px solid var(--line); }
.group-row:last-child { border-bottom: none; }
.group-row input { border: none; background: var(--field); border-radius: 8px; padding: 8px 10px; font-size: 16px; min-height: 36px; }
.footnote { font-size: 13px; color: var(--muted); padding: 0 4px; margin-top: -6px; }
.error { color: var(--severe); font-size: 14px; font-weight: 500; min-height: 1px; padding: 0 4px; }
.error:empty { display: none; }

fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
legend { padding: 0 0 8px 4px; }
.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; background: var(--seg); border-radius: 12px; padding: 4px; }
.seg label, .seg button {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 40px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted);
  cursor: pointer; border: none; background: transparent;
}
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked), .seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Historia */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat span:first-child { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat strong { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.chart-card { display: flex; flex-direction: column; gap: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; }
.chart-head h2 { font-size: 17px; }
.legend { display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .thr { stroke: var(--severe); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .axis.thr-label { fill: var(--severe); }
.chart .l-sys { fill: none; stroke: var(--sys); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .l-dia { fill: none; stroke: var(--dia); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .p-sys { fill: var(--card); stroke: var(--sys); stroke-width: 2; }
.chart .p-dia { fill: var(--card); stroke: var(--dia); stroke-width: 2; }
.small-note { font-size: 12px; color: var(--muted); }
.center { text-align: center; }

/* Ustawienia */
.text-input {
  width: 100%; border: none; background: var(--field); border-radius: 10px; padding: 12px; font-size: 16px; min-height: 44px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.steps strong { color: var(--text); }
.status-line { font-size: 13px; color: var(--muted); }
.ok-text { color: var(--ok); }
.err-text { color: var(--severe); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 40px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
details summary { cursor: pointer; min-height: 28px; }
details[open] summary { margin-bottom: 10px; }

/* ---------- Dodawanie: odczyty + klawiatura ---------- */
.add-view { display: flex; flex-direction: column; gap: 12px; }
.reading {
  border: none; cursor: pointer; text-align: left; width: 100%;
  display: flex; flex-direction: column; gap: 4px; color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .12s;
}
.reading[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--accent); }
.reading .reading-text { display: flex; flex-direction: column; gap: 2px; }
.reading.big .value { font-size: 48px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; min-height: 50px; order: 2; }
.reading.big .reading-text { display: contents; }
.reading.big .label { order: 1; }
.reading.big .hint { order: 3; }
.reading.inline { flex-direction: row; align-items: center; gap: 14px; }
.reading.inline svg { color: var(--pulse); flex-shrink: 0; }
.reading.inline .reading-text { flex: 1; }
.reading.inline .value { font-size: 36px; font-weight: 700; min-width: 80px; text-align: right; }
.value .placeholder { color: var(--faint); font-weight: 500; }
.caret { display: inline-block; width: 3px; height: 0.8em; margin-left: 3px; background: var(--accent); border-radius: 2px; vertical-align: -0.05em; }
@media (prefers-reduced-motion: no-preference) {
  .caret { animation: blink 1s steps(1) infinite; }
  .shake { animation: shake .3s; }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.key {
  min-height: 56px; border: none; border-radius: 14px; background: var(--card); color: var(--text);
  font-size: 26px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
.key:active { background: var(--seg); }
.key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.more { padding: 0 16px; display: flex; flex-direction: column; }
.more summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; font-size: 15px; font-weight: 500; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: '›'; color: var(--faint); font-size: 20px; transition: transform .15s; }
.more[open] summary::after { transform: rotate(90deg); }
.more[open] { padding-bottom: 16px; }
.more .group { padding: 0; margin-bottom: 12px; }
.more fieldset { margin-bottom: 12px; }

/* ---------- Potwierdzenie ---------- */
.saved { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; }
.saved h1 { text-align: center; font-size: 28px; }
.saved-check {
  width: 72px; height: 72px; border-radius: 36px; margin: 0 auto;
  background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center;
}
@media (prefers-reduced-motion: no-preference) { .saved-check { animation: pop .35s ease-out; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.status-list { list-style: none; margin: 0; padding: 4px 16px; }
.status-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
.status-list li:last-child { border-bottom: none; }
.status-list svg { flex-shrink: 0; margin-top: 1px; }
.st-ok svg { color: var(--ok); }
.st-warn { color: var(--high); }
.st-muted { color: var(--muted); }
.btn.centered, .centered { justify-content: center; }

/* ---------- Miła wiadomość ---------- */
#love {
  position: fixed; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: 488px; margin: 0 auto; z-index: 10;
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); color: var(--text); border-radius: 20px; padding: 18px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18), 0 0 0 1px var(--line);
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity .5s ease, transform .5s ease;
}
#love.show { opacity: 1; transform: none; pointer-events: auto; }
.love-icon { color: #D6336C; flex-shrink: 0; margin-top: 2px; }
.love-text { font-size: 17px; line-height: 1.4; font-weight: 500; display: flex; flex-direction: column; gap: 6px; }
.love-sig { font-size: 15px; color: var(--muted); font-weight: 400; }
@media (prefers-reduced-motion: reduce) { #love { transition: opacity .2s; transform: none; } }

/* ---------- Stopka, ustawienia ---------- */
.footer { margin-top: auto; padding-top: 12px; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; color: var(--faint); }
.footer a { padding: 8px 0; font-weight: 500; }
.help-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--text); }
.help-link > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.help-link > span:last-child { color: var(--faint); font-size: 22px; }
.radio-row { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 16px; }
.radio-row input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.text-input.plain-font { font-family: inherit; font-size: 16px; resize: vertical; }

/* ---------- Strona instrukcji ---------- */
.guide p { font-size: 16px; line-height: 1.5; }
.guide-step { display: flex; gap: 14px; align-items: flex-start; }
.guide-step h2 { font-size: 18px; }
.step-no {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.guide-actions { display: flex; flex-direction: column; gap: 8px; }
.note { background: var(--field); border-radius: 12px; padding: 10px 12px; font-size: 14px !important; color: var(--muted); }
code, kbd { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; background: var(--field); border-radius: 6px; padding: 1px 5px; }
.faq summary { font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.faq p { margin-top: 8px; color: var(--muted); font-size: 15px; }

/* ---------- Animacje: wciśnięcia, komunikaty, okno potwierdzenia ---------- */
@media (prefers-reduced-motion: no-preference) {
  .btn, .key, .icon-btn, .reading, .seg label, .seg button, .help-link, .back, .sheet-head a, .link, .footer a, .row {
    transition: transform .16s cubic-bezier(.2,.8,.2,1), background-color .16s, box-shadow .16s, opacity .16s;
  }
  .btn:active, .icon-btn:active, .help-link:active { transform: scale(.97); }
  .key:active { transform: scale(.93); }
  .reading:active { transform: scale(.98); }
  .seg label:active, .seg button:active { transform: scale(.96); }
  .back:active, .sheet-head a:active, .link:active, .footer a:active { opacity: .55; }
  .btn.primary:active { opacity: .9; }

  #toast { transform: translate(-50%, 16px) scale(.96); transition: opacity .25s ease, transform .35s cubic-bezier(.2,.8,.2,1); }
  #toast.show { transform: translate(-50%, 0) scale(1); }
  #love { transform: translateY(24px) scale(.97); transition: opacity .45s ease, transform .5s cubic-bezier(.2,.8,.2,1); }
  #love.show { transform: none; }
  #love.show .love-icon { animation: beat .9s .2s ease-out 1; }
  .alert { animation: rise .35s cubic-bezier(.2,.8,.2,1); }
}
@keyframes beat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.25); } 55% { transform: scale(.95); } 75% { transform: scale(1.08); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dlg { border: none; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: transparent; }
.dlg::backdrop { background: transparent; }
.dlg[open] { display: flex; align-items: flex-end; justify-content: center; }
.dlg-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); }
.dlg-sheet {
  position: relative; width: calc(100% - 24px); max-width: 496px; margin-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--card); color: var(--text); border-radius: 24px; padding: 22px 16px 12px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.dlg-sheet p { font-size: 17px; font-weight: 500; text-align: center; padding: 0 8px 10px; line-height: 1.4; }
.btn.danger-fill { background: var(--severe); color: #FFFFFF; }

/* ---------- Ekran startowy (logo A) ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; background: #1D4ED8; color: #FFFFFF;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  padding-bottom: 6vh; cursor: pointer;
  transition: opacity .35s ease, transform .35s ease;
}
.no-splash #splash { display: none; }
#splash.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.sp-heart { transform-origin: 50% 60%; animation: sp-beat 1.2s cubic-bezier(.2,.8,.2,1) both; }
.sp-line { stroke-dasharray: 110; stroke-dashoffset: 110; animation: sp-draw .55s .35s ease-out forwards; }
.sp-word { font-size: 36px; letter-spacing: -0.02em; animation: sp-rise .4s .6s ease-out both; }
.sp-word span { font-weight: 400; }
.sp-word strong { font-weight: 800; }
.sp-tag { font-size: 16px; font-weight: 500; color: #DCE6FB; animation: sp-rise .4s .75s ease-out both; }
@keyframes sp-beat { 0% { transform: scale(.5); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 37% { transform: scale(.95); } 50% { transform: scale(1.06); } 65%, 100% { transform: scale(1); opacity: 1; } }
@keyframes sp-draw { to { stroke-dashoffset: 0; } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Polityka prywatności ---------- */
.policy h2 { font-size: 18px; }
.policy a { text-decoration: underline; text-underline-offset: 3px; }
.policy-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 16px; line-height: 1.5; }
.policy .back, .policy .footer a { text-decoration: none; }

/* Powitanie (pierwsze uruchomienie) */
.welcome { flex: 1; display: flex; flex-direction: column; gap: 24px; padding-top: 24px; }
.w-top { display: flex; justify-content: space-between; align-items: center; }
.w-dots { display: flex; gap: 6px; }
.w-dot { display: block; width: 8px; height: 8px; border-radius: 4px; background: var(--faint); transition: width .2s, background-color .2s; }
.w-dot.on { width: 24px; background: var(--accent); }
.w-skip { background: none; border: 0; color: var(--accent); font: inherit; font-size: 16px; min-height: 44px; padding: 0 4px; cursor: pointer; }
.w-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.w-body h1 { font-size: 32px; font-weight: 800; line-height: 1.15; }
.w-lead { font-size: 17px; line-height: 1.55; color: var(--muted); }
.w-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.w-list li { display: flex; gap: 10px; align-items: center; }
.w-list svg { color: var(--accent); flex-shrink: 0; }
.w-tile { width: 72px; height: 72px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.w-note { font-size: 15px; line-height: 1.5; color: var(--muted); }
.w-actions { display: flex; flex-direction: column; gap: 10px; }
.w-actions a.btn { text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .w-dot { transition: none; } }

/* Dolny pasek kart: pływająca „szklana” kapsuła z przesuwaną pigułką (Pomiary / Historia / Ustawienia) */
.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 20;
  display: grid; grid-template-columns: repeat(3, 80px); padding: 5px; border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0 0 0.5px var(--glass-line), 0 12px 32px rgba(15, 23, 42, 0.16), 0 1px 3px rgba(15, 23, 42, 0.08);
  transform: translate(-50%, 0); opacity: 1; visibility: visible;
  transition: transform 300ms cubic-bezier(.2,.8,.2,1), opacity 200ms, visibility 0s;
}
.tabbar:not(.on) {
  transform: translate(-50%, calc(100% + 28px)); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 200ms cubic-bezier(.4,0,1,1), opacity 160ms, visibility 0s 200ms;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .tabbar { background: var(--card); } }
.tab-pill {
  position: absolute; top: 5px; left: 5px; width: 80px; height: calc(100% - 10px); border-radius: 999px;
  background: var(--accent-soft);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 360ms cubic-bezier(.3, 1.25, .5, 1); /* lekkie sprężynowanie */
}
.tab {
  position: relative; z-index: 1; min-height: 54px; border-radius: 999px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent; transition: color 200ms;
}
.tab[aria-current="page"] { color: var(--accent); }
.tab svg { transition: transform 160ms cubic-bezier(.2,.8,.2,1); }
.tab:active svg { transform: scale(0.86); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.has-tabbar #app { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.has-tabbar #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) {
  .tabbar, .tabbar:not(.on), .tab-pill, .tab, .tab svg { transition: none; }
}
