:root {
  --bg: #f1f2fb; --card: #fff; --ink: #1a1b3a; --muted: #63668a; --line: #e3e5f4;
  --head1: #14133f; --head2: #3b2f9e; --accent: #4f46e5; --accent2: #7c3aed; --accent-ink: #fff; --gold: #f59e0b; --gold2: #fde68a;
  --pitch1: #1d2a5f; --pitch2: #233172; --pitchline: rgba(255,255,255,.28);
  --tw: #f59e0b; --abw: #38bdf8; --mf: #a78bfa; --st: #fb7185;
  --err: #c62828; --warn: #a15c00; --shadow: 0 1px 2px rgba(26,27,58,.05), 0 10px 30px rgba(26,27,58,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c0d22; --card: #16173a; --ink: #eceefd; --muted: #9a9dc6; --line: #2a2c58; --head1: #0f0e33; --head2: #2c2390; --accent: #818cf8; --accent2: #a78bfa; --accent-ink: #11123a; --pitch1: #131b47; --pitch2: #19234f; --err: #ff8a80; --warn: #fbbf24; --shadow: 0 10px 30px rgba(0,0,0,.25); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 340px; z-index: -1; background: radial-gradient(900px 340px at 80% -10%, rgba(124,58,237,.18), transparent 70%), radial-gradient(700px 300px at 0% 0%, rgba(79,70,229,.14), transparent 70%); }

.top { position: sticky; top: 0; z-index: 10; background: linear-gradient(135deg, var(--head1), var(--head2)); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 6px 24px rgba(20,19,63,.35); }
.brand { display: flex; align-items: center; gap: 11px; } .brand img { border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.top h1 { font-size: 1.2rem; margin: 0; letter-spacing: .2px; line-height: 1.1; } .top h1 span { color: var(--gold2); }
.top small { opacity: .7; font-size: .74rem; }
main { max-width: 760px; margin: 0 auto; padding: 18px 16px 70px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px; margin-bottom: 18px; box-shadow: var(--shadow); animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }
h2 { font-size: 1.08rem; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
h3.center { text-align: center; margin-top: 4px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-size: .82rem; box-shadow: 0 3px 8px rgba(79,70,229,.4); }
label { display: block; margin: 12px 0; font-size: .86rem; color: var(--muted); font-weight: 500; }
label.check { display: flex; gap: 9px; align-items: center; color: var(--ink); font-size: .95rem; font-weight: 400; }
input, select, button, textarea { font: inherit; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; margin-top: 6px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--bg); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.25); }
textarea { font: .8rem monospace; word-break: break-all; }
button { border: 0; border-radius: 13px; padding: 12px 16px; cursor: pointer; transition: transform .06s, opacity .15s, box-shadow .15s; }
button:active { transform: scale(.98); }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 650; width: 100%; margin-top: 12px; padding: 14px 16px; box-shadow: 0 8px 20px rgba(79,70,229,.38); letter-spacing: .2px; }
button.primary:hover { box-shadow: 0 10px 26px rgba(79,70,229,.5); }
button.primary:disabled { opacity: .55; box-shadow: none; }
button.ghost { background: rgba(255,255,255,.14); color: #fff; padding: 8px 14px; font-size: .85rem; }
details > summary { cursor: pointer; margin-top: 14px; color: var(--accent); }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .hint { color: var(--muted); font-size: .82rem; } .hint.warn { color: var(--warn); }
.err { color: var(--err); min-height: 1.2em; margin: 8px 0 0; }

.welcome { text-align: center; padding: 6px 0 4px; }
.welcome img { border-radius: 20px; box-shadow: 0 10px 28px rgba(79,70,229,.4); }
.welcome h2 { justify-content: center; font-size: 1.3rem; margin: 14px 0 10px; }
.perks { list-style: none; margin: 0 auto 8px; padding: 0; max-width: 440px; text-align: left; }
.perks li { padding: 8px 0 8px 30px; position: relative; font-size: .9rem; color: var(--muted); border-bottom: 1px dashed var(--line); }
.perks li:last-child { border: 0; } .perks li b { color: var(--ink); }
.perks li::before { content: "★"; position: absolute; left: 4px; color: var(--gold); }

.rulebox { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 13px; padding: 10px 14px; margin: 12px 0 4px; font-size: .88rem; }
.rulebox ul { margin: 6px 0 0; padding-left: 18px; } .rulebox li { margin: 3px 0; }
.rulebox a { color: var(--accent); }
.rawd { margin-top: 6px; } .rawd summary { font-size: .78rem; color: var(--muted); margin-top: 4px; } .rawd pre { max-height: 180px; overflow: auto; margin: 6px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chips label { margin: 0; } .chips input { display: none; }
.chips span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); cursor: pointer; font-size: .88rem; font-variant-numeric: tabular-nums; font-weight: 600; transition: all .12s; }
.chips input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2), var(--gold)); transition: width .2s; }

.pl, .pl { cursor: pointer; }
body.noscroll { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(8,8,30,.6); backdrop-filter: blur(3px); animation: fade .2s both; }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 90vh; overflow: auto; background: var(--card); color: var(--ink); border-radius: 24px 24px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.4); animation: slide .25s ease both; }
@media (min-width: 640px) { .sheet-card { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; max-height: 86vh; border-radius: 24px; transform: translate(-50%, -50%); animation: pop .2s ease both; } }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } }
.sheet-x { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--bg); color: var(--ink); }
.shead { display: flex; gap: 14px; align-items: center; padding-right: 40px; }
.shead h2 { margin: 0 0 2px; font-size: 1.25rem; }
.ph.big { width: 76px; height: 76px; flex: none; margin: 0; font-size: 1.1rem; }
.ph.big img { height: 130px; top: -12px; }
.ph.p1 { --c: var(--tw); } .ph.p2 { --c: var(--abw); } .ph.p3 { --c: var(--mf); } .ph.p4 { --c: var(--st); }
.mini { width: 16px; height: 16px; vertical-align: -3px; }
.forecast { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; align-items: center; background: var(--bg); border-radius: 14px; padding: 11px 14px; margin: 14px 0 10px; }
.forecast small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.forecast b { font-size: 1.4rem; color: var(--accent); }
.chips2 { display: flex; flex-wrap: wrap; gap: 6px; } .chip2 { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: .76rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kpis > div { background: var(--bg); border-radius: 12px; padding: 8px 11px; } .kpis b { display: block; font-size: 1.05rem; } .kpis small { color: var(--muted); font-size: .72rem; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 112px; padding: 4px 0 0; }
.bar1 { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; font-size: .66rem; color: var(--muted); }
.bar1 i { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--accent2), var(--accent)); }
.bar1 i.neg { background: linear-gradient(180deg, #f87171, var(--err)); }
.bar1.na i { height: 10px !important; background: repeating-linear-gradient(45deg, var(--line) 0 3px, transparent 3px 6px); }
.bar1 span { font-weight: 700; color: var(--ink); } .bar1 em { font-style: normal; }
table.gt td, table.gt th { cursor: default; }
.sacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.pdot { position: absolute; top: 7px; right: 7px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--card); z-index: 2; }
.s11 { position: absolute; top: 5px; right: 4px; z-index: 2; font-size: .55rem; font-weight: 800; letter-spacing: .02em; background: #16a34a; color: #fff; border-radius: 6px; padding: 1px 4px; line-height: 1.3; }
.s11.bank { background: #ef4444; }
.s11.inl { position: static; display: inline-block; margin-right: 4px; vertical-align: 1px; }
.pdot.inl { position: static; display: inline-block; width: 9px; height: 9px; border: 0; vertical-align: 0; margin-right: 3px; }
.pr1 { background: #22c55e; } .pr2 { background: #84cc16; } .pr3 { background: #f59e0b; } .pr4 { background: #f97316; } .pr5 { background: #ef4444; }
.altl { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.altl .al1 { flex: 1; min-width: 0; } .altl .al2 { text-align: right; white-space: nowrap; } .altl .al2 b { display: block; }
.cbadge { position: absolute; z-index: 2; left: -5px; top: -7px; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #3a2600; font-weight: 800; font-size: .78rem; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.cbadge.static { position: static; display: inline-grid; width: 20px; height: 20px; font-size: .72rem; vertical-align: middle; box-shadow: none; }
.capbox { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 13px; padding: 11px 14px; margin: 0 0 12px; }
.capbox .ctitle { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.capbox .cmain b { font-size: 1.1rem; } .capbox .hint { margin: 4px 0 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--bg); border-radius: 14px; margin-bottom: 6px; }
.seg.six { grid-template-columns: repeat(6, 1fr); } .seg.six button { font-size: .78rem; padding: 9px 2px; }
table.mcmp { margin: 6px 0 2px; } table.mcmp td, table.mcmp th { cursor: pointer; font-size: .8rem; text-align: right; }
table.mcmp td:first-child, table.mcmp th:first-child { text-align: left; }
table.mcmp tr.cur td { background: var(--bg); } table.mcmp tr.cur td:first-child { border-radius: 10px 0 0 10px; font-weight: 700; } table.mcmp tr.cur td:last-child { border-radius: 0 10px 10px 0; }
details.how { margin-top: 10px; } details.how summary { margin-top: 4px; font-size: .88rem; } details.how li { margin-bottom: 6px; }
.alt2 { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.alt2:hover { background: var(--bg); border-radius: 10px; }
.alt2 .an { flex: 1; min-width: 0; } .alt2 .an b, .alt2 .an small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alt2 small { color: var(--muted); font-size: .74rem; } .alt2 .ad { text-align: right; } .alt2 .ad b { display: block; }
.alt2 small.up, .alt2 small.down { font-weight: 600; }
button.sm { padding: 6px 11px; font-size: .95rem; }
#sheetBody h4 { margin: 12px 0 2px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.av.lg { width: 44px; height: 44px; flex: none; margin: 0; } .av.lg img { height: 78px; top: -8px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.trow:hover { background: var(--bg); border-radius: 12px; }
.trow .rk { width: 22px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.trow:nth-child(-n+3) .rk { color: var(--gold); font-size: 1.1rem; }
.trow .tn { flex: 1; min-width: 0; } .trow .tn small { display: block; color: var(--muted); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbar { height: 5px; border-radius: 9px; background: var(--line); margin-top: 4px; overflow: hidden; } .tbar i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.trow .tv { text-align: right; } .trow .tv b { display: block; font-size: 1.1rem; color: var(--accent); font-variant-numeric: tabular-nums; } .trow .tv small { color: var(--muted); font-size: .74rem; }
.trow .in { font-size: .7rem; color: #15803d; font-weight: 600; }
@media (prefers-color-scheme: dark) { .trow .in { color: #4ade80; } }
.seg button { padding: 9px 4px; background: transparent; color: var(--muted); font-size: .86rem; font-weight: 600; border-radius: 11px; }
.seg button.on { background: var(--card); color: var(--accent); box-shadow: 0 2px 8px rgba(26,27,58,.15); }
.actions { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 10px 0 4px; }
button.soft { background: var(--bg); color: var(--accent); border: 1px solid var(--line); font-weight: 600; font-size: .88rem; }
button.soft:hover { border-color: var(--accent); }
button.soft:disabled { opacity: .5; }
.cmp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.cmp > div { background: var(--bg); border-radius: 13px; padding: 10px 12px; }
.cmp b { display: block; font-size: 1.15rem; } .cmp small { color: var(--muted); display: block; }
.up b, .up { color: #15803d; } .down b, .down { color: var(--err); }
@media (prefers-color-scheme: dark) { .up b, .up { color: #4ade80; } }
.hrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.hrow summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; margin: 0; color: var(--ink); }
.hrow > div:first-child { margin-bottom: 2px; }
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(135deg, var(--head1), var(--head2)); color: #fff; border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.hero::after { content: ""; position: absolute; right: -30px; top: -50px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(253,230,138,.25), transparent 70%); }
.hero small { opacity: .75; display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; }
.hero .big { font-size: 2.1rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .pts { text-align: right; position: relative; z-index: 1; } .hero .pts .big { color: var(--gold2); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin-bottom: 12px; }
.summary div { background: var(--bg); border-radius: 13px; padding: 10px 13px; }
.summary b { display: block; font-size: 1.05rem; } .summary small { color: var(--muted); }
.summary .over b { color: var(--err); }

.pitch { position: relative; border-radius: 18px; padding: 18px 6px 16px; display: flex; flex-direction: column; gap: 12px; overflow: hidden;
  background: repeating-linear-gradient(0deg, var(--pitch1) 0 56px, var(--pitch2) 56px 112px); border: 2px solid var(--pitchline); box-shadow: inset 0 0 60px rgba(0,0,0,.3); }
.pitch::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--pitchline); }
.pitch::after { content: ""; position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; border: 2px solid var(--pitchline); border-radius: 50%; }
.pitch .box { position: absolute; left: 50%; width: 44%; height: 12%; margin-left: -22%; border: 2px solid var(--pitchline); }
.pitch .box.bx-top { top: -2px; border-top: 0; } .pitch .box.bx-bot { bottom: -2px; border-bottom: 0; }
.line { position: relative; z-index: 1; display: flex; justify-content: space-around; gap: 4px; padding: 0 2px; }
.pl { flex: 0 1 88px; min-width: 0; text-align: center; font-size: .68rem; line-height: 1.2; cursor: pointer; background: var(--card); color: var(--ink); border-radius: 14px; padding: 7px 3px 6px; position: relative; box-shadow: 0 6px 16px rgba(0,0,0,.4); transition: transform .12s; }
.pl:hover { transform: translateY(-2px); }
.pl.p1 { --c: var(--tw); } .pl.p2 { --c: var(--abw); } .pl.p3 { --c: var(--mf); } .pl.p4 { --c: var(--st); }
.pl::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: var(--c, var(--accent)); }
.ph { position: relative; width: 46px; height: 46px; border-radius: 50%; margin: 2px auto 4px; overflow: hidden; border: 2px solid var(--c, var(--accent)); background: linear-gradient(160deg, var(--bg), var(--line)); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--muted); }
.ph img { position: absolute; height: 80px; width: auto; left: 50%; top: -8px; transform: translateX(-50%); max-width: none; }
.club { position: absolute; right: 3px; top: 38px; width: 20px; height: 20px; border-radius: 50%; background: #fff; padding: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pl b { display: block; font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl i { display: block; font-style: normal; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .ev { display: inline-block; margin: 3px 0 1px; padding: 1px 9px; border-radius: 99px; font-size: .92rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); font-variant-numeric: tabular-nums; }
.pl.locked { outline: 2px solid var(--gold); } .pl.locked::after { content: "🔒"; position: absolute; top: -9px; right: -6px; font-size: .8rem; }
.pl.warn { background: #fff4d6; color: #5b3a00; } .pl.warn i { color: #8a5a00; }
.pl .menu { display: none; position: absolute; inset: 0; background: rgba(15,16,48,.95); border-radius: 14px; flex-direction: column; justify-content: center; gap: 5px; padding: 5px; z-index: 3; }
.pl.open .menu { display: flex; }
.menu button { padding: 7px 2px; font-size: .72rem; background: #fff; color: #111; border-radius: 9px; }
.alts { display: grid; gap: 7px; }
.alt { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 13px; background: var(--bg); border-radius: 13px; border: 2px solid transparent; cursor: pointer; transition: border-color .12s; }
.alt:hover { border-color: var(--line); } .alt.sel { border-color: var(--accent); }
.alt .tag { font-size: .68rem; background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #3a2600; border-radius: 99px; padding: 2px 9px; margin-left: 6px; font-weight: 700; }
.alt .d { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 8px; margin: 10px 0; } .tools select { width: 90px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .82rem; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; cursor: pointer; }
td.n { text-align: right; } td button { padding: 3px 8px; font-size: .75rem; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; }
.av { display: inline-block; position: relative; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; vertical-align: middle; margin-right: 6px; background: var(--line); }
.av img { position: absolute; height: 50px; width: auto; left: 50%; top: -5px; transform: translateX(-50%); max-width: none; }
tr.out td { opacity: .45; }
pre { white-space: pre-wrap; font-size: .75rem; color: var(--muted); }



/* ===== Layout v2: Tabs, kompaktes Setup, aufklappbare Bereiche ===== */
body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.panel { animation: rise .25s ease both; }
.panel > .card:first-of-type { margin-top: 0; }
.empty { text-align: center; color: var(--muted); font-size: .9rem; padding: 26px 18px; border: 1.5px dashed var(--line); border-radius: 18px; margin: 0 0 16px; }
.panel[data-p=spieler]:has(.card:not([hidden])) > .empty, .panel:has(#histCard:not([hidden])) > #histEmpty { display: none; }

.tabbar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); width: min(540px, calc(100% - 24px)); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px; border-radius: 22px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: 0 10px 34px rgba(20,19,63,.28); }
.tabbar button { background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px 6px; border-radius: 16px; font-size: .72rem; font-weight: 650; }
.tabbar button span { font-size: 1.15rem; line-height: 1.2; filter: grayscale(.6); transition: filter .15s, transform .15s; }
.tabbar button.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.38); }
.tabbar button.on span { filter: none; transform: translateY(-1px); }

.setup { padding-bottom: 14px; }
.setup label { margin: 10px 0; }
.ctxsel select { font-size: 1.02rem; font-weight: 650; padding: 13px 14px; border-radius: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 label { margin: 10px 0 4px; }
button.primary.big { font-size: 1.05rem; padding: 16px; border-radius: 16px; margin-top: 14px; }

.fold { border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; background: var(--card); }
.fold > summary { list-style: none; cursor: pointer; margin: 0; padding: 12px 14px; color: var(--ink); font-weight: 650; font-size: .92rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.fold[open] > summary::after { transform: rotate(180deg); }
.fold .sum { margin-left: auto; margin-right: 6px; font-weight: 500; font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.foldbody { padding: 0 14px 14px; }
.foldbody h4 { margin: 12px 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

/* Challenge-Bedingungen als Chips */
.rulebox { padding: 0; background: transparent; border: 0; margin: 10px 0 0; }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; }
.rc { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: .84rem; line-height: 1.2; }
.rc b { font-weight: 700; } .rc.warn { background: #fff4d6; border-color: #f3d58a; color: #5b3a00; }
@media (prefers-color-scheme: dark) { .rc.warn { background: #3a2d0a; border-color: #6b520f; color: #fcd34d; } }
.rnote { margin: 8px 2px 0; font-size: .78rem; color: var(--muted); }
.rnote a { color: var(--accent); }
.rulebox .rawd { margin-top: 4px; }

.result-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.actions { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#result .hint { margin: 6px 2px; }
.alts, #altLineups { margin-top: 2px; }
.hero { margin-top: 10px; }
.card h2 { font-size: 1.02rem; }
.card { border-radius: 18px; }
.how-list li { margin-bottom: 8px; }
.center { text-align: center; }
[id] { scroll-margin-top: 72px; }.hero .big.sm { font-size: 1.55rem; white-space: nowrap; }
.hero > div:first-child { min-width: 0; }

.fold > summary > span:first-child { white-space: nowrap; }
.fold .sum { max-width: 60%; }
select optgroup { font-style: normal; font-weight: 700; }
.summary { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary div { padding: 8px 11px; } .summary b { font-size: 1rem; white-space: nowrap; } .summary small { font-size: .72rem; }
#modeNote { font-size: .8rem; margin: 4px 2px 8px; }
.moved { background: #fff4d6; color: #5b3a00; border: 1px solid #f3d58a; border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; font-size: .88rem; }
.moved a { color: #92400e; font-weight: 700; }
@media (prefers-color-scheme: dark) { .moved { background: #3a2d0a; color: #fcd34d; border-color: #6b520f; } .moved a { color: #fde68a; } }

/* ===== iPhone / Mobile: kein seitliches Wackeln, kein Zoom beim Tippen, sichere Ränder ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; overscroll-behavior-x: none; background: var(--bg); }
body { overflow-x: hidden; overflow-x: clip; overscroll-behavior-x: none; touch-action: pan-y pinch-zoom; width: 100%; max-width: 100%; position: relative; -webkit-tap-highlight-color: transparent; }
.tablewrap, pre, .sheet-card, textarea, .rawd pre { touch-action: pan-x pan-y; }
.sheet-card, .tablewrap { overscroll-behavior: contain; }
input, select, textarea, button { font-size: 16px; touch-action: manipulation; } /* >= 16px: Safari zoomt sonst beim Antippen in die Seite hinein */
textarea { font-size: 16px; }
main, .top { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
img, svg, video { max-width: 100%; }
.ph img, .av img { max-width: none; } /* Porträts werden bewusst größer als der Rahmen gezeichnet (Rahmen schneidet zu) */
.card, .fold, .rulebox, .rchips, .hero, .summary > div, .pitch, .alt, .altl, .trow, .alt2 { min-width: 0; }
.rawd pre, pre { overflow-wrap: anywhere; word-break: break-word; }
.sheet-card { max-height: 90vh; max-height: 90dvh; }
.sheet-card, .top, .tabbar { -webkit-backface-visibility: hidden; }
@media (max-width: 420px) {
  main { padding-top: 14px; }
  .card { padding: 14px 14px; }
  .pl { font-size: .64rem; }
  .tabbar { width: calc(100% - 20px); }
}