/* WerDran: mobil zuerst, eine Spalte, Tab-Leiste unten. Keine externen Schriften, damit die App offline
   und ohne Anfragen an Dritte funktioniert (Kinderdaten). */
:root {
    --bg: #f4f7f6;
    --surface: #ffffff;
    --ink: #16302f;
    --muted: #536b69;
    --line: #d8e1df;
    --accent: #e8604c;
    --accent-ink: #b63f2c;
    --on-accent: #ffffff;
    --amber: #f2b134;
    --teal: #1e8c85;
    --teal-soft: #dff1ef;
    --coral-soft: #fbe5e1;
    --danger: #b3261e;
    --focus: #1e8c85;
    --radius: 14px;
    --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1918;
        --surface: #152524;
        --ink: #e6f0ee;
        --muted: #9cb2af;
        --line: #27393a;
        --accent: #f0735f;
        --accent-ink: #f4907f;
        --on-accent: #1b0f0c;
        --amber: #f5bc4c;
        --teal: #35aea6;
        --teal-soft: #17393a;
        --coral-soft: #3a2420;
        --danger: #f2b8b5;
        --focus: #35aea6;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.5 var(--font);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-weight: 800; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
p { margin: 0; }
a { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Blazor fokussiert die Überschrift nach der Navigation (für Screenreader); ein Rahmen darum wäre nur Rauschen. */
[tabindex="-1"]:focus { outline: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Rahmen */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.content { flex: 1; width: 100%; max-width: 36rem; margin: 0 auto; padding: 1rem 1rem 2rem; }
.shell.signed-in .content { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }

.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: calc(.5rem + env(safe-area-inset-top, 0px)) 1rem .5rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font-size: 1.2rem; font-weight: 800; }
.brand b { color: var(--accent-ink); }
.who { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.who-name { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 10;
    display: flex; justify-content: center; gap: .25rem;
    padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
    flex: 1 1 0; max-width: 7rem;
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .4rem .25rem; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 700;
}
.tabbar svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent-ink); background: var(--coral-soft); }

/* Seiten */
.page { display: flex; flex-direction: column; gap: 1.25rem; }
.page > header { display: flex; flex-direction: column; gap: .25rem; }
.section { display: flex; flex-direction: column; gap: .6rem; }
.section > h2 { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.count { color: var(--muted); font-size: .9rem; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; padding: 1.5rem 1rem; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .25rem; }

/* Willkommen und Anmeldung */
.hero { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; padding-top: 2rem; }
.hero img { width: min(55vw, 14rem); height: auto; }
.hero h1 { font-size: 2.1rem; }
.hero h1 b { color: var(--accent-ink); }
.hero p { max-width: 24rem; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: .75rem; width: 100%; }

/* Formulare */
form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, .field .label { font-weight: 700; font-size: .95rem; }
.hint { color: var(--muted); font-size: .85rem; }
input[type=text], input[type=password], input[type=date], input[type=number], select {
    width: 100%; min-height: 2.9rem; padding: .5rem .75rem;
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1.5px solid var(--line); border-radius: 10px;
}
input:focus-visible, select:focus-visible { border-color: var(--focus); outline-offset: 0; }
.row { display: flex; gap: .75rem; }
.row > * { flex: 1 1 0; min-width: 0; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 2.9rem; padding: .5rem 1.1rem;
    font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
    color: var(--ink); background: var(--surface);
    border: 1.5px solid var(--line); border-radius: 12px;
}
.btn.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn.quiet { background: transparent; }
.btn.small { min-height: 2.4rem; padding: .25rem .8rem; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.wide { width: 100%; }
button.link { padding: .25rem; font: inherit; font-weight: 700; color: var(--accent-ink); background: none; border: 0; cursor: pointer; text-decoration: underline; }

/* Meldungen */
.alert { padding: .75rem 1rem; border-radius: 10px; font-weight: 600; background: var(--coral-soft); color: var(--danger); border: 1px solid var(--accent); }
.note { padding: .75rem 1rem; border-radius: 10px; background: var(--teal-soft); border: 1px solid var(--teal); }

/* Aufgaben */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.task {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .25rem .75rem;
    padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.task-title { font-weight: 800; overflow-wrap: anywhere; }
.task-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: .25rem .6rem; color: var(--muted); font-size: .875rem; }
.task-meta > span:not(:first-child):not(.pill)::before { content: "·"; margin-right: .6rem; }
.task .btn { grid-column: 2; grid-row: 1 / span 2; }
.task.done { background: var(--teal-soft); border-color: transparent; }
.task.done .task-title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.task.skipped { opacity: .6; }
.pill { padding: .05rem .5rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: .78rem; font-weight: 700; }

/* Punkte */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: .3rem .75rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rank .name { font-weight: 800; overflow-wrap: anywhere; }
.rank .score { font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: .6rem; border-radius: 99px; background: var(--bg); overflow: hidden; }
.bar > span { display: block; height: 100%; min-width: 2px; background: var(--teal); border-radius: 99px; }
.rank .sub { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; }

/* Verwalten */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { min-width: 0; }
.list .title { font-weight: 800; overflow-wrap: anywhere; }
.code {
    display: block; padding: .75rem 1rem; text-align: center;
    font: 800 1.8rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em;
    background: var(--bg); border: 2px dashed var(--accent); border-radius: 12px; user-select: all;
}

/* Mitglieder und Zuweisung wechseln */
.member { flex-direction: column; align-items: stretch !important; gap: .6rem; }
.member-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.member.inactive .title { color: var(--muted); }
.member-edit { display: flex; flex-direction: column; gap: 1rem; padding: .25rem 0 .5rem; }
.member-edit form { gap: .75rem; }
.member-edit .row { align-items: end; }
.task-extra { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; padding-top: .35rem; }
.task-extra select { flex: 1 1 auto; min-height: 2.4rem; }
.task .btn.link-like { grid-column: auto; grid-row: auto; }

/* Offline und Installation */
.offline-bar { padding: .5rem 1rem; text-align: center; font-size: .9rem; font-weight: 700; background: var(--amber); color: #2b2100; }
.offline-note { display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; padding: .75rem 1rem; border-radius: 10px; background: var(--coral-soft); border: 1px solid var(--amber); }
.install { display: flex; flex-direction: column; gap: .75rem; border-color: var(--teal); }
.install-text { display: flex; flex-direction: column; gap: .2rem; }
.install-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.plain { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.steps { margin: 0 0 .5rem; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .6rem; }
.steps:last-child { margin-bottom: 0; }

/* Start-Bildschirm und Fehlerleiste */
.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--muted); }
.loading { padding: 3rem 0; text-align: center; color: var(--muted); }

#blazor-error-ui {
    color-scheme: light only; background: #fff3c4; color: #3d3000;
    bottom: 0; box-shadow: 0 -1px 4px rgba(0, 0, 0, .25); box-sizing: border-box; display: none;
    left: 0; padding: .7rem 1.25rem calc(.8rem + env(safe-area-inset-bottom, 0px)); position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .reload { color: inherit; font-weight: 800; margin-left: .5rem; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .9rem; top: .6rem; font-size: 1.4rem; }

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