/* Heimspiel – Stylesheet
   Look: Spielbrett – dicke Konturen, Versatzschatten, bonbonbunte Flächen. */

@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url("fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  --ink: #1E1A3C;
  --ink-soft: #3B3760;
  --muted: #5A5677;
  --bg: #F3F1FF;
  --white: #FFFFFF;
  --violet: #5B3FD9;
  --violet-dark: #4A2FC4;
  --yellow: #FFC93C;
  --coral: #FF6F59;
  --mint: #3DD6A3;
  --sky: #4CB8FF;
  --lilac: #ECE6FF;
  --track: #ECE9FB;
  --yellow-soft: #FFF4D1;
  --mint-soft: #DDF8EE;
  --coral-soft: #FFE2DC;
  --sky-soft: #DCEFFF;
  --border: 3px solid var(--ink);
  --radius: 22px;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
  --font-head: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(32px, 5vw, 44px); }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 21px; }
p { margin: 0; }
a { color: var(--violet-dark); font-weight: 700; }
a:hover { color: #2E1A8F; }
img, svg { max-width: 100%; }
.icon { flex-shrink: 0; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 1000px; }
main { flex: 1; }
.page { padding-top: 28px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { color: var(--ink-soft); font-size: 18px; margin-top: 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Header ---------- */
.site-header { background: var(--white); border-bottom: var(--border); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--violet); color: var(--white); display: flex; align-items: center; justify-content: center; border: var(--border); }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 25px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nav a { padding: 9px 15px; border-radius: 12px; border: 3px solid transparent; color: var(--ink); text-decoration: none; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--lilac); }
.nav a[aria-current="page"] { background: var(--violet); color: var(--white); border-color: var(--ink); }
.user-box { display: flex; align-items: center; gap: 10px; }
.points-pill { padding: 7px 14px; border-radius: 999px; background: var(--yellow); border: var(--border); font-weight: 800; white-space: nowrap; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 10px); background: var(--white); border: var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 8px; min-width: 210px; display: flex; flex-direction: column; z-index: 30; }
.user-menu .menu a, .user-menu .menu button { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font: inherit; font-weight: 700; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--lilac); }
.menu-head { padding: 8px 12px 10px; border-bottom: 2px solid var(--track); margin-bottom: 6px; }

/* Mobile Navigation unten */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .site-header .nav-app { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--white); border-top: var(--border);
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 12px; color: var(--ink); text-decoration: none; font-size: 11.5px; font-weight: 800; border: 2px solid transparent; }
  .bottom-nav a[aria-current="page"] { background: var(--violet); color: var(--white); border-color: var(--ink); }
  body.app { padding-bottom: 84px; }
  .brand-name { font-size: 21px; }
  .brand-mark { width: 38px; height: 38px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 14px; border: var(--border);
  background: var(--white); color: var(--ink); font: inherit; font-weight: 800; text-decoration: none;
  cursor: pointer; transition: transform .08s ease, box-shadow .08s ease; white-space: nowrap;
}
.btn:hover { color: var(--ink); transform: translate(-1px, -1px); }
.btn:active { transform: translate(2px, 2px); box-shadow: none !important; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.btn-primary { background: var(--violet); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { color: var(--white); }
.btn-yellow { background: var(--yellow); box-shadow: var(--shadow-sm); }
.btn-coral { background: var(--coral); box-shadow: var(--shadow-sm); }
.btn-mint { background: var(--mint); }
.btn-lg { min-height: 56px; padding: 14px 28px; font-size: 18px; border-radius: 16px; }
.btn-sm { min-height: 44px; padding: 8px 14px; border-radius: 12px; font-size: 15px; }
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }
.inline-form { display: inline; margin: 0; }

/* ---------- Karten ---------- */
.card { background: var(--white); border: var(--border); border-radius: var(--radius); padding: 22px; }
.card-shadow { box-shadow: var(--shadow); }
.card-yellow { background: var(--yellow); }
.card-violet { background: var(--violet); color: var(--white); }
.card-violet .muted { color: #E8E5FA; }
.card-mint { background: var(--mint); }
.card-soft-yellow { background: var(--yellow-soft); }
.card-soft-mint { background: var(--mint-soft); }
.card-soft-coral { background: var(--coral-soft); }
.card-soft-sky { background: var(--sky-soft); }
.card-lilac { background: var(--lilac); }
.card-dashed { background: transparent; border-style: dashed; }
.card h2 + p, .card h3 + p { margin-top: 6px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--white); color: var(--ink); border: 2px solid var(--ink); font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.badge-yellow { background: var(--yellow); }
.badge-mint { background: var(--mint); }
.badge-coral { background: var(--coral); }
.badge-lilac { background: var(--lilac); }
.badge-dark { background: var(--ink); color: var(--white); }

.layout-2 { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.layout-2 > .main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.layout-2 > .side-col { flex: 1 1 330px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-wide { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ---------- Statistik ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--white); border: var(--border); border-radius: 20px; padding: 16px 18px; }
.stat-label { font-weight: 700; color: var(--muted); }
.stat-value { font-family: var(--font-head); font-weight: 700; font-size: 38px; line-height: 1.1; }
.stat-value.accent { color: var(--violet); }

/* ---------- Avatare & Fortschritt ---------- */
.avatar { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--ink); }
.avatar-lg { width: 76px; height: 76px; border-width: 3px; font-family: var(--font-head); font-size: 30px; }
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.progress { height: 14px; border-radius: 999px; background: var(--track); border: 2px solid var(--ink); overflow: hidden; flex: 1; }
.progress > span { display: block; height: 100%; background: var(--violet); }
.progress-lg { height: 22px; border-width: 3px; background: var(--white); }

/* ---------- Rangliste ---------- */
.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-no { width: 24px; font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--muted); text-align: center; }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.rank-pts { font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.rank-row.me .rank-main > strong::after { content: " (du)"; font-weight: 600; color: var(--muted); }

/* ---------- Aufgabenliste ---------- */
.task { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; border: var(--border); background: var(--white); }
.task.is-done { background: var(--mint-soft); }
.task.is-done .task-name { text-decoration: line-through; color: var(--muted); }
.task-chip { width: 14px; height: 42px; border-radius: 6px; border: 2px solid var(--ink); flex-shrink: 0; }
.task-body { flex: 1; min-width: 150px; display: flex; flex-direction: column; }
.task-name { font-weight: 800; font-size: 17px; }
.task-meta { font-size: 14px; color: var(--muted); font-weight: 600; }
.task-pts { font-family: var(--font-head); font-weight: 700; font-size: 20px; white-space: nowrap; }
.task-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Tabelle Tätigkeiten ---------- */
.table-card { background: var(--white); border: var(--border); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th { background: var(--ink); color: var(--white); text-align: left; padding: 12px 16px; font-size: 14px; letter-spacing: .3px; }
.table td { padding: 12px 16px; border-bottom: 2px solid var(--track); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-editing td { background: var(--yellow-soft); }
.table tr.is-inactive td { opacity: .55; }
.table .num { text-align: right; font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 6px; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.input, .select, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: var(--border); background: var(--white);
  color: var(--ink); font: inherit; font-weight: 600; min-height: 50px;
}
.hint { font-size: 14px; color: var(--muted); font-weight: 600; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 800; padding: 0; margin-bottom: 8px; }
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 12px; border: var(--border); background: var(--white); font-weight: 800; cursor: pointer; }
.choice input:checked + span { background: var(--ink); color: var(--white); }
.choice input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--violet); flex-shrink: 0; }
.check-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.range-wrap { display: flex; flex-direction: column; gap: 6px; }
.range-wrap input[type=range] { width: 100%; accent-color: var(--violet); height: 28px; }
.range-value { font-family: var(--font-head); font-size: 26px; color: var(--violet); }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 6px; padding: 6px; background: var(--white); border: var(--border); border-radius: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 12px; border: 3px solid transparent; color: var(--ink); text-decoration: none; font-weight: 800; }
.tabs a[aria-current="true"], .tabs a[aria-current="page"] { background: var(--violet); color: var(--white); border-color: var(--ink); }

/* ---------- Flash ---------- */
.flashes { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.flash { padding: 14px 18px; border-radius: 16px; border: var(--border); font-weight: 700; background: var(--white); box-shadow: var(--shadow-sm); }
.flash-success { background: var(--mint); }
.flash-error { background: var(--coral); }
.flash-info { background: var(--yellow-soft); }

/* ---------- Startseite ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; padding: 56px 0 56px; }
.hero-text { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero-text h1 { font-size: clamp(42px, 7vw, 64px); line-height: 1.02; }
.hero-text h1 span { color: var(--violet); }
.hero-text p { font-size: 20px; color: var(--ink-soft); max-width: 520px; }
.hero-art { flex: 1 1 400px; min-width: 0; position: relative; padding: 26px 8px; }
.hero-board { transform: rotate(-1.5deg); }
.sticker { position: absolute; padding: 10px 16px; border-radius: 16px; border: var(--border); box-shadow: var(--shadow-sm); font-weight: 800; }
.sticker-1 { right: 0; top: 0; background: var(--mint); transform: rotate(4deg); }
.sticker-2 { left: 0; bottom: 0; background: var(--coral); transform: rotate(-3deg); }
.band { background: var(--violet); border-top: var(--border); border-bottom: var(--border); }
.band h2 { color: var(--white); font-size: clamp(30px, 4vw, 44px); }
.section { padding: 60px 0; display: flex; flex-direction: column; gap: 28px; }
.step-no { width: 48px; height: 48px; border-radius: 14px; border: var(--border); display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 22px; }
.feature { display: flex; gap: 16px; align-items: flex-start; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--ink-soft); }
.cta { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; padding: 40px; }
.cta h2 { font-size: clamp(28px, 4vw, 40px); }

/* ---------- Bestenliste ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.podium-place { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.podium-place strong { font-size: 16px; overflow-wrap: anywhere; }
.podium-block { width: 100%; border: var(--border); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; }
.podium-block .place { font-family: var(--font-head); font-size: 44px; line-height: 1; }
.podium-1 .podium-block { height: 170px; background: var(--yellow); box-shadow: 6px 0 0 var(--ink); }
.podium-2 .podium-block { height: 125px; background: var(--sky-soft); }
.podium-3 .podium-block { height: 95px; background: var(--coral-soft); }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 2px solid var(--track); }
.lb-row:last-child { border-bottom: 0; }
.lb-row.is-me { background: var(--yellow-soft); }

/* ---------- Auth ---------- */
.auth-wrap { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; padding: 48px 0; }
.auth-intro { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.auth-intro h1 { font-size: clamp(36px, 6vw, 52px); }
.auth-card { flex: 1 1 400px; min-width: 0; max-width: 500px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #E8E5FA; margin-top: auto; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-top: 24px; padding-bottom: 24px; font-weight: 600; }
.site-footer a { color: #E8E5FA; }
body.app .site-footer { display: none; }

.empty { text-align: center; padding: 28px; color: var(--muted); font-weight: 700; }
.member-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row .input { flex: 1 1 200px; min-width: 0; }
.legal { max-width: 760px; }
.legal h2 { margin-top: 18px; }
@media (max-width: 520px) {
  body { font-size: 16px; }
  .card { padding: 18px; }
  .cta { padding: 26px; }
  .task-actions { width: 100%; justify-content: flex-end; }
  .podium-block .place { font-size: 34px; }
  .podium-1 .podium-block { height: 140px; }
  .podium-2 .podium-block { height: 105px; }
  .podium-3 .podium-block { height: 80px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
.choice input:checked + .swatch { color: var(--ink); box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--ink); }
.rank-main .progress { flex: none; }
.card-violet .choice input:not(:checked) + span { color: var(--ink); }

/* ---------- Version 2: Erfolge, Profilfotos, Katalog ---------- */
.avatar.has-photo { overflow: hidden; padding: 0; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-xl { width: 128px; height: 128px; border-width: 3px; font-family: var(--font-head); font-size: 52px; }
@media (max-width: 860px) { .bottom-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); } .bottom-nav a { font-size: 10.5px; } }

.tag-medal { display: inline-flex; vertical-align: -2px; color: #B07A00; margin-left: 2px; }
.partner-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border: 3px dashed #C9C3EE; border-radius: 16px; font-weight: 800; }
.partner-bar .select { width: auto; flex: 1 1 200px; min-height: 44px; padding: 8px 12px; }
.partner-bar.is-active { border-style: solid; border-color: var(--ink); background: var(--yellow-soft); }

.badge-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.badge-card { background: var(--white); border: var(--border); border-radius: var(--radius); padding: 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.badge-card.is-unlocked { box-shadow: var(--shadow-sm); background: var(--yellow-soft); }
.badge-card.is-locked .badge-img { filter: grayscale(1); opacity: .45; }
.badge-img { width: 120px; height: 120px; }
.badge-body { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.badge-body h3 { font-size: 19px; }
.badge-body p { color: var(--ink-soft); font-size: 15px; line-height: 1.4; }
.owners { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }

.badge-celebration { background: var(--yellow); display: flex; flex-direction: column; gap: 14px; animation: pop .35s ease-out; }
.badge-celebration-list { display: flex; flex-wrap: wrap; gap: 14px; }
.badge-celebration-item { display: flex; gap: 14px; align-items: center; background: var(--white); border: var(--border); border-radius: 18px; padding: 12px 16px; flex: 1 1 280px; }
.badge-celebration-item .badge { margin-top: 6px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .badge-celebration { animation: none; } }

.catalog-group { border: 3px solid var(--ink); border-radius: 16px; padding: 12px 16px; }
.catalog-group summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; list-style: none; }
.catalog-group summary::-webkit-details-marker { display: none; }
.catalog-group summary::before { content: "+"; font-family: var(--font-head); font-weight: 700; width: 18px; }
.catalog-group[open] summary::before { content: "–"; }
.mini-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.mini-badges img { width: 34px; height: 34px; }
.photo-box { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
