:root {
  --bg: #0D0E12;
  --card: #171920;
  --card-2: #1C1F27;
  --line: #262934;
  --text: #F2F3F5;
  --muted: #9AA0AE;
  --faint: #6B7180;
  --lime: #C5F15A;
  --lime-dark: #7FA62A;
  --orange: #FF9A3C;
  --orange-soft: #FFB46B;
  --orange-dark: #A85E1E;
  --red: #FF7A6B;
  --red-dark: #A8443A;
  --blue: #7CC2FF;
  --blue-dark: #3E6F99;
  --violet: #C9A7FF;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--text);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font-family: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

#app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: calc(var(--safe-top) + 28px) 24px calc(var(--safe-bottom) + 28px);
  min-height: 100dvh;
}
.screen.tight { gap: 16px; }
.spacer { flex: 1; }

/* ---------- Kopfzeile ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.top-right { display: flex; align-items: center; gap: 10px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.rank-line { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; white-space: nowrap; }
.title { font-size: 28px; font-weight: 900; flex: 1; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  display: flex; align-items: center; justify-content: center; padding: 0; flex: none;
}

.streak-pill {
  display: flex; align-items: center; gap: 6px;
  background: #1E1A14; border: 1px solid #3A2C18;
  padding: 8px 12px; border-radius: 999px;
}
.streak-pill svg { display: block; }
.streak-pill span { font-size: 17px; font-weight: 800; line-height: 18px; display: block; color: var(--orange-soft); }

/* ---------- Balken ---------- */
.bar { height: 12px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.bar.slim { height: 8px; }
.bar.mid { height: 10px; }
.bar > div { height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.2,.9,.3,1); }
.bar-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 8px; gap: 8px; }

/* ---------- Heute ---------- */
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.dots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dot { width: 28px; height: 8px; border-radius: 999px; background: var(--line); transition: width .3s, background .3s; }
.dot.done { background: var(--lime); }
.dot.skip { background: var(--orange); }
.dot.excused { background: var(--blue); }
.dot.cur { width: 44px; background: var(--text); }

.task-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 32px;
  padding: 36px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.tag {
  font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bg); padding: 6px 12px; border-radius: 999px;
}
.tag.routine { background: var(--violet); }
.tag.kalender { background: var(--blue); }
.tag.gestern { background: var(--orange); }
.task-title { font-size: 44px; font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.task-time { font-size: 17px; color: var(--muted); font-weight: 500; }
.task-hint { font-size: 14px; color: var(--faint); font-weight: 500; }
.task-card.upcoming { background: transparent; border-style: dashed; }
.task-card.upcoming .task-title { color: var(--muted); }
.tag.next { background: var(--line); color: var(--muted); }
.idle-note { text-align: center; font-size: 17px; font-weight: 700; color: var(--muted); padding: 18px 0 2px; }

.actions { display: flex; flex-direction: column; gap: 12px; }
.btn {
  height: 64px; border: none; border-radius: 20px;
  font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--shadow, transparent) !important; }
.btn.lime { background: var(--lime); color: var(--bg); box-shadow: 0 6px 0 var(--lime-dark); --shadow: var(--lime-dark); }
.btn.orange { background: var(--orange); color: var(--bg); box-shadow: 0 6px 0 var(--orange-dark); --shadow: var(--orange-dark); }
.btn.red { background: var(--red); color: var(--bg); box-shadow: 0 6px 0 var(--red-dark); --shadow: var(--red-dark); }
.btn.blue { background: var(--blue); color: var(--bg); box-shadow: 0 6px 0 var(--blue-dark); --shadow: var(--blue-dark); }
.btn.off { background: var(--card-2); color: var(--faint); }
.btn.white { background: var(--text); color: var(--bg); font-size: 17px; height: 56px; border-radius: 18px; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); font-size: 17px; height: 56px; border-radius: 18px; font-weight: 700; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.link-btn { height: 48px; border: none; background: transparent; color: var(--muted); font-size: 16px; font-weight: 600; }

/* ---------- Skippen / Verschieben ---------- */
.heading { display: flex; flex-direction: column; gap: 6px; }
.heading small { font-size: 15px; color: var(--muted); font-weight: 600; }
.heading h1 { margin: 0; font-size: 34px; font-weight: 900; line-height: 1.1; }
.group { display: flex; flex-direction: column; gap: 10px; }
.choice {
  height: 54px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  color: var(--text); font-size: 18px; font-weight: 600; text-align: left; padding: 0 20px;
}
.choice.sel-blue { border-color: var(--blue); background: #132030; font-weight: 700; }
.choice.sel-lime { border-color: var(--lime); background: #1D2414; font-weight: 700; }
.warn {
  background: #2A1512; border: 1px solid #5C2A22; color: #FFB3A8;
  border-radius: 16px; padding: 14px 16px; font-size: 15px; font-weight: 500; line-height: 1.4;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--card); color: var(--text); font-size: 16px; font-weight: 600;
}
.chip.sel { border-color: var(--blue); background: #132030; font-weight: 700; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.input {
  height: 56px; width: 100%; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  color: var(--text); font-size: 18px; font-weight: 600; padding: 0 14px; color-scheme: dark;
  -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--blue); outline: none; }
.note {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; font-size: 15px; color: var(--muted); font-weight: 500; line-height: 1.4;
}
.note svg { flex: none; }

/* ---------- Abschluss ---------- */
.center-head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.center-head h1 { margin: 0; font-size: 32px; font-weight: 900; }
.streak-big { display: flex; align-items: center; justify-content: center; gap: 6px; height: 64px; }
.streak-big svg { display: block; }
.streak-big span { font-size: 64px; font-weight: 900; line-height: 64px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.banner { border-radius: 12px; padding: 8px 12px; font-size: 15px; font-weight: 800; text-align: center; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bg); }
.banner.up { background: var(--lime); }
.banner.down { background: var(--red); }
.rank-row { display: flex; align-items: center; gap: 10px; }
.rank-row .name { flex: 1; font-size: 22px; font-weight: 900; }
.rank-row .delta { font-size: 17px; font-weight: 800; }
.lines { display: flex; flex-direction: column; gap: 6px; }
.line { display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; gap: 12px; }
.line span:first-child { color: var(--muted); }
.line span:last-child { font-weight: 700; }
.pos { color: var(--lime); }
.neg { color: var(--red); }
.zero { color: var(--muted); }
.sm-row { display: flex; align-items: center; gap: 12px; }
.sm-row .lbl { width: 56px; font-size: 16px; font-weight: 700; }
.sm-row .bar { flex: 1; }
.sm-row .val { width: 112px; text-align: right; font-size: 14px; font-weight: 700; }
.sub { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- Statistik ---------- */
.tiles { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile .big { font-size: 28px; font-weight: 900; }
.tile .small { font-size: 13px; color: var(--muted); font-weight: 600; }
.heat { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.heat div { height: 32px; border-radius: 7px; background: var(--card-2); }
.heat .perfect { background: var(--lime); }
.heat .limit { background: #6E8A35; }
.heat .broken { background: var(--orange); }
.heat .future { background: transparent; border: 1px dashed #23262F; }
.heat .is-today { outline: 2px solid var(--text); outline-offset: -2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 500; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bars { position: relative; height: 90px; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--line); }
.bars .limit-line { position: absolute; left: 0; right: 0; border-top: 2px dashed #3A3E4A; }
.bars .col { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.bars .col div { width: 100%; border-radius: 8px 8px 3px 3px; }
.days-row { display: flex; gap: 10px; }
.days-row span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.habit { display: flex; align-items: center; gap: 12px; }
.habit .n { width: 104px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.habit .bar { flex: 1; }
.habit .p { width: 44px; text-align: right; font-size: 14px; font-weight: 700; color: var(--muted); }
.empty-hint { font-size: 14px; color: var(--faint); font-weight: 500; }

/* ---------- Login / Hinweise ---------- */
.login { justify-content: center; }
.logo { display: flex; align-items: center; gap: 12px; font-size: 40px; font-weight: 900; }
.err { color: var(--red); font-size: 15px; font-weight: 600; min-height: 20px; }
.push-banner {
  display: flex; align-items: center; gap: 12px; background: #132030; border: 1px solid #23415E;
  border-radius: 16px; padding: 12px 14px; font-size: 15px; font-weight: 600;
}
.push-banner span { flex: 1; }
.push-banner button { height: 40px; border-radius: 12px; border: none; background: var(--blue); color: var(--bg); font-weight: 800; font-size: 15px; padding: 0 14px; }
.settings-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Tracking-Anleitung ---------- */
.lead { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.45; font-weight: 500; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.45; color: var(--text); }
.steps li::marker { color: var(--lime); font-weight: 800; }
.steps b { font-weight: 700; color: #fff; }
.copy-row { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 12px; }
.copy-row code { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; line-height: 1.4; }
.copy-row button { flex: none; height: 40px; border-radius: 10px; border: none; background: var(--lime); color: var(--bg); font-weight: 800; font-size: 14px; padding: 0 12px; }

/* ---------- Toast ---------- */
.toast[hidden] { display: none; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 150px); transform: translateX(-50%);
  white-space: nowrap;
  background: var(--text); color: var(--bg); border-radius: 16px; padding: 12px 14px 12px 18px;
  font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 10; max-width: calc(100% - 32px);
}
.toast button { border: none; background: var(--bg); color: var(--text); border-radius: 10px; height: 36px; padding: 0 12px; font-weight: 800; font-size: 14px; }

/* ---------- Animationen ---------- */
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { 0% { transform: translateY(16px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.pop { animation: pop .55s cubic-bezier(.2,.9,.3,1.3) both; }
.rise { animation: rise .4s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  .pop, .rise { animation: none; }
  .bar > div { transition: none; }
}
