:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --brand-soft: #ccfbf1;
  --done: #16a34a;
  --warn: #b45309;
  --radius: 14px;
  --me: #0f766e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --card: #1f2937;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --line: #374151;
    --brand-soft: #134e4a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: .6rem 0; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
main { max-width: 760px; margin: 0 auto; padding: 0 12px 24px; }
main.narrow { max-width: 440px; padding-top: 24px; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
code { background: var(--brand-soft); padding: 0 4px; border-radius: 4px; }

/* Kopf & Navigation */
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--brand); color: #fff;
}
.top .who { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.top .avatar { font-size: 1.4rem; }
.top .logout { color: #fff; opacity: .85; font-size: .9rem; }
.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.tabs a {
  padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--text);
  white-space: nowrap; font-weight: 500;
}
.tabs a.active { background: var(--brand); color: #fff; }
.badge {
  display: inline-block; min-width: 1.2em; padding: 0 5px; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: .75rem; text-align: center;
}
.festive { background: #fef3c7; color: #78350f; padding: 8px 14px; font-size: .9rem; text-align: center; }
@media (prefers-color-scheme: dark) { .festive { background: #78350f; color: #fef3c7; } }

/* Karten */
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  margin: 12px 0; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.card.highlight { border: 2px solid #f59e0b; }
.card.day.today { border: 2px solid var(--brand); }
.card.day h2 a { color: inherit; text-decoration: none; }
.flash { padding: 10px 14px; border-radius: 10px; margin: 12px 0; background: var(--brand-soft); }
.flash.error { background: #fee2e2; color: #7f1d1d; }
.banner {
  display: block; margin: 12px 0; padding: 12px 14px; border-radius: 12px;
  background: #fef3c7; color: #78350f; text-decoration: none; font-weight: 500;
}
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav a { font-size: 1.8rem; text-decoration: none; padding: 0 10px; }
.daynav h1 { text-align: center; flex: 1; }

/* Aufgaben */
.task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.card h2 + .task, .phead + .task, details > summary + .task { border-top: 0; }
.task.done .ttitle { text-decoration: line-through; color: var(--muted); }
.checkform { margin: 0; }
.check {
  width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--me);
  background: transparent; color: #fff; font-size: 1.2rem; font-weight: 700; cursor: pointer;
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
}
.task.done .check { background: var(--done); border-color: var(--done); }
.check.static { border-color: var(--line); color: var(--done); background: transparent; }
.tbody { flex: 1; min-width: 0; }
.ttitle { font-weight: 500; }
.ticon { margin-right: 2px; }
.tmeta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; }
.tnote { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.swaplink { font-size: .85rem; display: inline-block; margin-top: 4px; }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.tag { font-size: .75rem; padding: 1px 7px; border-radius: 999px; background: var(--brand-soft); }
.festive-tag { background: #fef3c7; color: #78350f; }
.pblock { margin-top: 10px; }
.phead { margin-bottom: 2px; }
details > summary { cursor: pointer; padding: 6px 0; }
.workout { margin-top: 8px; background: var(--brand-soft); border-radius: 10px; padding: 6px 10px; }
.workout ol { padding-left: 20px; }
.workout li { margin-bottom: 8px; }
.hint { font-size: .85rem; }
.hint ul { padding-left: 18px; margin: 4px 0; }

/* Termine & Fenster */
.events, .notes, .windows, .history { list-style: none; padding: 0; margin: 0 0 8px; }
.events li, .notes li, .windows li, .history li { padding: 4px 0; }
.etime { display: inline-block; min-width: 92px; font-variant-numeric: tabular-nums; color: var(--brand); font-weight: 600; }
.rules li { margin-bottom: 6px; }
.tips ul li { margin-bottom: 8px; }
.tips summary { font-weight: 600; }

/* Tabellen */
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th, .tbl td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 500; font-size: .85rem; }

/* Formulare */
label { display: block; margin: 10px 0; font-weight: 500; }
input[type=text], input[type=password], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text);
}
textarea.code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.btn {
  display: inline-block; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; margin: 6px 6px 0 0;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
form.inline { display: inline; }
.swap { padding: 8px 0; border-top: 1px solid var(--line); }
.swap:first-of-type { border-top: 0; }

/* Login */
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.person {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px;
  border-radius: var(--radius); background: var(--card); text-decoration: none; color: var(--text);
  font-weight: 600; border: 3px solid transparent;
}
.person .big { font-size: 2.6rem; }
.person.sel { border-color: var(--c); }

/* Kinderansicht: groß und bunt */
body.kid .kidtasks .task {
  background: var(--card); border-radius: 18px; padding: 16px; margin: 10px 0; border: 0;
  align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
body.kid .check { width: 56px; height: 56px; border-radius: 16px; font-size: 2rem; border-width: 3px; }
body.kid .ttitle { font-size: 1.25rem; }
body.kid .ticon { font-size: 2.2rem; display: block; margin-bottom: 2px; }
body.kid .tmeta { display: none; }
.stars { text-align: center; }
.starline { font-size: 1.6rem; word-break: break-all; }

/* Einkaufsliste */
.badge.gray { background: #64748b; }
.shopadd { display: flex; gap: 8px; align-items: center; }
.shopadd input[type=text] { margin: 0; flex: 1; }
.shopadd .btn { margin: 0; font-size: 1.3rem; padding: 8px 16px; }
.mic {
  width: 48px; height: 48px; border-radius: 50%; border: 0; font-size: 1.5rem;
  background: var(--brand); color: #fff; cursor: pointer; flex: 0 0 auto;
}
.mic.on { background: #dc2626; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.shopitem { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); margin: 0; }
.shopitem:first-of-type { border-top: 0; }
.shopitem .stext { flex: 1; font-size: 1.05rem; }
.shopitem.bought .stext { text-decoration: line-through; color: var(--muted); }
.check.done { background: var(--done); border-color: var(--done); }

/* Kinder-Wechsel */
.topright { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.kidswitch {
  background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 999px;
  padding: 5px 10px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; list-style: none;
}
.kidswitch::-webkit-details-marker { display: none; }
.backpin { position: relative; }
.backpin form {
  position: absolute; right: 0; top: 36px; background: var(--card); padding: 10px; border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); width: 200px; z-index: 20;
}
.backpin input { margin: 0 0 6px; }

/* Feier-Effekt */
#celebrate {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(15, 118, 110, .25);
  transition: opacity .5s; text-align: center; padding: 20px;
}
#celebrate.gone { opacity: 0; pointer-events: none; }
.bigstar { font-size: 9rem; animation: pop 1s cubic-bezier(.2, 1.6, .4, 1) both, spin 2.2s ease-out .2s; }
.celebmsg {
  margin-top: 12px; font-size: 1.6rem; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.4); animation: pop .8s .25s both;
}
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes spin { 0% { rotate: 0deg; } 100% { rotate: 360deg; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* Sterne & Wünsche */
.starcount { font-size: 2.6rem; font-weight: 800; }
.progress { height: 18px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #facc15, #f97316); border-radius: 999px; }
.wishes { list-style: none; padding: 0; margin: 0; }
.wishes li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.wishes li:first-child { border-top: 0; }
.wishes .wicon { font-size: 1.8rem; }
.wishes .wtext { flex: 1; }
.wishes .reach { opacity: 1; }
.wishes .far { opacity: .55; }
.wishes, .wishes li { text-align: left; }
.celebmsg { font-size: 1.8rem; }

/* Logo */
.biglogo { display: block; width: 150px; height: 150px; margin: 8px auto 4px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.18)); }
.toplogo { width: 34px; height: 34px; border-radius: 9px; margin-right: 2px; }
.top .who { color: #fff; text-decoration: none; }
