/* Brezelkatze V2 – V1-Identität (Gelb, Braun, Creme, Quicksand + Bubblegum Sans), aufgeräumt */
:root {
  --yellow: #FAD586;
  --yellow-deep: #feb958;
  --cream: #faf2e1;
  --cream-deep: #f1e4c6;
  --brown: #852c09;
  --brown-deep: #5e1e05;
  --plum: #422b41;
  --ink: #2a1a12;
  --ink-soft: #6e5541;
  --line: rgba(66, 43, 65, .12);
  --green: #4f8a12;
  --green-soft: #e3f0cd;
  --red: #c8123f;
  --red-soft: #fbdce3;
  --blue: #3e5f84;
  --blue-soft: #dfe7f1;
  --christina: #b8375a;
  --johannes: #852c09;
  --shadow: 0 6px 18px -8px rgba(94, 30, 5, .35), 0 1px 2px rgba(94, 30, 5, .08);
  --radius: 18px;
  --radius-s: 12px;
  --sans: 'Quicksand', system-ui, sans-serif;
  --display: 'Bubblegum Sans', 'Quicksand', sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
}
* { box-sizing: border-box; }
svg[hidden] { display: none; }
html { background: var(--yellow); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font: 600 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--brown); text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--brown); color: var(--cream); }
input { caret-color: var(--brown); accent-color: var(--brown); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; color: var(--brown); line-height: 1.05; text-wrap: balance; letter-spacing: .005em; }
h1 { font-size: 38px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
small, .muted { color: var(--ink-soft); font-weight: 600; font-size: .85rem; }
strong { font-weight: 700; }
svg.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Rahmen */
.demo-strip { background: var(--plum); color: var(--cream); text-align: center; font-size: 12px; font-weight: 700; padding: 5px 16px; letter-spacing: .02em; }
.app-shell { max-width: 880px; margin: auto; padding: 0 var(--s4) calc(96px + env(safe-area-inset-bottom)); overflow-x: clip; }
#header { display: flex; justify-content: center; align-items: center; height: 176px; transition: height .3s; }
#header.small { height: 108px; }
#logo { height: 150px; transition: height .3s; cursor: pointer; filter: drop-shadow(0 8px 14px rgba(94, 30, 5, .25)); }
#header.small #logo { height: 88px; }
@keyframes bounce { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-26px) } }
@keyframes flip { from { transform: rotateY(0) } to { transform: rotateY(360deg) } }
@keyframes pulse { 0% { transform: scale(1) } 50% { transform: scale(1.12) } 100% { transform: scale(1) } }
@keyframes shake { 0%, 100% { transform: translateX(0) } 25% { transform: translateX(-10px) } 75% { transform: translateX(10px) } }
@keyframes rotate { from { transform: rotate(0) } to { transform: rotate(360deg) } }
.bounce { animation: bounce .9s cubic-bezier(.2, .8, .3, 1) 2; }
.flip { animation: flip .9s ease-in-out; }
.pulse { animation: pulse .9s ease 2; }
.shake { animation: shake .5s ease 2; }
.rotate { animation: rotate .9s ease-in-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.screen { animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
main { min-height: 400px; }
main:focus { outline: 0; }

/* Seitenkopf */
.page-head { text-align: center; margin: var(--s2) 0 var(--s5); }
.page-head p { color: var(--ink-soft); margin-top: var(--s1); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.section-head:first-child { margin-top: 0; }
.section-head h2 { flex: 1; }
.text-link { font-weight: 700; white-space: nowrap; font-size: .9rem; }

/* Karten */
.card { background: var(--cream); border-radius: var(--radius); padding: var(--s5) var(--s4); box-shadow: var(--shadow); margin-bottom: var(--s4); }
.card.tight { padding: var(--s4); }
.card > .section-head:first-child { margin-top: 0; }
.center { text-align: center; }
.two-col { display: grid; gap: var(--s4); }

/* Duell (V1 overall-score) */
.duel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: var(--s2); }
.duel .who { text-align: center; }
.duel .who img { width: clamp(80px, 24vw, 104px); height: auto; aspect-ratio: 1; object-fit: contain; display: block; margin: 0 auto var(--s1); }
.duel .who .name { font-family: var(--display); font-size: 19px; white-space: nowrap; }
.duel .who.c .name { color: var(--christina); }
.duel .who.j .name { color: var(--johannes); }
.duel .score { font-size: clamp(28px, 9vw, 46px); font-weight: 700; line-height: 1; padding-bottom: 30px; white-space: nowrap; }
.duel .score i { font-style: normal; color: var(--ink-soft); font-weight: 600; padding: 0 2px; }

/* Vergleichszeilen: links Christina, rechts Johannes */
.rows { display: grid; }
.row3 { display: grid; grid-template-columns: 1fr minmax(96px, auto) 1fr; align-items: center; gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.row3:first-child, .duel + .row3 { border-top: 0; }
.row3 .v { font-size: 1.55rem; font-weight: 700; text-align: center; line-height: 1.1; }
.row3 .v.c { color: var(--christina); }
.row3 .v.j { color: var(--johannes); }
.row3 .k { font-size: .8rem; font-weight: 700; color: var(--ink-soft); text-align: center; line-height: 1.2; }
.row3 .k small { display: block; font-weight: 600; font-size: .7rem; }
.streak { position: relative; display: inline-block; padding: 0 10px; }
.streak .num { position: relative; z-index: 1; text-shadow: 0 1px 0 var(--cream), 0 0 6px var(--cream); }
.flame { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -52%); z-index: 0; line-height: 1; }
.flame.small { display: inline; font-size: 1.7rem; }
.flame.medium { display: inline; font-size: 2.1rem; }
.flame.large { display: inline; font-size: 2.5rem; }
.flame.xlarge { display: inline; font-size: 2.9rem; }
.flame.xxlarge { display: inline; font-size: 3.3rem; }
@keyframes sparkle { 0%, 100% { filter: drop-shadow(0 0 0 gold); transform: scale(1) } 50% { filter: brightness(1.5) drop-shadow(0 0 22px gold); transform: scale(1.12) } }
.sparkle-animation { animation: sparkle 2s infinite; }
@keyframes celebration-flash { 0%, 50%, 100% { background: transparent } 25% { background: rgba(255, 215, 0, .35) } }
.celebration-flash { animation: celebration-flash 1s ease-out; }

/* Kennzahlen (sparsam) */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); margin-bottom: var(--s4); }
.kpi { background: var(--cream); border-radius: var(--radius-s); padding: var(--s3) var(--s3); box-shadow: var(--shadow); }
.kpi .big { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi .lbl { font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.kpi.green .big { color: var(--green); }
.kpi.red .big { color: var(--red); }
.kpi.c .big { color: var(--christina); }
.kpi.j .big { color: var(--johannes); }
.kpi.wide { grid-column: 1 / -1; }
.kv { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv span:last-child { font-weight: 700; white-space: nowrap; }
.big-number { font-size: 2.8rem; font-weight: 700; line-height: 1; }
.phrase { cursor: pointer; color: var(--brown); text-align: center; font-weight: 700; margin-top: var(--s2); font-size: .95rem; }
.phrase:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 54px; padding: 10px 22px; border-radius: 999px; font-weight: 700; font-size: 1.05rem; background: var(--yellow-deep); color: var(--ink); box-shadow: var(--shadow); transition: transform .12s, filter .12s, background .12s; text-decoration: none; }
.button:hover { filter: brightness(1.04); }
.button:active { transform: scale(.97); }
.button.primary { background: var(--brown); color: var(--cream); }
.button.primary:hover { background: var(--brown-deep); filter: none; }
.button.ghost { background: transparent; box-shadow: none; border: 2px solid var(--brown); color: var(--brown); }
.button.full { width: 100%; }
.button.small { min-height: 40px; font-size: .9rem; padding: 6px 14px; box-shadow: none; }
.under-button { text-align: center; color: var(--ink-soft); margin: var(--s2) 0 var(--s5); font-size: .9rem; }
.back { display: inline-flex; align-items: center; gap: var(--s1); font-weight: 700; color: var(--brown); padding: var(--s2) 0; margin-bottom: var(--s2); }
.back .icon { width: 18px; height: 18px; }

/* Zeitraum-Chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-bottom: var(--s3); }
.chip { min-height: 42px; padding: 6px 16px; border-radius: 999px; background: var(--cream); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: var(--s1); }
.chip.active { background: var(--brown); color: var(--cream); }
.chip-select { position: relative; }
.chip-select select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.chip-select .icon { width: 16px; height: 16px; }
.period-note { text-align: center; color: var(--ink-soft); font-size: .85rem; margin-bottom: var(--s5); }

/* Eintragen */
.date-field { display: flex; flex-direction: column; align-items: center; gap: var(--s1); margin-bottom: var(--s5); font-weight: 700; font-size: .9rem; color: var(--ink-soft); }
.date-field input { min-height: 48px; border-radius: var(--radius-s); border: 2px solid var(--yellow-deep); background: var(--cream); padding: 0 var(--s4); font-weight: 700; color: var(--ink); font-size: 1rem; }
fieldset.round { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
fieldset.round legend { font-family: var(--display); font-size: 22px; color: var(--brown); margin-bottom: var(--s2); text-align: center; width: 100%; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.choice { min-height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 700; font-size: 1.1rem; border: 3px solid transparent; transition: transform .12s, background .15s, border-color .15s; }
.choice img { width: 48px; height: 48px; margin-bottom: 4px; }
.choice:active { transform: scale(.97); }
.choice[aria-pressed="true"] { background: var(--yellow-deep); border-color: var(--brown); }
.choice .chosen { font-size: .8rem; color: var(--brown); min-height: 1.2em; }
.settlement { margin: var(--s4) 0; }
.settlement h3 { margin-bottom: var(--s2); }
.error { color: var(--red); font-weight: 700; min-height: 1.4em; text-align: center; margin: var(--s2) 0; font-size: .9rem; }

/* Verlauf */
.history { display: grid; }
.history-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.history-row:first-child { border-top: 0; }
.history-row .date { font-weight: 700; }
.history-row .meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; margin-top: 2px; }
.history-row .result { font-size: 1.5rem; font-weight: 700; white-space: nowrap; line-height: 1; text-align: right; }
.history-row .result b { font-weight: 700; }
.history-row .result b.c { color: var(--christina); }
.history-row .result b.j { color: var(--johannes); }
.history-row .result i { font-style: normal; color: var(--ink-soft); padding: 0 3px; font-weight: 600; }
.dots { display: flex; gap: 4px; justify-content: flex-end; margin-top: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--johannes); }
.dots i.c { background: var(--christina); }
.tag { display: inline-block; font-size: .7rem; padding: 1px 7px; border-radius: 999px; background: var(--cream-deep); color: var(--ink-soft); font-weight: 700; }
.pay { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; }
.pay .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.pay.open { color: var(--red); }
.pay.reported { color: var(--blue); }
.pay.confirmed { color: var(--green); }

/* Forderungen */
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.status .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.status.open { background: var(--red-soft); color: var(--red); }
.status.reported { background: var(--blue-soft); color: var(--blue); }
.status.confirmed { background: var(--green-soft); color: var(--green); }
.claim { margin-bottom: var(--s3); }
.claim .head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); }
.claim .head .who { font-weight: 700; font-size: 1.05rem; }
.claim .when { display: block; margin-top: 1px; }
.claim .amt { font-size: 1.7rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.claim .status { margin-top: var(--s2); }
.claim .actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.claim .actions .button { flex: 1; min-height: 48px; font-size: .95rem; padding: 8px 12px; }
.claim .done { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.overdue { color: var(--red); }
.purpose { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); background: var(--cream-deep); border-radius: var(--radius-s); padding: var(--s2) var(--s3); margin-top: var(--s3); font-size: .85rem; }
.purpose code { font-family: var(--sans); font-weight: 700; }
.notice { display: flex; align-items: center; gap: var(--s2); background: var(--green-soft); color: var(--green); border-radius: var(--radius-s); padding: var(--s3) var(--s4); font-weight: 700; }
.notice.warn { background: var(--red-soft); color: var(--red); }
.notice.soft { background: var(--cream-deep); color: var(--ink-soft); }
.checkline { display: flex; align-items: center; gap: var(--s3); }
.checkline input { width: 20px; height: 20px; }
.checkline small { display: block; }

/* Diagramme */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-top: var(--s2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--johannes); }
.legend i.c { background: var(--christina); }
.legend i.x { background: linear-gradient(135deg, var(--christina) 50%, var(--johannes) 50%); }
.form-strip { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.form-strip span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--cream); background: var(--johannes); }
.form-strip span.c { background: var(--christina); }
.form-days { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }
.form-days .d { display: flex; flex-direction: column; gap: 3px; }
.form-days .d i { width: 18px; height: 18px; border-radius: 4px; background: var(--johannes); display: block; }
.form-days .d i.c { background: var(--christina); }
.heat-wrap { overflow-x: auto; padding-bottom: var(--s1); }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; width: max-content; margin: auto; }
.heat i { width: 14px; height: 14px; border-radius: 3px; background: rgba(66, 43, 65, .08); }
.heat i.c { background: var(--christina); }
.heat i.j { background: var(--johannes); }
.heat i.x { background: linear-gradient(135deg, var(--christina) 50%, var(--johannes) 50%); }
.heat i.today { outline: 2px solid var(--ink); outline-offset: -1px; }
.bars { display: grid; gap: var(--s2); }
.bar-row { display: grid; grid-template-columns: 52px 1fr 48px; align-items: center; gap: var(--s2); font-size: .8rem; font-weight: 700; }
.bar-row .track { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: rgba(66, 43, 65, .08); }
.bar-row .track span { height: 100%; background: var(--christina); }
.bar-row .track span + span { background: var(--johannes); }
.bar-row .r { text-align: right; color: var(--ink-soft); }
table.plain { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.plain th, table.plain td { padding: 7px 4px; text-align: right; border-top: 1px solid var(--line); }
table.plain thead th { border-top: 0; font-size: .75rem; color: var(--ink-soft); padding-top: 0; }
table.plain th:first-child, table.plain td:first-child { text-align: left; }
table.plain td.c { color: var(--christina); font-weight: 700; }
table.plain td.j { color: var(--johannes); font-weight: 700; }

/* Navigation */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--cream); box-shadow: 0 -6px 20px -8px rgba(94, 30, 5, .35); padding: 6px var(--s2) calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: .75rem; font-weight: 700; color: var(--ink-soft); padding: 6px 20px; border-radius: 14px; position: relative; min-width: 84px; transition: background .15s, color .15s; }
.bottom-nav a .icon { width: 24px; height: 24px; }
.bottom-nav a[aria-current="page"] { background: var(--yellow-deep); color: var(--ink); }
#open-badge:not(:empty) { position: absolute; top: 2px; right: 12px; background: var(--red); color: #fff; font-size: .68rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

#footer { display: flex; justify-content: center; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s6) 0 var(--s2); font-size: .8rem; color: var(--ink-soft); }
#footer .heart { color: var(--brown); }
#footer button { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 700; color: var(--brown); font-size: .8rem; }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: var(--plum); color: var(--cream); padding: var(--s3) var(--s4); border-radius: var(--radius-s); font-weight: 700; opacity: 0; transition: .2s cubic-bezier(.2, .8, .2, 1); max-width: min(90vw, 420px); z-index: 6; pointer-events: none; font-size: .9rem; text-align: center; box-shadow: var(--shadow); }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .two-col { grid-template-columns: 1fr 1fr; align-items: start; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .kpi.wide { grid-column: span 2; }
  .bottom-nav { max-width: 420px; margin: auto; border-radius: 18px 18px 0 0; }
  h1 { font-size: 44px; }
}
@media (max-width: 380px) {
  .duel .score { font-size: 38px; }
  .duel .who img { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
.form-gap { margin-top: var(--s4); }
.money-table { margin-top: var(--s4); }
.sync { display: inline-flex; align-items: center; gap: 4px; background: none; }
.sync .icon { width: 16px; height: 16px; }
.login-choices { margin-bottom: var(--s4); }
.login-choices .choice { position: relative; cursor: pointer; }
.login-choices .choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.login-choices .choice:has(input:checked) { background: var(--yellow-deep); border-color: var(--brown); }
.login-choices .choice:has(input:focus-visible) { outline: 3px solid var(--plum); outline-offset: 3px; }
.date-field input[type="password"] { width: min(100%, 260px); }
[hidden] { display: none !important; }
a.history-row { color: inherit; text-decoration: none; border-radius: var(--radius-s); transition: background .12s; }
a.history-row:hover { background: var(--cream-deep); }
.c-text { color: var(--christina); } .j-text { color: var(--johannes); }
.actions-row { display: flex; gap: var(--s2); }
.actions-row .button { flex: 1; }
.button.danger { border-color: var(--red); color: var(--red); }
.balance .big-number { margin-top: var(--s1); }
.balance .phrase { text-align: left; margin-top: var(--s2); }
.balance-meta { font-size: .8rem; color: var(--ink-soft); margin-top: var(--s2); }
.balance .total-line { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.big-number.muted { color: var(--ink-soft); }
