/* ALBFRONT Oberflaeche: Schiefergrund, Messingrahmen, Pergamenttext (wie die Figurenvorschau).
   Systemschriften, damit keine Daten an Schriftanbieter gehen. */
:root {
  --grund: #17222b; --panel: #22313d; --rand: #B08A4F; --text: #F2ECE0; --text-leise: #B9C1C7;
  --akzent: #E8B04A; --sicher: #3FB8A9; --gefahr: #D8443A; --blau: #4C8FE0;
  --schrift-titel: Georgia, 'Times New Roman', serif; --schrift: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --oben: max(12px, env(safe-area-inset-top, 0px)); --unten: max(12px, env(safe-area-inset-bottom, 0px));
  --links: max(12px, env(safe-area-inset-left, 0px)); --rechts: max(12px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--grund); color: var(--text); font: 15px/1.45 var(--schrift); overscroll-behavior: none; }
body[data-ansicht="spiel"] { overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[hidden] { display: none !important; }
a { color: var(--akzent); }

.vollbild { position: fixed; inset: 0; }
.mittig { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--oben) var(--rechts) var(--unten) var(--links); overflow-y: auto; }
.marke { font: 700 34px/1 var(--schrift-titel); letter-spacing: 0.14em; color: var(--akzent); text-align: center; }
#laden p { color: var(--text-leise); max-width: 340px; text-align: center; }
.leise { color: var(--text-leise); }

.karte {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--rand); border-radius: 16px;
  padding: 22px 20px; display: flex; flex-direction: column; gap: 14px;
}
.karte .marke { margin-top: 4px; }
.karte > p { margin: 0; text-align: center; }
h1 { margin: 0; font: 700 22px var(--schrift-titel); }
form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; color: var(--text-leise); font-size: 12px; }
input:not([type=checkbox]) {
  font: 16px var(--schrift); color: var(--text); background: var(--grund); border: 1.5px solid #3a4e5e;
  border-radius: 10px; height: 46px; padding: 0 12px; width: 100%;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
input.fehlerhaft { border-color: var(--gefahr); }
label.haken { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.haken input { width: 22px; height: 22px; accent-color: var(--akzent); margin: 0; }
/* Honigtopf gegen Bots: fuer Menschen unsichtbar */
label.honig { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.meldung { margin: 0; min-height: 1.2em; color: #ff8a80; font-size: 14px; }
.meldung:empty { display: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 14px; margin-bottom: 8px; }

button { font: 600 15px var(--schrift); color: var(--text); background: var(--grund); border: 1.5px solid #3a4e5e; border-radius: 10px; height: 44px; padding: 0 14px; cursor: pointer; touch-action: manipulation; }
button.haupt { background: var(--akzent); color: var(--grund); border-color: var(--akzent); height: 50px; font-size: 16px; }
button:disabled { opacity: 0.6; cursor: progress; }
button.klein { height: 36px; font-size: 13px; padding: 0 10px; }

.reiter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--grund); padding: 4px; border-radius: 12px; }
.reiter button { border: 0; height: 38px; background: transparent; color: var(--text-leise); }
.reiter button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--rand); }

/* Figur erstellen */
.erstellen { height: 100%; display: grid; grid-template-rows: minmax(220px, 1fr) auto; padding: var(--oben) var(--rechts) var(--unten) var(--links); gap: 12px; justify-items: center; overflow-y: auto; }
#vorschau { width: 100%; height: 100%; min-height: 220px; display: block; }
.toene { display: flex; gap: 10px; flex-wrap: wrap; }
.ton { width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.ton[aria-pressed="true"] { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--grund) inset; }
@media (min-width: 760px) {
  .erstellen { grid-template-columns: 1fr 400px; grid-template-rows: 1fr; align-items: center; }
}

/* Spiel */
#welt { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.oben-links { top: var(--oben); left: var(--links); width: min(196px, 46vw); gap: 4px; background: rgba(23,34,43,0.72); border: 1px solid rgba(176,138,79,0.6); border-radius: 12px; padding: 6px 8px; }
.oben-links .balken { height: 12px; }
.oben-links .zeile { font-size: 12px; }
/* Klein: nur Level, duenne Balken und Sterne; aufgeklappt (Antippen) alles */
.oben-links:not(.offen) { width: min(118px, 30vw); padding: 4px 6px; gap: 3px; background: rgba(23,34,43,0.5); border-color: rgba(176,138,79,0.35); }
.oben-links:not(.offen) .zeile.leise, .oben-links:not(.offen) #hud-name, .oben-links:not(.offen) .balken span { display: none; }
.oben-links:not(.offen) .zeile { justify-content: flex-start; }
.oben-links:not(.offen) .abzeichen { font-size: 10px; padding: 1px 6px; }
.oben-links:not(.offen) .balken { height: 5px; }
.oben-links:not(.offen) .sterne { font-size: 13px; margin-top: 1px; }
.oben-links:not(.offen) #zone { font-size: 9px; padding: 1px 5px; }
.oben-rechts { top: var(--oben); right: var(--rechts); align-items: flex-end; }
.zeile { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.zeile b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abzeichen { font: 700 12px var(--schrift); padding: 2px 8px; border-radius: 999px; background: var(--akzent); color: var(--grund); white-space: nowrap; }
.balken { position: relative; height: 14px; border-radius: 7px; background: rgba(0,0,0,0.45); overflow: hidden; }
.balken i { position: absolute; inset: 0 auto 0 0; border-radius: 7px; }
.balken.hp i { background: var(--gefahr); }
.balken.exp i { background: var(--blau); }
.balken span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#kompass { width: 52px; height: 52px; border-radius: 50%; padding: 5px; background: rgba(23,34,43,0.85); border-color: var(--rand); color: var(--text); }
#kompass.an { border-color: var(--sicher); box-shadow: 0 0 0 3px rgba(63,184,169,0.35); }
#rose { width: 100%; height: 100%; display: block; transition: transform 60ms linear; }
/* Fahndungssterne (wie GTA): gefuellt = aktiv, blinken = gerade am Entkommen */
.sterne { display: flex; gap: 2px; margin-top: 6px; font-size: 22px; line-height: 1; letter-spacing: 0; }
.sterne span { color: rgba(255,255,255,0.22); text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.sterne span.an { color: #f5c542; text-shadow: 0 0 6px rgba(245,197,66,0.6), 0 1px 2px rgba(0,0,0,0.7); }
.sterne.blinkt span.an { animation: sterneBlinken 0.5s steps(2) infinite; }
@keyframes sterneBlinken { 50% { opacity: 0.25; } }
#zone { background: var(--sicher); text-align: center; overflow: hidden; text-overflow: ellipsis; }
#hinweis { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); background: rgba(23,34,43,0.92); border: 1px solid var(--rand); padding: 10px 14px; border-radius: 12px; max-width: min(320px, 86vw); text-align: center; font-size: 14px; }

.gespraech { position: absolute; left: 50%; top: calc(var(--oben) + 150px); transform: translateX(-50%); width: min(380px, calc(100vw - 24px)); background: rgba(23,34,43,0.94); border: 1px solid var(--rand); border-radius: 14px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.4); }
.gespraech .wer { color: var(--akzent); font-size: 15px; }
.gespraech .text { margin: 6px 0 10px; font-size: 15px; line-height: 1.4; }
.gespraech .knoepfe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.knopf-klein { font: 600 14px var(--schrift); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--rand); background: var(--panel); color: var(--text); min-height: 40px; }
.knopf-klein.gold { background: var(--akzent); color: var(--grund); border-color: var(--akzent); }

#joystick { position: absolute; left: var(--links); bottom: calc(var(--unten) + 22px); width: 132px; height: 132px; border-radius: 50%; background: rgba(23,34,43,0.35); border: 2px solid rgba(242,236,224,0.35); touch-action: none; }
#joystick .knopf { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(242,236,224,0.85); box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
#joystick.aktiv { background: rgba(23,34,43,0.5); }

.aktionen { position: absolute; right: var(--rechts); bottom: calc(var(--unten) + 22px); display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 10px; align-items: end; }
.rund { width: 62px; height: 62px; border-radius: 50%; font-size: 26px; padding: 0; background: rgba(23,34,43,0.8); border: 2px solid var(--rand); color: var(--text); }
.rund.gross { width: 82px; height: 82px; font-size: 34px; grid-column: 2; grid-row: 2; background: rgba(176,138,79,0.9); color: var(--grund); }
.rund.klein-rund { width: 50px; height: 50px; font-size: 22px; grid-column: 2; grid-row: 1; justify-self: center; }
.rund:active { transform: scale(0.94); }

.fps { position: fixed; left: 50%; transform: translateX(-50%); bottom: 4px; font-size: 10px; color: #1d2a33; background: rgba(242,236,224,0.75); padding: 1px 8px; border-radius: 6px; pointer-events: none; }
.quelle { font-size: 11px; color: var(--text-leise); text-align: center; margin: 10px 0 0; }
.quelle a { color: inherit; }

/* ---- Figur erstellen: Albgarde ---- */
.vorschau-rahmen { position: relative; width: 100%; height: 100%; min-height: 260px; }
.vorschau-rahmen #vorschau { touch-action: pan-y; cursor: grab; }
#vorschau-text { position: absolute; inset: auto 0 12px; text-align: center; margin: 0; }
.wahl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wahl.zwei { grid-template-columns: repeat(2, 1fr); }
.wahl button[hidden] { display: none; }
.wahl button { height: 40px; font-size: 13px; padding: 0 4px; }
.wahl button[aria-pressed="true"] { border-color: var(--akzent); color: var(--akzent); }
label.regler { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
label.regler output { font-weight: 400; color: var(--text-leise); }
label.regler input { width: 100%; accent-color: var(--akzent); height: 28px; }

/* ---- HUD rechts oben ---- */
.rund-hud { width: 48px; height: 48px; border-radius: 50%; padding: 9px; background: rgba(23,34,43,0.85); border-color: var(--rand); color: var(--text); }
.rund-hud svg { width: 100%; height: 100%; display: block; }
#kompass { width: 52px; height: 52px; padding: 5px; }
#ton .stumm { display: none; }
#ton[aria-pressed="false"] .stumm { display: inline; }
#ton[aria-pressed="false"] .wellen { display: none; }
#ton[aria-pressed="false"] { opacity: 0.75; }

/* ---- Bewegen: Joystick erscheint dort, wo der Daumen aufsetzt ---- */
#joystick-zone { position: absolute; left: 0; bottom: 0; width: 48%; height: 46%; touch-action: none; }
#joystick { left: var(--links); bottom: calc(var(--unten) + 22px); transition: opacity 0.2s; opacity: 0.75; pointer-events: none; }
#joystick.aktiv { opacity: 1; transition: none; }

/* ---- Aktionen ---- */
.rund svg { width: 55%; height: 55%; display: block; margin: auto; }
.waffen-symbol { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
.waffen-symbol svg { width: 56%; height: 56%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
[data-aktion="waffe"] { position: relative; grid-column: 1; grid-row: 2; }
[data-aktion="waffe"] .tausch { position: absolute; right: -2px; top: -4px; font-size: 13px; background: var(--rand); color: var(--grund); border-radius: 999px; width: 20px; height: 20px; line-height: 20px; }
[data-aktion="waffe"]:disabled, [data-aktion="angriff"]:disabled { opacity: 0.45; }
.rund.gedrueckt { transform: scale(0.94); filter: brightness(1.15); }

/* ---- Inventarfenster ---- */
.fenster { position: absolute; top: 0; right: 0; bottom: 0; width: min(372px, 100vw); z-index: 20;
  background: rgba(23,34,43,0.97); border-left: 1px solid var(--rand); padding: var(--oben) max(10px, env(safe-area-inset-right, 0px)) var(--unten) 10px;
  display: flex; flex-direction: column; gap: 8px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.fenster .kopf { display: flex; justify-content: space-between; align-items: center; }
.fenster h2 { margin: 0; font: 700 19px var(--schrift-titel); color: var(--akzent); letter-spacing: 0.06em; }
.fenster .schliessen { width: 40px; height: 40px; padding: 0; font-size: 24px; line-height: 1; }
.ausruestung { display: grid; gap: 5px; grid-template-columns: 54px 1fr 54px;
  grid-template-areas: "helm werte umhang" "schultern werte armband" "ruestung werte handschuhe" "kleidung werte schuhe" "nahkampf werte fernkampf"; }
.ausruestung .werte { grid-area: werte; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 8px 10px;
  border-radius: 10px; background: radial-gradient(ellipse at 50% 40%, rgba(176,138,79,0.18), rgba(0,0,0,0.25)); border: 1px solid rgba(176,138,79,0.35); font-size: 13px; }
.ausruestung .werte div { display: flex; justify-content: space-between; gap: 8px; }
.feld { position: relative; aspect-ratio: 1; border-radius: 8px; background: rgba(0,0,0,0.38); border: 1px solid #3a4e5e; }
.feld.slot { border-color: rgba(176,138,79,0.55); }
.feld .umriss { position: absolute; inset: 22%; width: 56%; height: 56%; fill: none; stroke: rgba(242,236,224,0.28); stroke-width: 1.4; stroke-linejoin: round; }
.feld.slot.belegt .umriss { display: none; }
.feld.ziel { border-color: var(--sicher); box-shadow: inset 0 0 0 2px var(--sicher); }
.feld.falsch { border-color: var(--gefahr); box-shadow: inset 0 0 0 2px var(--gefahr); }
.seiten { display: flex; gap: 6px; }
.seiten button { height: 30px; min-width: 44px; font: 700 13px var(--schrift-titel); }
.seiten button[aria-selected="true"] { border-color: var(--akzent); color: var(--akzent); }
.raster { display: grid; grid-template-columns: repeat(var(--spalten), 1fr); gap: 4px; }
.ding { position: absolute; inset: 2px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none;
  background: radial-gradient(circle at 50% 35%, rgba(242,236,224,0.10), transparent 70%); }
.ding img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.ding .kuerzel { font: 700 15px var(--schrift-titel); color: var(--text-leise); }
.ding .plus { position: absolute; right: 2px; bottom: 0; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.ding.selten { box-shadow: inset 0 0 0 1px rgba(76,143,224,0.8); }
.ding.episch { box-shadow: inset 0 0 0 1px rgba(170,110,230,0.9); }
.ding.legendaer { box-shadow: inset 0 0 0 1px rgba(232,176,74,0.95); }
.ding.gewaehlt { box-shadow: inset 0 0 0 2px var(--akzent); background-color: rgba(232,176,74,0.12); }
.ding.zieht { opacity: 0.3; }
.ding.geist { position: fixed; left: -28px; top: -28px; width: 56px; height: 56px; inset: auto; pointer-events: none; z-index: 50; opacity: 0.92; background-color: rgba(23,34,43,0.6); }
.info { border: 1px solid var(--rand); border-radius: 10px; padding: 10px 12px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.info .titel { font: 700 16px var(--schrift-titel); }
/* Ausgewaehlter Gegenstand: oben in der Mitte ueber den Werten, damit man ihn ohne Scrollen liest */
.ausruestung .info { grid-area: werte; z-index: 1; overflow-y: auto; min-height: 0; contain: size; font-size: 13px; padding: 8px 10px; }
.ausruestung .info .zeile-info { flex-wrap: wrap; }
.titel.selten { color: #7fb2f0; } .titel.episch { color: #c79bf0; } .titel.legendaer { color: var(--akzent); }
.klein-text { font-size: 12px; }
.wertliste { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 13px; }
.wertliste li { display: flex; justify-content: space-between; }
.beschreibung { margin: 0; font-size: 13px; color: var(--text-leise); }
.zeile-info { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.haupt-klein { background: var(--akzent); color: var(--grund); border-color: var(--akzent); height: 38px; }
.fuss-inv { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-leise); margin-top: auto; padding-top: 4px; }
.fuss-inv b { color: var(--text); }
@media (min-width: 900px) { .fenster { top: var(--oben); bottom: auto; max-height: calc(100% - 2 * var(--oben)); right: var(--rechts); border: 1px solid var(--rand); border-radius: 14px; } }

/* Schadenszahlen, Belohnung, roter Rand bei Treffern, Bewusstlos-Anzeige */
#zahlen { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.zahl { position: absolute; transform: translate(-50%, -50%); font: 800 22px system-ui, sans-serif; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.7), 0 0 6px rgba(0,0,0,0.5); animation: zahl-steigt 0.9s ease-out forwards; white-space: nowrap; }
.zahl.schaden { color: #ffd34d; }
.zahl.stark { color: #ff7a3d; font-size: 28px; }
.zahl.ich { color: #ff5a4f; }
.zahl.exp { color: #7fe3ff; font-size: 18px; animation-duration: 1.6s; }
.zahl.moneten { color: #f2c94c; font-size: 18px; animation-duration: 1.6s; }
.zahl.level { color: #ffe08a; font-size: 34px; animation-duration: 2.4s; }
@keyframes zahl-steigt { 0% { opacity: 0; margin: 0; transform: translate(-50%, -50%) scale(0.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.35); } 24% { transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; margin-top: -70px; margin-left: var(--dx, 0px); transform: translate(-50%, -50%) scale(0.9); } }
/* Kopf- und Herzschuss: gross, rot, wackelt kurz */
.zahl.toedlich { color: #ff2d2d; font-size: 34px; letter-spacing: 0.02em; text-shadow: 0 2px 0 #300, 0 0 14px rgba(255,40,40,0.75); animation: zahl-toedlich 1.4s ease-out forwards; }
@keyframes zahl-toedlich { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.6) rotate(-8deg); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(3deg); } 16% { transform: translate(-50%, -50%) rotate(-3deg); } 22% { transform: translate(-50%, -50%) rotate(0); } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -50px; transform: translate(-50%, -50%) scale(1.1); } }
#schadenrand { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px 20px rgba(200,20,20,0.75); opacity: 0; transition: opacity 0.5s; }
#schadenrand.an { opacity: 1; transition: none; }
#bewusstlos { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 16px calc(env(safe-area-inset-bottom) + 30vh); background: radial-gradient(circle at 50% 40%, rgba(40,0,0,0.2), rgba(20,0,0,0.78)); color: #f2ece0; font-size: 15px; z-index: 30; }
#bewusstlos b { font-size: 26px; font-weight: 800; color: #ff8a7a; text-shadow: 0 2px 8px rgba(0,0,0,.8); margin-bottom: 6px; }
#bewusstlos button { min-width: 240px; }
#bewusstlos button:disabled { opacity: 0.5; }
#bewusstlos[hidden] { display: none; }
#bewusstlos b { font-size: 26px; color: #ff8a7a; }

/* Profil */
#profil-knopf { cursor: pointer; pointer-events: auto; }
#profil-knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.abzeichen.gold { background: var(--akzent); color: #17222b; }
.zeile-info { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rang { color: #7fb2f0; }
.punkte { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.punkte li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--rand); border-radius: 10px; padding: 8px 10px; background: var(--panel); }
.punkte small { color: var(--text-leise); font-size: 12px; }
.rund-plus { width: 40px; height: 40px; flex: none; border-radius: 50%; padding: 0; font-size: 22px; font-weight: 700; }
.schalter { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--rand); border-radius: 10px; padding: 10px 12px; background: var(--panel); cursor: pointer; }
.schalter small { color: var(--text-leise); font-size: 12px; }
.schalter input { appearance: none; width: 46px; height: 26px; flex: none; border-radius: 13px; background: #3a4752; position: relative; transition: background .15s; margin: 0; }
.schalter input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #f2ece0; transition: transform .15s; }
.schalter input:checked { background: var(--akzent); }
.schalter input:checked::after { transform: translateX(20px); }
.schalter { flex-direction: row; text-align: left; }
.schalter > span { flex: 1; }
.schalter input { width: 46px !important; min-height: 0; padding: 0; border: 0; }
#profil { left: 0; right: auto; }
@media (min-width: 900px) { #profil { left: var(--links); right: auto; } }

/* Zielen: Knopf ueber dem Waffenwechsel, Fadenkreuz in der Bildmitte */
.rund.klein-rund[data-aktion="zielen"] { grid-column: 1; grid-row: 1; justify-self: end; }
[data-aktion="zielen"][aria-pressed="true"] { background: var(--akzent); color: var(--grund); }
[data-aktion="zielen"] svg { width: 26px; height: 26px; }
#fadenkreuz { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 6; }
#fadenkreuz i { position: absolute; background: #f2ece0; box-shadow: 0 0 2px rgba(0,0,0,.9); border-radius: 1px; transition: transform .12s; }
#fadenkreuz i:nth-child(1), #fadenkreuz i:nth-child(2) { width: 2px; height: 11px; left: -1px; }
#fadenkreuz i:nth-child(1) { top: -17px; } #fadenkreuz i:nth-child(2) { top: 6px; }
#fadenkreuz i:nth-child(3), #fadenkreuz i:nth-child(4) { height: 2px; width: 11px; top: -1px; }
#fadenkreuz i:nth-child(3) { left: -17px; } #fadenkreuz i:nth-child(4) { left: 6px; }
#fadenkreuz b { position: absolute; width: 4px; height: 4px; left: -2px; top: -2px; border-radius: 50%; background: #f2ece0; box-shadow: 0 0 2px #000; }
#fadenkreuz.ziel i, #fadenkreuz.ziel b { background: #d9661a; }
#fadenkreuz.toedlich i, #fadenkreuz.toedlich b { background: #ff2222; box-shadow: 0 0 6px rgba(255,30,30,.9); }
#fadenkreuz.toedlich b { transform: scale(1.6); }
#fadenkreuz.schuss i:nth-child(1) { transform: translateY(-4px); } #fadenkreuz.schuss i:nth-child(2) { transform: translateY(4px); }
#fadenkreuz.schuss i:nth-child(3) { transform: translateX(-4px); } #fadenkreuz.schuss i:nth-child(4) { transform: translateX(4px); }
body.zielt .hud.oben-links, body.zielt #profil-knopf { opacity: .55; }

/* ---- Sprechfunk ---- */
#funk { position: relative; }
#funk .stumm { opacity: 1; }
#funk[aria-pressed="true"] { background: rgba(46,140,88,0.92); border-color: #6FD68A; }
#funk[aria-pressed="true"] .stumm { opacity: 0; }
#funk.sendet { box-shadow: 0 0 0 3px rgba(111,214,138,0.55); }
#funk .zahl { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--akzent); color: #17222b; font: 700 12px/20px system-ui, sans-serif; }
#funkliste .hinweis-text { color: var(--text-leise); font-size: 13px; margin: 0; }
#funkliste .person { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; border: 1px solid var(--rand); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
#funkliste .person .name { font-weight: 700; }
#funkliste .person .name.spricht::after { content: ' 🎙'; }
#funkliste .person small { color: var(--text-leise); }
#funkliste .person .knoepfe { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
#funkliste .leer { color: var(--text-leise); text-align: center; padding: 18px 0; }

/* ---- Auto: Ein-/Aussteigen, beim Fahren nur Lenken und Aussteigen ---- */
.aktionen [data-aktion="auto"] { position: absolute; right: 10px; bottom: calc(100% + 14px); background: rgba(176,138,79,0.9); color: var(--grund); }
.aktionen [data-aktion="auto"].raus { background: rgba(23,34,43,0.85); color: var(--text); }
body.faehrt [data-aktion="angriff"], body.faehrt [data-aktion="springen"], body.faehrt [data-aktion="zielen"], body.faehrt [data-aktion="waffe"] { display: none; }
body.faehrt .aktionen [data-aktion="auto"] { position: static; grid-column: 2; grid-row: 2; width: 72px; height: 72px; }

/* ---- Kartenansicht ---- */
#karte { position: absolute; inset: 0; z-index: 40; background: #dfe3d3; }
#karte canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#karte .karte-knoepfe { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; display: flex; flex-direction: column; gap: 10px; }
#karte .karte-knoepfe .rund-hud { font: 700 20px system-ui, sans-serif; padding: 0; line-height: 1; }
#karte .karte-norden { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 16px; font: 700 13px system-ui, sans-serif; color: #26303a; background: rgba(255,255,255,.85); padding: 4px 8px; border-radius: 8px; }

/* Autoklauen: Knopf schwebt ueber dem angetippten Auto */
#fahren-knopf {
  position: absolute; left: 0; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px 10px 12px; min-height: 44px;
  border: 1px solid rgba(255,255,255,0.35); border-radius: 22px;
  background: rgba(176,138,79,0.95); color: var(--grund);
  font: 700 16px/1 system-ui, -apple-system, sans-serif;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  will-change: transform;
}
#fahren-knopf[hidden] { display: none; }
#fahren-knopf svg { width: 22px; height: 22px; }
#fahren-knopf::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px;
  border: 7px solid transparent; border-bottom: 0; border-top-color: rgba(176,138,79,0.95);
}
body.faehrt #fahren-knopf { display: none; }
.gespraech .text { white-space: pre-line; }

/* Handel zwischen Spielern */
#handel { z-index: 30; }
#handel .handel-seiten { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
#handel section { border: 1px solid var(--rand); border-radius: 12px; padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
#handel section.bereit { border-color: #4caf50; box-shadow: 0 0 0 1px #4caf50 inset; }
#handel .handel-liste { display: flex; flex-wrap: wrap; gap: 6px; }
#handel .handel-liste.tasche { max-height: 34vh; overflow-y: auto; margin: 6px 0 12px; }
#handel .handel-teil { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 1px solid var(--rand); background: var(--panel); color: var(--text); font: 600 12px var(--schrift); max-width: 100%; }
#handel .handel-teil img { width: 32px; height: 32px; object-fit: contain; }
#handel .handel-teil[disabled] { opacity: 1; }
#handel .handel-geld { margin-top: auto; font-size: 13px; display: flex; align-items: center; gap: 6px; }
#handel .handel-geld input { width: 100%; min-width: 0; font: 600 15px var(--schrift); padding: 6px 8px; border-radius: 8px; border: 1px solid var(--rand); background: var(--grund); color: var(--text); }
#handel .knoepfe { display: flex; gap: 8px; justify-content: flex-end; }

/* Karte: Teleportziel */
#karte .karte-teleport { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 48px); transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: rgba(23,34,43,0.94); color: #fff; padding: 8px 10px 8px 14px; border-radius: 999px; font: 600 14px system-ui, sans-serif; box-shadow: 0 4px 16px rgba(0,0,0,.35); max-width: calc(100vw - 24px); }

/* Ladenfenster (Waffenhaendler) */
.laden-fenster .laden-geld { margin: 6px 0 10px; color: var(--akzent); font-weight: 700; }
.laden-fenster .laden-liste { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; padding-bottom: 20px; }
.laden-ware { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.laden-ware img { width: 40px; height: 40px; flex: none; }
.laden-ware .laden-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.laden-ware .laden-text b { font-size: 14px; }
.laden-ware .laden-text small { font-size: 11px; opacity: .75; }
.laden-ware button { flex: none; min-width: 84px; }
.laden-ware.gesperrt { opacity: .5; }
/* Munition und Nachladen */
#munition { position: absolute; right: calc(var(--rechts, 12px) + 4px); bottom: 210px; padding: 4px 10px; border-radius: 999px; background: rgba(23,34,43,0.72); border: 1px solid rgba(176,138,79,0.6); font: 700 14px var(--schrift); pointer-events: auto; }
#munition.laedt { color: var(--akzent); }

/* Minikarte oben rechts neben den Knoepfen: halbtransparent, dreht mit der Blickrichtung */
#minikarte { position: absolute; top: var(--oben); right: calc(var(--rechts) + 62px); width: 108px; height: 108px; border-radius: 50%;
  opacity: 0.72; border: 2px solid rgba(255,255,255,0.55); box-shadow: 0 2px 8px rgba(0,0,0,0.25); z-index: 5; touch-action: manipulation; }
#minikarte[hidden] { display: none; }

/* Ladebildschirm: drehende Ringe, Balken, Restzeit, Schrittliste, Verbindung */
#laden { z-index: 50; background: radial-gradient(circle at 50% 30%, #23323e, #10171d 70%); gap: 10px; transition: opacity 0.4s; }
#laden.weg { opacity: 0; pointer-events: none; }
.lade-logo { position: relative; width: 84px; height: 84px; margin-bottom: 4px; }
.lade-logo i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--akzent); border-right-color: var(--akzent); animation: lade-dreh 1.4s linear infinite; }
.lade-logo i + i { inset: 12px; border-top-color: var(--sicher); border-right-color: transparent; border-left-color: var(--sicher); animation-duration: 2.1s; animation-direction: reverse; }
.lade-logo b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 30px/1 var(--schrift-titel); color: var(--akzent); animation: lade-puls 1.8s ease-in-out infinite; }
@keyframes lade-dreh { to { transform: rotate(360deg); } }
@keyframes lade-puls { 50% { opacity: 0.45; transform: scale(0.92); } }
#laden .lade-jetzt { color: var(--text); font-weight: 600; min-height: 2.6em; margin: 4px 0 0; }
#laden .lade-jetzt[data-art="warten"] { color: #f2c14e; }
#laden .lade-jetzt[data-art="fehler"] { color: #ff8a7a; }
.lade-balken { width: min(320px, 80vw); height: 10px; border-radius: 6px; background: rgba(255,255,255,0.1); overflow: hidden; }
.lade-balken i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width 0.3s;
  background: linear-gradient(90deg, var(--akzent), #f6d98b, var(--akzent)); background-size: 200% 100%; animation: lade-glanz 1.6s linear infinite; }
@keyframes lade-glanz { to { background-position: -200% 0; } }
#laden .lade-zahlen { display: flex; gap: 12px; justify-content: center; font-size: 13px; margin: 0; font-variant-numeric: tabular-nums; }
.lade-prozent { color: var(--akzent); font-weight: 700; }
#laden .lade-netz { font-size: 12px; margin: 0; }
#laden .lade-netz[data-art="fehler"] { color: #ff8a7a; }
#laden .lade-netz[data-art="warten"] { color: #f2c14e; }
.lade-liste { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; color: var(--text-leise); display: grid; gap: 3px; min-width: 240px; }
.lade-liste li::before { content: '○'; display: inline-block; width: 1.4em; color: var(--text-leise); }
.lade-liste li[data-zustand="laeuft"] { color: var(--text); }
.lade-liste li[data-zustand="laeuft"]::before { content: '◐'; color: var(--akzent); animation: lade-dreh 1s linear infinite; text-align: center; }
.lade-liste li[data-zustand="fertig"]::before { content: '✓'; color: var(--sicher); }
.lade-liste small { color: var(--text-leise); }

/* Waehrung: eigene Muenze (Alb-Taler) statt "M", das man mit Millionen verwechseln koennte */
.mit-muenze::after { content: ''; display: inline-block; width: 1.05em; height: 1.05em; margin-left: .28em; vertical-align: -.18em;
  background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2032%2032%27%3E%3Ccircle%20cx%3D%2716%27%20cy%3D%2716%27%20r%3D%2715%27%20fill%3D%27%23b8862b%27/%3E%3Ccircle%20cx%3D%2716%27%20cy%3D%2716%27%20r%3D%2712.5%27%20fill%3D%27%23e7bf55%27%20stroke%3D%27%238a5f16%27%20stroke-width%3D%271.5%27/%3E%3Cpath%20d%3D%27M10%2023%2016%208%2022%2023M11.5%2017.5h9M12.8%2014.5h6.4%27%20fill%3D%27none%27%20stroke%3D%27%236b4610%27%20stroke-width%3D%272.4%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27/%3E%3C/svg%3E") center / contain no-repeat; }
.laden-ware .knopf-klein.aus { opacity: .55; }

/* Haustier-Befehle ueber dem Tier */
.haustier-befehle { position: absolute; left: 0; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px;
  background: rgba(16, 22, 28, .82); border: 1px solid rgba(255, 255, 255, .15); border-radius: 12px; pointer-events: auto; }
.haustier-befehle[hidden] { display: none; }
.haustier-befehle button { font: 600 14px system-ui, sans-serif; color: #f2ece0; background: #2a3440; border: 1px solid #4a5868; border-radius: 8px; padding: 9px 10px; min-width: 104px; }
.haustier-befehle button[data-befehl="zurueck"] { grid-column: 1 / -1; background: transparent; }
.handel-schnell{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px}
.handel-schnell .knopf-klein{padding:4px 7px;font-size:12px}
.wirkungen{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px;font-size:11px}
.wirkungen span{background:rgba(255,255,255,.12);border-radius:999px;padding:1px 7px;white-space:nowrap}
.zahl.heil { color: #6dff8f; font-size: 22px; animation-duration: 1.4s; }
.ding.auto { box-shadow: 0 0 0 2px #6dff8f inset, 0 0 10px rgba(109,255,143,.6); }
.ding.auto::after { content: 'AUTO'; position: absolute; left: 2px; top: 1px; font: 800 8px system-ui, sans-serif; color: #6dff8f; text-shadow: 0 1px 2px #000; }
#schadenrand.heil { box-shadow: inset 0 0 70px 14px rgba(80,255,120,.5); }
#schadenrand.tempo { box-shadow: inset 0 0 70px 14px rgba(90,160,255,.5); }

/* Erlaubnisse beim ersten Start */
.erlaubnis { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: var(--oben) var(--rechts) var(--unten) var(--links); background: rgba(10,16,22,0.7); }
.erlaubnis .zeilen { display: flex; flex-direction: column; gap: 10px; }
.erlaubnis .zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #3a4e5e; border-radius: 12px; }
.erlaubnis .zeile.ok { border-color: var(--sicher); }
.erlaubnis .zeile small { display: block; color: var(--text-leise); font-size: 12.5px; }
.erlaubnis .zeile small.fehler { color: #ff9b8f; margin-top: 4px; }
.erlaubnis .zeile button { flex: none; min-width: 84px; }
