/* CleanUp: dunkler Kachel-Look wie Trio. Oben die ausgeloste Aufgabe als große Karte, darunter ein Raster aus quadratischen Kacheln.
   Wird von Hand gepflegt, nicht generiert. */
/* Schriften liegen selbst auf dem Server (keine Anfrage an Google), Lizenz: SIL Open Font License */
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 600 800; font-display: swap }
@font-face { font-family: "Figtree"; src: url("fonts/figtree.woff2") format("woff2"); font-weight: 400 700; font-display: swap }
:root {
  --bg: #141d21;          /* Grund, dunkles Schiefer-Petrol wie Trio */
  --surface: #1f2b31;     /* Karten, Sheets */
  --surface-2: #2a3940;   /* Eingaben, Chips */
  --line: #36474f;
  --fg: #eef3f1;
  --muted: #95a6ab;
  --accent: #7fe0c4;      /* Auslosen, frisch und sauber (Trio: Gelb) */
  --accent-fg: #06261d;
  --danger: #ff7b6b;
  --star: #ffcf5c;        /* Gute-Nudel-Sterne */
  --c0: #9a6450; --c1: #4c6a88; --c2: #6c6390; /* Rausgehen, Daily Tasks, Wochenend-Aufgaben */
  --i0: #e0a48d; --i1: #98b7d6; --i2: #b6acdf; /* Symbolfarben für die schlichten Kacheln */
  --tile: #223037;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", -apple-system, "Segoe UI", system-ui, sans-serif;
  --r: 20px;
  color-scheme: dark;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
html { background: var(--bg) }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased }
button, input, textarea, select { font: inherit; color: inherit }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; border: 0; background: none; padding: 0 }
button:disabled { cursor: default; opacity: .5 }
svg { flex: none; display: block }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; text-wrap: balance; margin: 0 }
p { margin: 0 }
.muted { color: var(--muted) }
.small { font-size: 14px }
.center { text-align: center; padding-block: 40px }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted) }
.label, form label { display: block; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px }
.label .muted, form label .muted { text-transform: none; letter-spacing: 0; font-weight: 600 }

.c0 { --cat: var(--c0); --ink: var(--i0) } .c1 { --cat: var(--c1); --ink: var(--i1) } .c2 { --cat: var(--c2); --ink: var(--i2) }

/* Kopf */
.app { max-width: 760px; margin: 0 auto; padding: 14px 16px 120px; display: flex; flex-direction: column; gap: 16px }
.top { display: flex; align-items: center; gap: 12px }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -.04em; line-height: 1; margin-right: auto }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; overflow: hidden; flex: none }
.brand .logo svg { width: 100%; height: 100% }
.brand b { color: var(--accent); margin-left: 3px; font-size: .7em; vertical-align: .35em }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); flex: none }

/* Gute-Nudel-Sterne */
.star-chip { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 99px; background: var(--surface); font-weight: 800; font-variant-numeric: tabular-nums; flex: none }
.star-chip svg { color: var(--star) }
.star-chip.pop { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1) }
@keyframes pop { 40% { transform: scale(1.3) } }
.gain { display: inline-flex; align-items: center; gap: 2px; margin-left: 2px; font-size: 13px; font-weight: 800; opacity: .75; font-variant-numeric: tabular-nums }
.star-meter { display: grid; justify-items: center; gap: 10px; padding: 18px 14px; background: var(--bg); border-radius: 18px }
.star-count { display: flex; align-items: baseline; gap: 8px }
.star-count b { font-family: var(--display); font-size: 56px; line-height: 1; color: var(--star); font-variant-numeric: tabular-nums }
.star-count span { color: var(--muted); font-weight: 700 }
.star-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px }
.star-row span { color: var(--line) }
.star-row span.on { color: var(--star) }
.star-note { font-weight: 700; text-align: center }
.star-rule { margin-top: 10px }
.treats { display: grid; gap: 6px }
.treat { display: flex; gap: 6px }
.treat-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 14px; background: var(--surface-2); font-weight: 600; text-align: left; overflow-wrap: anywhere }
.treat-pick svg { color: var(--star) }
.treat-x { width: 46px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); color: var(--muted) }
.treats + .confirm { margin-top: 10px }
.treat-add { display: flex; gap: 8px; margin-top: 10px }
.treat-add input { flex: 1; min-width: 0; padding: 12px 14px }
.treat-add .secondary { width: auto; flex: none; padding: 12px 16px }
.history { list-style: none; margin: 0; padding: 0 }
.history li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line) }
.history b { color: var(--star); font-variant-numeric: tabular-nums }
.history li.spent b { color: var(--accent) }
.history span { overflow-wrap: anywhere }
.history small { color: var(--muted); font-size: 13px; white-space: nowrap }

/* Auslosen, solange nichts gezogen ist */
.draw-panel { background: var(--surface); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; gap: 18px }
.draw-panel h1 { font-size: clamp(26px, 7vw, 34px); line-height: 1.1; margin: 6px 0 8px }
.draw-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--accent); color: var(--accent-fg); font-weight: 800; font-size: 18px; border-radius: 16px; padding: 17px; box-shadow: 0 8px 24px #7fe0c426 }
.is-drawing .draw-btn svg { animation: spin 1s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }

/* Wochenend-Pause Mo–Fr: Schalter im Auslosebereich */
.weekend-switch { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface-2); border-radius: 16px; padding: 12px 14px; margin-top: -4px }
.weekend-switch > svg { color: var(--ink) }
.weekend-switch > span:not(.switch) { display: grid; flex: 1; min-width: 0 }
.weekend-switch small { font-size: 13px; color: var(--muted) }
.switch { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--line); flex: none; transition: background .2s }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); transition: transform .2s }
[aria-checked="true"] .switch { background: var(--accent) }
[aria-checked="true"] .switch::after { transform: translateX(18px); background: var(--accent-fg) }

/* Ausgeloste Aufgabe: große Karte über allen anderen */
.hero { background: radial-gradient(120% 90% at 85% 0%, #ffffff2e, transparent 60%), var(--cat); border-radius: 26px; padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 18px 40px #0007; color: #fff }
.hero.arrived { animation: land .7s cubic-bezier(.2, 1.4, .4, 1) }
@keyframes land { from { transform: translateY(60px) scale(.85); opacity: 0 } }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px }
.hero .eyebrow { color: #fff; background: #0000002e; padding: 6px 10px; border-radius: 99px; white-space: nowrap }
.hero-cat { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; opacity: .9 }
.hero-body { text-align: left; display: grid; gap: 6px; padding: 6px 2px; color: inherit }
.hero-icon { width: 72px; height: 72px; border-radius: 20px; background: #ffffff26; display: grid; place-items: center; margin-bottom: 6px }
.hero h1 { font-size: clamp(28px, 8vw, 40px); line-height: 1.05; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto }
.hero-body p { font-size: 16px; opacity: .92; white-space: pre-wrap; overflow-wrap: anywhere }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.hero-actions button { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 14px; padding: 13px 10px; font-weight: 700 }
.clear { display: flex; align-items: center; justify-content: center; gap: 6px; align-self: center; color: inherit; opacity: .8; font-size: 14px; font-weight: 600; padding: 2px 10px }
.clear-confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600 }
.clear-confirm span { flex-basis: 100%; text-align: center }
.clear-confirm button { border-radius: 12px; padding: 9px 14px; font-weight: 700 }
.light { background: #fff; color: #141d21 }
.ghost { background: #00000030; color: #fff }

/* Kategorien, Auswahl „nur / alle außer“ und Tabs */
.chips { display: flex; gap: 8px; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none }
.chips::-webkit-scrollbar { display: none }
.chips button { flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 99px; background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap }
.chips button svg { color: var(--cat) }
.chips button b { font-size: 13px; opacity: .65; font-variant-numeric: tabular-nums }
.chips button.on { background: var(--fg); color: var(--bg) }
.chips button.on[class*="c"] { background: var(--cat); color: #fff }
.chips button.on svg { color: currentColor }
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -6px }
.mode button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px; border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 600 }
.mode button.on { color: var(--fg); box-shadow: inset 0 0 0 2px var(--cat) }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 14px; padding: 4px }
.tabs button { padding: 10px; border-radius: 10px; font-weight: 700; color: var(--muted) }
.tabs button.on { background: var(--surface-2); color: var(--fg) }
.tabs span { font-size: 13px; opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums }

/* Sortierung und Zwischenüberschriften (wie Trio) */
.list { display: grid; gap: 12px }
.list-bar { display: flex; align-items: center; gap: 10px; margin: -4px 0 -2px }
.add-btn { display: flex; align-items: center; gap: 6px; padding: 8px 14px 8px 11px; border-radius: 99px; background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 800; flex: none }
.sort { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: -4px 0 -2px auto; font-size: 14px; font-weight: 600; color: var(--muted); min-width: 0 }
.list { grid-template-columns: minmax(0, 1fr) }
.list-bar .sort { margin: 0 0 0 auto; flex: 0 1 auto }
/* Neben „Neue Aufgabe“ nur das Symbol, das Wort bleibt für Screenreader */
.list-bar .sort-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.sort select { min-width: 0; max-width: 100%; text-overflow: ellipsis }
.sort select { background: var(--surface); color: var(--fg); border: 0; border-radius: 10px; padding: 7px 10px; font-weight: 600 }
.grid-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 10px 0 -2px; color: var(--fg) }
.grid-head:first-child { margin-top: 0 }
.grid-head svg { color: var(--ink) }

/* Kacheln */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)) } }
.tile { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 18px; background: var(--cat); color: #fff; padding: 12px 11px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; transition: transform .15s, opacity .2s, box-shadow .15s }
.tile:active { transform: scale(.96) }
.tile:disabled { opacity: 1 }
.tile-title { font-weight: 700; font-size: 14px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto }
.tile small { font-size: 12px; opacity: .75; margin-top: 2px }
.tile-text { display: grid }
.tile.done { background: var(--tile); color: var(--fg) }
.tile.done > svg { color: var(--ink) }
.tile.done .tile-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #95a6ab80 }
.check { position: absolute; top: 9px; right: 9px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg) }
.grid.drawing .tile { opacity: .35; transform: scale(.94) }
.grid.drawing .tile.lit { opacity: 1; transform: scale(1.07); box-shadow: 0 0 0 3px var(--accent), 0 0 30px #7fe0c499; z-index: 1 }
.hint { text-align: center; padding: 4px 0 }
.empty { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 40px 16px; color: var(--muted) }
.empty h3 { color: var(--fg); font-size: 20px }

/* Sheets */
.overlay { position: fixed; inset: 0; z-index: 10; background: #050a0cb3; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s }
@keyframes fade { from { opacity: 0 } }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px)); animation: up .32s cubic-bezier(.2, .9, .3, 1) }
@keyframes up { from { transform: translateY(100%) } }
@media (min-width: 700px) { .overlay { align-items: center } .sheet { border-radius: 26px; padding-bottom: 24px } }
.grabber { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px }
.sheet-head h2 { font-size: 24px; line-height: 1.15; margin-top: 4px; overflow-wrap: anywhere }
.sheet-head .icon-btn { background: var(--surface-2) }
.sheet-tile { height: 120px; border-radius: 18px; background: radial-gradient(90% 120% at 90% 0%, #ffffff30, transparent 60%), var(--cat); display: grid; place-items: center; color: #fff; margin-bottom: 14px }
.note { margin-bottom: 6px; white-space: pre-wrap; overflow-wrap: anywhere }
.actions { display: grid; gap: 10px; margin-top: 20px }
.primary, .secondary, .danger { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border-radius: 14px; padding: 15px; font-weight: 700 }
.primary { background: var(--accent); color: var(--accent-fg) }
.secondary { background: var(--surface-2) }
.danger { background: var(--danger); color: #2a0703 }
.text-danger { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--danger); padding: 10px; font-weight: 600 }
.confirm { display: grid; gap: 8px; background: #ff7b6b1a; border-radius: 14px; padding: 12px; text-align: center; overflow-wrap: anywhere }
.menu { display: grid; gap: 6px }
.menu button { display: flex; align-items: center; gap: 12px; padding: 15px 14px; border-radius: 14px; background: var(--surface-2); font-weight: 600; text-align: left }
.steps { padding-left: 22px; display: grid; gap: 6px; margin: 4px 0 14px }

/* Formulare */
input, textarea { width: 100%; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 14px; padding: 14px; font-size: 16px }
input:focus, textarea:focus { outline: none; border-color: var(--accent) }
textarea { min-height: 90px; resize: vertical }
::placeholder { color: var(--muted) }
form .primary { margin-top: 22px }
.cat-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
.cat-pick button { aspect-ratio: 4 / 3; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; align-content: center; gap: 6px; padding: 4px; font-size: 13px; font-weight: 600; line-height: 1.15; text-align: center }
.cat-pick button svg { color: var(--cat) }
.cat-pick button.on { background: var(--cat); color: #fff; box-shadow: 0 0 0 2px var(--fg) }
.cat-pick button.on svg { color: #fff }

/* Meldungen */
.error { color: var(--danger); margin-top: 8px; white-space: pre-wrap }
.banner { background: #ff7b6b1a; border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; align-items: center; margin: 0 }
.banner button { font-weight: 700; color: var(--fg); flex: none }
.toast { display: flex; align-items: center; gap: 14px; position: fixed; z-index: 20; left: 16px; right: 16px; width: fit-content; margin: 0 auto; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); font-weight: 700; padding: 12px 18px; border-radius: 99px; box-shadow: 0 10px 30px #0008; animation: fade .2s; max-width: 520px; text-align: left }

.toast button { font-weight: 800; color: inherit; text-decoration: underline; text-underline-offset: 3px; flex: none }
.once { text-align: left }
.once span { display: grid }
.once small { font-size: 12.5px; font-weight: 600; color: var(--muted) }

/* Anmeldung */
.login { max-width: 440px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 28px }
.login-card { background: var(--surface); border-radius: 26px; padding: 22px; display: grid; gap: 4px }
.login-card h1 { font-size: 30px; line-height: 1.1; margin-top: 18px }
.login-card .primary { margin-top: 16px }
.login-hint { margin-top: 10px }
.login-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
.login-tiles span { aspect-ratio: 2 / 1; border-radius: 14px; background: var(--cat); display: grid; place-items: center; color: #fff }

/* Schlichte Variante: alle Kacheln gleich, nur das Symbol trägt die Kategoriefarbe */
.plain .tile:not(.add) { background-color: var(--tile); color: var(--fg) }
.plain .tile:not(.add) > svg, .plain .chips button svg, .plain .cat-pick button svg { color: var(--ink) }
.plain .chips button.on[class*="c"] { background: var(--fg); color: var(--bg) }
.plain .chips button.on[class*="c"] svg { color: var(--cat) }
.plain .cat-pick button.on { background: var(--line); color: var(--fg) }
.plain .cat-pick button.on svg { color: var(--ink) }
.plain .hero { background: var(--tile); color: var(--fg); box-shadow: 0 0 0 1.5px var(--line), 0 18px 40px #0007 }
.plain .hero .eyebrow { background: var(--surface-2); color: var(--accent) }
.plain .hero-cat svg, .plain .hero-icon { color: var(--ink) }
.plain .hero-icon { background: var(--surface-2) }
.plain .ghost { background: var(--surface-2); color: var(--fg) }
.plain .sheet-tile, .plain .login-tiles span { background: var(--surface-2); color: var(--ink) }

/* Sehr schmale Handys: Kopf etwas kleiner, damit Logo, Sterne und Menü nebeneinander passen */
@media (max-width: 360px) {
  .top { gap: 8px }
  .brand { font-size: 25px; gap: 8px }
  .brand .logo { width: 30px; height: 30px }
  .star-chip { padding: 0 11px }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important } }
