:root { --gold: #f1c46b; --dunkel: rgba(16, 24, 34, .74); --tafel: rgba(22, 30, 40, .93); --hell: #f4efe4; --rot: #c23a2c; --blau: #2f63b0; --linie: rgba(255,255,255,.2); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #c9d6df; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--hell);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
#buehne { position: fixed; inset: 0; }
#buehne canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
#laden { position: fixed; inset: 0; display: grid; place-items: center; background: #1d2a36; font-size: 1.1rem; z-index: 9; }
#kopf { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 10px; right: 10px; display: flex; align-items: center; gap: 10px; pointer-events: none; z-index: 3; }
#kopf .titel { font-weight: 800; font-size: 1.05rem; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
#kopf small { display: block; font-weight: 600; font-size: .7rem; opacity: .85; letter-spacing: .04em; }
#kopf .kopfknoepfe { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
#kopf button.rund { width: 44px; padding: 0; font-size: 1.15rem; }
#kopf button.rund.aus { opacity: .55; }
#kopf button.rund.stockt { border-color: var(--gold); color: var(--gold); }
#radioPille { position: fixed; left: 10px; top: calc(env(safe-area-inset-top) + 58px); max-width: min(60vw, 340px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--dunkel); padding: 6px 12px; border-radius: 12px; font-size: .85rem; font-weight: 600; pointer-events: none; z-index: 2; transition: opacity .6s; }
#radioPille.weg { opacity: 0; }
.radiozeile { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--linie); }
.radiozeile .radioan { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.radiozeile .radioan input { width: 20px; height: 20px; accent-color: var(--gold); }
.radiozeile button.klein { min-height: 38px; padding: 6px 12px; font-size: .85rem; }
.radiozeile .laeuft { grid-column: 1 / -1; margin: 0; font-size: .85rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radiozeile .zuschauer { grid-column: 1 / -1; margin-top: 0; }
.radiozeile input[type=range] { width: min(50vw, 220px); accent-color: var(--gold); }
button { font: 700 .9rem system-ui, sans-serif; color: var(--hell); background: var(--dunkel); border: 1px solid rgba(255,255,255,.25); border-radius: 12px; padding: 9px 14px; min-height: 44px; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

#stand { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 8px); background: var(--dunkel); border-radius: 12px; padding: 6px 12px;
  display: grid; gap: 2px; text-align: center; font-size: .86rem; pointer-events: none; z-index: 2; max-width: min(64vw, 560px); }
#stand .zeile1 { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; justify-content: center; font-weight: 800; font-variant-numeric: tabular-nums; }
#stand .team { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; min-width: 0; }
#stand .team .nm { overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
#stand .punkte { font-size: 1.05rem; white-space: nowrap; }
#stand .dots { display: inline-flex; gap: 2px; }
#stand .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
#stand .dot.voll { background: currentColor; }
#stand .zeile2 { font-size: .78rem; opacity: .9; }
#meldung { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 66px); max-width: min(92vw, 520px); text-align: center; background: var(--dunkel);
  padding: 7px 14px; border-radius: 12px; font-size: .9rem; pointer-events: none; z-index: 2; }
#meldung:empty { display: none; }
#draufsicht { position: fixed; right: 10px; top: calc(env(safe-area-inset-top) + 62px); width: 92px; height: 140px; border-radius: 10px; border: 2px solid rgba(255,255,255,.7); box-shadow: 0 3px 10px rgba(0,0,0,.35); pointer-events: none; }
#drall { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 14px); display: flex; gap: 6px; z-index: 2; }
#drall button { min-width: 50px; padding: 6px 8px; }
#drall svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; display: block; }
#drall button[aria-pressed="true"] { background: #c98d2e; border-color: var(--gold); color: #1f1407; }
#kraft { position: fixed; left: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#kraftBalken { width: 22px; height: 38vh; border-radius: 11px; background: rgba(16,24,34,.55); border: 2px solid rgba(255,255,255,.75); position: relative; overflow: hidden; }
#kraftWert { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #4ea86b, #f1c46b 70%, #f1c46b); }
#kraftSchuss { position: absolute; left: 0; right: 0; top: 0; height: 18%; border-bottom: 2px dashed rgba(255,255,255,.8); background: rgba(208,85,62,.35); }
#kraftZiel { background: var(--dunkel); padding: 4px 8px; border-radius: 8px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
#raffer { position: fixed; top: calc(env(safe-area-inset-top) + 112px); left: 12px; background: var(--dunkel); padding: 6px 10px; border-radius: 10px; font-weight: 800; }
#debug { position: fixed; left: 10px; bottom: 4px; font: 12px monospace; background: rgba(0,0,0,.5); padding: 2px 6px; border-radius: 6px; }

/* Tafeln (Menü, Ergebnis) */
.tafel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 560px); max-height: 90vh; overflow: auto; background: var(--tafel); border: 1px solid var(--linie);
  border-radius: 18px; padding: 18px 18px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.45); z-index: 5; -webkit-user-select: auto; user-select: auto; touch-action: auto; }
.tafel h1 { margin: 0 0 2px; font-size: 1.45rem; line-height: 1.15; text-wrap: balance; }
.tafel h1 span { display: block; font-size: .95rem; font-weight: 600; opacity: .8; }
.tafel h2 { margin: 0 0 8px; font-size: 1.2rem; }
.tafel .unter { margin: 4px 0 14px; opacity: .85; font-size: .9rem; }
.knoepfe { display: grid; gap: 8px; }
.knoepfe button { text-align: left; display: grid; gap: 2px; padding: 11px 14px; background: rgba(255,255,255,.06); }
.knoepfe button b { font-size: 1rem; }
.knoepfe button span { font-weight: 500; font-size: .8rem; opacity: .8; }
.knoepfe button:hover, .knoepfe button.aktiv { background: rgba(241,196,107,.18); border-color: var(--gold); }
.einst { margin-top: 12px; display: grid; gap: 10px; }
.einst label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; }
select, .einst input { font: 600 .95rem system-ui, sans-serif; background: rgba(255,255,255,.1); color: var(--hell); border: 1px solid var(--linie); border-radius: 10px; padding: 8px 10px; min-height: 40px; }
select option { color: #111; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.teams fieldset { border: 2px solid var(--linie); border-radius: 12px; padding: 8px; margin: 0; display: grid; gap: 6px; min-width: 0; }
.teams fieldset[data-team="0"] { border-color: var(--rot); } .teams fieldset[data-team="1"] { border-color: var(--blau); }
.teams legend { padding: 0 4px; }
.teams .tname { width: 9em; font-weight: 800; }
.teams .spieler { display: grid; gap: 6px; }
.teams .spieler div { display: flex; gap: 4px; }
.teams .spieler input { flex: 1; min-width: 0; }
.teams .spieler button { min-height: 40px; padding: 4px 10px; }
.teams .plus { padding: 6px; min-height: 38px; background: rgba(255,255,255,.06); }
.los { background: #c98d2e; border-color: var(--gold); color: #1f1407; font-size: 1.05rem; }
.zuschauer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; font-weight: 600; }
.hilfe { margin-top: 12px; font-size: .86rem; line-height: 1.45; opacity: .9; }
.hilfe summary { cursor: pointer; font-weight: 700; }
.zeit { margin: 10px 0 0; font-size: .82rem; opacity: .8; text-align: center; }
.zeit a { color: var(--gold); }
#ergebnis table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 6px 0 12px; }
#ergebnis th, #ergebnis td { padding: 5px 6px; border-bottom: 1px solid var(--linie); text-align: center; }
#ergebnis th:first-child, #ergebnis td:first-child { text-align: left; }
#ergebnis .gross { font-size: 1.6rem; font-weight: 800; text-align: center; margin: 4px 0 10px; }
#ergebnis .reihe { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#ergebnis .reihe button:first-child { background: #c98d2e; border-color: var(--gold); color: #1f1407; }

@media (orientation: portrait) {
  #draufsicht { width: 64px; height: 98px; top: calc(env(safe-area-inset-top) + 112px); }
  #radioPille { top: calc(env(safe-area-inset-top) + 160px); max-width: 64vw; }
  #stand { top: calc(env(safe-area-inset-top) + 54px); max-width: 94vw; }
  #meldung { font-size: .84rem; top: auto; bottom: calc(env(safe-area-inset-bottom) + 76px); max-width: 92vw; }
  #stand .team .nm { max-width: 6.5em; }
  .teams { grid-template-columns: 1fr; }
}

body.menue-offen #draufsicht, body.menue-offen #stand { display: none; }

/* Werkstatt (Eisstock-Generator) */
.knoepfe button.werkstattknopf { background: rgba(241,196,107,.12); border-color: rgba(241,196,107,.55); }
.stockwahl { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: .85rem; font-weight: 600; }
.stockwahl select { max-width: 62%; min-height: 36px; font-size: .85rem; }
.tafel.werkstatt { width: min(96vw, 900px); max-height: 94vh; padding-block: 14px; }
.wk-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wk-kopf h2 { margin: 0; } .wk-kopf h2 span { font-size: .9rem; font-weight: 600; opacity: .75; }
.wk-kopf button { min-height: 40px; width: 44px; padding: 0; }
.wk-inhalt { display: grid; gap: 12px; margin-top: 10px; }
.wk-buehne canvas { display: block; width: 100%; height: min(32vh, 280px); border-radius: 12px; background: radial-gradient(ellipse at 50% 35%, #3a4d60, #17212c 75%); touch-action: none; cursor: grab; }
.wk-buehne p { margin: 6px 0 0; font-size: .78rem; opacity: .75; text-align: center; }
.wk-gruppe { margin-bottom: 12px; } .wk-gruppe h3 { margin: 0 0 6px; font-size: .95rem; } .wk-gruppe h3 small { font-weight: 500; opacity: .7; font-size: .75rem; }
.wk-zeile { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.wk-zeile button { min-height: 36px; }
.wk-chip { padding: 6px 11px; font-size: .82rem; border-radius: 999px; background: rgba(255,255,255,.06); }
.wk-chip.an { background: rgba(241,196,107,.22); border-color: var(--gold); color: #fff; }
.wk-farbe, .wk-holz { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; position: relative; border: 2px solid rgba(255,255,255,.35); }
.wk-farbe { background: var(--f); }
.wk-holz { background: repeating-linear-gradient(170deg, var(--f) 0 5px, var(--f2) 5px 6px, var(--f) 6px 11px); }
.wk-farbe.an, .wk-holz.an { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(241,196,107,.55); }
.wk-farbe span, .wk-holz span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wk-farbe:disabled { opacity: .45; cursor: not-allowed; } .wk-farbe:disabled::after { content: '🔒'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; }
.wk-hinweis { margin: 2px 0 0; font-size: .78rem; opacity: .8; }
.wk-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
@media (orientation: landscape) and (min-width: 640px) {
  .wk-inhalt { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }
  .wk-buehne { position: sticky; top: 0; }
  .wk-buehne canvas { height: min(66vh, 440px); }
}

/* Spielhallen-Links + Quellen im Menü */
.portal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 10px; font-size: .8rem; }
.portal-links a, .quellen a { color: var(--gold); }
.quellen p { font-size: .8rem; }

/* Werkstatt: Knopf „Auf diesem Gerät merken“ */
.wk-merken { margin: 4px 0 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(241,196,107,.6); background: rgba(241,196,107,.08); font-size: .85rem; }
.wk-merken p { margin: 0 0 8px; } .wk-merken p.klein { margin: 8px 0 0; font-size: .74rem; opacity: .75; line-height: 1.35; }
.wk-merken button { min-height: 40px; background: #c98d2e; border-color: var(--gold); color: #1f1407; }
.wk-merken.an { border-style: solid; border-color: rgba(110,190,120,.6); background: rgba(110,190,120,.1); }

/* Platz fuer das Zahnrad der Spielhalle unten rechts (hs-play.js), damit es keine Tafel-Ecke verdeckt */
@media (orientation: portrait) { .tafel, .tafel.werkstatt { max-height: calc(100vh - 120px); top: calc(50% - 18px); } }
@media (orientation: landscape) and (max-height: 500px) { .tafel, .tafel.werkstatt { max-height: calc(100vh - 56px); top: calc(50% - 14px); } }

/* Tageszeit-Schalter im Menü (Charly 25.11.: größer, nicht nur kleine Schrift) */
.tageszeit { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; font-weight: 600; }
.zeitknoepfe { display: inline-flex; gap: 6px; }
a.zeitknopf { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--linie);
  background: rgba(255,255,255,.08); color: var(--hell); text-decoration: none; font-weight: 700; font-size: .95rem; white-space: nowrap; }
a.zeitknopf:hover { border-color: var(--gold); }
a.zeitknopf.an { background: #c98d2e; border-color: var(--gold); color: #1f1407; }
