:root {
  --bg: #0f1417;
  --card: #182025;
  --card2: #1f292f;
  --line: #2b373e;
  --text: #e9eef0;
  --muted: #8fa0a8;
  --accent: #c6f432;
  --accent-ink: #11160a;
  --blue: #5cc8ff;
  --warn: #ffb547;
  --bad: #ff6b6b;
  --good: #59d98e;
  --r: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 14px 16px 10px; }
.top h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }

main { padding: 4px 16px 24px; max-width: 640px; margin: 0 auto; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 24px 4px 10px; font-weight: 600; }
h3 { margin: 0 0 6px; font-size: 17px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px; }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--card2); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--card); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.goal-head .pct { white-space: nowrap; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--card2); color: var(--muted); vertical-align: middle; }
.badge.garmin { background: #10334a; color: var(--blue); }
.badge.done { background: #173a26; color: var(--good); }
.phase { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent); border-radius: 99px; padding: 2px 10px; margin: 10px 0 4px; }
ul.plan { margin: 6px 0 0; padding-left: 18px; }
ul.plan li { margin: 5px 0; }

.hint { border-left: 3px solid var(--blue); }
.hint.warn { border-left-color: var(--warn); }
.hint.good { border-left-color: var(--good); }
.hint h3 { font-size: 15px; }

.sess li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sess li:last-child { border-bottom: 0; }
.sess { list-style: none; margin: 0; padding: 0; }
.sess .why { font-size: 12px; color: var(--muted); }
.sess .dose { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--card2); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; color: var(--bad); }
.btn.ghost { background: transparent; color: var(--accent); padding: 8px 4px; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:active { transform: scale(0.98); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

label.f { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; outline: none;
  font-size: 16px; /* verhindert Zoom auf iOS */
}
input:focus, select:focus { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 7px 12px; font-size: 14px; cursor: pointer; }
.chip:active { background: var(--card2); }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.ex-block { background: var(--card2); border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.ex-block select { background: var(--card); margin-bottom: 6px; }
.set-row { display: grid; grid-template-columns: 34px 1fr 1fr 34px; gap: 6px; align-items: center; margin: 4px 0; }
.set-row.one { grid-template-columns: 34px 1fr 34px; }
.set-row .n { color: var(--muted); font-size: 13px; text-align: center; }
.set-row input { padding: 8px 10px; background: var(--card); text-align: center; }
.set-head { display: grid; grid-template-columns: 34px 1fr 1fr 34px; gap: 6px; font-size: 11px; color: var(--muted); text-align: center; }
.set-head.one { grid-template-columns: 34px 1fr 34px; }
.x { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 4px; }

.list-month { margin: 18px 4px 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.w-meta { font-size: 13px; color: var(--muted); }

svg.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
svg.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dt { fill: var(--accent); }
svg.chart .tg { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; }
svg.chart text { fill: var(--muted); font-size: 10px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; padding: 4px 0; cursor: pointer; }
.tabs svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; }
.tabs button.on { color: var(--accent); }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-panel { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-panel h3 { font-size: 20px; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: 0.25s; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--muted); padding: 24px 12px; }
.steps { padding-left: 20px; margin: 6px 0; }
.steps li { margin: 4px 0; }
.file-btn { position: relative; overflow: hidden; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
textarea { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 16px; resize: vertical; }
.eq-head { margin: 14px 0 0; color: var(--accent); font-weight: 600; }
.eq-head:first-of-type { margin-top: 4px; }
.sync-line { margin: 8px 4px 0; }

.chips.days { gap: 4px; }
.chips.days .chip { flex: 1; min-width: 0; padding: 7px 0; text-align: center; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.week .day { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.week .day:last-of-type { border-bottom: 0; }
.week .day > b { width: 28px; color: var(--muted); }
.week .day.today > b { color: var(--accent); }
.week .day.today { background: color-mix(in srgb, var(--accent) 8%, transparent); margin: 0 -10px; padding: 9px 10px; border-radius: 10px; }
.week .day.tap { cursor: pointer; }
.week .day.past .small { opacity: 0.55; }
.week .done { text-decoration: line-through; opacity: 0.6; }
.week .tick { color: var(--good); font-weight: 700; }

.rest-bar { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 14px -16px calc(-20px - env(safe-area-inset-bottom)); padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card2); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.rest-t { font-weight: 700; font-variant-numeric: tabular-nums; }
.rest-bar.running .rest-t { color: var(--accent); }
.rest-prog { height: 4px; background: var(--line); border-radius: 99px; margin-top: 4px; overflow: hidden; }
.rest-prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s linear; }

.loading { text-align: center; padding: 40px 10px; }
.spinner { width: 40px; height: 40px; margin: 0 auto 14px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.idea { border-top: 1px solid var(--line); padding: 10px 0; }

.cam { position: relative; border-radius: 14px; overflow: hidden; background: #000; margin: 10px 0; }
.cam video { width: 100%; max-height: 55vh; display: block; object-fit: contain; }
.cam-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 96px; font-weight: 800; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); pointer-events: none; }
.thumbs { display: flex; gap: 8px; margin: 12px 0; }
.thumbs figure { margin: 0; flex: 1; max-width: 33%; }
.thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; display: block; }
.thumbs figcaption { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
