/* CLOSER: Oberfläche im Pixel-Stil, Farben aus dem RLS-Branding */
:root {
  --schwarz: #0D0D0D;
  --tafel: #17121a;
  --tafel2: #221b26;
  --rand-hell: #e9dfd2;
  --rand-dunkel: #050405;
  --text: #f3ece3;
  --text-leise: #b9aca2;
  --rot: #DC2626;
  --rot-dunkel: #8f1717;
  --gold: #D1B186;
  --gruen: #5fc27e;
  --orange: #e8a13c;
  --blau: #7fa7e0;
  --t-zeit: #e8a13c;
  --t-geld: #D1B186;
  --t-passung: #5fc27e;
  --t-entscheider: #7fa7e0;
  --t-vermeidung: #e0505a;
  --f-pixel: "Pixelify Sans", "Courier New", monospace;
  --f-label: "Silkscreen", "Courier New", monospace;
  --f-marke: "Syncopate", "Arial Black", sans-serif;
  --sicher-oben: env(safe-area-inset-top, 0px);
  --sicher-unten: env(safe-area-inset-bottom, 0px);
  --sicher-links: env(safe-area-inset-left, 0px);
  --sicher-rechts: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--schwarz); color: var(--text);
  position: fixed; inset: 0; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  font-family: var(--f-pixel); font-size: 17px; line-height: 1.35;
}
#spiel { position: fixed; inset: 0; touch-action: none; }
#spiel canvas { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui > #meldungen, #ui > #hud { pointer-events: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Pixel-Kasten: heller Rand, dunkler Außenrand, wie in klassischen Rollenspielen */
.kasten {
  background: var(--tafel);
  border: 3px solid var(--rand-hell);
  box-shadow: 0 0 0 3px var(--rand-dunkel), inset 0 0 0 2px #2c2330;
  border-radius: 2px;
}

/* Ladebild */
#ladebild { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--schwarz); z-index: 50; transition: opacity .4s; }
#ladebild.weg { opacity: 0; pointer-events: none; }
.lade-logo { font-family: var(--f-marke); font-size: clamp(38px, 11vw, 72px); letter-spacing: .08em; color: var(--text); text-shadow: 4px 4px 0 var(--rot); }
.lade-unter { font-family: var(--f-label); font-size: 12px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; text-align: center; padding: 0 16px; }
.lade-balken { width: min(260px, 70vw); height: 12px; border: 2px solid var(--rand-hell); padding: 2px; }
#lade-fuellung { height: 100%; width: 0; background: var(--rot); transition: width .2s; }
.lade-text { font-size: 14px; color: var(--text-leise); }

/* HUD oben */
#hud { position: fixed; top: calc(8px + var(--sicher-oben)); left: calc(8px + var(--sicher-links)); right: calc(8px + var(--sicher-rechts)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; z-index: 10; }
.hud-block { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-family: var(--f-label); font-size: 12px; pointer-events: auto; }
.hud-block .wert { color: var(--gold); font-size: 14px; }
.hud-ziel { display: flex; flex-direction: column; gap: 3px; min-width: 128px; }
.hud-ziel .zeile { display: flex; justify-content: space-between; gap: 8px; }
.balken { height: 6px; background: #3a2f3c; position: relative; }
.balken > i { position: absolute; inset: 0 auto 0 0; background: var(--gruen); display: block; }
.hud-menue { padding: 6px 12px; font-family: var(--f-label); font-size: 12px; }

/* Steuerung (Handy) */
#steuerung { position: fixed; left: 0; right: 0; bottom: 0; height: 42vh; z-index: 5; pointer-events: none; }
#joy-zone { position: absolute; left: 0; bottom: 0; width: 60%; height: 100%; pointer-events: auto; touch-action: none; }
#joy-ring { position: absolute; width: 112px; height: 112px; border-radius: 50%; border: 3px solid #ffffff40; background: #00000030; opacity: 0; transition: opacity .15s; transform: translate(-50%, -50%); }
#joy-ring.an { opacity: 1; }
#joy-knopf { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: #ffffff70; border: 3px solid #ffffffa0; }
#knoepfe { position: absolute; right: calc(18px + var(--sicher-rechts)); bottom: calc(26px + var(--sicher-unten)); display: flex; align-items: flex-end; gap: 14px; pointer-events: auto; }
.rund { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--rand-hell); background: #17121acc; font-family: var(--f-label); font-size: 18px; box-shadow: 0 3px 0 var(--rand-dunkel); }
.rund.gross { width: 74px; height: 74px; background: var(--rot); font-size: 22px; }
.rund:active { transform: translateY(2px); box-shadow: none; }
body.tastatur #steuerung { display: none; }

/* Dialogbox */
#dialog { position: fixed; left: calc(10px + var(--sicher-links)); right: calc(10px + var(--sicher-rechts)); bottom: calc(12px + var(--sicher-unten)); z-index: 20; max-width: 760px; margin: 0 auto; }
.dialog-box { padding: 14px 16px 12px; min-height: 112px; display: flex; flex-direction: column; gap: 8px; }
.dialog-name { font-family: var(--f-label); font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }
.dialog-text { font-size: 18px; min-height: 2.7em; }
.dialog-weiter { align-self: flex-end; font-family: var(--f-label); font-size: 11px; color: var(--text-leise); animation: hupf 1s steps(2) infinite; }
.dialog-wahl { display: flex; flex-direction: column; gap: 6px; }
.wahl { text-align: left; padding: 10px 12px; background: var(--tafel2); border: 2px solid #4a3d4e; font-size: 16px; }
.wahl:hover, .wahl.fokus { border-color: var(--gold); background: #2d2431; }
@keyframes hupf { 50% { transform: translateY(2px); } }

/* Meldungen (Toasts) */
#meldungen { position: fixed; top: calc(56px + var(--sicher-oben)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 60; }
.meldung { padding: 8px 14px; font-size: 15px; animation: rein .25s ease-out; max-width: 92vw; text-align: center; }
.meldung.gold { border-color: var(--gold); color: var(--gold); }
.meldung.rot { border-color: var(--rot); }
@keyframes rein { from { transform: translateY(-8px); opacity: 0; } }

/* ===== Kampf ===== */
#kampf { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: space-between; padding: calc(10px + var(--sicher-oben)) calc(10px + var(--sicher-rechts)) calc(10px + var(--sicher-unten)) calc(10px + var(--sicher-links)); pointer-events: none; }
#kampf > * { pointer-events: auto; }
.k-oben { display: flex; flex-direction: column; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.k-gegner { padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.k-gegner .kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.k-gegner .name { font-size: 17px; font-weight: 600; }
.k-gegner .betrieb { font-size: 13px; color: var(--text-leise); }
.k-ringe { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ring { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border: 2px solid var(--tc, #888); font-family: var(--f-label); font-size: 10px; text-transform: uppercase; color: var(--tc, #888); }
.ring .hp { display: flex; gap: 2px; }
.ring .hp i { width: 7px; height: 7px; background: var(--tc, #888); display: block; }
.ring .hp i.leer { background: transparent; border: 1px solid var(--tc, #888); }
.ring.gebrochen { opacity: .35; text-decoration: line-through; }
.ring.aktiv { box-shadow: 0 0 0 2px var(--rand-dunkel), 0 0 10px var(--tc); }
.ring.panzer::after { content: "🛡"; font-size: 11px; }
.ring.verdeckt { --tc: #888; }
.absicht { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-label); font-size: 11px; color: var(--text-leise); }
.absicht b { color: #000; background: var(--tc, var(--orange)); padding: 1px 6px; font-weight: 400; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .6; } }

.k-sprechblase { position: relative; background: #f6f0e8; color: #1b1418; padding: 12px 14px; border: 3px solid var(--rand-dunkel); font-size: 18px; line-height: 1.35; max-width: 760px; width: 100%; margin: 0 auto; }
.k-sprechblase .wer { display: block; font-family: var(--f-label); font-size: 10px; color: #7a6a70; margin-bottom: 4px; text-transform: uppercase; }

.k-unten { display: flex; flex-direction: column; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.k-ich { padding: 8px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; font-family: var(--f-label); font-size: 11px; }
.k-ich .balken { height: 9px; }
.k-ich .balken.haltung > i { background: var(--gruen); }
.k-ich .schmerz { display: flex; gap: 3px; }
.k-ich .schmerz i { width: 10px; height: 10px; border: 2px solid var(--rot); display: block; }
.k-ich .schmerz i.an { background: var(--rot); }
.k-phase { grid-column: 1 / -1; color: var(--gold); }

.k-hand { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.t-karte { text-align: left; padding: 8px 10px; background: var(--tafel2); border: 2px solid #4a3d4e; border-left: 6px solid var(--tc, #888); display: flex; flex-direction: column; gap: 2px; min-height: 58px; }
.t-karte .ast { font-family: var(--f-label); font-size: 9px; color: var(--tc, var(--text-leise)); text-transform: uppercase; }
.t-karte .nm { font-size: 15px; font-weight: 600; }
.t-karte .kz { font-size: 12px; color: var(--text-leise); line-height: 1.25; }
.t-karte.mentor { border-color: var(--gold); box-shadow: 0 0 12px #d1b18655; }
.t-karte.gewaehlt { border-color: var(--rand-hell); background: #352a3a; }
.t-karte:active { transform: translateY(1px); }
.k-leiste { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.sicherheit { display: flex; align-items: center; gap: 6px; font-family: var(--f-label); font-size: 10px; color: var(--text-leise); }
.sicherheit button { padding: 4px 9px; border: 2px solid #4a3d4e; background: var(--tafel2); font-family: var(--f-label); font-size: 11px; }
.sicherheit button.an { border-color: var(--gold); color: var(--gold); }
.k-klein { padding: 6px 10px; border: 2px solid #4a3d4e; background: var(--tafel2); font-family: var(--f-label); font-size: 10px; }

.k-antworten { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.k-antwort { text-align: left; padding: 10px 12px; background: var(--tafel2); border: 2px solid #4a3d4e; font-size: 15px; line-height: 1.3; }
.k-antwort:hover { border-color: var(--gold); }

.k-sprechen { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; }
.mikro { width: 92px; height: 92px; border-radius: 50%; background: var(--rot); border: 4px solid var(--rand-hell); box-shadow: 0 4px 0 var(--rand-dunkel); font-family: var(--f-label); font-size: 11px; touch-action: none; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.mikro.an { background: #ff3b3b; animation: puls 0.9s ease-in-out infinite; }
@keyframes puls { 50% { box-shadow: 0 0 0 10px #dc262644, 0 4px 0 var(--rand-dunkel); } }
.live-text { min-height: 2.6em; width: 100%; font-size: 16px; color: var(--text); text-align: center; }
.live-text .zw { color: var(--text-leise); }
.k-tippen { display: flex; gap: 6px; width: 100%; }
.k-tippen textarea { flex: 1; min-height: 64px; resize: none; background: #0f0b10; color: var(--text); border: 2px solid #4a3d4e; padding: 8px; font: 16px var(--f-pixel); -webkit-user-select: text; user-select: text; }
.k-tippen button { padding: 0 14px; background: var(--rot); border: 2px solid var(--rand-hell); font-family: var(--f-label); font-size: 11px; }

.k-rueck { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.k-rueck .titel { font-family: var(--f-label); font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.k-rueck .titel.stark { color: var(--gruen); }
.k-rueck .titel.okay { color: var(--gold); }
.k-rueck .titel.schwach, .k-rueck .titel.fehler, .k-rueck .titel.wirkungslos { color: var(--rot); }
.k-rueck .warum { font-size: 15px; }
.k-rueck .muster { border-left: 3px solid var(--gold); padding-left: 10px; font-size: 15px; color: var(--text); }
.k-rueck .muster small { display: block; font-family: var(--f-label); font-size: 9px; color: var(--gold); }
.k-rueck .mentor { font-size: 14px; color: var(--text-leise); }
.k-rueck .mentor b { color: var(--gold); font-weight: 400; font-family: var(--f-label); font-size: 10px; }
.pruef { display: flex; flex-wrap: wrap; gap: 4px; }
.pruef span { font-family: var(--f-label); font-size: 9px; padding: 2px 6px; border: 1px solid; }
.pruef .ja { color: var(--gruen); }
.pruef .nein { color: var(--rot); }
.k-weiter { align-self: flex-end; padding: 8px 16px; background: var(--rot); border: 2px solid var(--rand-hell); font-family: var(--f-label); font-size: 12px; }
.hyper { border-color: var(--rot) !important; box-shadow: 0 0 0 3px var(--rand-dunkel), 0 0 24px #dc2626aa; }

.k-mentor { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border-color: var(--gold); }
.k-mentor .wer { font-family: var(--f-label); font-size: 11px; color: var(--gold); }
.k-mentor .satz { font-size: 17px; }
.k-mentor .erkl { font-size: 14px; color: var(--text-leise); }

/* Bericht nach dem Kampf, Menü */
.voll { position: fixed; inset: 0; z-index: 40; background: #0d0d0dee; display: flex; flex-direction: column; padding: calc(14px + var(--sicher-oben)) calc(14px + var(--sicher-rechts)) calc(14px + var(--sicher-unten)) calc(14px + var(--sicher-links)); overflow-y: auto; }
.voll-innen { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.voll h2 { font-family: var(--f-marke); text-transform: uppercase; font-size: clamp(20px, 6vw, 30px); margin: 0; letter-spacing: .04em; }
.voll h2 .rot { color: var(--rot); }
.reiter { display: flex; gap: 6px; flex-wrap: wrap; }
.reiter button { padding: 6px 10px; border: 2px solid #4a3d4e; background: var(--tafel2); font-family: var(--f-label); font-size: 11px; }
.reiter button.an { border-color: var(--gold); color: var(--gold); }
.ast-liste { display: flex; flex-direction: column; gap: 10px; }
.ast { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ast-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ast-kopf .lv { font-family: var(--f-label); color: var(--gold); font-size: 12px; }
.knoten-liste { display: flex; flex-wrap: wrap; gap: 6px; }
.knoten { padding: 6px 8px; border: 2px solid #4a3d4e; background: var(--tafel2); font-size: 13px; text-align: left; max-width: 100%; }
.knoten.offen { border-color: var(--gruen); }
.knoten.kaufbar { border-color: var(--gold); border-style: dashed; }
.knoten.zu { opacity: .45; }
.detail { padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.detail .zeit { font-family: var(--f-label); font-size: 10px; color: var(--text-leise); }
.belohnung { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.belohnung .zeile { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; }
.karte-beute { padding: 12px; border-color: var(--gold); display: flex; flex-direction: column; gap: 6px; }
.karte-beute .selt { font-family: var(--f-label); font-size: 10px; text-transform: uppercase; color: var(--gold); }
.zwei-knoepfe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.knopf { padding: 10px 16px; background: var(--tafel2); border: 2px solid var(--rand-hell); font-family: var(--f-label); font-size: 12px; }
.knopf.rot { background: var(--rot); }
.feld { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.feld input { background: #0f0b10; color: var(--text); border: 2px solid #4a3d4e; padding: 8px; font: 16px var(--f-pixel); -webkit-user-select: text; user-select: text; }

@media (min-width: 900px) {
  .k-hand { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
