/* =====================================================================
   Klotzland – Oberfläche
   Tokens: Klötzchen-Palette, Fredoka (Display) + Nunito (Text).
   Signatur-Element: die Werkzeugleiste als Reihe echter, farbiger Klötze.
   ===================================================================== */
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/Nunito.woff2') format('woff2'); font-weight: 200 1000; font-style: normal; font-display: swap; }

:root {
  --rot: #D9282F; --orange: #FF8A1F; --gelb: #FFD23F; --gruen: #3FAF4A; --tuerkis: #25B8C4; --blau: #2F6FE3;
  --lila: #8A47D6; --rosa: #F26BB5; --weiss: #F4F4F2; --grau: #8C8C94; --braun: #8B5A2B; --kohle: #2B2521;
  --kohle-2: #3D342E; --creme: #FFFDF7; --creme-dunkel: #ECE8DD;
  --knopf: var(--gelb);
  --himmel-oben: #6FB6F2; --himmel-unten: #E3EEF7;
  --schrift-display: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --schrift-text: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rand: clamp(12px, 3vw, 24px);
  --luft: clamp(8px, 2vh, 20px);
  --radius: 20px;
  --schatten: 0 5px 0 rgba(43, 37, 33, .28);
  --aktuelle-farbe: #D9282F;
}
body[data-himmel="abend"] { --himmel-oben: #F2A160; --himmel-unten: #E7B58A; }
body[data-himmel="nacht"] { --himmel-oben: #141433; --himmel-unten: #3A3160; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; height: 100%; }
body {
  margin: 0; min-height: 100dvh; overflow: hidden;
  font-family: var(--schrift-text); color: var(--kohle);
  background: linear-gradient(180deg, var(--himmel-oben) 0%, var(--himmel-unten) 65%, var(--himmel-unten) 100%);
  transition: background 1s ease;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none;
}
[hidden] { display: none !important; }
/* Nacht (Abenteuer): der CSS-Himmel wird über --nacht (0 = Tag, 1 = tiefe Nacht) abgedunkelt; Sterne als Punktmuster */
body::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #0B1030; opacity: calc(var(--nacht, 0) * .82); transition: opacity .8s linear; }
body::after { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: calc(max(0, var(--nacht, 0) - .55) * 2.2); transition: opacity .8s linear;
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, #fff 60%, transparent 62%), radial-gradient(1.2px 1.2px at 33% 9%, #fff 60%, transparent 62%), radial-gradient(1.8px 1.8px at 57% 22%, #fff 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 71% 6%, #fff 60%, transparent 62%), radial-gradient(1.5px 1.5px at 88% 15%, #fff 60%, transparent 62%), radial-gradient(1.2px 1.2px at 24% 31%, #fff 60%, transparent 62%),
    radial-gradient(1.8px 1.8px at 45% 36%, #fff 60%, transparent 62%), radial-gradient(1.2px 1.2px at 64% 30%, #fff 60%, transparent 62%), radial-gradient(1.5px 1.5px at 81% 40%, #fff 60%, transparent 62%), radial-gradient(1.2px 1.2px at 5% 44%, #fff 60%, transparent 62%);
  background-size: 100% 100%; }
#buehne { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 1; }
#ui { z-index: 2; }
#ui { position: fixed;  pointer-events: none; top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px); bottom: env(safe-area-inset-bottom, 0px); left: env(safe-area-inset-left, 0px); }
.schirm { pointer-events: auto; }
.schirm--voll { position: absolute; inset: 0; display: flex; flex-direction: column; padding: var(--rand); }
.schirm--dialog { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--rand); background: rgba(43, 37, 33, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

/* ---------- Knöpfe ---------- */
.knopf {
  font-family: var(--schrift-display); font-weight: 600; font-size: clamp(1rem, 2.2vh + .35rem, 1.25rem);
  color: var(--kohle); background: var(--knopf); border: 3px solid var(--kohle); border-radius: 999px;
  padding: .5em 1.3em; min-height: 46px; min-width: 46px; box-shadow: var(--schatten); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .45em; line-height: 1.1;
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease; max-width: 100%;
}
.knopf:hover { background: #FFDD66; }
.knopf:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 37, 33, .28); }
.knopf:focus-visible { outline: 4px solid var(--creme); outline-offset: 2px; }
.knopf--gross { font-size: clamp(1.25rem, 3vh + .4rem, 1.7rem); padding: .55em 1.5em; }
.knopf--leise { background: var(--creme); }
.knopf--leise:hover { background: #FFFFFF; }
.knopf--klein { font-size: .95rem; min-height: 40px; padding: .35em .9em; }
.knopf--rund { width: 46px; height: 46px; padding: 0; border-radius: 50%; background: var(--creme); }
.knopf--rund.knopf--klein { width: 40px; height: 40px; }
.knopf--rund svg { width: 24px; height: 24px; fill: currentColor; }
.knopf[disabled] { opacity: .45; cursor: default; transform: none; }
.textlink { font-family: var(--schrift-text); font-weight: 800; font-size: .95rem; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); background: none; border: 0; padding: 10px 6px; min-height: 40px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.rechtliches { display: inline-flex; align-items: center; gap: 2px; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); font-weight: 800; }
.credit { margin: 2px 0 0; font-family: var(--schrift-display); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--kohle); opacity: .5; text-align: center; }
kbd { font-family: var(--schrift-display); background: var(--creme); color: var(--kohle); border-radius: 6px; padding: 0 .35em; border: 2px solid var(--kohle); font-size: .85em; }
.ico-ton-aus { display: none; }
.knopf[aria-pressed="false"] .ico-ton-an { display: none; }
.knopf[aria-pressed="false"] .ico-ton-aus { display: block; }
.muenzen { display: inline-flex; align-items: center; gap: .4em; font-family: var(--schrift-display); font-weight: 600; font-size: 1.1rem; background: var(--creme); border: 3px solid var(--kohle); border-radius: 999px; padding: .25em .9em .25em .55em; box-shadow: var(--schatten); }
.ico-muenze { width: 1.35em; height: 1.35em; fill: var(--gelb); stroke: var(--kohle); stroke-width: 1.6; }
.ico-muenze__innen { fill: #D49A1A; stroke: none; }

/* Klotz-Icon (Signatur): Würfel mit Noppe */
.klotz { display: inline-block; width: 26px; height: 26px; border-radius: 5px; background: var(--k, #8C8C94); border: 2.5px solid var(--kohle); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), inset 6px 0 0 rgba(255, 255, 255, .22); position: relative; flex: none; }
.klotz::after { content: ''; position: absolute; left: 50%; top: -6px; width: 10px; height: 8px; margin-left: -5px; border-radius: 3px 3px 0 0; background: var(--k, #8C8C94); border: 2.5px solid var(--kohle); border-bottom: 0; }

/* ---------- Galerie ---------- */
.galerie { overflow: hidden; }
.galerie__kopf { text-align: center; }
.logo { margin: 0; display: inline-flex; gap: 2px; font-family: var(--schrift-display); font-weight: 700; font-size: clamp(2.2rem, min(11vw, 8vh), 4.4rem); line-height: 1; }
.logo span { display: inline-block; padding: .05em .12em; border-radius: .18em; border: 3px solid var(--kohle); background: var(--gelb); color: var(--kohle); box-shadow: 0 5px 0 var(--kohle); transform: rotate(-2deg); }
.logo span:nth-child(2n) { background: var(--rot); color: var(--creme); transform: rotate(2deg) translateY(3px); }
.logo span:nth-child(3n) { background: var(--blau); color: var(--creme); }
.logo span:nth-child(5n) { background: var(--gruen); color: var(--creme); }
.untertitel { margin: var(--luft) 0 0; font-weight: 800; font-size: clamp(.95rem, 2vh + .3rem, 1.2rem); color: var(--kohle); background: var(--creme); border: 3px solid var(--kohle); border-radius: 999px; padding: .3em 1em; display: inline-block; box-shadow: var(--schatten); }
.galerie__aktionen { display: flex; gap: var(--luft); flex-wrap: wrap; justify-content: center; margin-top: var(--luft); }
.galerie__inhalt { flex: 1; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; margin-top: var(--luft); padding: 4px 4px 12px; }
.galerie__titel { font-family: var(--schrift-display); font-weight: 700; font-size: 1.35rem; color: var(--creme); text-shadow: 0 3px 0 var(--kohle); margin: var(--luft) 0 8px; }
.kacheln { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1.6vw, 14px); max-width: 980px; margin: 0 auto; }
.kachel { background: var(--creme); border: 3px solid var(--kohle); border-radius: 18px; box-shadow: var(--schatten); padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kachel__bild { aspect-ratio: 16 / 9; border-radius: 12px; background: linear-gradient(180deg, #9FD3F5, #DCEBF6); border: 2px solid var(--kohle); display: grid; place-items: center; overflow: hidden; }
.kachel__bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kachel__klotzreihe { display: flex; gap: 6px; }
.kachel__name { margin: 0; font-family: var(--schrift-display); font-weight: 700; font-size: 1.1rem; line-height: 1.15; overflow-wrap: anywhere; }
.kachel__info { margin: 0; font-size: .82rem; font-weight: 700; color: var(--kohle-2); }
.kachel__knoepfe { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.kachel__knoepfe .knopf { box-shadow: 0 3px 0 rgba(43, 37, 33, .28); }
.galerie__leer { grid-column: 1 / -1; margin: 0; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); font-weight: 800; }
.galerie__fuss { display: flex; align-items: center; justify-content: space-between; gap: var(--luft); padding-top: var(--luft); }

/* ---------- Tafeln / Avatar ---------- */
.tafel__kopf { display: flex; align-items: center; gap: var(--luft); }
.tafel__kopf h2 { flex: 1; margin: 0; font-family: var(--schrift-display); font-weight: 700; font-size: clamp(1.6rem, 5vh, 2.4rem); color: var(--creme); text-shadow: 0 3px 0 var(--kohle); text-align: center; white-space: nowrap; }
.avatar { background: linear-gradient(90deg, rgba(43, 37, 33, 0) 0%, rgba(43, 37, 33, 0) 45%, rgba(43, 37, 33, .32) 62%); }
.avatar__panel { margin-left: auto; width: min(100%, 460px); flex: 1; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; background: var(--creme); border: 3px solid var(--kohle); border-radius: var(--radius); box-shadow: var(--schatten); padding: 14px; margin-top: var(--luft); }
.avatar__panel h3 { font-family: var(--schrift-display); font-weight: 700; margin: 14px 0 6px; font-size: 1.05rem; }
.avatar__panel h3 small { font-family: var(--schrift-text); font-weight: 700; font-size: .78rem; color: var(--kohle-2); }
.avatar__reihe { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 6px; }
.avatar__label { font-family: var(--schrift-display); font-weight: 700; font-size: .95rem; }
.avatar__farben { display: flex; gap: 4px; flex-wrap: wrap; }
.farbe { width: 30px; height: 30px; border-radius: 8px; border: 2.5px solid var(--kohle); background: var(--k); cursor: pointer; padding: 0; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18); flex: none; }
.farbe.aktiv { outline: 3px solid var(--creme); outline-offset: -1px; box-shadow: 0 0 0 3px var(--kohle), inset 0 -5px 0 rgba(0, 0, 0, .18); transform: scale(1.12); }
.farbe:focus-visible { outline: 3px solid var(--blau); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: var(--schrift-display); font-weight: 600; font-size: .95rem; background: var(--creme-dunkel); border: 2.5px solid var(--kohle); border-radius: 999px; padding: .35em .9em; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: .4em; }
.chip.aktiv { background: var(--gelb); }
.chip .punkt { width: 14px; height: 14px; border-radius: 50%; background: var(--k); border: 2px solid var(--kohle); }
.huete { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hut { background: var(--creme-dunkel); border: 2.5px solid var(--kohle); border-radius: 12px; padding: 8px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 60px; }
.hut.aktiv { background: var(--gelb); }
.hut--gesperrt { opacity: .85; }
.hut__name { font-family: var(--schrift-display); font-weight: 700; font-size: .92rem; }
.hut__farben { display: flex; gap: 2px; }
.hut__farben .klotz { width: 16px; height: 16px; }
.hut__preis { font-size: .8rem; font-weight: 800; display: inline-flex; align-items: center; gap: .2em; }
.hut__preis .ico-muenze { width: 1em; height: 1em; }

/* ---------- Editor ---------- */
.editor { position: absolute; inset: 0; pointer-events: none; padding: var(--rand); display: flex; flex-direction: column; justify-content: space-between; }
.editor__oben { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor__oben > * { pointer-events: auto; }
.editor__name { font-family: var(--schrift-display); font-weight: 700; font-size: 1.05rem; color: var(--kohle); background: var(--creme); border: 3px solid var(--kohle); border-radius: 999px; padding: .35em .9em; min-height: 46px; width: min(260px, 40vw); box-shadow: var(--schatten); }
.editor__name:focus { outline: 3px solid var(--blau); }
.editor__anzahl { font-family: var(--schrift-display); font-weight: 600; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); white-space: nowrap; }
.editor__leiste { pointer-events: auto; background: var(--creme); border: 3px solid var(--kohle); border-radius: var(--radius); box-shadow: var(--schatten); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.leiste__zeile { display: flex; gap: 6px; align-items: center; overflow-x: auto; overscroll-behavior: contain; touch-action: pan-x; scrollbar-width: thin; padding: 6px 2px 2px; }
.leiste__trenner { width: 2px; height: 30px; background: var(--creme-dunkel); flex: none; margin: 0 4px; }
.werkzeug { font-family: var(--schrift-display); font-weight: 600; font-size: .9rem; background: var(--creme-dunkel); border: 2.5px solid var(--kohle); border-radius: 12px; padding: 0 10px; min-height: 40px; min-width: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: .35em; white-space: nowrap; flex: none; }
.werkzeug svg { width: 20px; height: 20px; }
.werkzeug.aktiv { background: var(--gelb); }
.bauteil { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 2.5px solid transparent; border-radius: 12px; padding: 8px 6px 4px; cursor: pointer; font-family: var(--schrift-display); font-weight: 600; font-size: .72rem; color: var(--kohle); min-width: 58px; flex: none; }
.bauteil .klotz { width: 34px; height: 34px; }
.bauteil.aktiv { background: var(--gelb); border-color: var(--kohle); }
.leiste__zeile--farben .farbe { width: 34px; height: 34px; }
.editor__tipp { position: absolute; left: 50%; top: calc(var(--rand) + 60px); transform: translateX(-50%); margin: 0; font-size: .8rem; font-weight: 800; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); white-space: nowrap; }

/* ---------- HUD (Spielen) ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; padding: var(--rand); }
.hud .knopf, .hud .sprung { pointer-events: auto; }
.hud__zeile { display: flex; align-items: center; gap: var(--luft); }
.hud__zeit { font-family: var(--schrift-display); font-weight: 700; font-size: 1.4rem; color: var(--creme); text-shadow: 0 3px 0 var(--kohle); flex: 1; text-align: center; }
.hud__muenzen { display: inline-flex; align-items: center; gap: .35em; font-family: var(--schrift-display); font-weight: 600; background: var(--creme); border: 3px solid var(--kohle); border-radius: 999px; padding: .2em .8em; box-shadow: var(--schatten); white-space: nowrap; }
.hud__hinweis { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.6); font-family: var(--schrift-display); font-weight: 700; font-size: clamp(1.5rem, 5vh, 2.4rem); color: var(--creme); text-shadow: 0 3px 0 var(--kohle); opacity: 0; transition: opacity .2s ease, transform .2s cubic-bezier(.2, 1.6, .5, 1); white-space: nowrap; }
.hud__hinweis.an { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.hud__hinweis--schlecht { color: var(--rot); }
.hud__tipp { position: absolute; left: 50%; bottom: calc(var(--rand) + 6px); transform: translateX(-50%); margin: 0; font-size: .8rem; font-weight: 800; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); white-space: nowrap; }
.joystick { position: fixed; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; background: rgba(255, 253, 247, .25); border: 3px solid rgba(255, 253, 247, .7); }
.joystick__knopf { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: var(--creme); border: 3px solid var(--kohle); }
.sprung { position: absolute; right: var(--rand); bottom: calc(var(--rand) + 20px); width: 84px; height: 84px; border-radius: 50%; background: var(--gelb); border: 3px solid var(--kohle); box-shadow: var(--schatten); font-family: var(--schrift-display); font-weight: 700; font-size: 2rem; color: var(--kohle); cursor: pointer; display: none; }
.sprung:active { transform: translateY(3px); }
@media (pointer: coarse) { .sprung { display: block; } .hud__tipp, .editor__tipp { display: none; } }

/* ---------- HUD: freies Spielen (Herzen, Luft, Uhr, Fadenkreuz, Aktionen, Schnellleiste) ---------- */
.hud__zeile2 { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.hud__herzen { display: flex; gap: 2px; }
.herz { width: 26px; height: 26px; display: inline-block; }
.herz svg { width: 100%; height: 100%; overflow: visible; }
.herz__leer { fill: rgba(43, 37, 33, .55); stroke: var(--kohle); stroke-width: 2; }
.herz__voll { fill: var(--rot); stroke: var(--kohle); stroke-width: 2; }
.herz[data-z="0"] .herz__voll { display: none; }
.herz[data-z="1"] .herz__voll { clip-path: inset(0 50% 0 0); }
.hud__herzen.wackelt { animation: wackeln .4s ease; }
@keyframes wackeln { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.hud__luft { display: flex; gap: 3px; }
.blase { width: 14px; height: 14px; border-radius: 50%; background: #BDEFFF; border: 2px solid var(--kohle); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .12); }
.blase.leer { background: transparent; opacity: .45; }
.hud__uhr { display: inline-flex; align-items: center; gap: 6px; font-family: var(--schrift-display); font-weight: 600; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); background: rgba(43, 37, 33, .35); border-radius: 999px; padding: 3px 10px 3px 4px; }
.hud__uhr-scheibe { position: relative; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, #6FB6F2 0 50%, #141433 50% 100%); border: 2px solid var(--kohle); overflow: hidden; transform: rotate(calc(var(--t, 0) * 360deg - 90deg)); transition: transform 1s linear; }
.hud__uhr-sonne, .hud__uhr-mond { position: absolute; width: 10px; height: 10px; border-radius: 50%; left: 50%; margin-left: -5px; }
.hud__uhr-sonne { top: 2px; background: var(--gelb); }
.hud__uhr-mond { bottom: 2px; background: #F4F4F2; }
.fadenkreuz { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; pointer-events: none; }
.fadenkreuz::before, .fadenkreuz::after { content: ''; position: absolute; background: var(--creme); box-shadow: 0 0 0 1.5px var(--kohle); border-radius: 2px; }
.fadenkreuz::before { left: 50%; top: 0; width: 4px; height: 100%; margin-left: -2px; }
.fadenkreuz::after { top: 50%; left: 0; height: 4px; width: 100%; margin-top: -2px; }
.fadenkreuz--haut::before, .fadenkreuz--haut::after { background: var(--gelb); }
.hud__ziel { position: absolute; left: 50%; top: calc(50% + 22px); transform: translateX(-50%); font-family: var(--schrift-display); font-weight: 600; font-size: .9rem; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); white-space: nowrap; pointer-events: none; }
.hud__aktionen { position: absolute; right: var(--rand); bottom: calc(var(--rand) + 118px); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.aktion { pointer-events: auto; width: 74px; height: 74px; border-radius: 22px; background: var(--creme); border: 3px solid var(--kohle); box-shadow: var(--schatten); font-family: var(--schrift-display); font-weight: 700; font-size: .8rem; color: var(--kohle); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; touch-action: none; -webkit-user-select: none; user-select: none; }
.aktion svg { width: 30px; height: 30px; fill: currentColor; }
.aktion:active, .aktion.gedrueckt { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 37, 33, .28); background: var(--gelb); }
.aktion--klein { width: 52px; height: 52px; border-radius: 50%; font-size: 1.4rem; }
.aktion--klein svg { width: 24px; height: 24px; }
.aktion[aria-pressed="true"] { background: var(--gelb); }
/* Abbau-Fortschritt als Ring um den Hauen-Knopf */
.aktion--laeuft::after { content: ''; position: absolute; inset: -9px; border-radius: 28px; background: conic-gradient(var(--gelb) calc(var(--f, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px)); mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px)); pointer-events: none; }
.hotbar__box { position: absolute; left: 50%; bottom: calc(var(--rand) + 4px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; max-width: calc(100% - 2 * var(--rand)); }
.hotbar__name { font-family: var(--schrift-display); font-weight: 600; font-size: .9rem; color: var(--creme); text-shadow: 0 2px 0 var(--kohle); opacity: 0; transition: opacity .3s ease; white-space: nowrap; }
.hotbar__name.an { opacity: 1; animation: hotbarName 1.8s ease forwards; }
@keyframes hotbarName { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.hotbar__zeile { display: flex; align-items: center; gap: 8px; }
.hotbar { display: flex; gap: 3px; background: rgba(43, 37, 33, .45); border-radius: 14px; padding: 4px; pointer-events: auto; }
.hotbar .knopf, .hotbar__zeile .knopf { pointer-events: auto; }
.slot { position: relative; width: 46px; height: 46px; border-radius: 10px; background: var(--creme); border: 2.5px solid var(--kohle); padding: 0; cursor: pointer; display: grid; place-items: center; flex: none; -webkit-user-select: none; user-select: none; touch-action: none; }
.slot .klotz { width: 28px; height: 28px; }
.slot__werkzeug { width: 32px; height: 32px; display: grid; place-items: center; }
.slot__werkzeug svg { width: 30px; height: 30px; fill: var(--k); }
.slot__n { position: absolute; right: 2px; bottom: 0; font-family: var(--schrift-display); font-weight: 700; font-size: .78rem; color: var(--kohle); text-shadow: 0 0 3px var(--creme), 0 0 3px var(--creme); }
.slot.aktiv { background: var(--gelb); outline: 3px solid var(--creme); outline-offset: -1px; transform: scale(1.1); z-index: 1; }
.spiel--frei .sprung { bottom: calc(var(--rand) + 78px); }
.spiel--frei .hud__tipp { bottom: calc(var(--rand) + 92px); }
.spiel--frei .toast { bottom: calc(var(--rand) + 118px); }
@media (max-width: 46rem) {
  .slot { width: 32px; height: 32px; border-radius: 8px; }
  .slot .klotz { width: 20px; height: 20px; }
  .slot__werkzeug svg { width: 22px; height: 22px; }
  .slot__n { font-size: .7rem; }
  .hotbar { gap: 2px; padding: 3px; }
  .hotbar__zeile { gap: 6px; }
  .hotbar__zeile .knopf--rund { width: 40px; height: 40px; }
  .hud__aktionen { bottom: calc(var(--rand) + 160px); }
  .spiel--frei .sprung { bottom: calc(var(--rand) + 64px); width: 76px; height: 76px; }
  .aktion { width: 66px; height: 66px; }
  .herz { width: 22px; height: 22px; }
}
@media (pointer: fine) { .hud__aktionen { display: none; } }
/* ---------- Echter Ort (Karte) ---------- */
.ort { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.ort__panel { width: min(100%, 720px); margin: 0 auto; display: flex; flex-direction: column; gap: 8px; background: var(--creme); border: 3px solid var(--kohle); border-radius: var(--radius); box-shadow: var(--schatten); padding: 12px; margin-top: var(--luft); }
.ort__suche { display: flex; gap: 8px; }
.ort__suche input { flex: 1; min-width: 0; font-family: var(--schrift-text); font-weight: 700; font-size: 1rem; color: var(--kohle); background: #fff; border: 3px solid var(--kohle); border-radius: 999px; padding: .4em 1em; min-height: 44px; }
.ort__suche input:focus { outline: 3px solid var(--blau); }
.ort__karte { height: clamp(220px, 46dvh, 460px); border: 3px solid var(--kohle); border-radius: 14px; overflow: hidden; background: #E3EEF7; touch-action: none; }
.ort__credit { margin: 0; font-size: .78rem; font-weight: 700; color: var(--kohle-2); }
.ort__credit a { color: var(--blau); text-decoration: underline; text-shadow: none; }
.ort__regler { display: flex; flex-direction: column; gap: 4px; font-family: var(--schrift-display); font-weight: 600; }
.ort__regler input { width: 100%; accent-color: var(--gelb); height: 32px; }
.ort__zeile { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ort__status { color: var(--kohle); text-shadow: none; }
.ort__status.lobby__status--fehler { color: var(--rot); }
/* ---------- Lobby (Zusammen spielen) ---------- */
.lobby-schirm { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.tafel__platz { width: 46px; flex: none; }
.lobby { max-width: 520px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: var(--luft); align-items: center; color: var(--creme); text-align: center; padding-bottom: var(--luft); }
.lobby__wahl { display: flex; flex-direction: column; gap: var(--luft); align-items: center; width: 100%; }
.lobby__name { display: flex; flex-direction: column; gap: 6px; font-weight: 800; text-shadow: 0 2px 0 var(--kohle); width: min(100%, 300px); }
.lobby__name input, .lobby__beitreten input { font-family: var(--schrift-display); font-weight: 700; font-size: 1.15rem; color: var(--kohle); background: var(--creme); border: 3px solid var(--kohle); border-radius: 999px; padding: .35em .9em; min-height: 46px; text-align: center; box-shadow: var(--schatten); }
.lobby__beitreten input { width: 130px; letter-spacing: .25em; text-transform: uppercase; }
.lobby__name input:focus, .lobby__beitreten input:focus { outline: 3px solid var(--blau); }
.lobby__oder { font-family: var(--schrift-display); letter-spacing: .1em; text-shadow: 0 2px 0 var(--kohle); }
.lobby__beitreten { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.lobby__beitreten label { width: 100%; font-weight: 800; text-shadow: 0 2px 0 var(--kohle); }
.lobby__tipp { margin: 0; font-size: .9rem; font-weight: 700; text-shadow: 0 2px 0 var(--kohle); max-width: 420px; }
.lobby__raum { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%; }
.lobby__label { margin: 0; font-weight: 800; text-shadow: 0 2px 0 var(--kohle); }
.lobby__code { margin: 0; font-family: var(--schrift-display); font-size: clamp(2.6rem, 11vw, 4.4rem); letter-spacing: .25em; color: var(--gelb); text-shadow: 0 4px 0 var(--kohle); background: rgba(43, 37, 33, .55); border: 3px solid var(--kohle); border-radius: 18px; padding: .1em .4em .1em .65em; }
.lobby__status { margin: 0; font-weight: 800; text-shadow: 0 2px 0 var(--kohle); min-height: 1.4em; }
.lobby__status--fehler { color: #FFB3B3; }
.lobby__spieler { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.lobby__spieler li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--creme); color: var(--kohle); border: 3px solid var(--kohle); border-radius: 14px; padding: 6px 14px 6px 8px; font-weight: 800; text-align: left; }
.lobby__spieler li b { font-family: var(--schrift-display); font-weight: 600; font-size: 1.1rem; }
.lobby__spieler li i { font-style: normal; color: #2FA84A; font-size: .85rem; }
.lobby__spieler li .klotz { width: 26px; height: 26px; }
.lobby__spieler li.lobby__ich { outline: 3px solid var(--blau); outline-offset: -3px; }
.lobby__spieler li.lobby__frei { opacity: .55; background: transparent; color: var(--creme); border-style: dashed; }
.lobby__einstellungen { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.lobby__welten { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: 100%; }
.lobby__welten .chip { max-width: 100%; }
.lobby__weltinfo { margin: 0; font-weight: 800; text-shadow: 0 2px 0 var(--kohle); }
/* Laden */
.dialog.laden { width: min(100%, 520px); }
.laden__liste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; }
.laden__liste .hut { flex-direction: row; justify-content: space-between; text-align: left; gap: 8px; min-height: 52px; }
.laden__liste .hut .slot__werkzeug { flex: none; }
.laden__liste .hut .hut__name { flex: 1; }
.laden__liste .laden__leer { grid-column: 1 / -1; font-weight: 700; color: var(--kohle-2); margin: 0; }
@media (max-width: 30rem) { .laden__liste { grid-template-columns: 1fr; } }
/* Dialoge: Neue Welt, Rucksack, Palette, Truhe */
.neu__karten { display: grid; gap: 10px; width: 100%; }
.neu__karte { display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; background: var(--creme-dunkel); border: 3px solid var(--kohle); border-radius: 16px; padding: 10px 12px; cursor: pointer; font-family: var(--schrift-text); color: var(--kohle); }
.neu__karte:hover { background: var(--gelb); }
.neu__karte .neu__icon { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 14px; background: var(--k); border: 3px solid var(--kohle); display: grid; place-items: center; font-size: 1.6rem; }
.neu__karte b { font-family: var(--schrift-display); font-weight: 700; font-size: 1.1rem; }
.neu__karte span:last-child { font-size: .85rem; font-weight: 700; color: var(--kohle-2); }
.dialog.inventar, .dialog.palette { width: min(100%, 520px); }
.slots { display: grid; grid-template-columns: repeat(9, 40px); gap: 4px; justify-content: center; }
.slots--truhe { grid-template-columns: repeat(6, 40px); }
.slots .slot { width: 40px; height: 40px; }
.slots .slot .klotz { width: 24px; height: 24px; }
.inventar__titel { font-family: var(--schrift-display); font-weight: 700; margin: 8px 0 0; font-size: 1rem; }
.palette__farben { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.palette__bauteile { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; max-height: 46dvh; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.palette__bauteile .bauteil { min-width: 74px; }
@media (max-width: 30rem) { .slots { grid-template-columns: repeat(9, 32px); gap: 3px; } .slots .slot { width: 32px; height: 32px; } .slots .slot .klotz { width: 20px; height: 20px; } .slots--truhe { grid-template-columns: repeat(6, 36px); } .slots--truhe .slot { width: 36px; height: 36px; } }

/* ---------- Dialoge ---------- */
.dialog { width: min(100%, 440px); max-height: calc(100dvh - 2 * var(--rand) - var(--sicher-hoehe)); overflow-y: auto; background: var(--creme); border: 3px solid var(--kohle); border-radius: var(--radius); box-shadow: var(--schatten); padding: clamp(16px, 3.5vh, 28px) clamp(14px, 4vw, 26px); display: flex; flex-direction: column; align-items: center; gap: var(--luft); text-align: center; }
.dialog h2 { margin: 0; font-family: var(--schrift-display); font-weight: 700; font-size: clamp(1.6rem, 4.5vh, 2.3rem); line-height: 1; }
.dialog h3 { margin: 0; align-self: flex-start; font-family: var(--schrift-display); font-weight: 700; font-size: 1rem; }
.dialog .chips { align-self: flex-start; }
.dialog__reihe { display: flex; gap: var(--luft); flex-wrap: wrap; justify-content: center; }
.ergebnis__text { margin: 0; font-weight: 700; }
.ergebnis__werte { margin: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ergebnis__werte div { background: #FFFFFF; border: 2px solid var(--kohle); border-radius: 14px; padding: 8px 4px; }
.ergebnis__werte dt { font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--kohle-2); }
.ergebnis__werte dd { margin: 2px 0 0; font-family: var(--schrift-display); font-weight: 700; font-size: 1.3rem; }
.teilen__block { width: 100%; text-align: left; }
.teilen__block label { font-family: var(--schrift-display); font-weight: 700; font-size: .95rem; display: block; margin-bottom: 4px; }
.teilen__zeile { display: flex; gap: 6px; align-items: stretch; }
.teilen__zeile input, .teilen__zeile textarea, .dialog textarea { flex: 1; min-width: 0; width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; border: 2.5px solid var(--kohle); border-radius: 12px; padding: 8px 10px; background: #FFFFFF; color: var(--kohle); resize: none; }
.teilen__hinweis { margin: 0; font-weight: 800; color: var(--rot); }
.anleitung { width: min(100%, 520px); }
.anleitung__liste { list-style: none; margin: 0; padding: 0 4px 22px 0; width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; min-height: 0; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent); }
.anleitung__liste li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; background: #FFFFFF; border: 2px solid var(--kohle); border-radius: 14px; padding: 10px 12px; font-size: .92rem; font-weight: 600; line-height: 1.4; }
.anleitung__liste svg { width: 34px; height: 34px; fill: var(--kohle); color: var(--kohle); margin-top: 2px; }
.anleitung__liste li > div > b:first-child { display: block; font-family: var(--schrift-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; }
@media (min-width: 46rem) { .dialog.anleitung { width: min(100%, 820px); } .anleitung__liste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Banner / Toast ---------- */
.banner { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.4) rotate(-4deg); font-family: var(--schrift-display); font-weight: 700; font-size: clamp(2.2rem, 8vh, 4.2rem); color: var(--gelb); text-shadow: 0 4px 0 var(--kohle), 0 8px 0 rgba(43, 37, 33, .35); opacity: 0; pointer-events: none; white-space: nowrap; transition: opacity .25s ease, transform .45s cubic-bezier(.2, 1.8, .4, 1); }
.banner.an { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-4deg); }
.toast { position: absolute; left: 50%; bottom: calc(var(--rand) + 8px); transform: translate(-50%, 20px); font-family: var(--schrift-display); font-weight: 600; font-size: 1.02rem; color: var(--creme); background: var(--kohle); border-radius: 999px; padding: .5em 1.2em; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 2 * var(--rand)); text-align: center; }
.toast.an { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mobil ---------- */
@media (max-width: 46rem) {
  .kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .huete { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .avatar { background: linear-gradient(180deg, rgba(43, 37, 33, 0) 0%, rgba(43, 37, 33, 0) 30%, rgba(43, 37, 33, .32) 45%); }
  .avatar__panel { width: 100%; margin-top: 36dvh; max-height: 56dvh; }
  .editor__name { width: min(160px, 34vw); }
  .editor__anzahl { display: none; }
  .knopf--gross { font-size: 1.25rem; }
  .galerie__aktionen .knopf { font-size: 1rem; padding: .45em 1em; }
  .hud__tipp, .editor__tipp { display: none; }
}
@media (max-width: 30rem) { .kacheln { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .knopf, .banner, .toast, .hud__hinweis, body { transition: none; } }

/* Fuß mit drei Links (Spielhalle · Impressum · Datenschutz): auf schmalen Handys eigene Zeile, sonst wird er abgeschnitten */
@media (max-width: 27rem) { .galerie__fuss { flex-wrap: wrap; } .galerie__fuss .rechtliches { order: 9; flex-basis: 100%; justify-content: center; } }

/* iPhone als Homescreen-App (Statusleiste „black-translucent", viewport-fit=cover): Der Sicherheitsabstand ist die
   LAGE von #ui, kein Padding – die Bildschirme darin sind absolut (inset: 0) und ignorieren Padding; sonst lag das
   Menü unter Uhrzeit und WLAN. Abgedunkelte Ebenen reichen per Rand-Schatten trotzdem bis unter die Statusleiste. */
/* Höhe, die Statusleiste + Home-Balken wegnehmen (Maße in dvh zählen sonst die ganze Bildschirmhöhe) */
:root { --sicher-hoehe: calc(env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)); }
:root { --sicher-rand: max(env(safe-area-inset-top, 0px), env(safe-area-inset-right, 0px), env(safe-area-inset-bottom, 0px), env(safe-area-inset-left, 0px)); }
.schirm--dialog { box-shadow: 0 0 0 var(--sicher-rand) rgba(43, 37, 33, .45); }
