/* ==========================================================
   Nádech-výdech – styly
   ========================================================== */
:root {
  --bg-1: #0b1320;
  --bg-2: #13233a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8eef6;
  --muted: #93a4ba;
  --accent: #2dd4bf;

  /* barvy fází */
  --c-in: #2dd4bf;
  --c-hold: #818cf8;
  --c-out: #4ade80;
  --c-holdEmpty: #7c93b5;
  --c-ready: #5b6b82;

  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg-1) 70%) fixed;
  background-color: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
button:disabled { opacity: 0.4; cursor: default; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* ---------- Horní lišta ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: brand-breath 8s ease-in-out infinite;
}
@keyframes brand-breath { 50% { transform: scale(1.5); opacity: 0.7; } }

.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1.25rem;
  display: grid; place-items: center;
  background: var(--surface);
  transition: background 0.2s, opacity 0.2s;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn.off { opacity: 0.4; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 32px; }

/* ---------- Obrazovky ---------- */
.screen { display: none; animation: fade-in 0.35s ease; }
.screen.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Tlačítka ---------- */
.btn {
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #062a26; }
.btn-primary:hover { background: #5eead4; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); }
.btn-big { width: 100%; padding: 16px; font-size: 1.15rem; }

/* ---------- 1) Seznam ---------- */
.intro { color: var(--muted); margin: 4px 0 20px; }

.group { margin-bottom: 26px; }
.group-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.group-desc { color: #6f8199; font-size: 0.85rem; margin-bottom: 12px; }
.cards { display: grid; gap: 10px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-align: left;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
}
.card:hover { background: var(--surface-hover); border-color: rgba(45, 212, 191, 0.35); }
.card:active { transform: scale(0.985); }
.card-icon { font-size: 1.7rem; width: 40px; text-align: center; flex-shrink: 0; }
.card-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.card-name { font-weight: 650; }
.card-short { color: var(--muted); font-size: 0.88rem; }
.card-rhythm {
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.list-footer { text-align: center; margin-top: 10px; display: grid; gap: 14px; justify-items: center; }
.disclaimer { color: var(--muted); font-size: 0.82rem; max-width: 460px; }
.domain { color: #4f6079; font-size: 0.8rem; letter-spacing: 0.05em; }

/* ---------- 2) Detail ---------- */
.detail-card {
  max-width: 520px;
  margin: 8px auto 0;
  padding: 28px 22px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}
.detail-icon { font-size: 3rem; margin-bottom: 6px; }
.detail-card h1 { font-size: 1.6rem; margin-bottom: 8px; }
.rhythm {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 22px;
}
.chip {
  --chip: var(--c-in);
  font-size: 0.82rem;
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--chip);
  background: color-mix(in srgb, var(--chip) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--chip) 35%, transparent);
}
.chip b { font-weight: 700; }
.chip-hold { --chip: var(--c-hold); }
.chip-out { --chip: var(--c-out); }
.chip-holdEmpty { --chip: var(--c-holdEmpty); }
.how { text-align: left; list-style: none; display: grid; gap: 10px; margin-bottom: 26px; }
.how li { position: relative; padding-left: 22px; color: #c7d3e2; line-height: 1.45; }
.how li::before {
  content: ""; position: absolute; left: 4px; top: 0.55em;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}

.duration { margin-bottom: 22px; }
.duration-label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}
.segmented button { padding: 9px 18px; border-radius: 999px; color: var(--muted); transition: all 0.2s; }
.segmented button.selected { background: var(--surface-hover); color: var(--text); font-weight: 600; }

/* ---------- 3) Cvičení ---------- */
#screen-session.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100dvh - 72px - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.session-title { font-size: 1.05rem; font-weight: 600; color: var(--muted); margin: 4px 0 10px; }

/* registrovaná proměnná → barva se mezi fázemi plynule prolíná */
@property --c {
  syntax: "<color>";
  inherits: true;
  initial-value: #5b6b82;
}

.stage {
  --c: var(--c-ready);
  transition: --c 0.8s ease;
  position: relative;
  width: min(86vw, 52dvh, 440px);
  aspect-ratio: 1;
  margin: auto 0;
  display: grid;
  place-items: center;
}
.stage[data-phase="in"] { --c: var(--c-in); }
.stage[data-phase="hold"] { --c: var(--c-hold); }
.stage[data-phase="out"] { --c: var(--c-out); }
.stage[data-phase="holdEmpty"] { --c: var(--c-holdEmpty); }

.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring-track { stroke: rgba(255, 255, 255, 0.07); }
.ring-progress {
  stroke: var(--c);
  stroke-linecap: round;
  transition: stroke 0.6s ease;
}

.circle {
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 55%),
    var(--c);
  box-shadow:
    0 0 40px color-mix(in srgb, var(--c) 55%, transparent),
    0 0 120px color-mix(in srgb, var(--c) 30%, transparent),
    inset 0 -18px 40px rgba(0, 0, 0, 0.18);
  opacity: 0.92;
  transform: scale(0.5);
  will-change: transform;
  transition: opacity 0.3s ease;
}

.circle-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #06121f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  pointer-events: none;
}
.circle-phase { font-size: clamp(1.1rem, 4.5vw, 1.5rem); font-weight: 700; }
.circle-count {
  font-size: clamp(2.8rem, 13vw, 4.6rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.circle-count.pop { animation: pop 0.35s ease; }
@keyframes pop { 0% { transform: scale(1.25); opacity: 0.5; } 100% { transform: scale(1); opacity: 1; } }

.stage[data-phase="ready"] .circle-text { color: var(--text); text-shadow: none; }

.stage.paused .circle { opacity: 0.35; }
.stage.paused .circle-text { color: var(--text); text-shadow: none; }
.stage.paused .circle-phase::after { content: " · pauza"; }

.hint { color: var(--muted); min-height: 1.4em; margin: 14px 0 4px; text-align: center; }

.session-bottom { width: 100%; max-width: 440px; display: grid; gap: 10px; margin-top: 12px; }
.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
.session-time { text-align: center; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.session-controls { display: flex; gap: 10px; justify-content: center; }
.session-controls .btn { flex: 1; max-width: 200px; }

/* ---------- 4) Hotovo ---------- */
.done-card { text-align: center; padding: 60px 20px; }
.done-icon { font-size: 4rem; margin-bottom: 10px; animation: brand-breath 6s ease-in-out infinite; }
.done-card h1 { font-size: 2rem; margin-bottom: 8px; }
.done-stats { color: var(--muted); margin-bottom: 30px; }
.done-actions { display: flex; flex-direction: column; gap: 10px; max-width: 280px; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .brand-dot, .done-icon { animation: none; }
}
