:root {
  --bg: #fff7f2;
  --bg2: #ffeef0;
  --card: #ffffff;
  --text: #2d2a32;
  --muted: #8a8292;
  --line: #f0e6ea;
  --accent: #ff7a8a;
  --accent-soft: #ffe3e7;
  --ok: #2fb67c;
  --ok-soft: #dcf6ea;
  --warn: #f2a33a;
  --warn-soft: #fff0d9;
  --bad: #e5534b;
  --bad-soft: #ffe2df;
  --shadow: 0 6px 20px rgba(80, 40, 60, .08);
  --radius: 22px;
  --pattern: none;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  background-image: var(--pattern);
  background-size: 120px 120px;
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, select, textarea {
  width: 100%; border: 2px solid var(--line); background: #fff;
  border-radius: 14px; padding: 12px 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label.field { display: block; margin: 10px 0; font-weight: 700; font-size: 14px; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { margin-top: 6px; color: var(--text); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Kopfbereich */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 12px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; gap: 12px;
}
.top h1 { margin: 0; font-size: 24px; font-weight: 900; flex: 1; letter-spacing: -.3px; }
.top .sub { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.me-btn {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 5px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow); font-weight: 800;
}

.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-size: 22px; background: var(--accent-soft); flex: 0 0 auto;
}
.avatar.lg { width: 64px; height: 64px; font-size: 36px; }
.avatar.sm { width: 28px; height: 28px; font-size: 16px; }

main { padding: 4px 16px calc(100px + var(--safe-b)); max-width: 720px; margin: 0 auto; }

/* Karten */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin: 14px 0;
}
.card h2 { margin: 0 0 10px; font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.card h2 .count { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 800; }
.section-title { font-size: 13px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 22px 4px 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; font-weight: 800; padding: 12px 18px;
  border-radius: 14px; transition: transform .1s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 11px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: var(--bg2); }

.fab {
  position: fixed; right: 18px; bottom: calc(88px + var(--safe-b)); z-index: 25;
  width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: #fff;
  font-size: 30px; font-weight: 700; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Navigation unten */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 11px; font-weight: 800; padding: 4px 0; position: relative; border-radius: 14px;
}
.nav a .ic { display: block; font-size: 24px; line-height: 1.2; filter: grayscale(.6); opacity: .75; }
.nav a.active { color: var(--accent); }
.nav a.active .ic { filter: none; opacity: 1; transform: translateY(-1px); }
.badge {
  position: absolute; top: 0; left: 55%; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; font-weight: 900;
}

/* Listen */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 16px; background: var(--bg2);
}
.item .emo { font-size: 26px; width: 36px; text-align: center; flex: 0 0 auto; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 800; }
.item .meta { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item.done .title { text-decoration: line-through; color: var(--muted); }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chk {
  width: 32px; height: 32px; border-radius: 10px; border: 2.5px solid #d9cdd3; background: #fff;
  display: grid; place-items: center; font-size: 18px; flex: 0 0 auto;
}
.chk.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 800; background: #fff; color: var(--muted);
}
.pill.offen { background: #eef0ff; color: #5a63d6; }
.pill.pruefung { background: var(--warn-soft); color: #b46d0c; }
.pill.erledigt { background: var(--ok-soft); color: #1d8a5c; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: var(--card);
  font-weight: 800; font-size: 14px; box-shadow: var(--shadow); color: var(--muted);
}
.chip.on { background: var(--accent); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 18px 8px; font-weight: 700; }
.empty .big { font-size: 40px; display: block; margin-bottom: 4px; }

/* Startseite */
.hero {
  border-radius: 26px; padding: 18px; margin-top: 8px; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffb36b));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.hero h2 { margin: 0; font-size: 22px; font-weight: 900; }
.hero p { margin: 4px 0 0; font-weight: 700; opacity: .92; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin: 0; }

.heart-card { text-align: center; position: relative; overflow: hidden; }
.heart {
  width: 120px; height: 108px; margin: 4px auto 6px; position: relative;
  display: grid; place-items: center; color: #fff;
}
.heart svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(229,60,90,.35)); animation: beat 2.4s infinite; }
.heart .txt { position: relative; font-weight: 900; line-height: 1.1; margin-top: -10px; }
.heart .txt b { display: block; font-size: 22px; }
.heart .txt span { font-size: 13px; }
@keyframes beat { 0%,100%{transform:scale(1)} 10%{transform:scale(1.07)} 20%{transform:scale(1)} 30%{transform:scale(1.05)} 40%{transform:scale(1)} }

.stat { text-align: center; }
.stat .n { font-size: 30px; font-weight: 900; }
.stat .l { font-size: 13px; font-weight: 800; color: var(--muted); }

.alert {
  border-radius: 18px; padding: 14px; margin: 12px 0; display: flex; gap: 12px; align-items: center; font-weight: 700;
}
.alert .emo { font-size: 30px; }
.alert.warn { background: var(--warn-soft); }
.alert.bad { background: var(--bad-soft); }
.alert.ok { background: var(--ok-soft); }
.alert.info { background: #eaf2ff; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 3px; background: var(--line); border-radius: 2px; }
.tl { position: relative; margin-bottom: 12px; }
.tl::before {
  content: ''; position: absolute; left: -22px; top: 18px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent-soft);
}
.tl.past::before { background: #cfc6cc; }
.tl .card { margin: 0; }
.daylabel { font-size: 13px; font-weight: 900; color: var(--accent); margin: 0 0 4px; }

.proof { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; margin-top: 8px; }

/* Stundenplan */
.tt { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.tt th { font-size: 12px; font-weight: 900; color: var(--muted); }
.tt td { padding: 0; }
.tt td input {
  padding: 8px 2px; font-size: 12px; text-align: center; border-radius: 10px; border-width: 1.5px;
  font-weight: 800; min-height: 40px;
}
.tt td.n { width: 22px; font-size: 12px; font-weight: 900; color: var(--muted); text-align: center; }
.tt td input.filled { background: var(--accent-soft); border-color: transparent; }
.tt td input.today { outline: 2px solid var(--accent); }
.tt-photo { width: 100%; border-radius: 16px; margin-top: 10px; }

/* Beate */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 20px; font-weight: 600; line-height: 1.35; }
.bubble .who { font-size: 11px; font-weight: 900; opacity: .7; display: block; margin-bottom: 2px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble.bot { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.beate-head { display: flex; align-items: center; gap: 12px; }
.beate-face { width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(135deg,#ffd6a5,#ffadad); display: grid; place-items: center; font-size: 32px; }
.composer { display: flex; gap: 8px; position: sticky; bottom: calc(84px + var(--safe-b)); margin-top: 14px; }
.composer input { border-radius: 999px; box-shadow: var(--shadow); border-color: transparent; }
.composer .btn { border-radius: 999px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Mehr-Menü */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.tile {
  background: var(--card); border-radius: 22px; padding: 16px 8px; text-align: center; box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); font-weight: 800; font-size: 13px;
}
.tile .ic { font-size: 32px; display: block; margin-bottom: 4px; }

/* Bottom sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(40,20,30,.35); z-index: 50; animation: fade .15s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 90vh; overflow-y: auto;
  background: var(--bg); border-radius: 28px 28px 0 0; padding: 10px 18px calc(24px + var(--safe-b));
  animation: up .22s ease-out; max-width: 720px; margin: 0 auto;
}
.sheet .grip { width: 44px; height: 5px; background: #e2d6dc; border-radius: 3px; margin: 0 auto 10px; }
.sheet h3 { margin: 4px 0 8px; font-size: 21px; font-weight: 900; }
@keyframes up { from { transform: translateY(40px); opacity: 0 } }
@keyframes fade { from { opacity: 0 } }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 6px 0; }
.emoji-grid button { font-size: 24px; padding: 6px 0; border-radius: 10px; }
.emoji-grid button.on { background: var(--accent-soft); outline: 2px solid var(--accent); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--text); }
.seg { display: flex; background: var(--bg2); border-radius: 14px; padding: 4px; gap: 4px; margin: 8px 0; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 11px; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.days { display: flex; gap: 6px; margin: 8px 0; }
.days button { flex: 1; padding: 9px 0; border-radius: 11px; background: var(--bg2); font-weight: 800; font-size: 13px; color: var(--muted); }
.days button.on { background: var(--accent); color: #fff; }

.who-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.who-grid button { background: var(--card); border-radius: 22px; padding: 14px 6px; box-shadow: var(--shadow); font-weight: 800; }
.who-grid button.on { outline: 3px solid var(--accent); }
.who-grid .avatar { margin: 0 auto 6px; }

.pin { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.pin span { width: 16px; height: 16px; border-radius: 50%; background: var(--line); }
.pin span.on { background: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.keypad button { background: var(--card); border-radius: 18px; padding: 16px 0; font-size: 22px; font-weight: 800; box-shadow: var(--shadow); }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 800;
  opacity: 0; transition: .25s; z-index: 60; pointer-events: none; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.install-tip { background: #eaf2ff; }
.progress { height: 10px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--ok); border-radius: 6px; transition: width .3s; }

.sched { display: grid; grid-template-columns: 44px 1fr; gap: 6px 10px; align-items: start; }
.sched .d { font-weight: 900; color: var(--muted); font-size: 14px; padding-top: 8px; }
.sched .slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { padding: 6px 10px; border-radius: 12px; font-size: 13px; font-weight: 800; background: var(--bg2); }
.slot.now { background: var(--accent); color: #fff; }

@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* Glocke */
.bell { position: relative; flex: 0 0 auto; background: var(--card); box-shadow: var(--shadow); }
.bell .badge { top: -4px; left: auto; right: -6px; }

/* Familien-Timeline */
.post { padding: 14px; }
.post-img { width: 100%; max-height: 520px; object-fit: cover; border-radius: 16px; margin-top: 12px; display: block; }
.comments { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.cm { background: var(--bg2); border-radius: 14px; padding: 8px 12px; font-size: 14px; font-weight: 600; }

/* Wochenübersicht */
.week-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.week-stats span { background: rgba(255,255,255,.28); padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; }
.week-day.today { box-shadow: 0 0 0 2px var(--accent) inset; }
.week-regular { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.week-regular .slot { font-size: 12px; }

/* Ferien-Ticker */
.ferien { border-radius: 24px; overflow: hidden; margin-bottom: 14px; background: #fff; box-shadow: var(--shadow, 0 6px 20px rgba(0,0,0,.06)); }
.ferien .sky { position: relative; height: 92px; background: linear-gradient(180deg, #8fd3ff 0%, #c9ecff 70%, #7fd6c8 100%); }
.ferien .cloud { position: absolute; font-size: 26px; opacity: .9; animation: drift 14s linear infinite; }
.ferien .c1 { top: 8px; left: 20%; } .ferien .c2 { top: 30px; left: 60%; font-size: 20px; animation-duration: 20s; }
@keyframes drift { from { transform: translateX(0); } 50% { transform: translateX(-18px); } to { transform: translateX(0); } }
.ferien .route { position: absolute; left: 30px; right: 70px; top: 52px; border-top: 3px dashed rgba(255,255,255,.95); }
.ferien .route-done { position: absolute; left: 30px; top: 51px; height: 5px; border-radius: 3px; background: #ff7a3d; }
.ferien .plane { position: absolute; top: 30px; font-size: 38px; transform: rotate(45deg); animation: bobPlane 2.4s ease-in-out infinite; transition: left .6s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bobPlane { 0%,100% { transform: rotate(45deg) translate(0,0); } 50% { transform: rotate(45deg) translate(-4px,-4px); } }
.ferien .island { position: absolute; right: 12px; bottom: 6px; font-size: 52px; line-height: 1; }
.ferien.landed .plane { top: 44px; font-size: 30px; animation: none; transform: rotate(45deg); }
.ferien-txt { padding: 12px 16px 14px; font-size: 16px; }
.ferien-txt b { font-weight: 900; }
.ferien-txt span { font-size: 13px; font-weight: 700; color: var(--muted); }

/* Aufgaben mit Foto-Antwort */
.item.has-proof { flex-wrap: wrap; }
.proof-box { flex: 0 0 100%; margin: 8px 0 0 0; padding: 10px 12px; border-radius: 14px; background: var(--bg2, #f6f1f8); }
.proof-box .proof { margin-top: 8px; }
.nav a { min-width: 0; }
@media (max-width: 430px) { .nav a { font-size: 10px; } .nav a .ic { font-size: 22px; } }
.review-row { flex: 0 0 100%; display: flex; gap: 8px; margin-top: 8px; }
.review-row .btn { flex: 1; }

/* Sterne-Konto */
.star-hero { text-align: center; background: linear-gradient(135deg, #f5b82e, #ff8a3d); }
.star-big { display: inline-block; font-size: 54px; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
.rewards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.reward { text-align: center; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.reward .r-emo { font-size: 40px; line-height: 1.1; }
.reward .r-title { font-weight: 900; font-size: 15px; min-height: 2.4em; }
.reward .r-cost { font-weight: 900; color: #c2410c; }
.item .review-row { flex-wrap: wrap; }
@media (min-width: 700px) { .rewards { grid-template-columns: repeat(4, 1fr); } }

/* Beichte ohne Ärger */
.confess-hero { background: linear-gradient(135deg, #7c9cff, #b58cff); }
.confess textarea, .card textarea#cfText { width: 100%; }
.confess-answer { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: #eef3ff; }

/* Ranking & Autofahrt */
.item.rank.me { box-shadow: 0 0 0 2px var(--accent) inset; }
.rank-n { font-weight: 900; font-size: 18px; white-space: nowrap; }
.ride-card { margin-bottom: 12px; }
.ride-track { display: flex; align-items: center; gap: 8px; font-size: 22px; margin-top: 6px; }
.ride-track input[type=range] { flex: 1; accent-color: #ff7a3d; padding: 0; }
.ride-road { position: relative; height: 34px; margin: 6px 0; border-radius: 10px; background: repeating-linear-gradient(90deg, #6b6b6b 0 18px, #fff 18px 28px) center/100% 3px no-repeat, #7a7a7a; }
.ride-car { position: absolute; top: 2px; font-size: 26px; transform: scaleX(-1); transition: left .15s; }
.ride-sum { text-align: center; padding: 10px; border-radius: 14px; background: #fff4d6; margin: 10px 0; }
label.row { justify-content: flex-start; gap: 10px; }
label.row > input[type=checkbox] { flex: 0 0 auto; width: 22px; height: 22px; }
