:root {
  --akzent: #8c3b62; --akzent2: #5e2340; --akzent3: #f6e7ee; --tief: #4a463e; --panel: rgba(250, 247, 238, .9); --panel2: rgba(252, 250, 242, .97);
  --text: #2a2620; --mute: #625a4c; --rand: rgba(140, 59, 98, .4); --knopf1: #f2e6cf; --knopf2: #d8c19a; --knopfText: #2a2620;
  --gruen: #2f7d32; --rot: #b3261e; --kopf: Georgia, 'Times New Roman', serif;
  --tischbild: url(img/pflaster-morgen.webp?v=1); --kul: url(img/kulisse-morgen.webp?v=1); --kulH: url(img/kulisse-morgen-hoch.webp?v=1); --schleier: rgba(255, 246, 232, .06);
  --kante1: #8d877b; --kante2: #5a554c; --zettel: #fbf6ea; --zettelText: #3a2f24; --messing: #b98a35;
}
html[data-ansicht="mittag"] {
  --akzent: #3d6b3a; --akzent2: #2a4a28; --akzent3: #eef2e2; --tief: #e6e4d8; --panel: rgba(251, 251, 245, .9); --panel2: rgba(252, 252, 247, .97);
  --text: #26301f; --mute: #58644c; --rand: rgba(61, 107, 58, .4); --knopf1: #eef0dc; --knopf2: #cfd6b4; --knopfText: #26301f;
  --tischbild: url(img/pflaster-mittag.webp?v=1); --kul: url(img/kulisse-mittag.webp?v=1); --kulH: url(img/kulisse-mittag-hoch.webp?v=1); --schleier: rgba(255, 255, 245, .05);
  --kante1: #aaa292; --kante2: #7a7466; --zettel: #fbfbf2; --zettelText: #26301f; --messing: #c49a48;
}
html[data-ansicht="abend"] {
  --akzent: #f0b860; --akzent2: #f6d6a0; --akzent3: #3a2412; --tief: #1a1612; --panel: rgba(36, 28, 20, .88); --panel2: rgba(42, 32, 22, .96);
  --text: #fbecd6; --mute: #e2c39a; --rand: rgba(240, 184, 96, .45); --knopf1: #6e4a2a; --knopf2: #43291a; --knopfText: #fbecd6;
  --gruen: #86efac; --rot: #fca5a5;
  --tischbild: url(img/pflaster-abend.webp?v=1); --kul: url(img/kulisse-abend.webp?v=1); --kulH: url(img/kulisse-abend-hoch.webp?v=1); --schleier: rgba(10, 6, 2, .15);
  --kante1: #6a6458; --kante2: #36322a; --zettel: #3a2c1e; --zettelText: #fbecd6; --messing: #e0b057;
}
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.zu::after { content: '?'; position: absolute; left: 50%; top: 34px; transform: translate(-50%, -50%); font: 700 30px/1 var(--kopf); color: rgba(90, 70, 40, .55); pointer-events: none; }
.seite canvas { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; background: #8d877b; 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; }
#wahl h3 .stadt { font: 600 13px/1 'Segoe UI', system-ui, sans-serif; color: var(--mute); margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
#wahl h3 .stadt.fertig { color: var(--akzent); }
#wahl h3 .wappen { width: 18px; height: 21px; fill: #e8b030; stroke: #8a6a1c; stroke-width: 1.2; }
#wahl h3 .wappen .w2 { fill: #8c3b62; stroke: none; }
.seite .rek { font: 600 11px/1.2 'Segoe UI', system-ui, sans-serif; color: var(--mute); padding: 1px 6px; border-radius: 8px; border: 1px solid transparent; font-variant-numeric: tabular-nums; white-space: nowrap; }
.seite .rek.m-gold { border-color: #d4a017; background: rgba(232, 176, 48, .18); color: var(--text); }
.seite .rek.m-silber { border-color: #9aa3ad; background: rgba(170, 178, 188, .2); color: var(--text); }
.seite .rek.m-bronze { border-color: #b0703a; background: rgba(176, 112, 58, .16); color: var(--text); }

.chronik { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.foto { display: grid; justify-items: center; gap: 3px; padding: 7px 7px 6px; background: #f7f0de; border: 1px solid #c8b78f; border-radius: 3px; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); transform: rotate(-1deg); color: #3a2f24; }
.foto:nth-child(2n) { transform: rotate(1.2deg); }
.foto canvas { width: 92px; height: 92px; object-fit: contain; image-rendering: pixelated; background: #8d877b; filter: sepia(.9) contrast(.9) brightness(1.05); transition: filter .3s; }
.foto:hover canvas { filter: none; }
.foto b { font: 700 13px/1.2 var(--kopf); text-align: center; } .foto small { font: 12px/1.2 var(--kopf); color: #6a5c48; }
.chronik-leer { margin: 0; color: var(--mute); font: 14px/1.4 var(--kopf); }

.kach { display: block; width: 48px; height: 48px; border-radius: 10px; background: center / cover no-repeat; flex: none; border: 1px solid var(--rand); }
.k-giess { background-image: var(--k-giess); } .k-schloss { background-image: var(--k-schloss); }
.k-hof { background-image: var(--k-hof); } .k-kante { background-image: var(--k-kante); } .k-bord { background-image: var(--k-bord); } .k-raten { background-image: var(--k-raten); }
.kurz { padding: 10px 12px; border-radius: 10px; background: rgba(140, 59, 98, .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; } }
