:root {
  --akzent: #9a4a14; --akzent2: #6b3410; --akzent3: #f8ead4; --tief: #f0e4d2; --panel: rgba(255, 248, 236, .9); --panel2: rgba(255, 250, 241, .97);
  --text: #2f1c0f; --mute: #6e4f36; --rand: rgba(154, 74, 20, .45); --knopf1: #f3dcb8; --knopf2: #dcb27a; --knopfText: #2f1c0f;
  --gruen: #15803d; --rot: #b91c1c; --kopf: Georgia, 'Times New Roman', serif;
  --tischbild: url(img/tisch-frueh.webp?v=1); --kul: url(img/kulisse-frueh.webp?v=1); --kulH: url(img/kulisse-frueh-hoch.webp?v=1); --schleier: rgba(255, 246, 232, .1);
  --kante1: #c9a46a; --kante2: #7a5420; --zettel: #fbf3e2; --zettelText: #3b2414; --messing: #b98b3c;
}
html[data-ansicht="nacht"] {
  --akzent: #f2b53c; --akzent2: #f6d28a; --akzent3: #3b2312; --tief: #1d120a; --panel: rgba(38, 24, 14, .86); --panel2: rgba(44, 28, 16, .96);
  --text: #fbecd6; --mute: #e2c39a; --rand: rgba(242, 181, 60, .45); --knopf1: #7a4a26; --knopf2: #4a2a14; --knopfText: #fbecd6;
  --gruen: #4ade80; --rot: #fca5a5;
  --tischbild: url(img/tisch-nacht.webp?v=1); --kul: url(img/kulisse-nacht.webp?v=1); --kulH: url(img/kulisse-nacht-hoch.webp?v=1); --schleier: rgba(20, 10, 4, .22);
  --kante1: #8a6632; --kante2: #3a2410; --zettel: #3a2616; --zettelText: #fbecd6; --messing: #e0b057;
}
html[data-ansicht="advent"] {
  --akzent: #f87171; --akzent2: #fde68a; --akzent3: #3b1212; --tief: #26100c; --panel: rgba(48, 20, 16, .86); --panel2: rgba(54, 24, 18, .96);
  --text: #fff1e8; --mute: #f2c9b8; --rand: rgba(248, 113, 113, .45); --knopf1: #8a2f22; --knopf2: #521812; --knopfText: #fff1e8;
  --gruen: #86efac; --rot: #fda4af;
  --tischbild: url(img/tisch-advent.webp?v=1); --kul: url(img/kulisse-advent.webp?v=1); --kulH: url(img/kulisse-advent-hoch.webp?v=1); --schleier: rgba(30, 8, 6, .2);
  --kante1: #b98b3c; --kante2: #5a3010; --zettel: #3e1a14; --zettelText: #fff1e8; --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; right: -10%; top: 0; width: 60%; height: 70%; pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(ellipse at 60% 40%, rgba(255, 240, 220, .22), rgba(255, 240, 220, 0) 60%); animation: dampf 16s ease-in-out infinite alternate; }
  @keyframes dampf { from { transform: translate(0, 4%) scale(1); opacity: .6; } to { transform: translate(-10%, -4%) scale(1.15); opacity: 1; } }
}
html[data-ansicht="nacht"] #kulisse::before { background: radial-gradient(ellipse at 70% 60%, rgba(255, 150, 60, .22), rgba(255, 150, 60, 0) 55%); }

#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(--akzent2); }
html[data-ansicht="nacht"] #logo span, html[data-ansicht="nacht"] #logo b, html[data-ansicht="advent"] #logo span, html[data-ansicht="advent"] #logo b { text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.wert { background: rgba(255, 252, 244, .55); }
.wert b { color: var(--text); font-family: var(--kopf); }
html[data-ansicht="nacht"] .wert, html[data-ansicht="advent"] .wert { background: rgba(0, 0, 0, .25); }
.wert.klein b { font-size: 21px; }
.endwert { color: var(--akzent); text-shadow: 0 2px 0 rgba(255, 250, 238, .8); }
html[data-ansicht="nacht"] .endwert, html[data-ansicht="advent"] .endwert { text-shadow: 0 3px 0 rgba(0, 0, 0, .5); }
.hinweis { background: rgba(255, 250, 238, .65); color: var(--text); }
.hinweis.gut { color: #1d6a28; font-weight: 700; } .hinweis.schlecht { color: #a8261c; font-weight: 700; }
html[data-ansicht="nacht"] .hinweis, html[data-ansicht="advent"] .hinweis { background: rgba(0, 0, 0, .3); color: var(--mute); }
html[data-ansicht="nacht"] .hinweis.gut, html[data-ansicht="advent"] .hinweis.gut { color: var(--gruen); }
html[data-ansicht="nacht"] .hinweis.schlecht, html[data-ansicht="advent"] .hinweis.schlecht { color: var(--rot); }
#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); text-shadow: 0 1px 0 rgba(255, 250, 238, .9); }
html[data-ansicht="nacht"] #banner, html[data-ansicht="advent"] #banner { text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 18px rgba(0, 0, 0, .5); }
html[data-ansicht="nacht"] #banner small, html[data-ansicht="advent"] #banner small { text-shadow: 0 1px 0 rgba(0, 0, 0, .6); }
#knoepfe { grid-template-columns: repeat(4, 1fr); }
@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: 18px; }
  #knoepfe button { height: 40px; }
}

#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;
  box-shadow: 0 26px 40px rgba(30, 14, 2, .45), 0 0 0 5px var(--messing), 0 7px 0 3px var(--kante2), inset 0 2px 0 rgba(255, 255, 255, .45), inset 0 -18px 30px rgba(0, 0, 0, .1); }
#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: 50px; 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: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#kopf span { font-size: 14px; line-height: 19px; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; }

#meld { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; width: min(560px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 6px; 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: 8px 12px;
  font-size: 15px; line-height: 1.35; 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; }

#karte { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-.8deg); z-index: 4; width: min(400px, calc(100% - 32px)); padding: 16px 20px; border-radius: 10px;
  background: var(--zettel); border: 2px solid var(--messing); box-shadow: 0 14px 40px rgba(0, 0, 0, .4); text-align: center; color: var(--zettelText); font-family: var(--kopf); pointer-events: none; }
#karte[hidden] { display: none; }
#karte h2 { margin: 0 0 6px; font: 800 26px/1.1 var(--kopf); color: var(--akzent); }
#karte table { width: 100%; border-collapse: collapse; margin: 8px 0 6px; font-size: 15px; }
#karte td { padding: 4px 6px; border-bottom: 1px solid var(--rand); text-align: left; } #karte td + td { text-align: right; font-variant-numeric: tabular-nums; }
#karte tr.summe td { font-weight: 800; color: var(--akzent); }
#karte .unter { font-size: 14px; color: var(--mute); }

#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 h3 { margin: 14px 0 8px; font: 700 17px/1.2 var(--kopf); color: var(--akzent2); }
#wahl h3 small { font: 400 13px/1.2 'Segoe UI', system-ui, sans-serif; color: var(--mute); }
.wahlgitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.wahlgitter button { min-height: 64px; text-align: left; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--rand); background: rgba(255, 255, 255, .5);
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; color: var(--text); cursor: pointer; }
html[data-ansicht="nacht"] .wahlgitter button, html[data-ansicht="advent"] .wahlgitter button { background: rgba(0, 0, 0, .25); }
.wahlgitter button:hover { border-color: var(--akzent); }
.wahlgitter button.an { background: rgba(201, 138, 60, .3); }
.wahlgitter b { grid-row: span 2; font: 800 24px/1 var(--kopf); color: var(--akzent); align-self: center; text-align: center; }
.wahlgitter span { font-weight: 700; font-size: 14px; }
.wahlgitter em { font-style: normal; font-size: 12px; color: var(--mute); }
.wahlgitter .sterne { display: inline-flex; gap: 1px; vertical-align: -2px; margin-left: 4px; }
.wahlgitter .st { width: 13px; height: 13px; fill: rgba(0, 0, 0, .2); stroke: var(--mute); stroke-width: 1.2; }
.wahlgitter .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-conche { background-image: var(--k-conche); } .k-leitung { background-image: var(--k-leitung); } .k-kreuz { background-image: var(--k-kreuz); } .k-form { background-image: var(--k-form); }

body.hoch #hud { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-areas: 'zeit punkte e1 e2 e3 e4' 'kn kn kn kn kn kn'; gap: 4px; padding: 6px; }
body.hoch #logo, body.hoch #modus { 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 .wert { padding: 2px 2px 3px; } body.hoch .wert b, body.hoch .wert.klein b, body.hoch #eigen .wert b { font-size: 14px; line-height: 18px; white-space: nowrap; }
body.hoch .wert span { font-size: 10px; letter-spacing: .2px; }
body.hoch #knoepfe { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; } body.hoch #knoepfe button { width: auto; min-width: 0; max-width: none; }
body.hoch #brettbox { border-radius: 12px; }
body.hoch #kopf { height: 46px; } body.hoch #kopf b { font-size: 15px; line-height: 20px; } body.hoch #kopf span { font-size: 13px; line-height: 18px; }
@media (pointer: coarse) { #knoepfe button { min-height: 44px; } body:not(.hoch) #knoepfe button { min-width: 44px; } .wahlgitter button { min-height: 56px; } }
@media (prefers-reduced-motion: reduce) { #banner { animation: none !important; } }
#logo { font-size: 28px; letter-spacing: 1px; }
#meld { top: 6px; bottom: auto; left: auto; right: 12px; transform: none; width: min(440px, 52%); gap: 4px; }
#meld .m { font-size: 14px; padding: 6px 10px; line-height: 1.3; }
body.hoch #meld { top: 58px; right: 8px; left: 8px; width: auto; }
body.hoch #meld .m:not(:last-child) { display: none; }
#karte .sterne { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
#karte .sterne i { width: 26px; height: 26px; background: rgba(0, 0, 0, .2); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
#karte .sterne i.an { background: #f59e0b; }
#bSchnell.puls, #p-schnell.puls { box-shadow: 0 0 0 3px #f59e0b, 0 3px 0 rgba(0, 0, 0, .5); }
@media (prefers-reduced-motion: no-preference) { #bSchnell.puls, #p-schnell.puls { animation: kakPuls 1.1s ease-in-out infinite; } }
@keyframes kakPuls { 50% { filter: brightness(1.25); } }
body.hoch .gedreht #meld { top: auto; bottom: 8px; }
#karte.seite { top: auto; bottom: 12px; transform: translateX(-50%) rotate(-.8deg); width: min(360px, calc(100% - 32px)); padding: 10px 16px; }
#karte.seite h2 { font-size: 22px; } #karte.seite table { font-size: 14px; margin: 4px 0; }
#wahl h2 small { font-size: 15px; color: var(--mute); font-weight: 600; margin-left: 6px; }
.fabrikplan { display: grid; gap: 12px; }
.halle { border: 2px solid var(--rand); border-radius: 12px; padding: 8px 10px 10px; background: linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .12)); }
html[data-ansicht="nacht"] .halle, html[data-ansicht="advent"] .halle { background: rgba(0, 0, 0, .22); }
.halle h3 { display: flex; align-items: baseline; gap: 6px; margin: 0 0 6px; font: 800 16px/1.2 var(--kopf); color: var(--akzent); }
.halle h3 small { font: 600 12px/1.2 system-ui, sans-serif; color: var(--mute); }
.halle .hs { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font: 700 13px system-ui, sans-serif; color: var(--mute); }
.halle .hs .st { width: 14px; height: 14px; }
.gang { position: relative; display: flex; gap: 6px; }
.gang::before { content: ''; position: absolute; left: 22px; right: 22px; top: 21px; height: 8px; border-radius: 4px; background: linear-gradient(#f4f6f8, #9aa1a8); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }
.station { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 2px 4px; border: 0; background: none; cursor: pointer; color: inherit; }
.station b { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 800 18px/1 var(--kopf); color: var(--akzent);
  background: radial-gradient(circle at 35% 35%, #fff8ea, #e6d3b2); border: 3px solid #b8892e; box-shadow: 0 2px 4px rgba(0, 0, 0, .35); }
.station.fertig b { background: radial-gradient(circle at 35% 35%, #9a5a2a, #341605); color: #fde68a; }
.station:hover b, .station:focus-visible b, .station.an b { border-color: var(--akzent); transform: scale(1.06); }
.station .sterne { display: inline-flex; gap: 1px; }
.station .st { width: 12px; height: 12px; fill: rgba(0, 0, 0, .2); stroke: var(--mute); stroke-width: 1.2; }
.station .st.an, .halle .hs .st.an { fill: #f59e0b; stroke: #b45309; }
.station span { font-size: 11px; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
@media (pointer: coarse) { .station b { width: 46px; height: 46px; } }
#knoepfe button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 52px; padding: 2px 0; }
#knoepfe button svg { width: 20px; height: 20px; }
#knoepfe .kl { font: 700 11px/1.1 'Segoe UI', system-ui, sans-serif; color: var(--text); white-space: nowrap; }
body.hoch #knoepfe button { height: 46px; } body.hoch #knoepfe .kl { font-size: 10px; } body.hoch #knoepfe button svg { width: 18px; height: 18px; }
#banner.zahl { display: none !important; }
@media (max-height: 720px) and (min-aspect-ratio: 1/1) { #knoepfe button { height: 46px; } }
body.kak-wartet #banner { display: none !important; }
body.hoch #knoepfe { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.hoch #knoepfe button { flex-direction: row; gap: 5px; height: 44px; }
body.hoch #knoepfe .kl { font-size: 12px; }
body.hoch .wert span { font-size: 11px; }
