/* darlix · Welt — Anordnung der Anzeige über der Zeichenfläche.
   Farben, Schrift und Bausteine kommen aus design-system/darlix.css. */
html, body.welt { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body.welt { background: var(--ink); }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

/* Ebenen über der Zeichenfläche: nur Tasten und Felder fangen Klicks */
.geburt, .hud { position: fixed; inset: 0; z-index: 2; pointer-events: none; color: var(--fg); }
.geburt button, .geburt input, .geburt form, .hud button { pointer-events: auto; }

.ecke-ol { position: absolute; left: 28px; top: 24px; }
.ecke-or { position: absolute; right: 28px; top: 24px; display: flex; gap: 8px; }
.ecke-ul { position: absolute; left: 28px; bottom: 24px; }
.ecke-ur { position: absolute; right: 28px; bottom: 24px; }

/* Kleine Tafel, damit Text nie direkt über den Formen steht */
.tafel { background: var(--surface); color: var(--fg); border: var(--bw) solid var(--edge); padding: 8px 12px; }

/* Geburt */
.geburt-text { position: absolute; left: 28px; bottom: 28px; max-width: 600px; transition: opacity var(--t-soft); }   /* das Raster wird um den Text ausgespart, siehe spiel.js */
.geburt-text .section-sub { margin-bottom: 24px; }
.geburt.zieht .geburt-text { opacity: 0.16; }
.geburt-form { margin-top: 18px; max-width: 420px; }
.geburt-zeile { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.geburt-zeile .input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.08em; }
.geburt-da { position: absolute; left: 50%; top: 54%; transform: translateX(-50%); width: min(600px, calc(100% - 56px)); text-align: center; }
.code-gross { font-size: clamp(34px, 7vw, 68px); font-weight: var(--w-bold); letter-spacing: 0.06em; line-height: 1.1; margin: 10px 0 16px; }
.geburt-satz { font-size: 14px; line-height: 1.7; color: var(--muted); margin-bottom: 28px; }
.geburt-tasten { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Anzeige in der Welt */
.hud-ort { font-size: 12px; line-height: 1.5; }
.hud-ort b { display: block; font-size: 15px; letter-spacing: 0.06em; }
.hud-tasten { display: flex; gap: 8px; }
.hud .btn:not(:hover) { background: var(--surface); color: var(--fg); }   /* deckend, damit die Schrift über Formen lesbar bleibt */
.ecke-or .badge { background: var(--surface); padding: 6px 10px; font-size: 10px; border-width: 2px; }
.hud-hinweis { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 56px); font-size: 12px; line-height: 1.6; text-align: center; margin: 0; }
.hud-satz { position: absolute; left: 50%; top: 72px; transform: translateX(-50%); width: min(560px, calc(100% - 56px)); background: var(--surface); color: var(--fg); border: var(--bw-strong) solid var(--edge); box-shadow: var(--sh-md); padding: 18px 22px 16px; }
.hud-satz-t { font-size: 16px; font-weight: var(--w-bold); line-height: 1.45; margin: 12px 0 8px; }
.hud-satz-q { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 0; }
.hud-satz .btn { margin-top: 14px; }

/* Charakter im Modal */
#figur-modal .modal { max-height: 100%; overflow-y: auto; }
.modal-figur { display: block; width: 100%; height: 160px; margin-bottom: 18px; border: var(--bw) solid var(--edge); }
.code-mittel { font-size: 30px; font-weight: var(--w-bold); letter-spacing: 0.06em; line-height: 1.1; margin: 6px 0 10px; }
.modal-tasten { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.modal-form { margin-bottom: 0; }

@media (max-width: 600px) {
  .ecke-ol { left: 14px; top: 14px; }
  .ecke-or { right: 14px; top: 14px; }
  .ecke-ul { left: 14px; bottom: 14px; }
  .ecke-ur { right: 14px; bottom: 14px; }
  .geburt-text { left: 14px; right: 14px; bottom: 18px; }
  .hud-tasten { flex-direction: column; align-items: flex-end; }
  .hud-hinweis { bottom: 150px; }
  .geburt-da { top: 50%; }
}

/* Räumliche Fassung */
#ov { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 1; }
.hud-zeile { display: flex; gap: 12px; align-items: baseline; }
.hud-zeile span { width: 56px; flex-shrink: 0; font-size: 11px; color: var(--muted); }
.hud-zeile b { display: inline; }
#h-stand { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.hud-tuer { position: absolute; left: 0; top: 0; pointer-events: none; font-size: 11px; line-height: 1.5; max-width: 300px; }
.hud-tuer b { display: block; font-size: 13px; letter-spacing: 0.05em; }
.hud-tuer span { color: var(--muted); }
.hud-gene { display: flex; flex-wrap: wrap; gap: 6px; }
.hud-gene:not(:empty) { margin-top: 14px; }
.hud-gene .btn { margin-top: 0; pointer-events: auto; }

/* Landschaft: Titel beim Ankommen, Tafel zum Eintauchen, Weg zurück */
.hud-ort mark { background: var(--fg); color: var(--bg); padding: 0 1px; }
#h-pfad { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.hud-titel { position: absolute; left: 50%; top: 22%; transform: translate(-50%, 12px); text-align: center; background: var(--surface); color: var(--fg); border: var(--bw-strong) solid var(--edge); box-shadow: var(--sh-md); padding: 16px 30px 18px; opacity: 0; transition: opacity 0.5s, transform 0.5s; pointer-events: none; }
.hud-titel.an { opacity: 1; transform: translate(-50%, 0); }
.hud-titel b { display: block; font-size: clamp(30px, 6vw, 56px); line-height: 1.05; letter-spacing: -0.01em; }
.hud-titel span { display: block; font-size: 13px; letter-spacing: 0.1em; color: var(--muted); }
#h-titel-b { font-size: 16px; font-weight: var(--w-bold); color: var(--fg); margin-top: 6px; }
#h-titel-d { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--rule); letter-spacing: 0.04em; }
.hud-akt { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 12px 14px 12px 18px; max-width: calc(100% - 56px); box-shadow: var(--sh-md); }
.hud-akt b { display: block; font-size: 15px; letter-spacing: 0.05em; }
.hud-akt span { display: block; font-size: 11px; line-height: 1.5; color: var(--muted); max-width: 360px; }
.hud-akt .btn { flex-shrink: 0; pointer-events: auto; }
.hud .hud-akt .btn-primary:not(:hover) { background: var(--fg); color: var(--bg); }
.hud-hinweis { top: 24px; bottom: auto; max-width: calc(100% - 560px); }
@media (max-width: 760px) {
  .hud-akt { bottom: 196px; flex-direction: column; align-items: stretch; gap: 10px; width: calc(100% - 28px); }
  .hud-hinweis { top: 68px; bottom: auto; max-width: calc(100% - 150px); left: 14px; transform: none; text-align: left; }
  .hud-titel { top: 26%; width: max-content; max-width: calc(100% - 28px); }
}
#h-hinweis { margin: 6px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); max-width: 300px; }   /* Steuerung, nur in den ersten Sekunden */
#h-auftrag { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 12px; line-height: 1.5; font-weight: var(--w-bold); max-width: 300px; }

/* Ordnung der Anzeige: links oben, wo du bist und was zu tun ist; unten Mitte, was du mit dem gewählten Körper tun kannst */
.hud-ort.ecke-ul { top: 78px; bottom: auto; max-width: 300px; }
.hud .hud-hinweis { left: 28px; bottom: 24px; top: auto; transform: none; text-align: left; width: auto; max-width: min(460px, calc(100% - 420px)); }
@media (max-width: 760px) {
  .hud-ort.ecke-ul { top: 60px; left: 14px; max-width: calc(100% - 150px); padding: 6px 9px; }
  .hud-ort .z-ziel, #h-pfad { display: none; }
  .hud .hud-hinweis { left: 14px; bottom: 14px; max-width: calc(100% - 150px); }
  .hud-akt { bottom: 14px; left: 14px; right: auto; transform: none; width: calc(100% - 150px); }
}

/* Mittlere Breite: Die Tafel «Eintauchen» rückt nach links, damit sie «Hinaus» nie verdeckt */
@media (min-width: 761px) and (max-width: 1180px) {
  .hud-akt { left: 28px; transform: none; max-width: calc(100% - 400px); }
}

/* Sammlung: was du gefunden hast und was noch fehlt */
.ecke-or { align-items: center; }
#sammlung-modal .modal { max-width: 660px; max-height: 100%; overflow-y: auto; }
.sammlung section + section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.sammlung .label { margin-bottom: 14px; }
.sammlung .hint { margin-top: 12px; }
.sammlung .facts { margin-top: 0; border-top: 0; }
.sammlung .fact { padding-top: 0; }
.sammlung .modal-tasten { margin-bottom: 0; }
.sm-nullen { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.sm-stelle { text-align: center; min-width: 0; }
.sm-stelle span { display: block; font-size: 8px; font-weight: var(--w-bold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: clip; white-space: nowrap; }
.sm-stelle b { display: block; font-size: 20px; line-height: 34px; border: var(--bw) solid var(--edge); margin-top: 5px; }
.sm-stelle b + b { margin-top: -2px; margin-bottom: 5px; }   /* du oben, die Welt unten: ein gemeinsamer Rahmen */
.sm-stelle b.null { background: var(--fg); color: var(--bg); }
.sm-reihe { display: flex; flex-wrap: wrap; gap: 6px; }
.sm-satz { padding: 12px 0; border-top: 1px solid var(--line); }
.sm-satz:first-child { border-top: 0; padding-top: 0; }
.sm-satz p { margin: 0; font-size: 13px; font-weight: var(--w-bold); line-height: 1.5; }
.sm-satz p + p { margin-top: 4px; font-size: 11px; font-weight: var(--w-regular); color: var(--muted); }
@media (max-width: 600px) {
  .ecke-or .badge { display: none; }   /* die Zahlen stehen in der Sammlung */
  .sm-nullen { grid-template-columns: repeat(4, 1fr); row-gap: 14px; }
  #sammlung-modal { padding: 12px; }
}

/* Codes zum Kopieren: ein Klick auf den Code legt ihn in die Zwischenablage */
.hud-kopie { appearance: none; -webkit-appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 0; margin: 0; font: inherit; font-size: 15px; font-weight: var(--w-bold); letter-spacing: 0.06em; color: inherit; text-align: left; cursor: copy; }
.hud-kopie:hover, .hud-kopie:focus-visible { border-bottom-color: var(--fg); outline: none; }
.sm-codes { display: grid; gap: 10px; }
.sm-code { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 12px; }
.sm-code b { font-size: 22px; letter-spacing: 0.06em; line-height: 1.1; }
@media (max-width: 600px) { .sm-code { grid-template-columns: 1fr auto; } .sm-code .fact-label { grid-column: 1 / -1; margin-bottom: -6px; } .sm-code b { font-size: 19px; } }

/* So geht es: Schritt in der Anzeige, Erklärung im Modal */
#h-schritt { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 9px; letter-spacing: 0.14em; color: var(--muted); }
#h-schritt:empty { display: none; }
#h-schritt:not(:empty) + #h-auftrag { margin-top: 4px; padding-top: 0; border-top: 0; }
.hud-frage { appearance: none; -webkit-appearance: none; background: none; border: 0; border-bottom: 1px solid var(--muted); padding: 0; margin: 8px 0 0; font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; }
.hud-frage:hover, .hud-frage:focus-visible { color: var(--fg); border-bottom-color: var(--fg); outline: none; }
.hud-ort mark, .sm-code mark { background: var(--fg); color: var(--bg); padding: 0 1px; }
#hilfe-modal .modal { max-width: 620px; max-height: 100%; overflow-y: auto; }
.hilfe-ziel { font-size: 15px; font-weight: var(--w-bold); line-height: 1.5; margin: 0 0 18px; }
.hilfe .steps { margin: 20px 0 4px; grid-template-columns: 1fr 1fr; border-width: var(--bw); }
.hilfe .step { padding: 18px 18px 20px; border-right-width: var(--bw); }
.hilfe .step-num { font-size: 34px; margin-bottom: 10px; }
.hilfe .step-title { font-size: 12px; margin-bottom: 8px; }
.hilfe .step-desc { font-size: 12px; line-height: 1.6; }
.hilfe .hint { margin-top: 12px; }
.hilfe .modal-tasten { margin-bottom: 0; }
.hud .hud-gene .btn-primary:not(:hover) { background: var(--fg); color: var(--bg); }
@media (max-width: 600px) {
  .hilfe .steps { grid-template-columns: 1fr; }
  .hilfe .step { border-right: 0; border-bottom: var(--bw) solid var(--edge); }
  .hilfe .step:last-child { border-bottom: 0; }
  #hilfe-modal { padding: 12px; }
}

/* Mittlere Breite: Die Tafel mit Satz oder Begegnung rückt nach unten, damit sie die Anzeige links nicht verdeckt */
@media (min-width: 761px) and (max-width: 1260px) {
  .hud-satz { top: auto; bottom: 118px; }
}

/* Reisende (Probe): eine Zeile in der Anzeige und ein Schalter daneben */
#h-andere { margin: 6px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); max-width: 300px; }
.hud-links { display: flex; flex-wrap: wrap; gap: 0 16px; }

/* Rechtliches: Impressum und Datenschutz, auf dem Startbild oben rechts und am Fuss der Fenster */
.geburt a, .hud a { pointer-events: auto; }
.recht { display: flex; gap: 18px; margin: 0; }
.recht a { font-size: 10px; font-weight: var(--w-bold); letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.recht a:hover, .recht a:focus-visible { color: var(--fg); }
.geburt .recht { top: 28px; }
.modal .recht { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 600px) { .geburt .recht { top: 17px; gap: 14px; } }


/* Controller: Die Tasten in der Anzeige zeigen, welche Taste am Controller sie auslöst. Die Wahl in Fenstern hat einen Rahmen. */
body.pad [data-pad-name]::before { content: attr(data-pad-name); display: inline-grid; place-items: center; flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 3px; margin-right: 10px; border: 1.5px solid currentColor; font-size: 10px; font-weight: var(--w-bold); letter-spacing: 0; line-height: 1; }
.pad-fokus { outline: 3px solid var(--fg); outline-offset: 3px; }
.modal .pad-fokus { outline-color: var(--ink); }
.modal-head .pad-fokus { outline-color: var(--paper); }

/* Meldung schliessen: das Kreuz oben rechts, eine Stahltaste wie im Fenster. Nur in der räumlichen Fassung (body.raum). */
.raum .hud-satz { padding-right: 58px; }
.hud-satz-zu { position: absolute; top: 12px; right: 12px; border-color: var(--edge); pointer-events: auto; }
.hud-mehr, .hud-akt .hud-kurz, #h-andere .kurz { display: none; }

/* ── Kompakte Anzeige: Handy hochkant und quer (dieselbe Grenze wie klein() in spiel.js). ──
   Die Welt bleibt frei. Links oben steht nur, wo du bist und was zu tun ist; alles Weitere hinter «Mehr».
   Unten liegt die Tür in einer Zeile, darunter «Hinaus». Eine Meldung liegt oben und ersetzt solange die Tafel links.
   Beim Ankommen steht nur der Titel der Welt. */
@media (max-width: 760px), (max-height: 520px) {
  .raum .ecke-ol { left: 14px; top: 14px; }
  .raum .ecke-or { right: 14px; top: 14px; }
  .raum .ecke-or .badge { display: none; }

  .raum .hud-ort.ecke-ul { top: 60px; left: 14px; bottom: auto; max-width: min(250px, calc(100% - 138px)); padding: 7px 10px 6px; font-size: 11px; transition: opacity 0.4s; }
  .raum .hud-ort .hud-zeile { gap: 8px; }
  .raum .hud-ort .hud-zeile span { width: 44px; font-size: 10px; }
  .raum .hud-ort .hud-kopie, .raum .hud-ort .hud-zeile b { font-size: 13px; }
  .raum #h-stand { margin-top: 2px; font-size: 10px; }
  .raum #h-pfad { font-size: 10px; }
  .raum #h-schritt { margin-top: 6px; padding-top: 6px; font-size: 8px; }
  .raum #h-auftrag { margin-top: 6px; padding-top: 6px; font-size: 11px; line-height: 1.45; }
  .raum #h-hinweis, .raum #h-andere { margin-top: 5px; font-size: 10px; line-height: 1.45; }
  .raum .hud-mehr { display: inline-block; margin-top: 6px; padding: 5px 0 1px; font-size: 10px; font-weight: var(--w-bold); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg); border-bottom-color: var(--fg); }
  .raum .hud:not(.offen) .hud-ort .z-du, .raum .hud:not(.offen) .hud-ort .z-ur, .raum .hud:not(.offen) #h-stand, .raum .hud:not(.offen) .hud-links, .raum .hud:not(.offen) #h-andere .lang { display: none; }
  .raum .hud:not(.offen) #h-andere .kurz { display: inline; }
  .raum .hud:not(.offen) #h-andere:has(.kurz:empty) { display: none; }
  .raum .hud.offen .hud-ort .z-ziel { display: flex; }
  .raum .hud.offen #h-pfad { display: block; }
  .raum .hud.hat-satz .hud-ort { display: none; }
  .raum .hud.mit-titel:not(.offen) .hud-ort { opacity: 0; }

  .raum .hud-tasten.ecke-ur { right: 14px; bottom: 14px; flex-direction: row; align-items: center; }
  .raum .hud:not(.offen) #h-ton, .raum .hud:not(.offen) #h-figur { display: none; }
  .raum .hud-akt { left: 14px; right: 14px; bottom: 62px; transform: none; width: auto; max-width: 520px; flex-direction: row; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; box-shadow: var(--sh-sm); }
  .raum .hud-akt > div { flex: 1; min-width: 0; }
  .raum .hud-akt b { font-size: 13px; }
  .raum .hud-akt #h-akt-b { display: none; }
  .raum .hud-akt .hud-kurz { display: block; max-width: none; font-size: 10px; line-height: 1.4; }
  .raum .hud-akt .btn-primary { min-height: 46px; padding-left: 14px; font-size: 11px; box-shadow: var(--sh-sm); }
  .raum .hud-akt .btn-primary .key { width: 42px; margin-left: 12px; background-size: 16px, auto; }

  .raum .hud-satz { top: 60px; bottom: auto; left: 14px; right: 14px; width: auto; max-width: 520px; transform: none; padding: 10px 52px 12px 12px; border-width: var(--bw); box-shadow: var(--sh-sm); }
  .raum .hud-satz-zu { top: 8px; right: 8px; }
  .raum .hud-satz-t { margin: 8px 0 5px; font-size: 13px; line-height: 1.4; }
  .raum .hud-satz-q { font-size: 10px; line-height: 1.45; }
  .raum .hud-gene { flex-wrap: nowrap; overflow-x: auto; margin-right: -42px; padding: 2px 2px 6px; scrollbar-width: none; pointer-events: auto; }
  .raum .hud-gene::-webkit-scrollbar { display: none; }
  .raum .hud-gene:not(:empty) { margin-top: 10px; }
  .raum .hud-gene .btn { flex-shrink: 0; }

  .raum .hud-titel { top: 24%; width: max-content; max-width: calc(100% - 28px); padding: 12px 20px 14px; }
  .raum .hud-titel b { font-size: clamp(26px, 8vw, 40px); }
  .raum .hud-titel span { font-size: 11px; }
}
/* Quer und niedrig: Die Tür liegt neben «Hinaus» in derselben Zeile, das spart Höhe */
@media (max-height: 520px) and (min-width: 600px) {
  .raum .hud:not(.offen) .hud-akt { bottom: 14px; right: 104px; max-width: 460px; }
}
