/* Familienbuch: ruhige Papier-Fläche, Comic-Akzente mit Tintenrand. Keine externen Schriften (Datenschutz). */
:root {
  --paper: #F3F6FC; --card: #FFFFFF; --ink: #1B2340; --muted: #5C6584; --line: #D6DCEC;
  --sun: #FFC23D; --sun-soft: #FFF1C9; --sky: #3F72E0; --sky-soft: #E3ECFD; --good: #23895B; --bad: #C8323B;
  --panel-ink: #1B2340;
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10142A; --card: #1A2040; --ink: #EDF0FA; --muted: #A4ACC8; --line: #2D355A;
    --sun-soft: #3A3320; --sky: #7FA3F5; --sky-soft: #1F2A52; --good: #4CC48A; --bad: #F2777D; --panel-ink: #EDF0FA;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
[hidden] { display: none !important; }

.device { margin: 0 auto; max-width: 520px; }
.device.tablet { max-width: 920px; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.screen main { flex: 1; padding: 18px 0 28px; display: flex; flex-direction: column; gap: 18px; }

.appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--sun); border: 2.5px solid var(--panel-ink); display: grid; place-items: center; color: #1B2340; font-size: 15px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 700; }

.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; color: var(--muted); }
.date-h { font-size: 26px; font-weight: 800; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.countdown { background: var(--sun-soft); border: 2.5px solid var(--panel-ink); border-radius: 18px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.countdown .big { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1.15; }
.countdown .sm { font-size: 14px; color: var(--muted); }
.moon { width: 44px; height: 44px; flex: none; }

.faces { display: flex; flex-wrap: wrap; gap: 8px; }
.face { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 58px; font-size: 12px; font-weight: 700; text-align: center; line-height: 1.2; overflow-wrap: anywhere; }
.face.off svg { opacity: .35; filter: grayscale(1); }
.face.off span { color: var(--muted); font-weight: 600; }
.tick { position: absolute; right: 4px; top: 30px; width: 18px; height: 18px; border-radius: 50%; background: var(--good); color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid var(--card); }
.progress-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.progress-line b { font-family: var(--font-display); font-size: 18px; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .4s; }

.rec-btn { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--sky); color: #fff; border: 2.5px solid var(--panel-ink); border-radius: 22px; padding: 14px 18px; box-shadow: 4px 4px 0 var(--panel-ink); }
.rec-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--panel-ink); }
.rec-btn .mic { width: 54px; height: 54px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.rec-btn .t1 { font-family: var(--font-display); font-weight: 800; font-size: 21px; line-height: 1.1; display: block; }
.rec-btn .t2 { font-size: 13px; opacity: .92; }

.msg { border: 2px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.msg-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); font-weight: 700; }
.msg-head .err { color: var(--bad); }
textarea, input[type=text], select { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--paper); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { border: 2px solid var(--panel-ink); background: var(--card); border-radius: 12px; padding: 8px 14px; font-weight: 800; font-size: 15px; }
.btn.primary { background: var(--sun); color: #1B2340; }
.btn.ghost { border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.empty { color: var(--muted); font-size: 15px; margin: 0; }
.info { font-size: 14px; color: var(--muted); background: var(--sky-soft); border-radius: 12px; padding: 10px 12px; margin: 0; }
.pending { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

.tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-top: 2px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 12px; font-weight: 800; color: var(--muted); border-radius: 12px; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--ink); background: var(--sky-soft); }

.fam { display: grid; gap: 10px; }
.member { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.member .n { font-weight: 800; }
.member .r { font-size: 13px; color: var(--muted); font-weight: 700; }
.member .row { margin-top: 8px; }
.linkbox { display: flex; flex-direction: column; gap: 6px; background: var(--sun-soft); border-radius: 12px; padding: 10px; margin-top: 8px; font-size: 14px; }
.linkbox code { word-break: break-all; font-size: 13px; user-select: all; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.form .check { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); }
.swatches button[aria-pressed="true"] { border: 3px solid var(--panel-ink); }
.look-edit { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; }

/* Tablet */
.kid-hello { text-align: center; display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.kid-hello h1 { font-size: 38px; font-weight: 800; }
.kid-hello p { margin: 0; color: var(--muted); font-size: 18px; font-weight: 700; }
.kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.kid { border: 3px solid var(--panel-ink); border-radius: 26px; background: var(--card); padding: 16px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 5px 5px 0 var(--panel-ink); }
.kid:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--panel-ink); }
.kid .kn { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1; }
.kid .ks { font-size: 15px; font-weight: 800; color: var(--muted); }
.kid.done .ks { color: var(--good); }
.kid svg.ava { width: 100%; max-width: 150px; height: auto; }
.others { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.others button { border: 2px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px 4px 4px; display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; }

/* Overlay */
.overlay { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 94%, transparent); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.sheet { width: 100%; max-width: 440px; background: var(--card); border: 3px solid var(--panel-ink); border-radius: 26px; box-shadow: 6px 6px 0 var(--panel-ink); padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.sheet.wide { max-width: 580px; }
.sheet h2 { font-size: 24px; font-weight: 800; }
.sheet p { margin: 0; color: var(--muted); }
.timer { font-family: var(--font-display); font-weight: 800; font-size: 44px; font-variant-numeric: tabular-nums; line-height: 1; }
.timer small { font-size: 16px; color: var(--muted); font-weight: 600; }
.level { width: 100%; max-width: 260px; height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.level i { display: block; height: 100%; width: 0; background: var(--sky); border-radius: 99px; transition: width .08s; }
.stop { width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--panel-ink); background: #E5484D; display: grid; place-items: center; box-shadow: 4px 4px 0 var(--panel-ink); }
.stop span { width: 28px; height: 28px; background: #fff; border-radius: 6px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--sky); animation: sp .8s linear infinite; flex: none; }
.spinner.sm { width: 18px; height: 18px; border-width: 3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.kid-text { font-size: 19px; line-height: 1.5; font-weight: 600; background: var(--sun-soft); border-radius: 16px; padding: 14px; text-align: left; width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 60; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
