/* ── Hangman — Schultafel ─────────────────────────────────────────────────────────────────────────────────────────
   Eigene Optik nach Charakter (Memo „Spiele-Optik mit Wow“): grüne Schiefertafel im Holzrahmen vor dunkler Wand, Kreide für
   Zeichnung, Wort und Tasten, Ablage mit Kreide und Schwamm. Startbildschirm-Norm sb-* wie Mühle/Artillerie.
   Raster: quer zwei Spalten (Bild | Wort + Tasten), hochkant untereinander (@media unten). Schriften aus dem Archiv
   fonts.hirsing.eu (Cabin Sketch = Titel, Kalam = Kreideschrift). */
@font-face { font-family: 'Cabin Sketch'; font-weight: 700; font-display: swap;
  src: url('https://fonts.hirsing.eu/cabin-sketch-v23-latin/cabin-sketch-v23-latin-700.woff2') format('woff2'); }
@font-face { font-family: 'Kalam'; font-weight: 400; font-display: swap;
  src: url('https://fonts.hirsing.eu/kalam-v18-latin/kalam-v18-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Kalam'; font-weight: 700; font-display: swap;
  src: url('https://fonts.hirsing.eu/kalam-v18-latin/kalam-v18-latin-700.woff2') format('woff2'); }

:root {
  --kreide: #f3f1e8; --kreide-leise: rgba(243, 241, 232, 0.62); --kreide-hauch: rgba(243, 241, 232, 0.16);
  --gruen-kreide: #a9e3a1; --rot-kreide: #f2a0a0; --gelb-kreide: #f6dd8c;
  --schiefer: #22392f; --schiefer-tief: #172820; --holz: #7a4b28; --holz-dunkel: #3f2412;
  --hand: 'Kalam', 'Patrick Hand', 'Comic Sans MS', cursive; --titel: 'Cabin Sketch', 'Kalam', cursive;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --rand: max(14px, env(safe-area-inset-left)); --oben: max(14px, env(safe-area-inset-top)); --unten: max(14px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--kreide); font-family: var(--sans); }
/* Wand hinter der Tafel: warmes dunkles Grau mit Lichtkegel von oben */
body { background: radial-gradient(ellipse 80% 60% at 50% 0%, #4a4036 0%, #26211c 55%, #15120f 100%); user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.versteckt { display: none !important; }

/* ── Tafel ─────────────────────────────────────────────────────────────── */
.tafel {
  position: fixed; inset: var(--oben) var(--rand) calc(var(--unten) + 16px);
  /* Holzrahmen als Rand mit Maserung (border-image), dunkle Kante außen (outline) — eckig wie eine echte Schultafel */
  border: 14px solid var(--holz); border-image: repeating-linear-gradient(91deg, #6a3f20 0 3px, #7d4c28 3px 10px, #8a5a33 10px 12px, #73452a 12px 21px) 14;
  outline: 2px solid var(--holz-dunkel);
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr); grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "oben oben" "bild wort" "bild tasten"; gap: 8px clamp(12px, 3vw, 48px); padding: 14px clamp(16px, 3vw, 44px) 22px;
  /* Schiefer: Wischspuren (radial), feine Körnung (SVG-Rauschen), Randabdunklung */
  background:
    radial-gradient(ellipse 38% 26% at 28% 38%, rgba(255, 255, 255, 0.045), transparent 70%),
    radial-gradient(ellipse 30% 22% at 72% 64%, rgba(255, 255, 255, 0.04), transparent 70%),
    radial-gradient(ellipse 50% 18% at 55% 14%, rgba(255, 255, 255, 0.03), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 45%, var(--schiefer) 0%, var(--schiefer-tief) 100%);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 26px 60px 8px rgba(0, 0, 0, 0.6);
}

.tafel-oben { grid-area: oben; display: flex; align-items: center; gap: 12px; min-height: 44px; padding-left: 150px; }   /* links Platz für die GameZone-Pille */
.spielerleiste { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; flex: 1; min-width: 0; font-family: var(--hand); }
.spielerchip { display: flex; align-items: baseline; gap: 8px; padding: 2px 12px; border: 2px solid var(--kreide-hauch); border-radius: 999px; font-size: 18px; color: var(--kreide-leise); }
.spielerchip b { color: var(--kreide); font-size: 20px; }
.spielerchip .sc-name { max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spielerchip.dran { border-color: var(--gelb-kreide); color: var(--gelb-kreide); box-shadow: 0 0 14px rgba(246, 221, 140, 0.25); }
.rundenmarke { font-size: 16px; color: var(--kreide-leise); margin-left: auto; }
.knoepfe { display: flex; gap: 8px; margin-left: auto; }
.rund { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 2px solid var(--kreide-hauch); background: rgba(0, 0, 0, 0.18); color: var(--kreide-leise); }
.rund:hover { color: var(--kreide); border-color: var(--kreide-leise); }
.rund svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rund .strich-aus { display: none; } .rund.aus .strich-aus { display: inline; } .rund.aus .welle { display: none; }
body.im-menue .tafel-oben .knoepfe { visibility: hidden; }

/* Zeichnung */
.tafel-bild { grid-area: bild; min-height: 0; display: flex; align-items: center; justify-content: center; }
.zeichnung { width: 100%; height: 100%; max-height: 100%; overflow: visible; }
.strich { fill: none; stroke: var(--kreide); stroke-linecap: round; stroke-linejoin: round; opacity: 0.93;
  transition: stroke-dashoffset 0.42s cubic-bezier(.6, .1, .4, 1); }
.strich.sofort { transition: none; }
.gesicht { stroke: var(--rot-kreide); }
.figur { transform-origin: 196px 36px; }
.zeichnung.verloren .figur { animation: pendeln 2.6s ease-in-out 0.6s infinite; }
@keyframes pendeln { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(3.2deg); } 70% { transform: rotate(-2.6deg); } }

/* Wort */
.tafel-wort { grid-area: wort; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; font-family: var(--hand); }
.thema { font-size: clamp(16px, 1.6vw, 22px); color: var(--gelb-kreide); letter-spacing: 0.04em; }
.thema::before { content: '✎ '; opacity: 0.7; }
.wort { display: flex; flex-wrap: wrap; gap: 6px clamp(18px, 2.4vw, 34px); font-size: clamp(30px, 4.2vw, 66px); font-weight: 700; line-height: 1.15; }
.wort.lang { font-size: clamp(24px, 3.3vw, 50px); }
.wortteil { display: flex; gap: 0.16em; }
.zeichen { width: 0.82em; text-align: center; border-bottom: 3px solid var(--kreide-leise); border-radius: 2px; min-height: 1.15em;
  text-shadow: 0 0 1px var(--kreide), 0 0 10px rgba(255, 255, 255, 0.18); }
.zeichen.neu { animation: aufleuchten 0.7s ease-out; }
.zeichen.aufgedeckt { color: var(--rot-kreide); }
@keyframes aufleuchten { 0% { transform: translateY(-10px) scale(1.25); color: var(--gelb-kreide); } 100% { transform: none; } }
.info { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: clamp(16px, 1.5vw, 21px); color: var(--kreide-leise); min-height: 1.6em; }
.uebrig.knapp { color: var(--rot-kreide); }
.falsch { letter-spacing: 0.06em; }

/* Tasten */
.tastatur { grid-area: tasten; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: clamp(5px, 0.7vw, 9px); font-family: var(--hand); }
.taste { height: clamp(40px, 5.6vh, 54px); border: 2px solid var(--kreide-hauch); border-radius: 9px; background: rgba(255, 255, 255, 0.03);
  font-size: clamp(19px, 1.9vw, 26px); font-weight: 700; color: var(--kreide); transition: background .15s, border-color .15s, opacity .2s, transform .08s; }
.taste:hover:not(:disabled) { border-color: var(--kreide-leise); background: rgba(255, 255, 255, 0.07); }
.taste:active:not(:disabled) { transform: scale(0.94); }
.taste:disabled { cursor: default; }
.taste.treffer { color: var(--gruen-kreide); border-color: rgba(169, 227, 161, 0.35); opacity: 0.55; }
.taste.fehler { color: var(--rot-kreide); opacity: 0.32; text-decoration: line-through; text-decoration-thickness: 3px; }
body.im-menue .tastatur { opacity: 0.35; }
/* Hochkant liegt die Startkarte über der Zeichnung — dort blendet sie im Menü aus (Prüfung 30.10.: Galgenstrich lief durch den Titel) */
@media (max-width: 760px), (max-aspect-ratio: 4/5) { body.im-menue .tafel-bild { visibility: hidden; } }

/* Ablage unter der Tafel: Kreide und Schwamm (nur Zierde) */
.ablage { position: absolute; left: 8%; right: 8%; bottom: -27px; height: 10px; border-radius: 3px; background: linear-gradient(180deg, #8a5a33, #4a2b15); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); pointer-events: none; }
.kreide { position: absolute; bottom: 8px; left: 18%; width: 46px; height: 9px; border-radius: 3px; background: linear-gradient(180deg, #fff, #d9d6cc); transform: rotate(-4deg); }
.kreide.kurz { left: 24%; width: 22px; background: linear-gradient(180deg, #fbe7a1, #d8bf6a); transform: rotate(6deg); }
.schwamm { position: absolute; bottom: 8px; right: 14%; width: 62px; height: 16px; border-radius: 4px; background: linear-gradient(180deg, #4b5a72 0 40%, #c9b48a 40%); }

/* ── Startbildschirm (Norm sb-*) ───────────────────────────────────────── */
.ebene { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
/* padding-top: Startkarte bleibt unter der GameZone-Pille, wenn sie bei niedriger Fensterhöhe die volle Höhe braucht (Prüfung 30.10.) */
.sb { justify-content: flex-start; padding-top: 60px; padding-left: clamp(16px, 7vw, 110px);
  background: linear-gradient(90deg, rgba(10, 18, 14, 0.92) 0%, rgba(10, 18, 14, 0.7) 40%, rgba(10, 18, 14, 0.1) 72%); }
.sb-karte { width: min(520px, 100%); max-height: 100%; overflow-y: auto; padding: 8px 4px; scrollbar-width: none; font-family: var(--hand); }
.sb-titel { margin: 0; font-family: var(--titel); font-size: clamp(54px, 7vw, 104px); line-height: 0.95; font-weight: 700; color: var(--kreide);
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.6), 0 0 24px rgba(255, 255, 255, 0.15); }
.sb-unterzeile { margin: 8px 0 22px; color: var(--gelb-kreide); font-size: clamp(17px, 1.7vw, 22px); }
.sb-gruppe { margin: 0 0 14px; }
.sb-label { display: block; font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--kreide-leise); margin-bottom: 6px; }
.sb-wahl { display: flex; gap: 6px; }
.sb-wahl-umbruch { flex-wrap: wrap; }
.sb-wahl button { flex: 1 1 auto; padding: 7px 12px; border: 2px solid var(--kreide-hauch); border-radius: 10px; background: rgba(0, 0, 0, 0.18);
  color: var(--kreide-leise); font-family: var(--hand); font-size: 18px; font-weight: 700; transition: border-color .15s, color .15s, background .15s; }
.sb-wahl button:hover { color: var(--kreide); }
.sb-wahl button.an { border-color: var(--gelb-kreide); color: var(--gelb-kreide); background: rgba(246, 221, 140, 0.08); }
.sb-namen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sb-namen input { min-width: 0; padding: 8px 12px; border: 2px solid var(--kreide-hauch); border-radius: 10px; background: rgba(0, 0, 0, 0.22);
  color: var(--kreide); font-family: var(--hand); font-size: 18px; font-weight: 700; }
.sb-namen input:focus { outline: none; border-color: var(--gelb-kreide); }
.sb-namen input::placeholder { color: var(--kreide-leise); font-weight: 400; }
.sb-start { width: 100%; margin: 8px 0 14px; padding: 12px; border: 3px solid var(--kreide); border-radius: 14px; background: rgba(255, 255, 255, 0.06);
  font-family: var(--titel); font-size: 30px; font-weight: 700; color: var(--kreide); text-shadow: 0 0 10px rgba(255, 255, 255, 0.25); transition: background .15s, transform .08s; }
.sb-start:hover { background: rgba(255, 255, 255, 0.12); }
.sb-start:active { transform: translateY(1px); }
.sb-hilfe { border: 2px dashed var(--kreide-hauch); border-radius: 12px; padding: 8px 14px; font-size: 16px; color: var(--kreide-leise); }
.sb-hilfe summary { color: var(--kreide); font-weight: 700; cursor: pointer; }
.sb-hilfe p { margin: 8px 0 0; line-height: 1.45; }
.sb-sprache { margin-top: 12px; background: none; border: 2px solid var(--kreide-hauch); border-radius: 999px; padding: 4px 14px; color: var(--kreide-leise); font-family: var(--hand); font-size: 15px; }

/* ── Ergebnis / Pause ──────────────────────────────────────────────────── */
#ergebnis, #pause { background: rgba(10, 16, 12, 0.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.karte { width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: 22px 26px; text-align: center; border-radius: 14px; font-family: var(--hand);
  background: radial-gradient(ellipse at 50% 30%, #2b463a, #1b2e25); border: 2px solid var(--kreide-leise);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.25), 0 24px 60px rgba(0, 0, 0, 0.6); }
.karte h2 { margin: 0 0 8px; font-family: var(--titel); font-size: 36px; color: var(--kreide); }
.karte .leise { margin: 10px 0 2px; color: var(--kreide-leise); font-size: 16px; }
.ergebnis-wort { font-size: 32px; font-weight: 700; letter-spacing: 0.08em; color: var(--gelb-kreide); word-break: break-word; }
.ergebnis-punkte { margin-top: 6px; font-size: 24px; font-weight: 700; color: var(--gruen-kreide); }
.stand { list-style: none; counter-reset: platz; margin: 4px auto 6px; padding: 0; max-width: 300px; text-align: left; }
.stand li { counter-increment: platz; display: flex; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--kreide-hauch); font-size: 19px; }
.stand li::before { content: counter(platz) '.'; color: var(--kreide-leise); width: 1.4em; }
.stand li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knopf-gross { display: block; width: 100%; margin-top: 16px; padding: 11px; border: 3px solid var(--kreide); border-radius: 12px; background: rgba(255, 255, 255, 0.07);
  font-family: var(--titel); font-size: 24px; font-weight: 700; color: var(--kreide); }
.knopf-gross:hover { background: rgba(255, 255, 255, 0.13); }
.knopf-leise { display: block; width: 100%; margin-top: 8px; padding: 8px; border: 2px solid var(--kreide-hauch); border-radius: 12px; background: none;
  font-family: var(--hand); font-size: 18px; color: var(--kreide-leise); }

/* ── Hochkant / schmal (Handy) ─────────────────────────────────────────── */
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .tafel { inset: 4px 4px var(--unten); border-width: 7px; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "oben" "bild" "wort" "tasten"; gap: 8px; padding: 10px 12px 14px; }
  .tafel-oben { padding-left: 0; padding-top: 48px; min-height: 0; }      /* Pille liegt oben links über der Tafel → Leiste darunter */
  .knoepfe { position: absolute; top: 8px; right: 10px; }
  .rund { width: 36px; height: 36px; }
  .spielerchip { font-size: 15px; padding: 1px 9px; } .spielerchip b { font-size: 16px; }
  .tafel-wort { gap: 6px; align-items: center; text-align: center; }
  .wort { justify-content: center; font-size: clamp(24px, 7.6vw, 40px); }
  .wort.lang { font-size: clamp(19px, 5.6vw, 30px); }
  .info { justify-content: center; font-size: 15px; }
  .tastatur { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
  .taste { height: 44px; font-size: 21px; }
  .ablage { display: none; }
  .sb { justify-content: center; align-items: flex-end; padding: 16px; background: linear-gradient(180deg, rgba(10, 18, 14, 0.25) 0%, rgba(10, 18, 14, 0.93) 45%); }
  .sb-titel { font-size: 56px; }
  .sb-wahl button { font-size: 16px; padding: 6px 8px; }
}
/* Quer, aber niedrig (Handy quer): kompakter */
@media (max-height: 520px) and (min-aspect-ratio: 4/5) {
  .tafel { padding: 8px 18px 12px; gap: 4px 24px; }
  .taste { height: 34px; font-size: 18px; }
  .wort { font-size: clamp(24px, 3.4vw, 40px); }
  .ablage { display: none; }
  .sb-karte { width: min(760px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-content: center; }
  .sb-titel, .sb-unterzeile { grid-column: 1 / -1; }
  .sb-titel { font-size: 52px; } .sb-unterzeile { margin: 4px 0 10px; }
}
