:root {
  --bg: #0a0c10;
  --card2: #242b37;
  --input: #0c0f14;
  --text: #eef1f5;
  --muted: #97a1ae;
  --accent: #c8f135;
  --accent-2: #a8d61c;
  --accent-text: #131700;
  --danger: #ff6b6b;
  --ok: #4cd97b;
  --note: #eec27a;
  --hairline: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
  background: var(--bg);
  background-image: radial-gradient(1100px 700px at 50% -200px, #141a22 0%, var(--bg) 62%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 520px; margin: 0 auto; padding-bottom: 170px; }

/* ---------- Header ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 16px) 18px 12px;
  position: sticky;
  top: 0;
  background: rgba(10, 12, 16, 0.8);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--hairline);
  z-index: 5;
}
.bar .grow { flex: 1; }

h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 4px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 1px; }

.hbtn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
  padding: 8px 10px;
  min-width: 44px;
  min-height: 44px;
}

.pad { padding: 12px 16px; }

/* ---------- Karten ---------- */
.card {
  background: linear-gradient(180deg, #1a2029 0%, #151a22 100%);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.card.complete { opacity: 0.6; }
.card p { margin-top: 5px; line-height: 1.5; }

.k-label {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 8px 0 8px;
}

.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px;
  border-radius: 15px;
  border: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 12px;
  color: var(--text);
  background: var(--card2);
  white-space: nowrap;
}
.btn-primary,
.btn-log {
  background: linear-gradient(180deg, #d6fa5c 0%, var(--accent) 55%, var(--accent-2) 100%);
  color: var(--accent-text);
  box-shadow: 0 8px 22px rgba(200, 241, 63, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-log { padding: 13px; }
.btn-ghost { background: var(--card2); border: 1px solid var(--hairline); }
.btn-danger-ghost { background: none; color: var(--danger); font-weight: 500; }

.row { display: flex; gap: 8px; }
.row .btn { margin-top: 0; padding-left: 8px; padding-right: 8px; font-size: 15px; }

/* ---------- Übungskarten ---------- */
.ex-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; }
.ex-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.ex-count { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

.hint { margin-top: 3px; }
.last {
  margin-top: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.exnote {
  margin-top: 8px;
  background: rgba(238, 194, 122, 0.09);
  border: 1px solid rgba(238, 194, 122, 0.16);
  color: var(--note);
  padding: 8px 11px;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1.4;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: var(--card2);
  border: 1px solid var(--hairline);
  border-radius: 11px;
  padding: 7px 10px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.chip.pr {
  border-color: rgba(200, 241, 63, 0.55);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(200, 241, 63, 0.12);
}
.chip-x { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 4px; }

/* ---------- Eingaben ---------- */
.in-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.in-label { width: 36px; font-size: 13px; color: var(--muted); flex: none; }
.step {
  width: 64px;
  height: 54px;
  border-radius: 15px;
  border: 1px solid var(--hairline);
  background: var(--card2);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  flex: none;
  white-space: nowrap;
}
.num {
  flex: 1;
  height: 54px;
  border-radius: 15px;
  border: 1px solid var(--hairline);
  background: var(--input);
  color: var(--text);
  font-size: 23px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.text {
  width: 100%;
  padding: 13px;
  border-radius: 13px;
  border: 1px solid var(--hairline);
  background: var(--input);
  color: var(--text);
  font-size: 16px;
  margin: 6px 0;
}
textarea {
  width: 100%;
  padding: 13px;
  border-radius: 15px;
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, #1a2029 0%, #151a22 100%);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 4px;
  resize: vertical;
}

.linkrow { display: flex; gap: 20px; }
.linkbtn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  padding: 11px 0 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(151, 161, 174, 0.4);
}

.tag {
  font-size: 11px;
  background: var(--card2);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 2px 6px;
  color: var(--muted);
  vertical-align: 2px;
}
.tag.ok { color: var(--ok); background: none; border: 0; font-size: 15px; }

.mini {
  background: linear-gradient(180deg, #1a2029 0%, #151a22 100%);
  border: 1px solid var(--hairline);
  border-radius: 13px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}
.mini.pr { color: var(--accent); font-weight: 600; }

.teaser {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--text);
  font-size: 14px;
}
.teaser strong { color: var(--accent); }

/* ---------- Fragen (Protokoll, Waage) ---------- */
.q-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.q-row:last-of-type { border-bottom: 0; }
.q-label { font-size: 15px; line-height: 1.3; }
.segs { display: flex; gap: 6px; flex: none; }
.seg {
  border: 1px solid var(--hairline);
  background: var(--card2);
  color: var(--muted);
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  min-width: 58px;
}
.seg.on {
  background: linear-gradient(180deg, #d6fa5c 0%, var(--accent) 60%, var(--accent-2) 100%);
  color: var(--accent-text);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(200, 241, 63, 0.2);
}
.seg.onno { background: #3e4653; color: var(--text); border-color: transparent; }

.spark { width: 100%; height: 52px; margin-top: 12px; display: block; }
.sparkmini { width: 90px; height: 30px; flex: none; }

.kraftrow { display: flex; align-items: center; gap: 12px; }
.kraft-left { flex: 1; min-width: 0; }
.kraft-name { font-size: 14.5px; font-weight: 700; }
.tag.warn {
  color: var(--note);
  background: rgba(238, 194, 122, 0.08);
  border: 1px solid rgba(238, 194, 122, 0.3);
  font-size: 11px;
  padding: 2px 6px;
}

.row-icons { display: flex; gap: 6px; flex: none; }
.iconbtn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--card2);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  flex: none;
}
.iconbtn:disabled { opacity: 0.35; }
.iconbtn.danger { color: var(--danger); }

/* ---------- Wochenbalken ---------- */
.wk-row { display: flex; align-items: center; gap: 11px; margin-top: 12px; }
.wk-label { width: 72px; font-size: 14px; color: var(--muted); flex: none; }
.wk-bar { flex: 1; margin-top: 0; }
.wk-count { width: 34px; text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }

.bar-outer {
  height: 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--hairline);
  margin-top: 10px;
  overflow: hidden;
}
.bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(200, 241, 63, 0.35);
}

/* ---------- Belohnungsleiter ---------- */
.lvl {
  display: flex;
  align-items: center;
  gap: 13px;
  background: linear-gradient(180deg, #1a2029 0%, #151a22 100%);
  border: 1px solid var(--hairline);
  border-radius: 15px;
  padding: 13px 14px;
  margin-bottom: 8px;
  opacity: 0.5;
}
.lvl.unlocked { opacity: 1; border-color: rgba(200, 241, 63, 0.25); }
.lvl-num {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--card2);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.lvl.unlocked .lvl-num {
  background: linear-gradient(180deg, #d6fa5c 0%, var(--accent) 60%, var(--accent-2) 100%);
  color: var(--accent-text);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(200, 241, 63, 0.25);
}
.lvl-txt { flex: 1; min-width: 0; }
.lvl-title { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.lvl .tag.ok { flex: none; }
.claim {
  border: 0;
  background: linear-gradient(180deg, #d6fa5c 0%, var(--accent) 60%, var(--accent-2) 100%);
  color: var(--accent-text);
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 800;
  flex: none;
  min-width: 52px;
  box-shadow: 0 4px 14px rgba(200, 241, 63, 0.2);
}
.claim.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--hairline); box-shadow: none; }

/* ---------- Timer ---------- */
#timerbar[hidden] { display: none; }
#timerbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px);
  background: rgba(16, 20, 26, 0.85);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  z-index: 20;
}
#timerbar.done {
  background: linear-gradient(180deg, #d6fa5c 0%, var(--accent) 60%, var(--accent-2) 100%);
  border-top-color: transparent;
  box-shadow: 0 -6px 28px rgba(200, 241, 63, 0.3);
}
#timerbar.done .t-big, #timerbar.done .t-sub { color: var(--accent-text); }
#timerbar.above-tabs {
  bottom: calc(48px + env(safe-area-inset-bottom));
  padding-bottom: 10px;
}
.t-main { flex: 1; text-align: center; min-width: 0; }
.t-big { font-size: 31px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.01em; }
.t-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbtn {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--hairline);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 11px;
  font-size: 15px;
  font-weight: 700;
  flex: none;
}
#timerbar.done .tbtn { background: rgba(0, 0, 0, 0.14); color: var(--accent-text); border-color: transparent; }

/* ---------- Tab-Leiste ---------- */
#tabbar[hidden] { display: none; }
#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  background: rgba(13, 16, 21, 0.88);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 15;
}
.tab {
  flex: 1;
  background: none;
  border: 0;
  border-top: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 14px 2px 13px;
}
.tab.active { color: var(--accent); border-top-color: var(--accent); }

input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
