:root {
  --akzent: #9b2f2a; --akzent2: #6e2a1c; --akzent3: #f6e7cf; --tief: #3b2a1c; --panel: rgba(251, 244, 230, .9); --panel2: rgba(252, 247, 236, .97);
  --text: #2d2116; --mute: #6b5640; --rand: rgba(155, 47, 42, .4); --knopf1: #f1dcb6; --knopf2: #d9b27c; --knopfText: #2d2116;
  --gruen: #2f7d32; --rot: #b3261e; --kopf: Georgia, 'Times New Roman', serif;
  --tischbild: url(img/tisch-tag.webp?v=1); --kul: url(img/kulisse-tag.webp?v=1); --kulH: url(img/kulisse-tag-hoch.webp?v=1); --schleier: rgba(255, 246, 232, .08);
  --kante1: #a8703f; --kante2: #5e3a1c; --zettel: #fbf3e2; --zettelText: #3b2414; --messing: #b98a35;
}
html[data-ansicht="abend"] {
  --akzent: #f0c870; --akzent2: #f6dca0; --akzent3: #3a2412; --tief: #1c130b; --panel: rgba(40, 26, 15, .88); --panel2: rgba(46, 30, 18, .96);
  --text: #fbecd6; --mute: #e2c39a; --rand: rgba(240, 200, 112, .45); --knopf1: #7a4a26; --knopf2: #4a2a14; --knopfText: #fbecd6;
  --gruen: #86efac; --rot: #fca5a5;
  --tischbild: url(img/tisch-abend.webp?v=1); --kul: url(img/kulisse-abend.webp?v=1); --kulH: url(img/kulisse-abend-hoch.webp?v=1); --schleier: rgba(20, 10, 4, .18);
  --kante1: #7a4f28; --kante2: #3a2410; --zettel: #3a2616; --zettelText: #fbecd6; --messing: #e0b057;
}
html[data-ansicht="sommer"] {
  --akzent: #4f6f3a; --akzent2: #36502a; --akzent3: #eef2e2; --tief: #e8ead8; --panel: rgba(250, 251, 242, .9); --panel2: rgba(250, 251, 244, .97);
  --text: #2a3324; --mute: #5d6a52; --rand: rgba(79, 111, 58, .4); --knopf1: #eef0dc; --knopf2: #cfd6b4; --knopfText: #2a3324;
  --tischbild: url(img/tisch-sommer.webp?v=1); --kul: url(img/kulisse-sommer.webp?v=1); --kulH: url(img/kulisse-sommer-hoch.webp?v=1); --schleier: rgba(255, 255, 245, .06);
  --kante1: #c9a370; --kante2: #8a6a40; --zettel: #fafaf0; --zettelText: #2a3324; --messing: #c49a48;
}
body { background: var(--tief); }
#kulisse { position: fixed; inset: 0; background: var(--kul) center / cover no-repeat; z-index: 0; }
#kulisse::after { content: ''; position: absolute; inset: 0; background: var(--schleier); }
body.hoch #kulisse { background-image: var(--kulH); }
#buehne { z-index: 1; }
@media (prefers-reduced-motion: no-preference) {
  #kulisse::before { content: ''; position: absolute; left: 0; top: 0; width: 55%; height: 80%; pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(ellipse at 30% 30%, rgba(255, 246, 220, .22), rgba(255, 246, 220, 0) 60%); animation: licht 14s ease-in-out infinite alternate; }
  @keyframes licht { from { opacity: .55; transform: translate(0, 0); } to { opacity: 1; transform: translate(4%, 3%); } }
  html[data-ansicht="abend"] #kulisse::before { left: auto; right: 0; background: radial-gradient(ellipse at 75% 75%, rgba(255, 190, 90, .25), rgba(255, 190, 90, 0) 55%); animation: flackern 3.2s ease-in-out infinite alternate; }
  @keyframes flackern { 0% { opacity: .7; } 40% { opacity: 1; } 55% { opacity: .82; } 100% { opacity: .95; } }
}

#hud { background: var(--panel); border: 2px solid var(--messing); box-shadow: 0 10px 28px rgba(40, 20, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .06); }
#logo span, #logo b { font-family: var(--kopf); text-shadow: 0 2px 0 rgba(255, 255, 255, .5); }
#logo b { color: var(--akzent); }
html[data-ansicht="abend"] #logo span, html[data-ansicht="abend"] #logo b { text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
#logo { font-size: 28px; letter-spacing: 1px; }
.wert { background: rgba(255, 252, 244, .55); }
.wert b { color: var(--text); font-family: var(--kopf); font-variant-numeric: lining-nums tabular-nums; }
html[data-ansicht="abend"] .wert { background: rgba(0, 0, 0, .25); }
.wert.klein b { font-size: 19px; white-space: nowrap; }
.endwert { color: var(--akzent); }
.hinweis { background: rgba(255, 250, 238, .65); color: var(--text); }
.hinweis.gut { color: var(--gruen); font-weight: 700; } .hinweis.schlecht { color: var(--rot); font-weight: 700; }
html[data-ansicht="abend"] .hinweis { background: rgba(0, 0, 0, .3); color: var(--mute); }
#banner { color: var(--akzent); font-family: var(--kopf); text-shadow: 0 2px 0 rgba(255, 250, 238, .9), 0 0 14px rgba(255, 250, 238, .9); }
#banner small { color: var(--text); }
html[data-ansicht="abend"] #banner { text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 18px rgba(0, 0, 0, .5); }
#banner.zahl { display: none !important; }

#knoepfe { grid-template-columns: repeat(3, 1fr); }
#knoepfe button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 50px; padding: 2px 0; }
#knoepfe button svg { width: 20px; height: 20px; color: var(--akzent); }
#knoepfe .kl { font: 700 11px/1.1 'Segoe UI', system-ui, sans-serif; color: var(--knopfText); white-space: nowrap; }
@media (max-height: 720px) and (min-aspect-ratio: 1/1) {
  #hud { gap: 7px; padding: 10px 14px; } #logo { font-size: 24px; padding: 2px 0 0; } .wert { padding: 4px 8px 5px; } .wert b { font-size: 24px; } .wert.klein b { font-size: 17px; }
  #knoepfe button { height: 42px; }
}

#brettbox { overflow: hidden; border-radius: 16px; touch-action: none; background: transparent; }
#brett { position: absolute; inset: 0; touch-action: none; z-index: 1; pointer-events: none; }
#tisch { position: absolute; z-index: 0; border-radius: 14px; background: var(--tischbild) center / cover; pointer-events: none;
  box-shadow: 0 26px 40px rgba(30, 14, 2, .45), 0 7px 0 3px var(--kante2), inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -18px 30px rgba(0, 0, 0, .12); }
#tisch[hidden] { display: none; }
#tisch .kante { position: absolute; left: 6px; right: 6px; bottom: -15px; height: 10px; border-radius: 0 0 8px 8px; background: linear-gradient(var(--kante1), var(--kante2)); }

#kopf { position: absolute; left: 12px; top: 8px; z-index: 2; height: 48px; max-width: calc(100% - 24px); padding: 4px 14px; border-radius: 6px; overflow: hidden;
  background: var(--zettel); color: var(--zettelText); border: 1px solid var(--messing); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); transform: rotate(-.6deg);
  display: flex; flex-direction: column; justify-content: center; font-family: var(--kopf); pointer-events: none; }
#kopf[hidden] { display: none; }
#kopf b { font-size: 16px; line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kopf span { font-size: 14px; line-height: 18px; color: var(--mute); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }

#meld { position: absolute; top: 6px; right: 12px; z-index: 10; width: min(440px, 52%); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#meld .m { background: var(--panel2); color: var(--text); border: 1px solid var(--rand); border-left: 5px solid var(--akzent); border-radius: 10px; padding: 6px 10px;
  font-size: 14px; line-height: 1.3; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: opacity .35s; }
#meld .m.gut { border-left-color: var(--gruen); } #meld .m.schlecht { border-left-color: var(--rot); }
#meld .m.weg { opacity: 0; }

#zeile { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 2; width: min(640px, calc(100% - 24px)); height: 38px; padding: 0 14px;
  display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 8px; overflow: hidden;
  background: var(--zettel); color: var(--zettelText); border: 1px solid var(--messing); font: 14px/1.25 var(--kopf); box-shadow: 0 4px 12px rgba(0, 0, 0, .2); pointer-events: none; }
#zeile:empty { display: none; }
#zeile.erkl { border-color: var(--akzent); }

#raten { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(20, 10, 0, .25); }
#raten .schild { width: min(360px, calc(100% - 32px)); padding: 16px 18px; border-radius: 10px; background: var(--zettel); color: var(--zettelText); border: 2px solid var(--messing);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4); display: grid; gap: 8px; text-align: center; font-family: var(--kopf); transform: rotate(-.6deg); }
#raten b { font-size: 20px; color: var(--akzent); } #raten span { font-size: 14px; color: var(--mute); }
#raten button { min-height: 44px; border-radius: 10px; border: 2px solid var(--rand); background: linear-gradient(var(--knopf1), var(--knopf2)); color: var(--knopfText); font: 700 17px var(--kopf); }
#raten button:hover { filter: brightness(1.08); } #raten button.zu { font-size: 14px; min-height: 40px; opacity: .9; }

#wahl { position: absolute; inset: 0; z-index: 3; overflow: auto; padding: 16px; background: var(--panel2); border-radius: 16px; scrollbar-width: thin; scrollbar-color: var(--akzent) rgba(0, 0, 0, .12); }
#wahl[hidden] { display: none; }
#wahl::-webkit-scrollbar { width: 8px; } #wahl::-webkit-scrollbar-thumb { background: var(--akzent); border-radius: 4px; } #wahl::-webkit-scrollbar-track { background: rgba(0, 0, 0, .12); }
#wahl h2 { margin: 0 0 12px; text-align: center; font: 800 24px/1.2 var(--kopf); color: var(--akzent); }
#wahl h2 small { font-size: 15px; color: var(--mute); font-weight: 600; margin-left: 6px; }
#wahl h3 { margin: 10px 0 6px; font: 700 17px/1.2 var(--kopf); color: var(--akzent2); }
.buch section { border: 2px solid var(--rand); border-radius: 12px; padding: 6px 10px 10px; margin-bottom: 10px; background: rgba(255, 255, 255, .25); }
html[data-ansicht="abend"] .buch section { background: rgba(0, 0, 0, .2); }
.seiten { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.seite { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 4px 4px; border-radius: 10px; border: 2px solid var(--rand); background: rgba(255, 252, 244, .7); color: var(--text); }
html[data-ansicht="abend"] .seite { background: rgba(0, 0, 0, .25); }
.seite:hover, .seite.an { border-color: var(--akzent); }
.seite canvas { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; background: #efe6d2; border-radius: 4px; }
.seite b { position: absolute; left: 6px; top: 4px; font: 800 14px var(--kopf); color: var(--akzent); }
.seite i { display: inline-flex; gap: 1px; }
.seite .st { width: 13px; height: 13px; fill: rgba(0, 0, 0, .2); stroke: var(--mute); stroke-width: 1.2; }
.seite .st.an { fill: #e8b030; stroke: #a8780c; }

.kach { display: block; width: 48px; height: 48px; border-radius: 10px; background: center / cover no-repeat; flex: none; border: 1px solid var(--rand); }
.k-vorne { background-image: var(--k-vorne); } .k-bahn { background-image: var(--k-bahn); } .k-kette { background-image: var(--k-kette); } .k-raten { background-image: var(--k-raten); }
.kurz { padding: 10px 12px; border-radius: 10px; background: rgba(155, 47, 42, .08); border-left: 4px solid var(--akzent); margin-bottom: 10px; }

body.hoch #hud { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-areas: 'zeit punkte e1 e2 e3 e4 e5' 'kn kn kn kn kn kn kn'; gap: 4px; padding: 6px; }
body.hoch #logo, body.hoch #modus, body.hoch #info { display: none; }
body.hoch #eigen .wert:nth-child(3) { display: block; grid-area: e3; } body.hoch #eigen .wert:nth-child(4) { display: block; grid-area: e4; } body.hoch #eigen .wert:nth-child(5) { display: block; grid-area: e5; }
body.hoch #eigen .wert:nth-child(n+6) { display: none; }
body.hoch .wert { padding: 2px 1px 3px; min-width: 0; } body.hoch .wert b, body.hoch .wert.klein b { font-size: 14px; line-height: 18px; white-space: nowrap; overflow: hidden; }
body.hoch .wert span { font-size: 11px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; }
body.hoch #knoepfe { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
body.hoch #knoepfe button { width: auto; height: 46px; min-width: 0; } body.hoch #knoepfe .kl { font-size: 11px; letter-spacing: -.2px; }
body.hoch #brettbox { border-radius: 12px; }
body.hoch #meld { top: 58px; right: 8px; left: 8px; width: auto; }
body.hoch #meld .m:not(:last-child) { display: none; }
body.hoch #zeile { height: 40px; font-size: 14px; line-height: 1.2; bottom: 6px; }
@media (pointer: coarse) { #knoepfe button { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { #banner { animation: none !important; } }

.wert { position: relative; }
.wert .band { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 4px; border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--f, transparent) var(--p, 0%), rgba(0, 0, 0, .14) var(--p, 0%)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
body.hoch .wert .band { left: 3px; right: 3px; bottom: 1px; height: 3px; }

#tafel { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; }
#tafel[hidden] { display: none; }
#tafel .schild { position: relative; pointer-events: auto; width: min(380px, calc(100% - 32px)); max-height: calc(100% - 24px); overflow: auto; padding: 14px 18px 16px; border-radius: 10px;
  background: var(--zettel); color: var(--zettelText); border: 2px solid var(--messing); border-top: 6px solid var(--gruen); box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  display: grid; gap: 8px; text-align: center; font-family: var(--kopf); transform: rotate(-.5deg); scrollbar-width: thin; scrollbar-color: var(--akzent) transparent; }
#tafel .schild.schlecht { border-top-color: var(--rot); }
#tafel b { font-size: 20px; color: var(--akzent); padding: 0 34px; }
#tafel table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: lining-nums tabular-nums; }
#tafel td { padding: 3px 4px; border-bottom: 1px dashed var(--rand); text-align: left; }
#tafel td:nth-child(2) { color: var(--mute); font-size: 13px; }
#tafel td:last-child { text-align: right; white-space: nowrap; font-weight: 700; }
#tafel tr.summe td { border-bottom: 2px solid var(--messing); color: var(--akzent); }
#tafel span { font-size: 14px; color: var(--mute); }
#tafel .weiter { min-height: 44px; border-radius: 10px; border: 2px solid var(--rand); background: linear-gradient(var(--knopf1), var(--knopf2)); color: var(--knopfText); font: 700 17px var(--kopf); }
#tafel .x { position: sticky; top: 0; justify-self: end; margin: -6px -10px -38px 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rand);
  background: var(--zettel); color: var(--zettelText); display: grid; place-items: center; z-index: 1; }
#tafel .x svg { width: 18px; height: 18px; }

#wahl .legende { margin: -4px 0 10px; text-align: center; font: 14px/1.6 var(--kopf); color: var(--mute); }
#wahl .legende .st { width: 14px; height: 14px; vertical-align: -2px; margin-left: 8px; fill: #e8b030; stroke: #a8780c; stroke-width: 1.2; }
#wahl h3 small { font: 600 13px var(--kopf); color: var(--mute); margin-left: 6px; }
.seite em { font: 11px/1.2 var(--kopf); color: var(--mute); font-style: normal; white-space: nowrap; }
.k-gold { background-image: var(--k-gold); } .k-kissen { background-image: var(--k-kissen); }
#meld.eng .m:not(:nth-last-child(-n+2)) { display: none; }
body.hoch #tafel { place-items: end center; padding-bottom: 54px; }
.rekord { color: var(--akzent3); }

#ov { background: rgba(40, 22, 8, .32); backdrop-filter: blur(1.5px); }
html[data-ansicht="abend"] #ov { background: rgba(10, 6, 2, .5); }
.dlg { background-color: var(--zettel); color: var(--zettelText); border: 3px solid var(--messing); outline: 2px dashed var(--akzent); outline-offset: -11px;
  background-image: repeating-linear-gradient(0deg, rgba(120, 90, 50, .05) 0 1px, transparent 1px 4px), repeating-linear-gradient(90deg, rgba(120, 90, 50, .05) 0 1px, transparent 1px 4px); }
.modus { color: var(--zettelText); border: 2px dashed var(--akzent); border-radius: 12px; text-shadow: none;
  background: linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, 0)), var(--akzent3);
  box-shadow: 0 0 0 4px var(--akzent3), 0 0 0 5px var(--rand), 0 6px 12px rgba(0, 0, 0, .25); }
html[data-ansicht="abend"] .modus:not(.tag) { background: linear-gradient(rgba(255, 255, 255, .08), rgba(255, 255, 255, 0)), #4a2e18; }
.modus.tag { border-color: #8a5a10; box-shadow: 0 0 0 4px #f6cf62, 0 0 0 5px #a87412, 0 6px 12px rgba(0, 0, 0, .25); }
.modus:hover { filter: brightness(1.04); border-style: solid; }
.modus span { color: var(--mute); } .modus.tag span { color: #5a3608; }
@media (max-width: 420px) { .modus b { font-size: 18px; } .modus { padding-left: 8px; padding-right: 8px; } }
#wahl h4.stufe { margin: 16px 0 8px; padding: 6px 12px; border-radius: 8px; font: 800 18px/1.2 var(--kopf); color: var(--zettelText); background: var(--zettel); border-left: 6px solid var(--gruen); }
#wahl h4.stufe small { font: 600 13px var(--kopf); color: var(--mute); margin-left: 6px; }
#wahl h4.stufe.s2 { border-left-color: var(--messing); } #wahl h4.stufe.s3 { border-left-color: var(--akzent); } #wahl h4.stufe.s4 { border-left-color: var(--rot); }
.endwert .rekord { text-shadow: none; }

.modus.versteckt, .menue h3:has(+ #mListe_ab2), .menue h3:has(+ #mListe_ab3), .menue h3:has(+ #mListe_ab4), #mListe_ab2, #mListe_ab3, #mListe_ab4 { display: none !important; }
#wahl h4.stufe { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#wahl h4.stufe .ab, #wahl h2 .galerie { margin-left: auto; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 2px solid var(--rand); background: linear-gradient(var(--knopf1), var(--knopf2));
  color: var(--knopfText); font: 700 14px var(--kopf); cursor: pointer; }
#wahl h2 { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
#wahl h2 .galerie { margin-left: 12px; }

#galerie { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 14px; background: rgba(30, 16, 6, .45); }
#galerie[hidden] { display: none; }
.gal-box { position: relative; width: min(900px, 100%); max-height: 100%; overflow: auto; padding: 16px 20px 20px; border-radius: 14px; background: var(--zettel); color: var(--zettelText);
  border: 3px solid var(--messing); outline: 2px dashed var(--akzent); outline-offset: -11px; box-shadow: 0 18px 50px rgba(0, 0, 0, .45); scrollbar-width: thin; scrollbar-color: var(--akzent) transparent; }
.gal-x { position: sticky; top: 0; float: right; margin: -4px -6px 0 8px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--rand); background: var(--zettel); color: var(--zettelText);
  display: grid; place-items: center; z-index: 2; cursor: pointer; }
.gal-x svg { width: 18px; height: 18px; }
.gal-box h2 { margin: 0 0 6px; text-align: center; font: 800 26px/1.2 var(--kopf); color: var(--akzent); }
.gal-box h3 { margin: 14px 0 8px; font: 700 18px/1.2 var(--kopf); color: var(--akzent2); }
.gal-box h3 small { font: 600 13px var(--kopf); color: var(--mute); margin-left: 6px; }
.gal-abz { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.abz { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; text-align: center; color: var(--mute); }
.abz span { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #ddd2bb; border: 3px dashed #a99a7c; color: #8c7f66; }
.abz span svg { width: 24px; height: 24px; }
.abz b { font: 600 13px/1.2 var(--kopf); }
.abz.an { color: var(--zettelText); }
.abz.an span { background: radial-gradient(circle at 35% 30%, #f6d58a, #c9922e); border-color: var(--akzent); color: #3a1c02; box-shadow: 0 0 0 3px var(--zettel), 0 0 0 5px var(--messing); }
.gal-wand { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; padding: 12px; border-radius: 10px;
  background: repeating-linear-gradient(90deg, #8d6a45 0 26px, #7f5f3d 26px 52px); box-shadow: inset 0 0 18px rgba(0, 0, 0, .35); }
.gal-wand figure { margin: 0; display: grid; justify-items: center; gap: 3px; }
.gal-wand canvas { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; background: #efe6d2; padding: 4px; border: 4px solid #b98a35; box-shadow: 0 4px 8px rgba(0, 0, 0, .4); opacity: .55; }
.gal-wand figure.an canvas { opacity: 1; border-color: #d9a521; }
.gal-wand figcaption { font: 600 11px/1.2 var(--kopf); color: #fbf0dc; background: #2a1a0c; padding: 1px 5px; border-radius: 3px; max-width: 78px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
