:root {
  --bg: #f5f4f0;
  --card: #ffffff;
  --text: #1b1f1e;
  --muted: #5f6866;
  --line: #e2e0d9;
  --accent: #0f766e;
  --accent-soft: #d5ece8;
  --on-accent: #ffffff;
  --prep: #b45309;
  --prep-soft: #fbead3;
  --ring-bg: #e6e4dd;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121514;
    --card: #1c2120;
    --text: #eef1ef;
    --muted: #9aa5a2;
    --line: #2c3331;
    --accent: #2dd4bf;
    --accent-soft: #163a36;
    --on-accent: #06201d;
    --prep: #fbbf24;
    --prep-soft: #3a2c10;
    --ring-bg: #2a302e;
    color-scheme: dark;
  }
}

/* manipulation auf allen Elementen: sonst zoomt Safari bei zwei schnellen Tipps auf "Weiter". */
* { box-sizing: border-box; touch-action: manipulation; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; }

.view {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px);
  max-width: 560px;
  margin: 0 auto;
}

/* Home */
.home-head { padding: 8px 2px 18px; }
.home-head h1 { font-size: 34px; }
.routines { display: grid; gap: 12px; }
.routine {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 16px 14px; cursor: pointer;
}
.routine.main { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.routine.main .muted { color: inherit; opacity: 0.85; }
.routine-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.routine-name { font-size: 21px; font-weight: 650; }
.routine-time { font-size: 15px; font-weight: 600; white-space: nowrap; }
.routine .muted { margin-top: 4px; font-size: 14px; }
.routine:active { transform: scale(0.985); }

.block { margin-top: 30px; }
.block h2 { font-size: 20px; margin-bottom: 4px; }
.block > .muted { margin-bottom: 10px; }

.lib-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; overflow: hidden; }
.lib-item summary { list-style: none; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; cursor: pointer; }
.lib-item summary::-webkit-details-marker { display: none; }
.lib-item summary b { font-weight: 600; }
.lib-body { padding: 0 14px 14px; }
.lib-body img { width: 100%; border-radius: 10px; display: block; margin-bottom: 10px; }
.lib-body ol { padding-left: 20px; margin: 8px 0; }
.lib-body li { margin-bottom: 4px; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; align-self: center; white-space: nowrap; }

.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px;
}
.row small { display: block; color: var(--muted); font-size: 12px; }
.row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.row select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }

.info details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.info summary { cursor: pointer; font-weight: 550; }
.info details p { margin: 8px 0 2px; }
.info > .muted { margin-top: 14px; }

/* Player */
#player {
  display: flex; flex-direction: column; gap: 10px;
  height: 100dvh; min-height: 0; overflow: hidden;
  padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
}
.topbar { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; font-size: 15px; flex: none; }
.progress { flex: 1; height: 6px; background: var(--ring-bg); border-radius: 99px; overflow: hidden; }
#progressFill { height: 100%; width: 0; background: var(--accent); }

.ex-head h2 { font-size: 26px; line-height: 1.15; }
.ex-head .muted { font-size: 15px; }
.phase-row { display: flex; justify-content: space-between; align-items: center; min-height: 22px; }
.phase { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.phase.prep { color: var(--prep); }

.media {
  position: relative; flex: none;
  aspect-ratio: 3 / 2; max-height: 30dvh; width: 100%;
  border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line);
}
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-img, .breath { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.no-img span { color: var(--muted); font-size: 14px; }
.video-btn { background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; padding: 10px 18px; border-radius: 99px; }
.breath-circle { width: 42%; aspect-ratio: 1; border-radius: 50%; background: var(--accent-soft); border: 3px solid var(--accent); transform: scale(0.6); }
.breath-label { position: absolute; font-weight: 700; font-size: 20px; color: var(--accent); }
.paused-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent); font-size: 22px; font-weight: 700;
}

.timer-row { display: flex; align-items: center; gap: 16px; flex: none; }
.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--ring-bg); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.73; stroke-dashoffset: 0; }
.ring.prep .ring-fg { stroke: var(--prep); }
.time { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 700; }
.timer-side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.side-badge { background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 18px; letter-spacing: 0.04em; padding: 4px 14px; border-radius: 99px; }
.ring.prep + .timer-side .side-badge { background: var(--prep); }
.video-link { font-weight: 600; text-decoration: none; font-size: 15px; }

.cues-wrap { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cues { margin: 0; padding-left: 22px; }
.cues li { margin-bottom: 6px; font-size: 16px; }
.note { margin: 8px 0 0; font-size: 14px; color: var(--muted); padding-left: 2px; }

.controls { display: flex; justify-content: space-between; align-items: center; flex: none; padding-top: 4px; }
.ctl {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 60px; height: 60px; background: none; border: none; border-radius: 14px; color: var(--text);
}
.ctl:active { background: var(--card); }
.ctl svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctl small { font-size: 11px; color: var(--muted); }
.ctl-txt { font-size: 18px; font-weight: 700; line-height: 24px; }
.ctl.play { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.ctl.play svg { width: 30px; height: 30px; stroke-width: 3; }
.ctl.play #icoPlay { fill: currentColor; stroke-width: 1.5; }

/* Done */
.done { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; }
.done h2 { font-size: 40px; }
.primary { margin-top: 18px; background: var(--accent); color: var(--on-accent); border: none; border-radius: 99px; padding: 14px 40px; font-weight: 650; font-size: 17px; }

@media (max-height: 700px) {
  .media { max-height: 26dvh; }
  .ring { width: 96px; height: 96px; }
  .time { font-size: 34px; }
  .ex-head h2 { font-size: 22px; }
}
