/* Partybox-App. Farben pro Edition hängt das Build-Skript unten an. */
:root {
  --bg: #0d1330; --bg2: #23305e; --akzent: #ffd166; --c: #e63946;
  --fg: #fff; --mut: #c3c9e2; --gold: #ffd166;
  --flaeche: rgba(255, 255, 255, .08); --rand: rgba(255, 255, 255, .16);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(circle at 50% 0%, var(--bg2), var(--bg) 70%) fixed var(--bg);
  color: var(--fg); font-family: Nunito, 'Segoe UI', system-ui, sans-serif; font-size: 16px; line-height: 1.4;
  overflow-x: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
a { color: var(--gold); }
.hidden { display: none !important; }
#root { min-height: 100%; }

/* Tore: Alter, Installation, Freischaltung */
.gate { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 18px; max-width: 460px; margin: 0 auto; padding: calc(24px + var(--st)) 16px calc(24px + var(--sb)); text-align: center; }
.brand { letter-spacing: 4px; color: var(--gold); font-weight: 800; font-size: 13px; }
.titel { font-family: Fredoka, sans-serif; font-size: clamp(40px, 13vw, 64px); line-height: 1.05; font-weight: 700; color: var(--gold); }
.unter { font-family: Fredoka, sans-serif; font-weight: 500; font-size: clamp(20px, 5.4vw, 26px); }
.panel { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 18px; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.panel h2 { font-family: Fredoka, sans-serif; font-size: 22px; font-weight: 700; line-height: 1.2; }
.panel ol { padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.fein { color: var(--mut); font-size: 14px; }
.zeile { display: flex; flex-direction: column; gap: 5px; font-weight: 800; font-size: 15px; }
.zeile input { background: rgba(0, 0, 0, .25); border: 2px solid var(--rand); border-radius: 12px; padding: 12px; font-size: 17px; font-weight: 700; width: 100%; min-height: 48px; }
.zeile input:focus { outline: none; border-color: var(--gold); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; width: 100%; padding: 12px 16px; border-radius: 14px; font-weight: 800; font-size: 17px; background: var(--flaeche); border: 2px solid var(--rand); text-decoration: none; color: var(--fg); }
.btn.main { background: var(--akzent); border-color: var(--akzent); color: #161a2c; }
.btn:disabled { opacity: .6; }
.leise { color: var(--mut); text-decoration: underline; font-size: 15px; padding: 10px; min-height: 44px; }
.fehler { background: rgba(255, 60, 90, .18); border: 1px solid rgba(255, 120, 140, .6); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 15px; }
.gut { background: rgba(60, 220, 150, .16); border: 1px solid rgba(120, 240, 180, .55); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 15px; }

/* Menü */
#menu { max-width: 1100px; margin: 0 auto; padding: calc(16px + var(--st)) calc(14px + var(--sr)) calc(28px + var(--sb)) calc(14px + var(--sl)); }
#menu header { text-align: center; margin: 8px 0 18px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.kachel { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--flaeche); border: 1px solid var(--rand); border-left: 7px solid var(--c); border-radius: 14px; padding: 12px 14px; min-height: 72px; width: 100%; }
.kachel:active { background: rgba(255, 255, 255, .16); }
.kachel .ic { font-size: 30px; line-height: 1; flex: none; width: 38px; text-align: center; }
.kachel b { display: block; font-family: Fredoka, sans-serif; font-weight: 700; font-size: 18px; line-height: 1.2; }
.kachel small { color: var(--mut); font-size: 14px; }
.info { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.wichtig { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.wichtig h2 { font-family: Fredoka, sans-serif; font-size: 18px; margin-bottom: 4px; }
.wichtig ul { padding-left: 1.2em; }
.wichtig summary { font-family: Fredoka, sans-serif; font-size: 18px; min-height: 28px; cursor: pointer; }
.wichtig[open] summary { margin-bottom: 6px; }
.wichtig p { margin-top: 6px; }
.fuss { text-align: center; color: var(--mut); font-size: 13px; }
.fuss a { padding: 6px; display: inline-block; }

/* Spiel */
#game { position: fixed; inset: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--st)) calc(10px + var(--sr)) 8px calc(10px + var(--sl)); background: var(--c); flex: none; min-height: 56px; }
.top b { font-family: Fredoka, sans-serif; font-size: 18px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.top .zaehler { font-weight: 800; font-size: 14px; white-space: nowrap; opacity: .95; }
.rund { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .22); font-size: 20px; font-weight: 800; }
.pill { background: rgba(0, 0, 0, .25); padding: 0 12px; height: 44px; border-radius: 999px; font-weight: 800; white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.pill.run { background: var(--gold); color: #161a2c; }
.pill.done { background: #ff006e; color: #fff; animation: blink .5s 6 alternate; }
@keyframes blink { to { opacity: .4; } }
#stage { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; padding: 16px calc(16px + var(--sr)) 16px calc(16px + var(--sl)); text-align: center; user-select: none; -webkit-user-select: none; }
.karte { width: min(900px, 100%); margin: auto; }
.karte.rein { animation: pop .2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.pre { color: var(--gold); font-weight: 800; font-size: clamp(19px, 5.4vw, 30px); margin-bottom: 10px; }
.haupt { font-family: Fredoka, sans-serif; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; hyphens: auto; }
.haupt.xl { font-size: clamp(40px, 12.5vw, 84px); }
.haupt.l { font-size: clamp(32px, 9.4vw, 66px); }
.haupt.m { font-size: clamp(27px, 7.6vw, 54px); }
.haupt.s { font-size: clamp(24px, 6.4vw, 46px); }
.stufe { display: inline-block; background: var(--c); border-radius: 999px; padding: 5px 16px; font-weight: 800; margin-bottom: 14px; font-size: 16px; }
.verboten { list-style: none; margin-top: 20px; font-size: clamp(19px, 5.4vw, 30px); color: var(--mut); display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.verboten li::before { content: '✕ '; color: #ff6b6b; }
.buchstabe { font-family: Fredoka, sans-serif; font-weight: 700; font-size: clamp(96px, 30vw, 200px); line-height: 1; color: var(--gold); }
.emo { font-size: clamp(52px, 15vw, 110px); line-height: 1.2; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; overflow-wrap: anywhere; }
.loesung { margin-top: 22px; font-size: clamp(22px, 6.2vw, 36px); color: var(--gold); font-weight: 800; min-height: 1.3em; }
.verdeckt { font-size: 56px; line-height: 1.2; }
.verdeckt span { display: block; font-size: 20px; color: var(--mut); font-weight: 700; }
.regeln { text-align: left; max-width: 640px; margin: 0 auto; font-size: clamp(17px, 4.6vw, 21px); }
.regeln h2 { font-family: Fredoka, sans-serif; font-size: clamp(26px, 7.6vw, 40px); line-height: 1.15; text-align: center; }
.regeln .meta { color: var(--mut); text-align: center; margin: 4px 0 14px; font-size: 16px; }
.regeln ol { padding-left: 1.3em; }
.regeln li { margin-bottom: 9px; }
.papier { background: rgba(255, 209, 102, .14); border: 1px solid rgba(255, 209, 102, .5); border-radius: 12px; padding: 9px 12px; margin-bottom: 14px; font-size: 15px; font-weight: 700; }
/* Maße aus --w: Prozent bei padding beziehen sich nicht auf den Würfel, sondern auf die Karte */
.wuerfel { --w: clamp(104px, 30vw, 170px); display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: calc(var(--w) * .07); width: var(--w); height: var(--w); padding: calc(var(--w) * .14); background: #fff; border-radius: 22%; margin-bottom: 18px; }
.wuerfel i { border-radius: 50%; }
.wuerfel i.on { background: #0d1330; }
.wuerfel.rollt { animation: rollen .45s ease-out; }
@keyframes rollen { 0% { transform: rotate(0) scale(.6); } 60% { transform: rotate(320deg) scale(1.1); } 100% { transform: rotate(360deg) scale(1); } }
.leiste { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px calc(10px + var(--sr)) calc(10px + var(--sb)) calc(10px + var(--sl)); background: rgba(0, 0, 0, .2); }
.knoepfe { display: grid; grid-template-columns: repeat(var(--spalten, 4), minmax(0, 1fr)); gap: 6px; }
.knoepfe button { min-height: 50px; padding: 4px 2px; border-radius: 12px; background: var(--flaeche); border: 1px solid var(--rand); font-weight: 800; font-size: 12.5px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.knoepfe button span { font-size: 18px; }
.knoepfe button.aktiv { background: var(--gold); color: #161a2c; }
#weiter { min-height: 54px; border-radius: 14px; background: var(--c); font-weight: 800; font-size: 19px; border: 2px solid rgba(255, 255, 255, .28); text-shadow: 0 1px 3px rgba(0, 0, 0, .45); }

/* Bingo */
.bingo-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-weight: 800; }
.bingo-kopf .pre { margin: 0; font-size: 17px; }
.bgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.bfeld { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 9px; padding: 5px 3px; min-height: 96px; font-size: 11.5px; font-weight: 700; line-height: 1.16; display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; gap: 3px; overflow: hidden; }
.bfeld span { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; }
.bfeld em { font-style: normal; color: #161a2c; background: var(--gold); border-radius: 5px; padding: 1px 2px; font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bfeld.an { background: rgba(255, 209, 102, .22); border-color: var(--gold); }
.bingo-ruf { margin-top: 10px; font-family: Fredoka, sans-serif; font-size: 26px; font-weight: 700; color: var(--gold); }
.bingo-aktion { margin-top: 10px; }

/* Stadt-Land-Fluss */
.slf { width: 100%; max-width: 560px; margin: 0 auto; }
.slf .buchstabe { font-size: clamp(72px, 22vw, 130px); }
.slf-kopf { display: flex; align-items: center; justify-content: center; gap: 16px; }
.slf-stand { text-align: left; color: var(--mut); font-weight: 800; font-size: 15px; }
.slf-stand b { display: block; color: var(--fg); font-size: 22px; font-family: Fredoka, sans-serif; }
.slf-reihe { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 8px 10px; margin-top: 8px; text-align: left; }
.slf-reihe label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.slf-reihe input { width: 100%; background: rgba(0, 0, 0, .25); border: 1px solid var(--rand); border-radius: 9px; padding: 9px 10px; font-size: 16px; min-height: 44px; user-select: text; -webkit-user-select: text; }
.slf-punkte { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 6px; }
.slf-punkte button { min-height: 40px; border-radius: 9px; border: 1px solid var(--rand); font-weight: 800; }
.slf-punkte button.an { background: var(--gold); color: #161a2c; }

/* Zeichnen */
.zeichnen { position: absolute; inset: 0; display: flex; flex-direction: column; }
#stage.malt { position: relative; padding: 0; }
.malgrund { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #fff; }
.zeichnen canvas { position: absolute; left: 0; top: 0; touch-action: none; display: block; }
.mal-leiste { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(0, 0, 0, .35); }
.farbe { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); }
.farbe.an { border-color: #fff; }
.mal-knopf { min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--flaeche); border: 1px solid var(--rand); font-weight: 800; font-size: 14px; }
.platz { flex: 1; }

/* Ebenen */
.ebene { position: fixed; inset: 0; z-index: 20; background: rgba(5, 8, 22, .78); display: flex; align-items: center; justify-content: center; padding: calc(12px + var(--st)) 12px calc(12px + var(--sb)); }
.blatt { width: min(460px, 100%); max-height: 100%; overflow-y: auto; background: var(--bg); border: 1px solid var(--rand); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.blatt h2 { font-family: Fredoka, sans-serif; font-size: 22px; line-height: 1.2; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.punkte-reihe { display: flex; align-items: center; gap: 8px; background: var(--flaeche); border-radius: 12px; padding: 6px 8px; }
.punkte-reihe b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punkte-reihe .zahl { min-width: 36px; text-align: center; font-family: Fredoka, sans-serif; font-size: 22px; font-weight: 700; }
.mini { width: 42px; height: 42px; border-radius: 10px; background: var(--flaeche); border: 1px solid var(--rand); font-weight: 800; font-size: 20px; flex: none; }
.neu { display: flex; gap: 8px; }
.neu input { flex: 1; min-width: 0; background: rgba(0, 0, 0, .25); border: 2px solid var(--rand); border-radius: 12px; padding: 10px; font-size: 16px; min-height: 46px; }
.neu button { flex: none; width: auto; padding: 0 14px; min-height: 46px; }

/* Handy an der Stirn */
.stirn { position: fixed; inset: 0; z-index: 30; background: #000; color: #fff; overflow: hidden; text-align: center; font-family: Fredoka, sans-serif; font-weight: 700; }
.stirn .dreh { position: absolute; left: 50%; top: 50%; width: 92%; transform: translate(-50%, -50%); }
.stirn .wort { font-size: clamp(44px, 22vmin, 120px); line-height: 1.1; overflow-wrap: anywhere; }
.stirn .zahl { font-size: 34vmin; color: var(--gold); }
.stirn .tipp { font-family: Nunito, sans-serif; font-size: 18px; color: var(--mut); margin-top: 18px; }
@media (orientation: portrait) {
  .stirn .dreh { width: 92dvh; transform: translate(-50%, -50%) rotate(90deg); }
}

/* Laptop und Fernseher */
@media (min-width: 800px) {
  .haupt.xl { font-size: clamp(60px, 6.4vw, 110px); }
  .haupt.l { font-size: clamp(48px, 5vw, 90px); }
  .haupt.m { font-size: clamp(40px, 4.2vw, 72px); }
  .haupt.s { font-size: clamp(34px, 3.4vw, 60px); }
  .top b { font-size: 24px; }
  .leiste { flex-direction: row; justify-content: center; align-items: stretch; }
  .knoepfe { display: flex; flex-wrap: wrap; justify-content: center; }
  .knoepfe button { min-width: 84px; padding: 4px 10px; font-size: 13.5px; }
  #weiter { padding: 0 34px; }
  .bfeld { min-height: 110px; font-size: 14px; }
  .bgrid { max-width: 800px; margin: 0 auto; }
}
/* Handy quer, etwa zum Spiegeln auf den Fernseher: Knöpfe an die Seite, die Karte bekommt die Höhe */
@media (orientation: landscape) and (max-height: 520px) {
  #game { display: grid; grid-template-columns: minmax(0, 1fr) clamp(176px, 27vw, 230px); grid-template-rows: auto minmax(0, 1fr); }
  .top { grid-column: 1 / -1; min-height: 0; padding-top: calc(2px + var(--st)); padding-bottom: 2px; }
  .top b { font-size: 18px; }
  #stage { padding: 6px 10px 6px calc(12px + var(--sl)); }
  .leiste { flex-direction: column; justify-content: flex-end; align-items: stretch; min-height: 0; gap: 6px; padding: 6px calc(8px + var(--sr)) calc(6px + var(--sb)) 8px; }
  .knoepfe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; gap: 4px; }
  .knoepfe button { min-width: 0; min-height: 44px; padding: 2px; font-size: 11.5px; }
  .knoepfe button span { font-size: 16px; line-height: 1.1; }
  #weiter { flex: 1; min-height: 50px; padding: 0 4px; font-size: 16px; }
  .haupt.xl { font-size: clamp(34px, 15vh, 62px); }
  .haupt.l { font-size: clamp(28px, 12vh, 50px); }
  .haupt.m { font-size: clamp(24px, 9.5vh, 40px); }
  .haupt.s { font-size: clamp(20px, 7.6vh, 32px); }
  .pre { font-size: clamp(15px, 5vh, 21px); margin-bottom: 4px; }
  .stufe { margin-bottom: 6px; padding: 2px 12px; font-size: 14px; }
  .verboten { margin-top: 8px; font-size: clamp(15px, 5vh, 21px); flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px 14px; }
  .emo { font-size: clamp(44px, 19vh, 80px); line-height: 1.1; }
  .loesung { margin-top: 6px; font-size: clamp(18px, 6.5vh, 27px); }
  .verdeckt { font-size: 44px; }
  .verdeckt span { font-size: 17px; }
  .wuerfel { --w: clamp(76px, 27vh, 110px); margin-bottom: 6px; }
  .regeln { max-width: none; font-size: 17px; }
  .regeln h2 { font-size: 24px; }
  .bgrid { max-width: none; }
  .bfeld { min-height: 66px; }
  .slf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; max-width: none; }
  .slf-kopf, .slf .fein { grid-column: 1 / -1; }
  .slf .buchstabe { font-size: 64px; }
  .slf-stand b { display: inline; margin: 0 14px 0 4px; }
}
@media (min-width: 1400px) {
  .haupt.xl { font-size: 124px; }
  .haupt.l { font-size: 104px; }
  .haupt.m { font-size: 86px; }
  .haupt.s { font-size: 72px; }
  .karte { width: min(1500px, 100%); }
  .pre { font-size: 38px; }
  .loesung { font-size: 52px; }
  .verboten { font-size: 40px; }
  .emo { font-size: 170px; }
  .regeln { max-width: 1000px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .karte.rein, .wuerfel.rollt { animation: none; }
}

:root { --bg: #0d1330; --bg2: #23305e; --akzent: #ff6b6b; }
body { background-color: #0d1330; }
