:root {
  --akzent: #ffcf4a; --akzent2: #c98a2c; --akzent3: #5a2c08; --tief: #140f05; --panel: rgba(30, 20, 6, .86); --panel2: rgba(52, 34, 10, .9);
  --text: #fff6e0; --mute: #e8d4a6; --rot: #ff5a3c; --gruen: #8fe36a; --rand: rgba(255, 207, 74, .5); --schatten: 0 10px 30px rgba(0, 0, 0, .6);
  --kopf: 'Bahnschrift', 'Segoe UI', system-ui, sans-serif; --knopf1: #9a6a24; --knopf2: #5c3a0c; --knopfText: #fff6e0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--tief); color: var(--text);
  font: 15px/1.35 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; }
body { background: var(--tief) center / cover no-repeat; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
#ov, #ov * { scrollbar-width: thin; scrollbar-color: var(--akzent2) rgba(0, 0, 0, .35); }
#ov ::-webkit-scrollbar { width: 8px; height: 8px; }
#ov ::-webkit-scrollbar-track { background: rgba(0, 0, 0, .35); border-radius: 4px; }
#ov ::-webkit-scrollbar-thumb { background: var(--akzent2); border-radius: 4px; }

#buehne { position: fixed; inset: 0; display: grid; grid-template-columns: 280px 1fr; gap: 14px; padding: 14px; }
#hud { position: relative; border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden;
  background: var(--panel); border: 2px solid var(--rand); box-shadow: var(--schatten), inset 0 1px 0 rgba(255, 255, 255, .08); backdrop-filter: blur(3px); }
#logo { text-align: center; font: 800 32px/1 var(--kopf); letter-spacing: 2px; padding: 6px 0 2px; }
#logo span { color: var(--text); text-shadow: 0 2px 0 var(--akzent3), 0 4px 8px rgba(0, 0, 0, .5); }
#logo b { color: var(--akzent); text-shadow: 0 2px 0 var(--akzent3), 0 0 16px rgba(255, 200, 80, .5); }
#modus { text-align: center; font: 700 14px/1.2 var(--kopf); color: var(--mute); min-height: 17px; }
.wert { text-align: center; padding: 7px 8px 9px; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px solid var(--rand); }
.wert span { display: block; font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: 1.4px; }
.wert b { display: block; font: 800 34px/1.1 var(--kopf); color: #fff; font-variant-numeric: tabular-nums; }
.wert.knapp b { color: var(--rot); animation: knapp .5s steps(2) infinite; }
@keyframes knapp { 50% { opacity: .45; } }
#eigen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wert.klein b { font-size: 24px; }
#info { font-size: 13px; color: var(--mute); text-align: center; }
#info b { color: var(--text); }
#knoepfe { margin-top: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#knoepfe button, .knopf { height: 44px; border-radius: 12px; border: 2px solid rgba(0, 0, 0, .55); background: linear-gradient(var(--knopf1), var(--knopf2));
  display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 rgba(0, 0, 0, .5); color: var(--knopfText); }
#knoepfe button:hover, .knopf:hover { filter: brightness(1.12); }
#knoepfe button:active, .knopf:active { transform: translateY(2px); }
#knoepfe svg, .knopf svg { width: 22px; height: 22px; color: var(--akzent); }
#brettbox { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
#brett { display: block; touch-action: none; }
#banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; z-index: 3; white-space: nowrap;
  font: 800 52px/1.1 var(--kopf); color: #fff3cf; text-shadow: 0 3px 0 var(--akzent3), 0 0 24px rgba(255, 190, 60, .85), 0 6px 18px rgba(0, 0, 0, .85); animation: banner 1.6s ease-out forwards; }
#banner small { display: block; font: 700 18px/1.3 'Segoe UI', system-ui, sans-serif; color: var(--text); text-shadow: 0 2px 6px #000; margin-top: 6px; }
#banner.zahl { font-size: 110px; animation-duration: .7s; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

body.hoch #buehne { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 8px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
body.hoch #hud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: 'logo logo modus modus' 'zeit punkte e1 e2' 'kn kn kn kn'; gap: 6px; padding: 8px; border-radius: 14px; }
body.hoch #logo { grid-area: logo; font-size: 20px; text-align: left; padding: 0; }
body.hoch #modus { grid-area: modus; text-align: right; align-self: center; font-size: 12px; }
body.hoch #wZeit { grid-area: zeit; } body.hoch #wPunkte { grid-area: punkte; }
body.hoch #eigen { display: contents; }
body.hoch #eigen .wert:nth-child(1) { grid-area: e1; } body.hoch #eigen .wert:nth-child(2) { grid-area: e2; } body.hoch #eigen .wert:nth-child(n+3) { display: none; }
body.hoch .wert { padding: 3px 4px 4px; } body.hoch .wert b, body.hoch .wert.klein b { font-size: 21px; } body.hoch .wert span { font-size: 11px; letter-spacing: .5px; }
body.hoch #info { display: none; }
body.hoch #knoepfe { grid-area: kn; margin: 0; display: flex; justify-content: center; gap: 10px; }
body.hoch #knoepfe button { width: 54px; height: 44px; }
body.hoch #banner { font-size: 38px; } body.hoch #banner.zahl { font-size: 84px; }

#ov { position: fixed; inset: 0; z-index: 20; background: rgba(10, 6, 2, .66); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.dlg { position: relative; width: min(600px, 100%); max-height: 100%; overflow: auto; border-radius: 20px; padding: 22px 24px; background: var(--panel2); border: 2px solid var(--rand); box-shadow: var(--schatten); }
.dlg h2 { margin: 0 0 6px; font: 800 30px/1.15 var(--kopf); color: var(--akzent); text-align: center; text-shadow: 0 2px 0 var(--akzent3); }
.dlg h3 { margin: 20px 0 8px; font: 800 18px/1.2 var(--kopf); color: var(--akzent); }
.dlg p { margin: 6px 0; }
.dlg .unter { text-align: center; color: var(--mute); margin-bottom: 12px; }
.dlg .zu { position: absolute; right: 12px; top: 12px; width: 42px; height: 42px; border-radius: 10px; border: 2px solid rgba(0, 0, 0, .5); background: linear-gradient(var(--knopf1), var(--knopf2)); display: flex; align-items: center; justify-content: center; }
.dlg .zu svg { width: 18px; height: 18px; color: var(--akzent); }
.reihe { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.knopf { padding: 0 20px; font-weight: 700; min-width: 140px; }
.knopf.haupt { background: linear-gradient(#ffe48a, #f2b83a 50%, #c47d14); color: #3a1c02; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 3px 0 rgba(0, 0, 0, .45); }
.knopf.haupt svg { color: #3a1c02; }
.menue { width: min(640px, 100%); text-align: center; }
.menue .schildkopf { font: 800 48px/1 var(--kopf); letter-spacing: 3px; margin: 4px 0 8px; }
.menue .schildkopf span { color: var(--text); text-shadow: 0 3px 0 var(--akzent3); }
.menue .schildkopf b { color: var(--akzent); text-shadow: 0 3px 0 var(--akzent3), 0 0 16px rgba(255, 200, 80, .5); }
.modi { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 6px; }
.modi.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .menue:has(.modi.n3) { width: min(760px, 100%); }
.modi.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .menue:has(.modi.n4) { width: min(700px, 100%); }
.modus.verweis { border-style: dashed; }
.modus { padding: 14px 12px 12px; border-radius: 16px; border: 2px solid rgba(0, 0, 0, .5); text-align: center; color: #fff; background: linear-gradient(rgba(0, 0, 0, .38), rgba(0, 0, 0, .38)), linear-gradient(var(--knopf1), var(--knopf2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 rgba(0, 0, 0, .45); }
.modus.tag { background: linear-gradient(#ffe48a, #f2b83a 50%, #c47d14); color: #3a1c02; }
.modus svg { width: 30px; height: 30px; display: block; margin: 0 auto 4px; color: var(--akzent); }
.modus.tag svg { color: #5a2c08; }
.modus b { display: block; font: 800 22px/1.15 var(--kopf); }
.modus span { display: block; font-size: 13px; margin-top: 3px; }
.modus em { display: block; font-style: normal; font: 800 18px/1.2 var(--kopf); margin-top: 6px; font-variant-numeric: tabular-nums; }
.modus:hover { filter: brightness(1.1); }
.liste { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; text-align: left; }
.liste td { padding: 5px 6px; border-bottom: 1px solid rgba(255, 207, 74, .15); }
.liste td:first-child { width: 34px; color: var(--akzent); font-weight: 800; }
.liste td:last-child { text-align: right; font-weight: 700; }
.leer { color: var(--mute); padding: 8px; }
.endwert { text-align: center; font: 800 58px/1 var(--kopf); color: #fff3cf; text-shadow: 0 3px 0 var(--akzent3), 0 0 18px rgba(255, 200, 80, .5); margin: 8px 0; font-variant-numeric: tabular-nums; }
.endwert small { display: block; font: 700 13px/1.4 'Segoe UI', system-ui, sans-serif; color: var(--mute); text-shadow: none; letter-spacing: 1px; text-transform: uppercase; }
.rechnung { width: 100%; border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; }
.rechnung td { padding: 5px 4px; border-bottom: 1px solid rgba(255, 207, 74, .15); }
.rechnung td:last-child { text-align: right; font-weight: 700; }
.rechnung tr.summe td { border-bottom: 0; color: var(--akzent); font-size: 16px; }
.hinweis { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .3); color: var(--mute); font-size: 13.5px; text-align: center; }
.hinweis.gut { color: var(--gruen); } .hinweis.schlecht { color: var(--rot); }
.rekord { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 8px; background: var(--akzent); color: #3a1c02; font-size: 12px; font-weight: 800; vertical-align: middle; }
.regeln .bsp { display: grid; grid-template-columns: 56px 1fr; gap: 10px 14px; align-items: center; margin: 8px 0; }
.regeln .bsp img { width: 52px; height: 52px; object-fit: contain; }
.regeln ul { margin: 6px 0; padding-left: 20px; } .regeln li { margin: 4px 0; }
.lade { color: var(--mute); text-align: center; padding: 30px; font: 800 20px/1.3 var(--kopf); }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; background: var(--panel2); border: 1px solid var(--rand); border-radius: 12px; padding: 10px 16px; box-shadow: var(--schatten); }
@media (max-width: 700px) { .dlg { padding: 18px 14px; } .knopf { min-width: 120px; } .menue .schildkopf { font-size: 36px; } .modi { grid-template-columns: 1fr; gap: 10px; } .modus { padding: 10px; } .endwert { font-size: 46px; } }
@media (max-width: 700px) { .modi.n3 { grid-template-columns: 1fr; } }
@media (max-height: 560px) {
  body:not(.hoch) #buehne { grid-template-columns: 190px 1fr; gap: 8px; padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
  body:not(.hoch) #hud { padding: 8px 10px; gap: 6px; border-radius: 14px; overflow-y: auto; scrollbar-width: none; }
  body:not(.hoch) #logo { font-size: 21px; letter-spacing: 1px; padding: 0; }
  body:not(.hoch) #modus { font-size: 12px; min-height: 0; }
  body:not(.hoch) .wert { padding: 2px 6px 4px; border-radius: 10px; }
  body:not(.hoch) .wert span { font-size: 10px; letter-spacing: .8px; }
  body:not(.hoch) .wert b { font-size: 24px; } body:not(.hoch) .wert.klein b { font-size: 18px; }
  body:not(.hoch) #eigen { gap: 6px; } body:not(.hoch) #info { font-size: 11.5px; }
  body:not(.hoch) #knoepfe { gap: 5px; } body:not(.hoch) #knoepfe button { height: 38px; border-radius: 10px; }
  body:not(.hoch) #knoepfe svg { width: 19px; height: 19px; }
  .dlg { padding: 14px 16px; } .dlg h2 { font-size: 24px; } .endwert { font-size: 40px; margin: 4px 0; } .reihe { margin-top: 10px; }
}
