* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0D1117;
  --surf: #1A1A2E;
  --surf2: #22223A;
  --border: rgba(124,159,245,.18);
  --accent: #7C9FF5;
  --text: #E8EEFF;
  --dim: #8899BB;
  --green: #4CAF50;
  --red: #F44336;
  --yellow: #FFC107;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
}
.screen { display: none; position: fixed; inset: 0; flex-direction: column; }
.screen.active { display: flex; }

/* LOGIN */
#screen-login { align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--surf); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; max-width: 400px; width: 100%; }
.brand { font-size: 1.4rem; color: var(--accent); text-align: center; }
.brand strong { color: var(--text); }
.sub { color: var(--dim); text-align: center; margin: 6px 0 18px; font-size: .9rem; }
form { display: flex; flex-direction: column; gap: 12px; }
input[type=text], input[type=password], input[type=search], input[type=number] {
  background: var(--surf2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 10px; font-size: 1rem;
}
input:focus { outline: none; border-color: var(--accent); }
.btn { background: var(--surf2); color: var(--text); border: 1px solid var(--border);
  padding: 11px 18px; border-radius: 12px; font-size: 1rem; cursor: pointer; }
.btn.primary { background: var(--accent); color: #0F0F1E; font-weight: 700; border: none; }
.btn.outline { background: transparent; }
.btn.full { width: 100%; }
.btn.music { background: #FF8A65; color: #1A1A2E; font-weight: 700; }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: var(--red); font-size: .85rem; padding: 6px; }

/* BROWSE */
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surf); border-bottom: 1px solid var(--border);
  padding-top: max(14px, env(safe-area-inset-top)); }
.topbar .title { flex: 1; font-weight: 700; font-size: 1.05rem; }
.icon-btn { background: transparent; border: none; color: var(--text); font-size: 1.4rem;
  cursor: pointer; padding: 4px 8px; }
.icon-btn.round { width: 40px; height: 40px; border-radius: 50%;
  background: rgba(13,17,23,.8); }
.search-bar { padding: 12px 16px; }
.search-bar input { width: 100%; }
.adv-list { flex: 1; overflow-y: auto; padding: 0 16px 16px; display: flex;
  flex-direction: column; gap: 10px; }
.adv-card { background: var(--surf); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; cursor: pointer; }
.adv-card:hover { border-color: var(--accent); }
.adv-card .t { font-weight: 700; color: var(--accent); }
.adv-card .meta { color: var(--dim); font-size: .8rem; margin-top: 4px; }
.adv-card .desc { color: var(--text); font-size: .85rem; margin-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }

/* INTRO */
.intro-wrap { flex: 1; padding: 24px 20px; display: flex; flex-direction: column;
  align-items: center; padding-top: max(28px, env(safe-area-inset-top)); }
.outro-wrap { background: radial-gradient(circle at top, rgba(76,175,80,.18), transparent 36%), #0F0F1E; }
.intro-emoji { font-size: 3.5rem; margin-bottom: 12px; }
.intro-wrap h1 { font-size: 1.6rem; text-align: center; margin-bottom: 8px; }
.chip { display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--surf2); font-size: .85rem; }
.chip.green { background: rgba(76,175,80,.18); color: #A5D6A7; }
.chip.online { color: #4CAF50; font-size: .75rem; }
.intro-actions { margin: 14px 0; }
.intro-scroll { flex: 1; width: 100%; overflow-y: auto; display: flex;
  flex-direction: column; gap: 14px; padding: 12px 0; }
.info-card { background: var(--surf); border-radius: 14px; padding: 16px; }
.info-title { color: var(--dim); font-size: .75rem; font-weight: 700;
  text-transform: uppercase; margin-bottom: 8px; }
.info-body { font-size: .95rem; line-height: 1.45; white-space: pre-wrap; }
.info-body.strong { font-weight: 600; color: var(--accent); }
.intro-video-wrap {
  justify-content: center;
  gap: 14px;
}
.intro-video-frame {
  position: relative;
  width: min(100%, 860px);
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.intro-video-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: #000;
}
.intro-video-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: #000;
}
#intro-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.intro-video-blocker {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  touch-action: none;
}

.intro-skip-overlay {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .15s;
}
.intro-skip-overlay:hover { background: rgba(255,255,255,0.15); }

#intro-video-status {
  width: min(100%, 860px);
  text-align: center;
  color: var(--dim);
}

/* MAP */
#screen-map { flex-direction: column; }
#map { flex: 1; background: #0D1117; }
.offline-map-tile {
  background-color: #10231b;
  background-image:
    radial-gradient(circle at 28px 28px, rgba(255,224,138,.14) 0 2px, transparent 3px),
    linear-gradient(rgba(124,159,245,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,159,245,.10) 1px, transparent 1px),
    linear-gradient(135deg, rgba(101,214,143,.08), rgba(16,35,27,.20));
  background-size: 96px 96px, 48px 48px, 48px 48px, 100% 100%;
}
.zone-label {
  background: rgba(13,17,23,.92);
  border: 1px solid #FFC107;
  color: #FFE08A;
  border-radius: 999px;
  padding: 4px 9px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.map-overlay { position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; gap: 8px; padding: 8px;
  padding-top: max(8px, env(safe-area-inset-top)); z-index: 1000; }
.map-topbar { display: flex; gap: 8px; align-items: center; pointer-events: auto;
  justify-content: flex-end; }
.title-pill { background: rgba(13,17,23,.8); padding: 8px 14px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; flex: 1; }
.route-info { background: rgba(13,17,23,.92); padding: 8px 14px; border-radius: 999px;
  align-self: center; pointer-events: auto; font-size: .85rem; }
.zone-info { position: absolute; bottom: 0; left: 0; right: 0; pointer-events: auto;
  background: var(--surf); border-top: 1px solid var(--border);
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.zone-info .num { background: var(--green); color: #000; font-weight: 700;
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; }
.zone-info-row { display: flex; gap: 12px; align-items: center; }
.zone-info-text { flex: 1; }

@media (max-width: 560px) {
  .map-overlay {
    padding: 6px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .map-topbar {
    gap: 6px;
    align-items: flex-start;
  }
  .title-pill {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 12px;
    font-size: .82rem;
    line-height: 1.25;
    border-radius: 18px;
    max-height: 46px;
    overflow: hidden;
  }
  .map-topbar .icon-btn.round {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #screen-map .leaflet-top.leaflet-left {
    top: max(54px, calc(env(safe-area-inset-top) + 48px));
    left: 8px;
  }
  #screen-map .leaflet-control-zoom a {
    width: 34px;
    height: 34px;
    line-height: 34px;
    font-size: 18px;
  }
}
.pfp-player-marker {
  background: transparent;
  border: 0;
}
.pfp-person-wrap {
  position: relative;
  width: 42px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.34));
}
.pfp-direction {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 18px solid #FFD54F;
  transform-origin: 50% 28px;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
  z-index: 0;
}
.pfp-person-wrap.moving .pfp-direction { opacity: 1; }
.pfp-person {
  position: relative;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background:
    linear-gradient(145deg, #42A5F5, #1565C0);
  border: 3px solid #fff;
  box-shadow:
    0 0 0 4px rgba(21,101,192,.20),
    inset 0 -4px 7px rgba(0,0,0,.22);
}
.pfp-person-head {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: #fff;
}
.pfp-person-body {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 12px;
  height: 11px;
  border-radius: 7px 7px 5px 5px;
  transform: translateX(-50%);
  background: #fff;
}
.pfp-person-body::before,
.pfp-person-body::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 5px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
}
.pfp-person-body::before { left: -3px; transform: rotate(-24deg); }
.pfp-person-body::after { right: -3px; transform: rotate(24deg); }
.pfp-person-shadow {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 24px;
  height: 7px;
  border-radius: 50%;
  transform: translateX(-50%) scaleX(1);
  background: rgba(0,0,0,.26);
  z-index: 1;
}

/* CHAT */
.chat-header { background: #1F2C3E; padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex; gap: 10px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%;
  background: #1A2A4A; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-meta { flex: 1; }
.chat-name { font-weight: 700; }
.chat-sub { color: var(--dim); font-size: .75rem; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex;
  flex-direction: column; gap: 8px; background: #0E1525; }
.bubble { display: inline-block; max-width: 100%; min-width: 120px; padding: 8px 12px; border-radius: 16px;
  font-size: .95rem; overflow-wrap: break-word; word-break: normal; white-space: pre-wrap; }
.bubble.npc { background: #1E3A5C; border-top-left-radius: 4px; align-self: flex-start; }
.bubble.player { background: #2E7D32; border-top-right-radius: 4px; align-self: flex-end; }
.bubble.narrator { background: #2E1A3D; align-self: center; text-align: center;
  border: 1px solid rgba(156,39,176,.4); }
.bubble-row { display: flex; gap: 8px; max-width: 100%; align-items: flex-end; }
.bubble-row > div:last-child { max-width: min(78%, 680px); min-width: 120px; }
.bubble-row.right { justify-content: flex-end; }
.bubble-row.right > div { max-width: min(78%, 680px); min-width: 120px; }
.bubble-meta { color: var(--dim); font-size: .7rem; margin-top: 2px;
  padding: 0 8px; }
.npc-label { color: #64B5F6; font-size: .7rem; font-weight: 700;
  padding: 0 8px; margin-bottom: 2px; }
.chat-choices { padding: 12px; background: #0E1525;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.choice-btn { background: rgba(46,125,50,.15); color: #A5D6A7;
  border: 1.5px solid #4CAF50; padding: 12px 16px; border-radius: 20px;
  cursor: pointer; font-size: .9rem; max-width: 280px; }
.chat-footer { background: #1F2C3E; padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom)); }

/* ══════════════════ ADVENTURE (ABENTEUERBOX) STYLE ══════════════════ */
.dialog-style-adventure {
  background: radial-gradient(ellipse at top, #2a1505 0%, #0e0703 100%);
  background-color: #0e0703;
}
.dialog-style-adventure #dlg-topbar {
  background: linear-gradient(180deg, #2a1a06 0%, #1a0f03 100%);
  border-bottom: 2px solid #c9a84c;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.dialog-style-adventure #dlg-name {
  color: #f0d070;
  font-weight: 700;
  letter-spacing: .06em;
  text-shadow: 0 0 12px rgba(200,160,60,.5);
}
.dialog-style-adventure #dlg-sub {
  color: #a07840;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.dialog-style-adventure #dlg-avatar {
  border: 2px solid #c9a84c !important;
  border-radius: 50% !important;
  box-shadow: 0 0 8px rgba(200,160,60,.4);
}
/* Kartenbreich: zentriert */
.dialog-style-adventure #chat-list {
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 16px;
  overflow: hidden;
}
/* Nur die aktuelle Karte */
.dialog-style-adventure #chat-list .bubble-row:not(:last-child) { display: none; }
/* Karten-Umdreh-Animation */
@keyframes adv-card-flip {
  0%   { opacity: 0; transform: perspective(700px) rotateY(-90deg) scale(.9); }
  55%  { opacity: 1; transform: perspective(700px) rotateY(6deg) scale(1.01); }
  100% { opacity: 1; transform: perspective(700px) rotateY(0deg) scale(1); }
}
.dialog-style-adventure .bubble-row {
  animation: adv-card-flip .48s cubic-bezier(.2,.8,.35,1) both;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0 !important;
  width: 100%;
}
/* Charakter-Portrait oben auf der Karte */
.dialog-style-adventure .bubble-row .avatar {
  width: 72px !important;
  height: 72px !important;
  font-size: 2.8rem !important;
  border: 3px solid #c9a84c !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 2px #3d2a10, 0 0 18px rgba(200,160,60,.5) !important;
  background: radial-gradient(circle, #3d2510 0%, #1a0f03 100%);
  margin-bottom: -28px;
  z-index: 2;
  position: relative;
}
/* NPC-Name: Goldenes Schriftband */
.dialog-style-adventure .npc-label {
  color: #f0d070;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 0 8px rgba(200,160,60,.6);
  background: linear-gradient(90deg, transparent, rgba(200,160,60,.12), transparent);
  border-top: 1px solid rgba(200,160,60,.4);
  border-bottom: 1px solid rgba(200,160,60,.4);
  width: 100%;
  padding: 6px 0 5px;
  margin: 28px 0 0;
}
/* Die Abenteuerkarte */
.dialog-style-adventure .bubble {
  background: linear-gradient(160deg, #f7edda 0%, #ead9b0 60%, #dcc990 100%) !important;
  color: #2a1706 !important;
  border: 2px solid #a07840 !important;
  border-radius: 6px !important;
  box-shadow: 0 0 0 1px #c9a84c, inset 0 0 0 3px rgba(200,160,60,.15), 0 14px 44px rgba(0,0,0,.75) !important;
  padding: 20px 18px 16px !important;
  font-size: 1.06rem !important;
  line-height: 1.65;
  width: 100%;
  position: relative;
}
/* Ecken-Ornamente */
.dialog-style-adventure .bubble::before,
.dialog-style-adventure .bubble::after {
  content: '✦';
  position: absolute;
  color: #c9a84c;
  font-size: .9rem;
  line-height: 1;
  opacity: .65;
}
.dialog-style-adventure .bubble::before { top: 6px; left: 9px; }
.dialog-style-adventure .bubble::after  { bottom: 6px; right: 9px; }
.dialog-style-adventure .bubble.narrator {
  background: linear-gradient(160deg, #1e1005 0%, #2a1a08 100%) !important;
  color: #e8d090 !important;
  border-color: #a07840 !important;
  font-style: italic;
  text-align: center;
}
.dialog-style-adventure .bubble.player {
  background: linear-gradient(160deg, #e8f5e8 0%, #c8e8c4 100%) !important;
  color: #1a2e1a !important;
  border-color: #5a8a5a !important;
  box-shadow: 0 0 0 1px #7ab87a, 0 8px 24px rgba(0,0,0,.55) !important;
}
.dialog-style-adventure .bubble.player::before,
.dialog-style-adventure .bubble.player::after { color: #5a8a5a; }
.dialog-style-adventure .bubble-meta {
  font-size: .68rem;
  color: #8b6930;
  letter-spacing: .05em;
  width: 100%;
  text-align: right;
  padding: 4px 4px 0;
}
.dialog-style-adventure .bubble-row > div:not(.avatar) { width: 100%; }
/* Footer: Quest-Entscheidungsbereich */
.dialog-style-adventure #chat-choices {
  background: linear-gradient(180deg, #1a0f03 0%, #0e0703 100%);
  border-top: 2px solid #c9a84c;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dialog-style-adventure .choice-btn {
  background: linear-gradient(160deg, #2d1e08 0%, #1e1205 100%) !important;
  color: #f0d070 !important;
  border: 1px solid #a07840 !important;
  border-radius: 4px !important;
  box-shadow: 0 0 0 1px #c9a84c, 0 4px 12px rgba(0,0,0,.5) !important;
  font-size: .98rem !important;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 12px 18px !important;
  text-align: left;
  transition: background .15s, box-shadow .15s !important;
}
.dialog-style-adventure .choice-btn::before { content: '⚔ '; opacity: .75; }
.dialog-style-adventure .choice-btn:active {
  background: linear-gradient(160deg, #3d2810 0%, #2a1a08 100%) !important;
  box-shadow: 0 0 0 1px #f0d070, 0 0 18px rgba(200,160,60,.4) !important;
}

/* ══════════════════ FUNKGERÄT (RADIO) STYLE ══════════════════ */
#screen-dialog.dialog-style-radio {
  background: #020902;
  background-image: repeating-linear-gradient(
    0deg, transparent 0px, transparent 3px,
    rgba(0,0,0,.13) 3px, rgba(0,0,0,.13) 4px
  );
}
#screen-dialog.dialog-style-radio::before,
#screen-dialog.dialog-style-radio::after { display: none; }

/* Topbar: Radio-Kopfzeile */
.dialog-style-radio #dlg-topbar {
  background: #0b1a0b;
  border-bottom: 3px solid #060a06;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding-bottom: 22px;
  position: relative;
  box-shadow: 0 4px 18px rgba(0,0,0,.8);
}
/* LED-Blinker */
.dialog-style-radio #dlg-topbar::before {
  content: '';
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-80%);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #00ff41;
  box-shadow: 0 0 6px #00ff41, 0 0 14px rgba(0,255,65,.55);
  animation: pfp-led-blink 1.8s ease-in-out infinite;
}
@keyframes pfp-led-blink {
  0%,100% { opacity:1; box-shadow: 0 0 7px #00ff41, 0 0 16px rgba(0,255,65,.6); }
  45%,55% { opacity:.15; box-shadow: 0 0 2px #00ff41; }
}
/* Lautsprecherschlitze */
.dialog-style-radio #dlg-topbar::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  width: 110px; height: 9px;
  background: repeating-linear-gradient(90deg, #040404 0px,#040404 4px,#1c1c1c 4px,#1c1c1c 7px);
  border-radius: 4px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.9);
}
.dialog-style-radio #dlg-name {
  font-family: 'Courier New', monospace;
  font-weight: 700; letter-spacing: .08em;
  color: #ccc; font-size: .88rem;
}
.dialog-style-radio #dlg-sub {
  font-family: 'Courier New', monospace;
  font-size: .62rem; color: #00bb2e;
  letter-spacing: .1em; text-transform: uppercase;
  text-shadow: 0 0 5px rgba(0,187,46,.4);
}
.dialog-style-radio #dlg-avatar {
  background: #0a180a;
  border: 1px solid #1a3a1a !important;
  border-radius: 4px !important;
  color: #00cc33;
  font-size: .85rem;
  text-shadow: 0 0 6px rgba(0,200,50,.5);
  box-shadow: none !important;
}
.dialog-style-radio #btn-dlg-tts { display: none; }
.dialog-style-radio .chip.online {
  font-family: 'Courier New', monospace;
  font-size: .58rem; color: #00ff41;
  background: rgba(0,255,65,.07);
  border: 1px solid rgba(0,255,65,.28);
  border-radius: 3px; padding: 3px 7px;
  text-shadow: 0 0 5px rgba(0,255,65,.5);
}

/* LCD-Display: füllt den restlichen Platz */
.dialog-style-radio #chat-list {
  flex: 1;
  background: #020d02;
  margin: 6px 8px 4px;
  border: 3px solid #050505;
  border-radius: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  box-shadow: inset 0 0 50px rgba(0,0,0,.97), inset 0 0 14px rgba(0,255,65,.03), 0 0 0 1px #161616;
  font-family: 'Courier New', monospace;
  padding: 22px 10px 10px;
}
/* Status-Label */
.dialog-style-radio #chat-list::before {
  content: '◀ EMPFANG ◀';
  position: absolute; top: 5px; right: 8px;
  font-family: 'Courier New', monospace;
  font-size: .52rem; color: rgba(0,255,65,.3);
  letter-spacing: .14em; pointer-events: none; z-index: 11;
}
/* Scanlines */
.dialog-style-radio #chat-list::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0px,transparent 3px,rgba(0,0,0,.2) 3px,rgba(0,0,0,.2) 4px);
  pointer-events: none; z-index: 10; border-radius: 4px;
}

.dialog-style-radio .bubble-row { gap: 0 !important; }
.dialog-style-radio .bubble-row > div:not(.avatar) { max-width: 100%; width: 100%; }
/* Avatar in Radio-Nachrichten */
.dialog-style-radio .bubble-row .avatar {
  width: 32px !important; height: 32px !important;
  font-size: 1.1rem !important;
  border: 1px solid #1a3a1a !important;
  border-radius: 3px !important;
  background: #0a180a;
  box-shadow: 0 0 5px rgba(0,255,65,.15) !important;
  flex-shrink: 0;
  align-self: flex-start;
}

/* Rufzeichen (NPC-Label) */
.dialog-style-radio .npc-label {
  font-family: 'Courier New', monospace;
  font-size: .6rem; color: rgba(0,255,65,.5);
  letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: 1px;
}
/* Nachrichten */
.dialog-style-radio .bubble {
  border-radius: 2px; border: none;
  border-bottom: 1px solid rgba(0,255,65,.09);
  padding: 6px 10px; margin: 0;
  background: transparent; color: #55ff66;
  font-family: 'Courier New', monospace;
  font-size: .9rem; font-weight: 500;
  line-height: 1.48;
  text-shadow: 0 0 4px rgba(0,255,65,.3);
  box-shadow: none; min-width: unset;
}
.dialog-style-radio .bubble.npc { background: transparent; color: #55ff66; }
.dialog-style-radio .bubble.player {
  background: rgba(0,255,65,.06); color: #aaffaa;
  border-bottom-color: rgba(0,255,65,.15);
}
.dialog-style-radio .bubble.narrator {
  background: rgba(0,180,65,.07);
  border: 1px dashed rgba(0,255,65,.2);
  color: #ccffcc; text-shadow: none;
}
.dialog-style-radio .bubble-meta {
  color: rgba(0,255,65,.22);
  font-family: 'Courier New', monospace; font-size: .6rem;
}

/* Physische Tasten */
.dialog-style-radio #chat-choices {
  background: #0d0d0e;
  padding: 8px 10px;
  border-top: 2px solid #050505;
  display: flex; flex-direction: column;
  gap: 7px; z-index: 2;
  box-shadow: 0 -3px 14px rgba(0,0,0,.55);
}
.dialog-style-radio .choice-btn {
  background: linear-gradient(180deg, #172a17 0%, #0f1f0f 100%) !important;
  border: 1.5px solid #1a481a !important;
  border-bottom: 4px solid #040e04 !important;
  border-radius: 5px !important;
  color: #77dd77 !important;
  font-family: 'Courier New', monospace !important;
  font-size: .82rem !important; letter-spacing: .04em;
  padding: 11px 14px !important;
  text-shadow: 0 0 6px rgba(0,255,65,.38);
  transition: transform .07s ease, border-bottom-width .07s ease !important;
  text-align: left;
}
.dialog-style-radio .choice-btn:active {
  border-bottom-width: 1px !important;
  transform: translateY(3px) !important;
}

/* Weiter-Button */
.dialog-style-radio #dlg-footer,
.dialog-style-radio .chat-footer {
  background: #0d0d0e;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border-top: 2px solid #050505;
  z-index: 2;
}
.dialog-style-radio #dlg-footer .btn.primary,
.dialog-style-radio .chat-footer .btn.primary {
  background: linear-gradient(180deg, #0b2a0b, #061406) !important;
  color: #00ff41 !important;
  border: 1.5px solid #1a4a1a !important;
  border-bottom: 4px solid #020702 !important;
  border-radius: 5px !important;
  font-family: 'Courier New', monospace !important;
  letter-spacing: .1em; font-size: .88rem; font-weight: 700;
  text-shadow: 0 0 10px rgba(0,255,65,.65);
  box-shadow: 0 0 14px rgba(0,255,65,.1) !important;
  transition: transform .07s ease, border-bottom-width .07s ease !important;
}
.dialog-style-radio #dlg-footer .btn.primary:active,
.dialog-style-radio .chat-footer .btn.primary:active {
  border-bottom-width: 1px !important;
  transform: translateY(3px) !important;
}

/* ── BRIEF (ALTER BRIEF AUF ECHTEM PAPIER) ────────────────────── */

#screen-dialog.dialog-style-letter {
  background: #1a1208;
}

.dialog-style-letter .chat-header {
  background: #1e1408;
  border-bottom: 2px solid #0e0904;
  box-shadow: 0 4px 18px rgba(0,0,0,.6);
}
.dialog-style-letter .chat-name {
  font-family: Georgia, 'Times New Roman', serif;
  color: #e8d8b0;
}
.dialog-style-letter .chat-sub {
  color: #a08040;
  font-size: .72rem;
}

/* Altes Papier als Hintergrund */
.dialog-style-letter #chat-list {
  background-color: #f0ddb0;
  background-image:
    radial-gradient(ellipse 55% 30% at 12% 8%,  rgba(160,100,30,.14), transparent),
    radial-gradient(ellipse 40% 25% at 88% 85%, rgba(140, 80,20,.12), transparent),
    radial-gradient(ellipse 30% 20% at 55% 45%, rgba(180,130,50,.06), transparent),
    radial-gradient(ellipse 20% 15% at 70% 20%, rgba(120, 70,10,.08), transparent),
    radial-gradient(circle    8%       at 30% 70%, rgba(100, 60,10,.06), transparent),
    repeating-linear-gradient(
      180deg,
      transparent 0px, transparent 30px,
      rgba(100,55,10,.10) 30px, rgba(100,55,10,.10) 31px
    );
  padding: 24px 24px 20px 60px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}
/* Nur die aktuelle Briefseite zeigen */
.dialog-style-letter #chat-list .bubble-row:not(:last-child) { display: none; }
/* Sanftes Einblenden — wie Seite umblättern */
@keyframes letter-page-in {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: none; }
}
.dialog-style-letter .bubble-row {
  animation: letter-page-in .4s ease both;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 2px !important;
}
/* Kein Avatar pro Nachricht */
.dialog-style-letter .bubble-row .avatar { display: none !important; }
.dialog-style-letter .bubble-row > div { width: 100%; }

/* Roter Rand-Strich links (liniertes Papier) */
.dialog-style-letter #chat-list::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50px;
  width: 1px;
  background: rgba(200,80,60,.28);
  pointer-events: none;
  z-index: 1;
}

/* Leichter Schatten an den Rändern für Tiefe */
.dialog-style-letter #chat-list::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow:
    inset 6px 0 16px rgba(100,60,20,.12),
    inset -6px 0 16px rgba(100,60,20,.08),
    inset 0 -20px 30px rgba(100,60,20,.1);
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

/* Text direkt auf dem Papier — kein Box-Stil */
.dialog-style-letter .bubble {
  background: transparent;
  border: none;
  border-radius: 0;
  color: #2a1608;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .97rem;
  line-height: 1.65;
  padding: 2px 0;
  min-width: 0;
  box-shadow: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.06);
  position: relative;
  z-index: 2;
}
.dialog-style-letter .bubble.npc {
  background: transparent;
  color: #2a1608;
}
.dialog-style-letter .bubble.player {
  background: transparent;
  color: #1a2a08;
  font-style: italic;
}
.dialog-style-letter .bubble.narrator {
  background: transparent;
  border: none;
  color: #3a2010;
  font-style: italic;
  font-size: .9rem;
  opacity: .75;
}
.dialog-style-letter .bubble-row > div:last-child { max-width: 100%; }
.dialog-style-letter .npc-label {
  font-family: Georgia, serif;
  font-size: .7rem;
  color: rgba(100,50,10,.5);
  letter-spacing: .04em;
  font-style: normal;
}
.dialog-style-letter .bubble-meta {
  color: rgba(100,55,10,.4);
  font-family: Georgia, serif;
  font-size: .68rem;
}

/* Antwort-Buttons: Handnotiz-Stil */
.dialog-style-letter .chat-choices {
  background: #1e1408;
  border-top: 2px solid #0e0904;
  padding: 8px 10px;
  gap: 7px;
  align-items: stretch;
}
.dialog-style-letter .choice-btn {
  background: #f0ddb0;
  border: 1px solid #a07840;
  border-bottom: 3px solid #7a5820;
  border-radius: 3px;
  color: #2a1608;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .9rem;
  font-style: italic;
  padding: 10px 14px;
  max-width: none;
  text-align: left;
  transition: transform .07s, border-bottom-width .07s;
}
.dialog-style-letter .choice-btn:active {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

/* Weiter-Button: dunkler Umschlag-Knopf */
.dialog-style-letter .chat-footer {
  background: #1e1408;
  border-top: 2px solid #0e0904;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.dialog-style-letter .chat-footer .btn.primary {
  background: linear-gradient(180deg, #3a2010, #2a1608);
  color: #e8d8a0;
  border: 1px solid #6a4020;
  border-bottom: 3px solid #180e04;
  border-radius: 3px;
  font-family: Georgia, serif;
  letter-spacing: .04em;
  font-size: .92rem;
  transition: transform .07s, border-bottom-width .07s;
}
.dialog-style-letter .chat-footer .btn.primary:active {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

/* ── BRIEF-UMSCHLAG ANIMATION ─────────────────────────────────── */
.pfp-letter-env-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(ellipse at 50% 60%, #1e160a, #0d0905);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity .4s ease;
  cursor: pointer;
}
.pfp-letter-env-overlay.fade-out { opacity: 0; pointer-events: none; }

.pfp-letter-env-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: pfp-env-drop .5s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes pfp-env-drop {
  from { transform: translateY(-24px) scale(.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Umschlag gesamt — feste Maße damit alles stimmt */
.pfp-env {
  position: relative;
  width: min(300px, 82vw);
  height: min(176px, calc(82vw * 0.587));
  overflow: hidden;
}

/* Umschlag-Körper */
.pfp-env-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, #caa870, #b58844);
  border-radius: 4px;
  box-shadow:
    0 28px 70px rgba(0,0,0,.72),
    inset 0 1px 0 rgba(255,255,255,.1),
    0 0 0 1px rgba(0,0,0,.22);
}
/* Seitenfalz (diagonale Linien) */
.pfp-env-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom right, rgba(0,0,0,.13) 50%, transparent 50%),
    linear-gradient(to bottom left,  rgba(0,0,0,.13) 50%, transparent 50%);
  background-size: 50% 100%;
  background-position: 0 0, 100% 0;
  background-repeat: no-repeat;
}
/* Untere Falz */
.pfp-env-body::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 100%;
  clip-path: polygon(0% 100%, 50% 45%, 100% 100%);
  background: rgba(0,0,0,.13);
}

/* Obere Klappe — clip-path Dreieck, faltet sich zu */
.pfp-env-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, #c8a468 0%, #b88c44 100%);
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
  transform-origin: top center;
  transition: transform .55s cubic-bezier(.42,0,.58,1), opacity .3s ease .25s;
  z-index: 5;
  box-shadow: 0 6px 14px rgba(0,0,0,.3);
}
.pfp-env-flap.open {
  transform: scaleY(0);
  opacity: 0;
}

/* Wachssiegel — mittig auf der Klappe */
.pfp-env-seal {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #ee3333, #880000);
  z-index: 6;
  box-shadow: 0 3px 12px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,180,180,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,218,218,.6);
  font-size: .8rem;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .28s;
}
.pfp-env-seal.broken {
  transform: translate(-50%, -50%) scale(1.5) rotate(22deg);
  opacity: 0;
}

/* Brief-Papier das nach oben gleitet */
.pfp-env-paper {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 6%;
  height: 88%;
  background: linear-gradient(172deg, #f8ecd0 0%, #edd99a 100%);
  border-radius: 2px;
  z-index: 4;
  opacity: 0;
  transform: translateY(0);
  transition: transform .65s cubic-bezier(.22,.68,0,1.2) .2s, opacity .25s ease .2s;
  box-shadow: 0 -4px 18px rgba(0,0,0,.26), 0 2px 6px rgba(0,0,0,.14);
}
/* Linien auf dem Papier */
.pfp-env-paper::before {
  content: '';
  position: absolute;
  inset: 12px 8px;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px, transparent 19px,
    rgba(100,55,10,.15) 19px, rgba(100,55,10,.15) 20px
  );
}
.pfp-env-paper.slide-out {
  opacity: 1;
  transform: translateY(-72%);
}

/* Hinweis-Text */
.pfp-env-hint {
  color: rgba(200,165,95,.5);
  font-family: Georgia, serif;
  font-style: italic;
  font-size: .82rem;
  letter-spacing: .04em;
  user-select: none;
}

/* ══════════════════ MISSION STYLE ══════════════════ */
.dialog-style-mission {
  background: #07100a;
  background-image:
    linear-gradient(rgba(0,220,70,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,220,70,.03) 1px, transparent 1px);
  background-size: 28px 28px;
}
/* Taktischer Header */
.dialog-style-mission #dlg-topbar {
  background: #0b1a0e;
  border-bottom: 1px solid #1e4a24;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.dialog-style-mission #dlg-name {
  color: #3dff6a;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.dialog-style-mission #dlg-sub {
  color: #ffab40;
  font-family: 'Courier New', monospace;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.dialog-style-mission #dlg-sub::after {
  content: '  ● LIVE';
  color: #ff3b3b;
  animation: msn-blink 1.1s step-end infinite;
}
@keyframes msn-blink { 0%,100%{opacity:1} 50%{opacity:0} }
.dialog-style-mission #dlg-avatar {
  border: 1px solid #1e4a24;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0,220,70,.25);
}
/* Chat-Bereich */
.dialog-style-mission #chat-list {
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 16px;
  overflow: hidden;
}
/* Nur das aktuelle Panel */
.dialog-style-mission #chat-list .bubble-row:not(:last-child) { display: none; }
/* Einblendeanimation */
@keyframes msn-msg-in {
  0%   { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: none; }
}
.dialog-style-mission .bubble-row { animation: msn-msg-in .32s ease both; }
/* Avatar als Personal-ID */
.dialog-style-mission .bubble-row .avatar {
  width: 44px !important;
  height: 44px !important;
  font-size: 1.7rem !important;
  border: 1px solid #1e4a24 !important;
  border-radius: 2px !important;
  background: #0b1a0e;
  box-shadow: 0 0 8px rgba(0,220,70,.2) !important;
  flex-shrink: 0;
}
/* NPC-Name als Dienstgrad-Label */
.dialog-style-mission .npc-label {
  font-family: 'Courier New', monospace;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #ffab40;
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 5px;
}
.dialog-style-mission .npc-label::before { content: '▶ '; }
/* Briefing-Nachricht */
.dialog-style-mission .bubble {
  background: #0b1a0e !important;
  color: #b8ffc8 !important;
  border: 1px solid #1e4a24 !important;
  border-left: 3px solid #3dff6a !important;
  border-radius: 2px !important;
  box-shadow: 0 0 18px rgba(0,220,70,.08) !important;
  padding: 16px 18px !important;
  font-family: 'Courier New', monospace !important;
  font-size: .93rem !important;
  line-height: 1.7;
  position: relative;
}
/* Taktische Ecken */
.dialog-style-mission .bubble::before {
  content: '';
  position: absolute;
  top: 5px; left: 5px;
  width: 9px; height: 9px;
  border-top: 1px solid #3dff6a;
  border-left: 1px solid #3dff6a;
}
.dialog-style-mission .bubble::after {
  content: '';
  position: absolute;
  bottom: 5px; right: 5px;
  width: 9px; height: 9px;
  border-bottom: 1px solid #3dff6a;
  border-right: 1px solid #3dff6a;
}
.dialog-style-mission .bubble.narrator {
  background: #120f00 !important;
  border-left-color: #ffab40 !important;
  color: #ffd59b !important;
}
.dialog-style-mission .bubble.narrator::before { border-color: #ffab40; }
.dialog-style-mission .bubble.narrator::after  { border-color: #ffab40; }
.dialog-style-mission .bubble.player {
  background: #091410 !important;
  border-left-color: #7ec890 !important;
  color: #7ec890 !important;
}
/* Zeitstempel militärisch */
.dialog-style-mission .bubble-meta {
  font-family: 'Courier New', monospace;
  font-size: .68rem;
  color: #2a5c30;
  letter-spacing: .07em;
}
/* Footer: Kommando-Konsole */
.dialog-style-mission #chat-choices {
  background: #0b1a0e;
  border-top: 1px solid #1e4a24;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dialog-style-mission .choice-btn {
  background: transparent !important;
  color: #3dff6a !important;
  border: 1px solid #1e4a24 !important;
  border-left: 3px solid #3dff6a !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  font-family: 'Courier New', monospace !important;
  font-size: .9rem !important;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 16px !important;
  transition: background .12s, box-shadow .12s !important;
}
.dialog-style-mission .choice-btn::before { content: '▶  '; }
.dialog-style-mission .choice-btn:active {
  background: rgba(0,220,70,.09) !important;
  box-shadow: 0 0 12px rgba(0,220,70,.25) !important;
}

/* ══════════════════ COMIC STYLE ══════════════════ */
.dialog-style-comic {
  background: #fff9ee;
  background-image: radial-gradient(circle, rgba(0,0,0,.08) 1px, transparent 1px);
  background-size: 10px 10px;
}
/* Topbar: Comicbuch-Header */
.dialog-style-comic #dlg-topbar {
  background: #FFE000;
  border-bottom: 3px solid #000;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.dialog-style-comic #dlg-name { color: #000; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.dialog-style-comic #dlg-sub  { color: #333; font-weight: 700; text-transform: uppercase; }
.dialog-style-comic #dlg-avatar {
  border: 2.5px solid #000;
  border-radius: 4px;
  box-shadow: 2px 2px 0 #000;
}
/* Chat-Bereich */
.dialog-style-comic #chat-list {
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 20px 18px 12px;
  overflow: hidden;
  gap: 0;
}
/* Nur das aktuelle Panel zeigen */
.dialog-style-comic #chat-list .bubble-row:not(:last-child) { display: none; }

/* Panel-Flip-Animation beim Blättern */
@keyframes comic-panel-in {
  0%   { opacity: 0; transform: translateX(55px) rotate(2.5deg); }
  100% { opacity: 1; transform: translateX(0)    rotate(-0.4deg); }
}
.dialog-style-comic .bubble-row {
  animation: comic-panel-in .38s cubic-bezier(.2,.8,.3,1) both;
  /* Avatar oben, Blase darunter */
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0 !important;
}
.dialog-style-comic .bubble-row.right { align-items: flex-end !important; }

/* Avatar: großes Charakter-Portrait */
.dialog-style-comic .bubble-row .avatar {
  width: 58px !important;
  height: 58px !important;
  font-size: 2.2rem !important;
  border: 3px solid #000;
  border-radius: 6px;
  box-shadow: 4px 4px 0 #000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 0;
  z-index: 1;
  position: relative;
}
/* NPC-Name als Badge */
.dialog-style-comic .npc-label {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #000;
  background: #FFE000;
  border: 2.5px solid #000;
  padding: 2px 10px 2px 8px;
  margin: 4px 0 8px;
  display: inline-block;
  box-shadow: 3px 3px 0 #000;
}
/* Die Sprechblase */
.dialog-style-comic .bubble {
  background: #fff;
  color: #111;
  border: 3px solid #000 !important;
  border-radius: 8px !important;
  box-shadow: 5px 5px 0 #000 !important;
  padding: 14px 16px !important;
  font-size: 1.05rem !important;
  font-weight: 500;
  line-height: 1.55;
  width: 100%;
  position: relative;
}
/* Sprechblase-Schwanz oben (zeigt auf den Avatar darüber) */
.dialog-style-comic .bubble.npc::before {
  content: '';
  position: absolute;
  top: -14px; left: 18px;
  border: 7px solid transparent;
  border-bottom: 7px solid #000;
}
.dialog-style-comic .bubble.npc::after {
  content: '';
  position: absolute;
  top: -9px; left: 21px;
  border: 4px solid transparent;
  border-bottom: 5px solid #fff;
}
/* Player-Blase */
.dialog-style-comic .bubble.player {
  background: #d0f0fd !important;
  align-self: flex-end;
}
.dialog-style-comic .bubble.player::before {
  left: auto; right: 18px;
  border-bottom-color: #000;
}
.dialog-style-comic .bubble.player::after {
  left: auto; right: 21px;
  border-bottom-color: #d0f0fd;
}
/* Erzähler: Caption-Box */
.dialog-style-comic .bubble.narrator {
  background: #fffde7 !important;
  border-radius: 0 !important;
  font-style: italic;
  text-align: center;
}
.dialog-style-comic .bubble.narrator::before,
.dialog-style-comic .bubble.narrator::after { display: none; }
/* Zeitstempel verstecken */
.dialog-style-comic .bubble-meta { display: none; }
/* Text-Wrapper: volle Breite */
.dialog-style-comic .bubble-row > div:not(.avatar) { width: 100%; }

/* Footer: gelbe Aktions-Leiste */
.dialog-style-comic #chat-choices {
  background: #FFE000;
  border-top: 3px solid #000;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dialog-style-comic .choice-btn {
  background: #e8192c !important;
  color: #fff !important;
  border: 3px solid #000 !important;
  border-radius: 4px !important;
  box-shadow: 4px 4px 0 #000 !important;
  font-size: 1.05rem !important;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 12px 16px !important;
  transition: transform .1s, box-shadow .1s !important;
}
.dialog-style-comic .choice-btn:active {
  transform: translate(3px,3px) !important;
  box-shadow: 1px 1px 0 #000 !important;
}

/* TASK */
.task-scroll { flex: 1; overflow-y: auto; padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.task-type-row { display: flex; gap: 8px; align-items: center;
  justify-content: space-between; margin-bottom: 16px; }
.task-scroll h2 { font-size: 1.4rem; margin-bottom: 12px; }
.task-desc { color: #B0BEC5; line-height: 1.5; margin-bottom: 16px; }
.task-image { width: 100%; max-height: 260px; object-fit: contain;
  border-radius: 12px; margin-bottom: 16px; }
.quiz-question { font-weight: 600; margin-bottom: 16px; }
.quiz-answers { display: flex; flex-direction: column; gap: 8px; }
.quiz-answer { background: #111827; border: 1.5px solid #2A3A5C;
  padding: 14px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; }
.quiz-answer.wrong { background: #3A1A1A; border-color: var(--red); pointer-events: none; }
.quiz-answer.correct { background: #1B3A1A; border-color: var(--green); }
.quiz-answer.disabled { pointer-events: none; opacity: .6; }
.quiz-feedback { padding: 14px; border-radius: 12px; font-weight: 600;
  margin-top: 14px; }
.quiz-feedback.ok { background: #1B3A1A; color: var(--green); }
.quiz-feedback.fail { background: #3A1A1A; color: var(--red); }
.puzzle-card { background: #171225; border: 1.5px solid rgba(186,104,200,.55);
  border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.puzzle-card input { width: 100%; margin: 10px 0; }
.photo-card { background: #101f17; border: 1.5px solid rgba(129,199,132,.55);
  border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.photo-ref { margin-bottom: 12px; }
.photo-label { color: var(--dim); font-size: .75rem; font-weight: 700; margin-bottom: 6px; }
.photo-card img { width: 100%; max-height: 260px; object-fit: contain;
  border-radius: 10px; border: 1px solid var(--border); margin-bottom: 10px; }

/* MUSIC */
.music-card { background: #1A1A2E; border: 1.5px solid rgba(255,138,101,.6);
  border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.music-row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.music-emoji { font-size: 2rem; }
.music-info { flex: 1; }
#music-status { color: #FF8A65; font-size: .85rem; font-weight: 600; }
.music-time { color: var(--dim); font-size: .75rem; margin-top: 2px; }
.music-progress { height: 6px; background: #2A2A4A; border-radius: 3px;
  overflow: hidden; margin-bottom: 12px; }
#music-bar { height: 100%; width: 0%; background: #FF8A65; transition: width .2s; }
.music-locked { color: var(--dim); font-size: .75rem; text-align: center;
  margin-top: 8px; }

/* STATS */
.stats-wrap { flex: 1; padding: 24px; display: flex; flex-direction: column;
  align-items: center; padding-top: max(28px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.finish-emoji { font-size: 4rem; margin-bottom: 12px; }
.stats-wrap h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.grade-circle { width: 140px; height: 140px; border-radius: 50%;
  border: 4px solid var(--green); background: rgba(76,175,80,.15);
  display: flex; align-items: center; justify-content: center;
  margin: 24px 0 12px; flex-direction: column; }
.grade-circle.g2 { border-color: #8BC34A; background: rgba(139,195,74,.15); color: #8BC34A; }
.grade-circle.g3 { border-color: #FFC107; background: rgba(255,193,7,.15); color: #FFC107; }
.grade-circle.g4 { border-color: #FF9800; background: rgba(255,152,0,.15); color: #FF9800; }
.grade-circle.g5 { border-color: #FF5722; background: rgba(255,87,34,.15); color: #FF5722; }
.grade-circle.g6 { border-color: #F44336; background: rgba(244,67,54,.15); color: #F44336; }
.grade-num { font-size: 4rem; font-weight: 900; color: var(--green); }
.grade-circle.g2 .grade-num { color: #8BC34A; }
.grade-circle.g3 .grade-num { color: #FFC107; }
.grade-circle.g4 .grade-num { color: #FF9800; }
.grade-circle.g5 .grade-num { color: #FF5722; }
.grade-circle.g6 .grade-num { color: var(--red); }
.grade-label { font-size: .75rem; font-weight: 700; color: inherit; }
.grade-text { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.grade-praise { color: var(--dim); margin-bottom: 20px; }
.stats-table { width: 100%; margin-bottom: 16px; }
.stat-row { display: flex; padding: 8px 0; border-bottom: 1px solid #1F2937; }
.stat-row:last-child { border: 0; }
.stat-row span { flex: 1; color: var(--dim); }
.stat-row b { font-weight: 700; }
.stat-row b.green { color: var(--green); }
.stat-row b.red { color: var(--red); }
.stat-row b.yellow { color: var(--yellow); }
.team-card { width: 100%; }
#team-count { width: 100%; margin: 8px 0 12px; }
.team-name-list { display: flex; flex-direction: column; gap: 10px; }
.team-name-list input { width: 100%; }
.completion-card {
  width: 100%;
  margin: 14px 0 8px;
  border-color: rgba(76,175,80,.45);
  background: rgba(76,175,80,.08);
}
.completion-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.completion-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
}
.completion-row span { color: var(--dim); overflow-wrap: anywhere; }
.completion-row b {
  color: var(--yellow);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  text-align: right;
}
.rating-card { width: 100%; margin: 12px 0; }
.rating-symbols, .rating-stars {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 10px 0;
}
.rating-symbols button, .rating-stars button {
  min-width: 44px;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surf2);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
}
.rating-symbols button.active,
.rating-stars button.active {
  border-color: var(--yellow);
  background: rgba(255,193,7,.18);
  color: var(--yellow);
}
#rating-comment {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  background: var(--surf2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  margin: 8px 0 10px;
}
.rating-status { margin-top: 8px; color: var(--dim); }
.ratings-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rating-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,.18);
}
.rating-item-head { display: flex; justify-content: space-between; gap: 8px; color: var(--yellow); font-weight: 800; }
.rating-item-meta { color: var(--dim); font-size: .78rem; margin-top: 2px; }
.rating-item-comment { margin-top: 8px; color: var(--text); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
#btn-stats-home { order: 99; }

/* TOAST */
#toast-box { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 99999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; }
.toast { background: #E53935; color: white; padding: 10px 20px;
  border-radius: 10px; font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  transition: opacity .4s; }
.toast.success { background: #4CAF50; }

/* TTS-STOP */
.tts-stop { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #E53935; color: white; font-weight: bold;
  padding: 12px 20px; border-radius: 28px; border: none;
  cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 9999; }

/* GPS-Permission-Button (Overlay) */
.gps-overlay.gps-overlay {
  position: fixed; inset: 0; background: rgba(13,17,23,.92); z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 16px; text-align: center;
}
.gps-overlay .e { font-size: 4rem; }
.gps-overlay h2 { font-size: 1.3rem; }
.gps-overlay p { color: var(--dim); max-width: 320px; }
.prep-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13,17,23,.94);
}
.prep-overlay[hidden] { display: none; }
.prep-card {
  width: min(380px, 100%);
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 20px 70px rgba(0,0,0,.45);
}
.prep-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #0D1117;
  font-weight: 900;
}
.prep-card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.prep-card p { color: var(--dim); line-height: 1.45; }
.prep-bar {
  height: 12px;
  border-radius: 999px;
  background: #111827;
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 16px 0 8px;
}
#prep-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width .2s ease;
}
.prep-detail { font-size: .8rem; }

.app-version { text-align: center; color: var(--dim); font-size: .7rem;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.update-banner { position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  background: #FF8A65; color: #1A1A2E; padding: 10px 16px; border-radius: 999px;
  font-size: .85rem; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  z-index: 99998; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.update-banner.hidden { display: none; }

/* SCROLL-FIX v2 — Screens werden selber zum Scroll-Container */
.screen { -webkit-overflow-scrolling: touch; }
#screen-intro.active, #screen-browse.active, #screen-outro.active, #screen-stats.active,
#screen-task.active {
  display: block !important;     /* nicht flex damit normaler Block-Scroll geht */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
#screen-intro .intro-wrap, #screen-outro .intro-wrap, #screen-stats .stats-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100%;
}
#screen-browse .topbar { position: sticky; top: 0; z-index: 10; }
#screen-browse .search-bar { position: sticky; top: 56px; z-index: 9;
  background: var(--bg); }
#screen-browse .adv-list {
  flex: 0 1 auto; overflow: visible; height: auto;
}
.task-scroll {
  flex: none; overflow: visible; height: auto;
}
/* Map bleibt flex (volle Höhe nötig) */

.search-hint { color: var(--dim); font-size: .75rem; margin-top: 6px; padding: 0 4px; }

.warn-box, .builder-note, .builder-request-note {
  border: 1px solid rgba(255, 193, 7, .45);
  background: rgba(255, 193, 7, .10);
  color: #FFE7A3;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .82rem;
  line-height: 1.45;
  margin: 10px 0;
}
.offline-box, .offline-status-card {
  border: 1px solid rgba(76, 175, 80, .45);
  background: rgba(76, 175, 80, .10);
  color: #C8FACC;
  border-radius: 10px;
}
.offline-box {
  margin: 12px 16px;
  padding: 10px 12px;
  font-size: .82rem;
  line-height: 1.45;
}
.offline-code-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 8px;
}
.offline-code-list .btn {
  width: 100%;
  text-align: left;
}
.offline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.offline-actions .btn { font-size: .82rem; padding: 8px 10px; border-radius: 8px; }
.builder-request-note { margin: 10px 16px 0; }
.form-title { color: var(--text); font-weight: 700; margin: 12px 0 8px; text-align: center; }
.small-gap { margin-top: 10px; }
.bot-field { position: absolute; left: -9999px; opacity: 0; height: 0; pointer-events: none; }
.captcha-label { display: block; color: var(--dim); font-size: .78rem; margin: 8px 0 4px; }

[hidden], .is-hidden { display: none !important; }

.message-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.74);
}
.message-modal-card {
  width: min(520px, 100%);
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 18px 70px rgba(0,0,0,0.5);
}
.message-modal-card h2 { color: var(--accent); font-size: 1.1rem; margin-bottom: 10px; }
.message-modal-text { line-height: 1.55; white-space: pre-wrap; margin-bottom: 12px; }
.message-modal-text hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.message-modal textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surf2);
  color: var(--text);
  font: inherit;
  resize: vertical;
  margin-bottom: 10px;
}
.message-modal label { display: flex; gap: 8px; align-items: center; color: var(--dim); margin-bottom: 12px; }
.message-modal .btn:disabled { opacity: .45; cursor: default; }

/* ═══════════════════════════════════════════════════════════════
   4D — TIEFE & 3D-EFFEKTE
   ═══════════════════════════════════════════════════════════════ */

/* Hintergrund-Tiefenebenen */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 55% at 15% 0%,   rgba(124,159,245,.08) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 100%, rgba(76,175,80,.06)   0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 50%,  rgba(124,159,245,.03) 0%, transparent 70%);
  animation: pfp-bg-breathe 12s ease-in-out infinite;
}
@keyframes pfp-bg-breathe {
  0%,100% { opacity: 1; }
  50%     { opacity: .65; }
}
.screen { z-index: 1; }

/* Screen-Übergang: aus der Tiefe einfahren */
@keyframes pfp-screen-in {
  from { opacity: 0; transform: perspective(900px) translateZ(-28px) scale(.975); }
  to   { opacity: 1; transform: perspective(900px) translateZ(0) scale(1); }
}
.screen.active {
  animation: pfp-screen-in .24s cubic-bezier(.4,0,.2,1) forwards;
}
#screen-map.active { animation: none; }

/* Topbar: Glastiefe */
.topbar {
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  box-shadow:
    0 4px 28px rgba(0,0,0,.38),
    inset 0 1px 0 rgba(255,255,255,.07);
}

/* Buttons: 3D Press */
.btn {
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow:
    0 4px 14px rgba(0,0,0,.3),
    0 2px 0 rgba(0,0,0,.5);
}
.btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 8px 24px rgba(0,0,0,.38),
    0 4px 0 rgba(0,0,0,.42);
}
.btn:active:not(:disabled) {
  transform: translateY(2px) scale(.99);
  box-shadow:
    0 1px 6px rgba(0,0,0,.3),
    0 0 0 rgba(0,0,0,.4);
}
.btn.primary {
  box-shadow:
    0 4px 22px rgba(124,159,245,.4),
    0 2px 0 rgba(0,0,40,.55);
}
.btn.primary:hover:not(:disabled) {
  box-shadow:
    0 8px 32px rgba(124,159,245,.52),
    0 4px 0 rgba(0,0,40,.45);
}
.btn.primary:active:not(:disabled) {
  box-shadow:
    0 2px 10px rgba(124,159,245,.28),
    0 0 0 rgba(0,0,0,.4);
}

/* Adventure-Karten: Tiefenschatten (JS legt Tilt drüber) */
.adv-card {
  box-shadow:
    0 4px 18px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.04);
  will-change: transform;
  transform-style: preserve-3d;
}
.adv-card.pfp-tilt { transition: box-shadow .18s ease; }
.adv-card.pfp-tilt-leave {
  transition: transform .32s cubic-bezier(.25,.46,.45,.94), box-shadow .18s ease;
}
.adv-card:hover {
  box-shadow:
    0 18px 48px rgba(0,0,0,.55),
    0 0 0 1px rgba(124,159,245,.45),
    inset 0 1px 0 rgba(255,255,255,.07);
}

/* Info-Karten: schwebende Tiefe */
.info-card {
  box-shadow:
    0 6px 24px rgba(0,0,0,.32),
    inset 0 1px 0 rgba(255,255,255,.04);
}

/* Modals: 3D Einflug */
@keyframes pfp-modal-in {
  from {
    opacity: 0;
    transform: perspective(700px) rotateX(-10deg) scale(.9);
    transform-origin: 50% 0;
  }
  to {
    opacity: 1;
    transform: perspective(700px) rotateX(0deg) scale(1);
    transform-origin: 50% 0;
  }
}
.message-box,
.prep-card,
.message-modal-card {
  animation: pfp-modal-in .3s cubic-bezier(.34,1.56,.64,1) forwards;
  box-shadow:
    0 28px 90px rgba(0,0,0,.7),
    0 0 0 1px rgba(124,159,245,.2),
    inset 0 1px 0 rgba(255,255,255,.08);
}

/* Note-Kreis: Schweben + Glow */
@keyframes pfp-grade-float {
  0%,100% { transform: perspective(400px) translateY(0) rotateX(0deg); }
  50%     { transform: perspective(400px) translateY(-10px) rotateX(6deg); }
}
.grade-circle {
  box-shadow:
    0 0 0 12px rgba(76,175,80,.07),
    0 0 44px rgba(76,175,80,.22),
    0 28px 70px rgba(0,0,0,.55);
  animation: pfp-grade-float 3.5s ease-in-out infinite;
}
.grade-circle.g2 { box-shadow: 0 0 0 12px rgba(139,195,74,.07), 0 0 44px rgba(139,195,74,.22), 0 28px 70px rgba(0,0,0,.55); }
.grade-circle.g3 { box-shadow: 0 0 0 12px rgba(255,193,7,.07),  0 0 44px rgba(255,193,7,.22),  0 28px 70px rgba(0,0,0,.55); }
.grade-circle.g4 { box-shadow: 0 0 0 12px rgba(255,152,0,.07),  0 0 44px rgba(255,152,0,.22),  0 28px 70px rgba(0,0,0,.55); }
.grade-circle.g5 { box-shadow: 0 0 0 12px rgba(255,87,34,.07),  0 0 44px rgba(255,87,34,.22),  0 28px 70px rgba(0,0,0,.55); }
.grade-circle.g6 { box-shadow: 0 0 0 12px rgba(244,67,54,.07),  0 0 44px rgba(244,67,54,.22),  0 28px 70px rgba(0,0,0,.55); }

/* Quiz-Antworten: 3D-Hover */
.quiz-answer {
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.quiz-answer:hover:not(.wrong):not(.correct):not(.disabled) {
  transform: perspective(400px) translateZ(8px) translateX(5px);
  box-shadow: -5px 6px 24px rgba(0,0,0,.5);
  border-color: rgba(124,159,245,.55);
}

/* Chat-Blasen: leichte Tiefe */
.bubble { box-shadow: 0 2px 8px rgba(0,0,0,.28); }
.bubble.npc { box-shadow: 0 3px 14px rgba(0,0,0,.35); }

/* Login-Karte: Tiefe */
.login-card {
  box-shadow:
    0 20px 60px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.06);
}

/* Prep-Icon: Glow */
.prep-icon {
  box-shadow: 0 4px 20px rgba(124,159,245,.4);
}
