@font-face { font-family: "Bricolage"; src: url("/static/display.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #f5f0e8; --card: #fffdf9; --ink: #211d2e; --muted: #7a7385; --line: #e6dfd3;
  --c0: #ee6a4c; --c0-soft: #fde6df; --c1: #1d9a94; --c1-soft: #d9f1ee;
  --accent: #5b4bdb; --err: #c8372d; --ok: #1f8a5b;
  --shadow: 0 1px 2px rgba(33,29,46,.06), 0 8px 24px -12px rgba(33,29,46,.18);
  --r: 18px; --display: "Bricolage", ui-rounded, "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#16131d; --card:#201c2b; --ink:#f1ecf7; --muted:#9d96ab; --line:#322d40;
    --c0:#ff8266; --c0-soft:#3a2420; --c1:#3dc4bc; --c1-soft:#16312f; --accent:#9b8cff; --err:#ff7a70; --ok:#4cd698;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.7); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; }
body.app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1, h2, .brand, .pts, .winner, .tile-stat .v, .invite-code { font-family: var(--display); letter-spacing: -.01em; }
h1 { font-size: 1.75rem; line-height: 1.15; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; } .row.between { justify-content: space-between; align-items: center; }
[hidden] { display: none !important; }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.wrap { max-width: 640px; margin: 0 auto; padding: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.5rem; color: var(--ink); text-decoration: none; }
.brand.big { font-size: 2.6rem; justify-content: center; width: 100%; }
.mark { position: relative; width: 1.5em; height: .9em; display: inline-block; }
.mark i { position: absolute; top: 0; width: .9em; height: .9em; border-radius: 50%; mix-blend-mode: multiply; }
.mark i.c0 { left: 0; background: var(--c0); } .mark i.c1 { right: 0; background: var(--c1); }
@media (prefers-color-scheme: dark) { .mark i { mix-blend-mode: screen; opacity: .9; } }
.who { display: flex; align-items: center; gap: .3rem; text-decoration: none; color: var(--ink); }
.who-name { margin-left: .35rem; font-size: .9rem; color: var(--muted); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; font: 700 .85rem var(--display); color: #fff; background: var(--muted); flex: none; }
.dot.lg { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; }
.dot.c0, .seg.c0, .fill.c0 { background: var(--c0); } .dot.c1, .seg.c1, .fill.c1 { background: var(--c1); }
.c0-text { color: var(--c0); } .c1-text { color: var(--c1); }
.people { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.people li { display: flex; align-items: center; gap: .8rem; font-weight: 600; }
.people .ghost .dot { background: transparent; border: 2px dashed var(--line); color: var(--muted); }

/* Tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around; padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); }
.tabs a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem 0; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ink); } .tabs a.on svg { stroke: var(--accent); }

/* Formulare & Buttons */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label small { font-weight: 400; }
input, select { font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: .65rem .8rem; width: 100%; }
input:focus-visible, select:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
input.code { font: 700 1.3rem var(--display); letter-spacing: .25em; text-transform: uppercase; text-align: center; }
fieldset { border: 0; padding: 0; margin: 0; } legend { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; font: 600 .95rem system-ui; padding: .7rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.small { padding: .4rem .8rem; font-size: .82rem; }
.link { background: none; border: 0; padding: .3rem; font: inherit; font-size: .9rem; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--err); }
.error { color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); padding: .6rem .8rem; border-radius: 12px; margin: 0; font-size: .92rem; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin: 0 0 1rem; padding: .7rem 1rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: pop .35s ease-out; }
.notice.done { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.stepper { display: flex; gap: .5rem; } .stepper input { text-align: center; font: 700 1.2rem var(--display); }
.stepper button { flex: none; width: 3rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 1.3rem; cursor: pointer; }
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: .4rem; }
.ico { display: block; } .ico input { position: absolute; opacity: 0; pointer-events: none; }
.ico span { display: grid; place-items: center; height: 3rem; font-size: 1.5rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); cursor: pointer; }
.ico input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); transform: scale(1.06); }
.ico input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.custom label { flex: 1; min-width: 7rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; } .pagehead h1 { margin: 0; }
.crumb { margin: 0 0 .25rem; } .crumb a { text-decoration: none; font-size: .9rem; }

/* Anmeldung */
body.plain { display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: .75rem; } .auth.wide { max-width: 640px; }
.auth h1 { text-align: center; margin: 0; } .lead { text-align: center; margin: 0 0 .5rem; }
.two { display: grid; gap: 1rem; } @media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } }
.invite-code { font-size: 2.4rem; font-weight: 800; letter-spacing: .2em; text-align: center; margin: .2rem 0; padding: .6rem; border-radius: 14px; background: var(--bg); border: 2px dashed var(--line); }

/* Duell */
.duel { margin-bottom: 1.25rem; }
.duel-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: .45rem; }
.side { display: flex; flex-direction: column; } .side:last-child { align-items: flex-end; }
.side .pts { font-size: 2.6rem; font-weight: 800; line-height: 1; } .side .nm { font-size: .85rem; font-weight: 600; }
.side.c0 { color: var(--c0); } .side.c1 { color: var(--c1); }
.bar { display: flex; gap: 4px; height: 14px; }
.seg { display: block; min-width: 10px; flex-basis: 0; border-radius: 99px; transition: flex-grow .7s cubic-bezier(.2,.9,.3,1.2); }
.duel p { margin: .5rem 0 0; }
.hint { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: .7rem 1rem; margin: 0 0 1rem; font-size: .92rem; }

/* Aufgaben-Karten */
.sect { display: flex; align-items: center; gap: .5rem; margin: 1.4rem 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-family: system-ui; font-weight: 700; }
.count { background: var(--line); color: var(--ink); border-radius: 99px; padding: 0 .55rem; font-size: .75rem; }
.cards { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.task { display: flex; align-items: center; gap: .8rem; padding: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); animation: rise .4s ease-out backwards; }
.task:nth-child(2) { animation-delay: .04s; } .task:nth-child(3) { animation-delay: .08s; } .task:nth-child(4) { animation-delay: .12s; }
.task.late { border-color: color-mix(in srgb, var(--c0) 55%, var(--line)); }
.task .tile { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; font-size: 1.5rem; border-radius: 14px; background: var(--bg); }
.task.late .tile { background: var(--c0-soft); }
.task .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task .title { font-weight: 650; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.task .meta, .timeline .meta { font-size: .8rem; color: var(--muted); }
.late-tag { color: var(--c0); font-weight: 700; }
.task.waiting { box-shadow: none; opacity: .72; }
.pill { flex: none; font: 700 .85rem var(--display); background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: .15rem .6rem; }
.done-btn { display: flex; flex-direction: column; align-items: center; min-width: 4.6rem; padding: .5rem .7rem; border: 0; border-radius: 14px; cursor: pointer; background: var(--ink); color: var(--bg); transition: transform .12s; }
.done-btn:hover { transform: scale(1.04); } .done-btn:active { transform: scale(.95); }
.done-btn .plus { font: 800 1.2rem/1 var(--display); } .done-btn .lbl { font-size: .68rem; opacity: .8; }
.htmx-request .done-btn { opacity: .5; pointer-events: none; }
.empty, .all-done { text-align: center; padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; } .all-done { display: block; font-size: 1.1rem; }

/* Verlauf */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.timeline li { display: flex; align-items: center; gap: .8rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); animation: rise .35s ease-out backwards; }
.timeline .body { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Auswertung */
.reveal { text-align: center; padding: 2rem 1rem 1.6rem; border-radius: 26px; margin: .5rem 0 1rem; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.reveal.c0 { background: linear-gradient(160deg, var(--c0-soft), var(--card) 70%); } .reveal.c1 { background: linear-gradient(160deg, var(--c1-soft), var(--card) 70%); }
.trophy { font-size: 3.4rem; animation: bounce 1s .2s cubic-bezier(.3,1.6,.5,1) backwards; }
.kicker { margin: .2rem 0 0; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.winner { font-size: 2.6rem; margin: .1rem 0; animation: rise .7s .45s ease-out backwards; } .reveal.c0 .winner { color: var(--c0); } .reveal.c1 .winner { color: var(--c1); }
.sub { margin: 0; color: var(--muted); animation: rise .7s .65s ease-out backwards; }
.pbar { display: flex; flex-direction: column; gap: .3rem; }
.track { height: 12px; background: var(--bg); border-radius: 99px; overflow: hidden; } .fill { display: block; height: 100%; border-radius: 99px; animation: grow 1s .3s cubic-bezier(.2,.8,.2,1) backwards; transform-origin: left; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
.tile-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem; display: flex; flex-direction: column; }
.tile-stat .v { font-size: 1.7rem; font-weight: 800; line-height: 1.1; } .tile-stat .l { font-size: .8rem; color: var(--muted); }
.dist { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .92rem; } .dist th, .dist td { padding: .45rem .3rem; border-bottom: 1px solid var(--line); text-align: left; }
.dist .num { text-align: right; font-variant-numeric: tabular-nums; } .dist th { font-size: .78rem; color: var(--muted); }

/* Animationen */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes bounce { from { opacity: 0; transform: translateY(-30px) scale(.6) rotate(-12deg); } }
@keyframes grow { from { transform: scaleX(0); } }
.float-pts { position: fixed; z-index: 50; pointer-events: none; font: 800 1.6rem var(--display); color: var(--ok); animation: floatup 1s ease-out forwards; text-shadow: 0 2px 10px rgba(0,0,0,.15); }
@keyframes floatup { to { transform: translateY(-70px); opacity: 0; } }
.confetti { position: fixed; z-index: 49; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: confetti 900ms ease-out forwards; }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; } .confetti, .float-pts { display: none; } }
@media (min-width: 700px) { .wrap { padding-top: 1.5rem; } .tiles { grid-template-columns: repeat(3, 1fr); } }
