:root {
  color-scheme: light dark;
  --bg: #f3f4f1; --card: #ffffff; --ink: #171a1d; --ink2: #4a525a; --line: #d6dadd;
  --a: #0b6e69; --b: #8a4513; --accent: #0b6e69; --on-accent: #ffffff;
  --ok: #1d7a3e; --field: #f3f4f1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --card: #1e2327; --ink: #eef0f1; --ink2: #aab3ba; --line: #353d44;
    --a: #3fb8b0; --b: #e09a5f; --accent: #3fb8b0; --on-accent: #0c1113;
    --ok: #5fcf88; --field: #14171a;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior-y: none;
}
#app { max-width: 560px; margin: 0 auto; padding: 14px 14px 110px; }
.unit-A { --accent: var(--a); }
.unit-B { --accent: var(--b); }
h1 { font-size: 26px; line-height: 1.15; margin: 4px 0 10px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink2); margin: 22px 2px 8px; font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--ink2); }
.small { font-size: 14px; }
.card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.tag { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--accent); }

button, input { font: inherit; color: inherit; }
button { border: 0; border-radius: 14px; min-height: 50px; padding: 0 16px; background: var(--field); font-weight: 600; cursor: pointer; }
button:active { opacity: .7; }
.primary { background: var(--accent); color: var(--on-accent); }
.ghost { background: transparent; border: 1.5px solid var(--line); }
.wide { width: 100%; display: block; }
.big { min-height: 62px; font-size: 19px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
input[type=text], input[type=password] {
  width: 100%; min-height: 50px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--field); padding: 0 12px; font-size: 18px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* Startseite */
.goal { display: flex; align-items: center; gap: 14px; }
.goal b { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.pips { display: flex; gap: 6px; margin-top: 6px; }
.pips i { width: 26px; height: 8px; border-radius: 4px; background: var(--line); }
.pips i.on { background: var(--ok); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.hist li:first-child { border-top: 0; }
.switch { display: flex; align-items: center; gap: 12px; }
.switch input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

/* Training */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.top .clock { font-variant-numeric: tabular-nums; color: var(--ink2); }
.top button { min-height: 40px; padding: 0 12px; font-size: 15px; }
.pills { display: flex; gap: 6px; margin-bottom: 12px; }
.pill { flex: 1; min-height: 34px; padding: 0; border-radius: 9px; font-size: 12px; font-weight: 700; background: var(--card); color: var(--ink2); border: 1.5px solid transparent; }
.pill.done { background: var(--accent); color: var(--on-accent); }
.pill.cur { border-color: var(--ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.chips span { border-radius: 9px; padding: 5px 11px; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.chips span + span { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.how { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.how .lab, .lab { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 10px 0 1px; }
.how p { margin: 0; font-size: 16px; }
.sets { margin-top: 4px; }
.set { display: grid; grid-template-columns: 30px 1fr 1fr 58px; gap: 8px; align-items: center; margin-bottom: 8px; }
.set.one { grid-template-columns: 30px 1fr 58px; }
.set .n { font-weight: 700; color: var(--ink2); text-align: center; }
.set input { text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.set .chk { min-height: 50px; padding: 0; font-size: 22px; border: 1.5px solid var(--line); background: transparent; color: var(--ink2); }
.set.done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.set.done input { opacity: .65; }
.sethead { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); margin-bottom: 4px; }
.sethead span { text-align: center; }
.last { font-size: 14px; color: var(--ink2); margin: 2px 0 10px; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 22%); }
.dock .inner { max-width: 532px; margin: 0 auto; }
.dock button:not(.primary) { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); }
.rest { background: var(--card); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 2px 14px rgba(0,0,0,.14); }
.rest .t { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 86px; }
.rest.over .t { color: var(--ok); }
.rest button { min-height: 42px; padding: 0 12px; font-size: 15px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; }

/* Bottom-Sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--card); width: 100%; max-width: 560px; margin: 0 auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto; }
.sheet h3 { margin: 0 0 6px; font-size: 21px; }
.opt { text-align: left; height: auto; min-height: 56px; padding: 11px 14px; font-weight: 400; }
.opt b { display: block; font-weight: 700; }
.opt span { display: block; font-size: 14px; color: var(--ink2); margin-top: 2px; }
.danger { color: #c0392b; }
.toast { pointer-events: none; position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px; z-index: 20; max-width: 90vw; text-align: center; }
.toast[hidden] { display: none; }
