:root {
  --akzent: #ffd27a; --akzent2: #c98a2c; --akzent3: #4a2a08; --tief: #2a1a10; --panel: rgba(58, 36, 20, .5); --panel2: rgba(60, 38, 20, .96);
  --text: #fff3d6; --mute: #ecd8b0; --rand: rgba(255, 210, 122, .5); --knopf1: #9a6a3a; --knopf2: #5a3a1c; --knopfText: #fff3d6;
  --holz1: #7a5230; --holz2: #6a4424; --holz3: #8a5e38; --papier1: #f8efd6; --papier2: #ead9b0; --tinte: #3a2a14; --tinte2: #8a4a10;
  --grund-q: url(img/kulisse-heide-q.webp?v=2); --grund-h: url(img/kulisse-heide-h.webp?v=2); --boden: url(img/weide-heide.webp?v=2);
}
html[data-ansicht="morgen"] {
  --akzent: #ffc8a8; --akzent2: #c4766a; --panel: rgba(70, 40, 50, .5); --panel2: rgba(74, 44, 54, .96); --mute: #f0d4cc;
  --holz1: #7a5040; --holz2: #6a4034; --holz3: #8a6050;
  --grund-q: url(img/kulisse-morgen-q.webp?v=2); --grund-h: url(img/kulisse-morgen-h.webp?v=2); --boden: url(img/weide-morgen.webp?v=2);
}
html[data-ansicht="mittag"] {
  --akzent: #7a3a08; --akzent2: #b07434; --akzent3: #f2e2c0; --tief: #e6d6b6; --panel: rgba(246, 234, 206, .55); --panel2: rgba(246, 236, 214, .97);
  --text: #2e2010; --mute: #47351a; --rand: rgba(138, 74, 16, .45); --knopf1: #ead2a2; --knopf2: #c9a466; --knopfText: #2e2010;
  --holz1: #e8d2a8; --holz2: #d6bc8e; --holz3: #eedcb8;
  --grund-q: url(img/kulisse-mittag-q.webp?v=2); --grund-h: url(img/kulisse-mittag-h.webp?v=2); --boden: url(img/weide-mittag.webp?v=2);
}
body { background: #6a4a6a; }
#kulisse { position: fixed; inset: 0; z-index: 0; background: var(--grund-q) center / cover no-repeat; overflow: hidden; }
body.hoch #kulisse { background-image: var(--grund-h); }
#kulisse .wolke { position: absolute; top: 6%; width: 220px; height: 60px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(255, 250, 240, .55), rgba(255, 250, 240, 0) 70%); animation: wolke 90s linear infinite; }
#kulisse .w2 { top: 14%; width: 300px; animation-duration: 140s; animation-delay: -60s; }
@keyframes wolke { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }
@media (prefers-reduced-motion: reduce) { #kulisse .wolke { animation: none; display: none; } }
#buehne { z-index: 1; }
html[data-ansicht="mittag"] #logo span, html[data-ansicht="mittag"] #logo b { text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
html[data-ansicht="mittag"] .wert b { color: #2e2010; }

#hud { background: repeating-linear-gradient(90deg, var(--holz1) 0 38px, var(--holz2) 38px 40px, var(--holz3) 40px 78px, var(--holz2) 78px 80px);
  border: 3px solid #4a2e18; box-shadow: 0 12px 28px rgba(30, 15, 5, .5), inset 0 2px 0 rgba(255, 230, 190, .25); backdrop-filter: none; }
.wert { background: rgba(40, 24, 12, .42); }
html[data-ansicht="mittag"] .wert { background: rgba(255, 248, 230, .6); }
#knoepfe { grid-template-columns: repeat(3, 1fr); }
@media (max-height: 860px) and (min-aspect-ratio: 1/1) {
  #hud { gap: 6px; padding: 10px 12px; } #logo { font-size: 26px; padding: 2px 0 0; } .wert { padding: 3px 8px 4px; } .wert b { font-size: 24px; } .wert.klein b { font-size: 19px; }
  #knoepfe button { height: 40px; }
}
#eigen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

#zettel { flex: none; position: relative; padding: 10px 12px 8px; border-radius: 4px; color: var(--tinte); transform: rotate(-1.2deg);
  background: linear-gradient(180deg, var(--papier1), var(--papier2)); box-shadow: 0 6px 12px rgba(30, 15, 5, .45); font: 14px/1.3 Georgia, serif; min-height: 132px; }
#zettel::before { content: ''; position: absolute; left: 50%; top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #b7372b; box-shadow: 1px 2px 2px rgba(0, 0, 0, .4); }
#zettel > b { display: block; text-align: center; font: 800 15px/1.2 Georgia, serif; color: var(--tinte2); margin: 4px 0 4px; }
#zettel .zl { display: flex; align-items: center; gap: 6px; height: 26px; white-space: nowrap; overflow: hidden; }
#zettel .zl .kach { width: 22px; height: 22px; border-radius: 4px; border: 0; }
#zettel .zl.da { color: #6a8a3a; text-decoration: line-through; }
#zettel .zl.jetzt { font-weight: 700; color: var(--tinte2); }
#zettel .zuschlag, #zettel .glocke { font-size: 12.5px; color: #5a4424; height: 17px; white-space: nowrap; }
#zettel .zuschlag b { color: #b7372b; }

#meldung { min-height: 40px; padding: 5px 10px; border-radius: 8px; font: 700 13px/1.3 'Segoe UI', system-ui, sans-serif; color: #fff3d6;
  background: rgba(48, 30, 14, .86); border: 1.5px solid rgba(255, 214, 120, .45); display: flex; align-items: center; justify-content: center; text-align: center;
  opacity: 0; transition: opacity .18s; }
#meldung.an { opacity: 1; }
#meldung.warn { border-color: #e04a30; box-shadow: 0 0 0 2px rgba(224, 74, 48, .35); }
@media (max-height: 860px) and (min-aspect-ratio: 1/1) { #meldung { min-height: 34px; font-size: 12px; padding: 3px 8px; } }
#meldung.schwebt { position: fixed; z-index: 3; min-height: 30px; height: 30px; padding: 2px 8px; font-size: 12px; box-sizing: border-box; }

#brettbox { overflow: visible; }
#weide { position: absolute; border-radius: 6px; background: var(--boden) center / cover no-repeat; box-shadow: 0 0 0 5px #5a3a1e, 0 0 0 7px #3a2412, 0 16px 34px rgba(30, 15, 5, .55); touch-action: none; }
#weide canvas { position: absolute; left: 0; top: 0; }

#kreuz { position: absolute; right: 8px; bottom: 8px; width: 168px; height: 168px; display: none; z-index: 2; touch-action: none; transform-origin: 100% 100%; }
@media (pointer: coarse) { #kreuz { display: block; } }
#kreuz.unten { right: auto; left: 50%; margin-left: -84px; bottom: 4px; transform-origin: 50% 100%; }
#kreuz .kr { position: absolute; width: 56px; height: 56px; border-radius: 12px; border: 2px solid #3a2412; padding: 0; color: #ffe7a8; touch-action: none;
  background: repeating-linear-gradient(90deg, #8a5e38 0 10px, #7a5230 10px 12px); box-shadow: 0 4px 8px rgba(30, 15, 5, .5), inset 0 1px 0 rgba(255, 230, 190, .3);
  display: flex; align-items: center; justify-content: center; }
#kreuz .kr.an { background: #c98a2c; }
#kreuz .kr svg { width: 26px; height: 26px; fill: currentColor; pointer-events: none; }
#kreuz .kr0 { left: 56px; top: 0; } #kreuz .kr1 { left: 112px; top: 56px; } #kreuz .kr2 { left: 56px; top: 112px; } #kreuz .kr3 { left: 0; top: 56px; }
#kreuz .kr1 svg { transform: rotate(90deg); } #kreuz .kr2 svg { transform: rotate(180deg); } #kreuz .kr3 svg { transform: rotate(270deg); }
#kreuz .kmitte { position: absolute; left: 58px; top: 58px; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 2px solid #3a2412; touch-action: none;
  background: radial-gradient(circle at 40% 35%, #a77a4c, #5a3a1e); box-shadow: 0 3px 6px rgba(30, 15, 5, .45); }

#wahl { position: absolute; inset: 0; z-index: 3; overflow: auto; padding: 16px; border-radius: 12px; background: var(--panel2); scrollbar-width: thin; scrollbar-color: var(--akzent2) rgba(0, 0, 0, .3); }
#wahl::-webkit-scrollbar { width: 8px; } #wahl::-webkit-scrollbar-thumb { background: var(--akzent2); border-radius: 4px; } #wahl::-webkit-scrollbar-track { background: rgba(0, 0, 0, .3); }
#wahl h2 { margin: 0 0 6px; text-align: center; font: 800 24px/1.2 Georgia, serif; color: var(--akzent); }
#wahl p { text-align: center; margin: 0 0 12px; 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(0, 0, 0, .2);
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; color: var(--text); }
.wahlgitter button:hover { border-color: var(--akzent); }
.wahlgitter button.an { background: rgba(255, 210, 122, .3); }
.wahlgitter b { grid-row: span 2; font: 800 24px/1 Georgia, serif; 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); }

.kach { display: block; width: 48px; height: 48px; border-radius: 10px; background: center / cover no-repeat; flex: none; border: 1px solid var(--rand); }
.k-beere { background-image: var(--k-beere); } .k-gatter { background-image: var(--k-gatter); } .k-hinnerk { background-image: var(--k-hinnerk); }
.k-bock0 { background-image: var(--k-bock0); } .k-bock1 { background-image: var(--k-bock1); } .k-bock2 { background-image: var(--k-bock2); } .k-bock3 { background-image: var(--k-bock3); }
.k-pfeife { background-image: var(--k-pfeife); }
.k-ware0 { background-image: var(--k-ware0); } .k-ware1 { background-image: var(--k-ware1); } .k-ware2 { background-image: var(--k-ware2); }
.regeln .kurz { background: rgba(255, 210, 122, .14); border: 1px solid var(--rand); border-radius: 10px; padding: 8px 12px; }

body.hoch #hud { grid-template-areas: 'logo logo modus modus' 'zeit punkte e1 e2' 'zt zt zt zt' 'kn kn kn kn'; }
body.hoch #zettel { grid-area: zt; min-height: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 6px 10px 6px 18px; transform: none; font-size: 12px; }
body.hoch #zettel > b { display: none; } body.hoch #zettel .zl { height: 22px; } body.hoch #zettel .zl .kach { width: 18px; height: 18px; }
body.hoch #zettel::before { left: 8px; top: 50%; margin: -5px 0 0; }
body.hoch #zettel .glocke, body.hoch #zettel .zuschlag { height: auto; font-size: 11.5px; }
body.hoch #meldung { grid-area: zt; min-height: 0; z-index: 2; pointer-events: none; }
body.hoch #knoepfe button { width: 46px; }

#zettel .aufgabe { font-size: 12px; line-height: 1.25; margin: 2px 0 4px; color: var(--tinte2); white-space: normal; }
#zettel .geist { font-size: 12.5px; color: #4a3a8a; height: 17px; white-space: nowrap; }
body.hoch #zettel .aufgabe { flex-basis: 100%; margin: 0; font-size: 11px; }
#wahl h3 { margin: 16px 0 4px; text-align: center; font: 800 19px/1.2 Georgia, serif; color: var(--akzent); }
.wahlgitter button.lehr b { font-size: 18px; }
.wahlgitter em .sterne { display: flex; gap: 2px; margin-top: 3px; font-style: normal; }
.wahlgitter em .st { width: 16px; height: 16px; color: rgba(255, 255, 255, .25); display: inline-flex; }
.wahlgitter em .st.an { color: var(--akzent); }
.wahlgitter em .st svg { width: 16px; height: 16px; }

@media (max-height: 480px) and (min-aspect-ratio: 1/1) {
  #buehne { grid-template-columns: 176px 1fr; gap: 8px; padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
  #hud { padding: 6px 8px; gap: 4px; border-radius: 12px; }
  #logo { order: -2; font-size: 17px; letter-spacing: 1px; padding: 0; }
  #modus, #info { display: none; }
  #knoepfe { order: -1; margin: 0 0 2px; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  #knoepfe button { height: 34px; border-radius: 9px; }
  .wert { padding: 1px 6px 2px; }
  .wert span { font-size: 9px; letter-spacing: .6px; }
  .wert b, .wert.klein b { font-size: 16px; }
  #eigen { gap: 4px; }
  #zettel { min-height: 0; transform: none; padding: 4px 6px 3px 16px; font-size: 11px; }
  #zettel::before { left: 5px; top: 8px; margin: 0; }
  #zettel > b, #zettel .aufgabe { display: none; }
  #zettel .zl { height: 17px; } #zettel .zl .kach { width: 14px; height: 14px; }
  #zettel .glocke { display: none; }
  #zettel .zuschlag, #zettel .geist { font-size: 10.5px; height: 15px; }
}
@media (max-height: 860px) and (min-aspect-ratio: 1/1) {
  #info { display: none; }
  #zettel .aufgabe { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; margin: 0 0 2px; }
}
