:root {
  --bg: #0e1622;
  --bg-2: #15233a;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e9eff6;
  --muted: #98a9bd;
  --accent: #8fd3c8;
  --accent-2: #b4a5f2;
  --accent-ink: #0b1a1f;
  --err: #f3a7a0;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-2) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
.screen { display: flex; flex-direction: column; min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px); }

/* nagłówek */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.streak {
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.streak-num { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.streak-label { font-size: 13px; color: var(--muted); }

.label {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 22px 0 10px;
}

/* cele: siatka 2 kolumny */
.goals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.goal {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; width: 100%;
  padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.goal[aria-checked="true"] { background: var(--surface-2); border-color: var(--accent); }
.goal-dot {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6, transparent 60%), var(--c, var(--accent));
  opacity: .9;
}
.goal-name { display: block; font-weight: 600; font-size: 16px; line-height: 1.25; }
.goal-desc { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; margin-top: 2px; }

/* chipy */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 15px; min-height: 40px;
}
.chip[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.start {
  margin-top: 28px; width: 100%; min-height: 56px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-weight: 700; font-size: 18px; letter-spacing: .01em;
}
.start:active { transform: scale(.985); }
.start:disabled { opacity: .5; }

/* statystyki */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stats dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }

.notice { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.notice code { color: var(--text); }
.notice-err { color: var(--err); border-color: rgba(243, 167, 160, .35); }

/* offline */
.offline { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.offline-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.offline-title { margin: 0; font-size: 15px; font-weight: 600; }
.offline-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.offline-status.ok { color: var(--accent); }
.offline-text { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.offline-progress { margin: 12px 0 0; }
.offline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-accent { color: var(--accent); border-color: rgba(143, 211, 200, .45); }
.btn-ghost:disabled { opacity: .5; }

.hint {
  margin-top: 18px; display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--line);
  color: var(--muted); font-size: 14px;
}
.hint b { color: var(--text); font-weight: 600; }
.hint-x { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--muted); padding: 0 2px; }

/* odtwarzacz */
.player-top { text-align: center; margin-bottom: 8px; }
.player-goal { font-size: 22px; font-weight: 650; }
.player-sub { color: var(--muted); font-size: 14px; }

.breath-wrap { flex: 1; display: grid; place-items: center; position: relative; min-height: 300px; }
.breath {
  --s: .6;
  width: min(72vw, 300px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, rgba(143, 211, 200, .28) 0%, rgba(180, 165, 242, .12) 55%, transparent 70%);
  transform: scale(var(--s));
  will-change: transform;
}
.breath-core {
  width: 46%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffffff55, transparent 55%), linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 60px rgba(143, 211, 200, .35);
}
.breath-label {
  position: absolute; bottom: 4px; left: 0; right: 0; text-align: center;
  font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.player-dim .breath { opacity: .55; }

.time { text-align: center; font-size: 44px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin-top: 8px; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 12px 0 22px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.btn-round {
  width: 72px; height: 72px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
}
.btn-round svg { fill: currentColor; }
.btn-ghost { justify-self: start; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; color: var(--muted); min-height: 44px; }

.volumes { margin-top: 24px; display: grid; gap: 12px; }
.volumes label { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.vol-note { margin: 0; font-size: 13px; color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; }

/* koniec */
.done-box { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.done-ring {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffffff55, transparent 55%), linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 80px rgba(143, 211, 200, .35);
  animation: glow 4s ease-in-out infinite alternate;
}
.done-title { font-size: 28px; margin: 28px 0 6px; }
.done-text { color: var(--muted); margin: 0; }
.done-box .start { max-width: 320px; }

@keyframes glow { from { transform: scale(.94); } to { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .done-ring { animation: none; }
}
