* { 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: linear-gradient(180deg, rgba(17,19,42,.96), rgba(12,14,31,.98));
  border-top: 1px solid rgba(199,214,255,.26); color: #F5F8FF;
  box-shadow: 0 -14px 34px rgba(0,0,0,.42);
  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; min-width: 0; }
.zone-info-name { color: #FFFFFF; font-weight: 800; line-height: 1.15; }
.zone-info-progress { color: #C9D6FF; font-size: .85rem; font-weight: 650; line-height: 1.25; margin-top: 2px; }
.zone-required { color: #FFE180; font-size: .9rem; font-weight: 700; line-height: 1.3; margin-top: 8px; }
.zone-distance { color: #EAF0FF; font-size: .9rem; font-weight: 650; line-height: 1.35; margin-top: 8px; }
.zone-distance-value { color: #FFD43B; font-weight: 900; text-shadow: 0 0 12px rgba(255,212,59,.36); }
.zone-distance-ok { color: #7DFF91; font-weight: 900; text-shadow: 0 0 12px rgba(125,255,145,.28); }
.zone-inventory { color: #DCE6FF; font-size: .86rem; font-weight: 650; line-height: 1.35; margin-top: 8px; }
.zone-inventory.is-empty { color: #FFC978; }

@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;
  }
}

/* Feinschliff nach Sichtpruefung: Objekt-Layouts ohne schwebende Sprecherlabels. */
#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .npc-label {
  display: none !important;
}

#screen-dialog.dialog-style-newspaper .bubble {
  padding-top: 126px !important;
}

#screen-dialog.dialog-style-newspaper .bubble::after {
  top: 84px !important;
}

#screen-dialog.dialog-style-gps .bubble {
  padding-left: 68px !important;
  padding-right: 68px !important;
}

@media (max-width: 560px) {
  #screen-dialog.dialog-style-newspaper .bubble {
    padding-top: 112px !important;
  }

  #screen-dialog.dialog-style-gps .bubble {
    padding-left: 44px !important;
    padding-right: 44px !important;
  }
}

/* Ultimativer 3D-Finish: steht am Dateiende und gewinnt gegen alle Speziallayouts. */
#screen-dialog[class*="dialog-style-"] #chat-list {
  perspective: 1250px !important;
  perspective-origin: 50% 36% !important;
}

#screen-dialog[class*="dialog-style-"] .bubble-row {
  transform-style: preserve-3d !important;
  filter: drop-shadow(0 22px 32px rgba(5, 10, 22, .25)) !important;
}

#screen-dialog[class*="dialog-style-"] .bubble {
  --pfp-3d-rx: 4deg;
  --pfp-3d-ry: -4deg;
  --pfp-3d-rz: 0deg;
  --pfp-3d-z: 28px;
  transform:
    rotateX(var(--pfp-3d-rx))
    rotateY(var(--pfp-3d-ry))
    rotateZ(var(--pfp-3d-rz))
    translateZ(var(--pfp-3d-z)) !important;
  transform-style: preserve-3d !important;
  transform-origin: 50% 58% !important;
  backface-visibility: hidden !important;
  box-shadow:
    0 34px 62px rgba(6, 10, 22, .32),
    0 14px 22px rgba(6, 10, 22, .2),
    inset 0 1px 0 rgba(255, 255, 255, .42),
    inset 0 -16px 28px rgba(0, 0, 0, .08) !important;
  transition: transform .22s ease, box-shadow .22s ease, filter .22s ease !important;
}

#screen-dialog[class*="dialog-style-"] .bubble:not(.narrator):hover {
  transform:
    rotateX(calc(var(--pfp-3d-rx) - 1deg))
    rotateY(calc(var(--pfp-3d-ry) + 1deg))
    rotateZ(var(--pfp-3d-rz))
    translateY(-3px)
    translateZ(calc(var(--pfp-3d-z) + 14px)) !important;
  box-shadow:
    0 42px 72px rgba(6, 10, 22, .36),
    0 18px 28px rgba(6, 10, 22, .23),
    inset 0 1px 0 rgba(255, 255, 255, .48),
    inset 0 -18px 32px rgba(0, 0, 0, .1) !important;
}

#screen-dialog.dialog-style-chat .bubble { --pfp-3d-rx: 2deg; --pfp-3d-ry: -2deg; --pfp-3d-z: 16px; }
#screen-dialog.dialog-style-adventure .bubble,
#screen-dialog.dialog-style-box .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -8deg; --pfp-3d-z: 34px; }
#screen-dialog.dialog-style-letter .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: 0deg; --pfp-3d-rz: -.4deg; --pfp-3d-z: 30px; }
#screen-dialog.dialog-style-radio .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 7deg; --pfp-3d-z: 32px; }
#screen-dialog.dialog-style-mission .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -7deg; --pfp-3d-z: 30px; }
#screen-dialog.dialog-style-comic .bubble { --pfp-3d-rx: 3deg; --pfp-3d-ry: -5deg; --pfp-3d-rz: -.8deg; --pfp-3d-z: 34px; }
#screen-dialog.dialog-style-diary .bubble,
#screen-dialog.dialog-style-dossier .bubble,
#screen-dialog.dialog-style-newspaper .bubble,
#screen-dialog.dialog-style-treasure-map .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: -3deg; --pfp-3d-rz: -.8deg; --pfp-3d-z: 32px; }
#screen-dialog.dialog-style-bottle .bubble,
#screen-dialog.dialog-style-polaroid .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -6deg; --pfp-3d-rz: -1deg; --pfp-3d-z: 34px; }
#screen-dialog.dialog-style-phone .bubble,
#screen-dialog.dialog-style-video .bubble,
#screen-dialog.dialog-style-scanner .bubble,
#screen-dialog.dialog-style-gps .bubble,
#screen-dialog.dialog-style-terminal .bubble,
#screen-dialog.dialog-style-audio .bubble,
#screen-dialog.dialog-style-ar .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 6deg; --pfp-3d-z: 36px; }
#screen-dialog.dialog-style-detective .bubble,
#screen-dialog.dialog-style-safe .bubble,
#screen-dialog.dialog-style-compass .bubble,
#screen-dialog.dialog-style-mystery .bubble,
#screen-dialog.dialog-style-emergency .bubble,
#screen-dialog.dialog-style-inventory .bubble,
#screen-dialog.dialog-style-riddle .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -6deg; --pfp-3d-z: 34px; }

#screen-dialog.dialog-style-comic .chat-footer .btn.primary,
#screen-dialog.dialog-style-comic .choice-btn {
  transform: perspective(560px) rotateX(5deg) rotateZ(-1deg) translateZ(14px) !important;
  transform-style: preserve-3d !important;
  box-shadow:
    5px 5px 0 #000,
    0 18px 28px rgba(0, 0, 0, .24),
    inset 0 1px 0 rgba(255, 255, 255, .5) !important;
}

@media (max-width: 560px) {
  #screen-dialog[class*="dialog-style-"] .bubble {
    --pfp-3d-rx: 3deg;
    --pfp-3d-ry: -2deg;
    --pfp-3d-z: 18px;
  }
}

/* Endgueltiger 3D-Override fuer alle gestalteten Dialogboxen. */
#screen-dialog[class*="dialog-style-"]:not(.dialog-style-chat) #chat-list {
  perspective: 1250px !important;
  perspective-origin: 50% 34% !important;
}

#screen-dialog[class*="dialog-style-"]:not(.dialog-style-chat) .bubble-row {
  transform-style: preserve-3d !important;
  filter: drop-shadow(0 34px 36px rgba(0, 0, 0, .36)) !important;
}

#screen-dialog[class*="dialog-style-"]:not(.dialog-style-chat) .bubble {
  --pfp-3d-rx: 5deg;
  --pfp-3d-ry: -4deg;
  --pfp-3d-rz: 0deg;
  transform:
    rotateX(var(--pfp-3d-rx))
    rotateY(var(--pfp-3d-ry))
    rotateZ(var(--pfp-3d-rz))
    translateZ(28px) !important;
  transform-style: preserve-3d !important;
  backface-visibility: hidden;
  box-shadow:
    0 46px 98px rgba(0, 0, 0, .62),
    0 18px 0 rgba(0, 0, 0, .16),
    -12px 0 26px rgba(255, 255, 255, .06) inset,
    14px -18px 32px rgba(255, 255, 255, .07) inset,
    0 0 0 1px rgba(255, 255, 255, .08) inset !important;
}

#screen-dialog[class*="dialog-style-"]:not(.dialog-style-chat) .bubble:not(.narrator):hover {
  transform:
    rotateX(calc(var(--pfp-3d-rx) - 1deg))
    rotateY(calc(var(--pfp-3d-ry) + 2deg))
    rotateZ(var(--pfp-3d-rz))
    translateY(-4px)
    translateZ(40px) !important;
}

#screen-dialog.dialog-style-adventure .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-letter .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 0deg; --pfp-3d-rz: -.5deg; }
#screen-dialog.dialog-style-radio .bubble { --pfp-3d-rx: 3deg; --pfp-3d-ry: -6deg; }
#screen-dialog.dialog-style-mission .bubble { --pfp-3d-rx: 3deg; --pfp-3d-ry: -6deg; }
#screen-dialog.dialog-style-comic .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -3deg; --pfp-3d-rz: -1deg; }
#screen-dialog.dialog-style-diary .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -4deg; }
#screen-dialog.dialog-style-dossier .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: -5deg; --pfp-3d-rz: .4deg; }
#screen-dialog.dialog-style-newspaper .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 1deg; --pfp-3d-rz: .3deg; }
#screen-dialog.dialog-style-bottle .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -8deg; --pfp-3d-rz: -3deg; }
#screen-dialog.dialog-style-treasure-map .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -4deg; --pfp-3d-rz: -.6deg; }
#screen-dialog.dialog-style-polaroid .bubble { --pfp-3d-rx: 8deg; --pfp-3d-ry: 5deg; --pfp-3d-rz: -2.4deg; }
#screen-dialog.dialog-style-phone .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -7deg; }
#screen-dialog.dialog-style-video .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -2deg; }
#screen-dialog.dialog-style-detective .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: 4deg; --pfp-3d-rz: 1.5deg; }
#screen-dialog.dialog-style-safe .bubble { --pfp-3d-rx: 8deg; --pfp-3d-ry: -6deg; }
#screen-dialog.dialog-style-scanner .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-gps .bubble { --pfp-3d-rx: 8deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-compass .bubble { --pfp-3d-rx: 9deg; --pfp-3d-ry: 3deg; }
#screen-dialog.dialog-style-mystery .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -3deg; }
#screen-dialog.dialog-style-terminal .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-emergency .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: 4deg; }
#screen-dialog.dialog-style-inventory .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: -4deg; }
#screen-dialog.dialog-style-riddle .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 5deg; }
#screen-dialog.dialog-style-audio .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -4deg; }
#screen-dialog.dialog-style-ar .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }

@media (max-width: 560px) {
  #screen-dialog[class*="dialog-style-"]:not(.dialog-style-chat) .bubble {
    transform:
      rotateX(4deg)
      rotateY(-2deg)
      rotateZ(var(--pfp-3d-rz, 0deg))
      translateZ(14px) !important;
  }
}

/* 3D-Dialogboxen: mehr Tiefe, Lichtkante und echte Objekt-Perspektive. */
#screen-dialog:is(
  .dialog-style-adventure,
  .dialog-style-letter,
  .dialog-style-mission,
  .dialog-style-comic,
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) #chat-list {
  perspective: 1250px !important;
  perspective-origin: 50% 34% !important;
}

#screen-dialog:is(
  .dialog-style-adventure,
  .dialog-style-letter,
  .dialog-style-mission,
  .dialog-style-comic,
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble-row {
  transform-style: preserve-3d !important;
  filter: drop-shadow(0 34px 36px rgba(0, 0, 0, .36)) !important;
}

#screen-dialog:is(
  .dialog-style-adventure,
  .dialog-style-letter,
  .dialog-style-mission,
  .dialog-style-comic,
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble {
  --pfp-3d-rx: 5deg;
  --pfp-3d-ry: -4deg;
  --pfp-3d-rz: 0deg;
  transform:
    rotateX(var(--pfp-3d-rx))
    rotateY(var(--pfp-3d-ry))
    rotateZ(var(--pfp-3d-rz))
    translateZ(28px) !important;
  transform-style: preserve-3d !important;
  backface-visibility: hidden;
  box-shadow:
    0 46px 98px rgba(0, 0, 0, .62),
    0 18px 0 rgba(0, 0, 0, .16),
    -12px 0 26px rgba(255, 255, 255, .06) inset,
    14px -18px 32px rgba(255, 255, 255, .07) inset,
    0 0 0 1px rgba(255, 255, 255, .08) inset !important;
}

#screen-dialog:is(
  .dialog-style-adventure,
  .dialog-style-letter,
  .dialog-style-mission,
  .dialog-style-comic,
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble:not(.narrator):hover {
  transform:
    rotateX(calc(var(--pfp-3d-rx) - 1deg))
    rotateY(calc(var(--pfp-3d-ry) + 2deg))
    rotateZ(var(--pfp-3d-rz))
    translateY(-4px)
    translateZ(40px) !important;
}

#screen-dialog.dialog-style-adventure .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-letter .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 0deg; --pfp-3d-rz: -.5deg; }
#screen-dialog.dialog-style-mission .bubble { --pfp-3d-rx: 3deg; --pfp-3d-ry: -6deg; }
#screen-dialog.dialog-style-comic .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -3deg; --pfp-3d-rz: -1deg; }
#screen-dialog.dialog-style-diary .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -4deg; }
#screen-dialog.dialog-style-dossier .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: -5deg; --pfp-3d-rz: .4deg; }
#screen-dialog.dialog-style-newspaper .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 1deg; --pfp-3d-rz: .3deg; }
#screen-dialog.dialog-style-bottle .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -8deg; --pfp-3d-rz: -3deg; }
#screen-dialog.dialog-style-treasure-map .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -4deg; --pfp-3d-rz: -.6deg; }
#screen-dialog.dialog-style-polaroid .bubble { --pfp-3d-rx: 8deg; --pfp-3d-ry: 5deg; --pfp-3d-rz: -2.4deg; }
#screen-dialog.dialog-style-phone .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: -7deg; }
#screen-dialog.dialog-style-video .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -2deg; }
#screen-dialog.dialog-style-detective .bubble { --pfp-3d-rx: 7deg; --pfp-3d-ry: 4deg; --pfp-3d-rz: 1.5deg; }
#screen-dialog.dialog-style-safe .bubble { --pfp-3d-rx: 8deg; --pfp-3d-ry: -6deg; }
#screen-dialog.dialog-style-scanner .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-gps .bubble { --pfp-3d-rx: 8deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-compass .bubble { --pfp-3d-rx: 9deg; --pfp-3d-ry: 3deg; }
#screen-dialog.dialog-style-mystery .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -3deg; }
#screen-dialog.dialog-style-terminal .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }
#screen-dialog.dialog-style-emergency .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: 4deg; }
#screen-dialog.dialog-style-inventory .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: -4deg; }
#screen-dialog.dialog-style-riddle .bubble { --pfp-3d-rx: 6deg; --pfp-3d-ry: 5deg; }
#screen-dialog.dialog-style-audio .bubble { --pfp-3d-rx: 5deg; --pfp-3d-ry: -4deg; }
#screen-dialog.dialog-style-ar .bubble { --pfp-3d-rx: 4deg; --pfp-3d-ry: -5deg; }

@media (max-width: 560px) {
  #screen-dialog:is(
    .dialog-style-adventure,
    .dialog-style-letter,
    .dialog-style-mission,
    .dialog-style-comic,
    .dialog-style-diary,
    .dialog-style-dossier,
    .dialog-style-newspaper,
    .dialog-style-bottle,
    .dialog-style-treasure-map,
    .dialog-style-polaroid,
    .dialog-style-phone,
    .dialog-style-video,
    .dialog-style-detective,
    .dialog-style-safe,
    .dialog-style-scanner,
    .dialog-style-gps,
    .dialog-style-compass,
    .dialog-style-mystery,
    .dialog-style-terminal,
    .dialog-style-emergency,
    .dialog-style-inventory,
    .dialog-style-riddle,
    .dialog-style-audio,
    .dialog-style-ar
  ) .bubble {
    transform:
      rotateX(4deg)
      rotateY(-2deg)
      rotateZ(var(--pfp-3d-rz, 0deg))
      translateZ(14px) !important;
  }
}
.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); }
#screen-team .intro-wrap {
  justify-content: center;
  overflow-y: auto;
}
#screen-team .intro-emoji,
#screen-team h1,
#screen-team .sub,
#screen-team .team-card,
#screen-team #btn-team-next {
  flex: 0 0 auto;
}
.team-card {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  text-align: center;
}
#screen-team .team-card .info-title {
  display: block;
  text-align: center;
}
.team-count-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px auto 14px;
}
#team-count {
  display: block;
  width: min(160px, calc(100% - 62px));
  margin: 0;
  text-align: center;
}
#team-count::-webkit-outer-spin-button,
#team-count::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#team-count {
  appearance: textfield;
  -moz-appearance: textfield;
}
.team-count-arrows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.team-count-btn {
  width: 44px;
  height: 34px;
  border: 1px solid rgba(124,159,245,.34);
  border-radius: 10px;
  background: rgba(124,159,245,.14);
  color: #dfe7ff;
  font-size: .95rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 18px rgba(0,0,0,.18);
}
.team-count-btn:active {
  transform: translateY(1px);
}
.team-count-btn:disabled {
  opacity: .35;
  cursor: default;
  transform: none;
}
.team-name-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.team-name-list input {
  display: block;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.team-name-list input::placeholder {
  text-align: center;
}
#screen-team #btn-team-next {
  max-width: 420px;
}
.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);
}

/* Realistic dialog skins, 2026-07-04 */
#screen-dialog.dialog-style-adventure {
  background:
    radial-gradient(circle at 50% -20%, rgba(222,170,82,.26), transparent 42%),
    linear-gradient(115deg, rgba(70,34,12,.45), transparent 35%),
    linear-gradient(180deg, #150b04, #070402 70%);
}
#screen-dialog.dialog-style-adventure::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,214,128,.035) 0 2px, transparent 2px 46px),
    radial-gradient(circle at 22% 28%, rgba(255,210,120,.08), transparent 16%),
    radial-gradient(circle at 75% 70%, rgba(0,0,0,.38), transparent 28%);
  pointer-events: none;
}
.dialog-style-adventure #chat-list {
  perspective: 1000px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.35), transparent 14%, transparent 86%, rgba(0,0,0,.35)),
    repeating-linear-gradient(0deg, #3a210e 0 18px, #321b0b 18px 36px);
  border-top: 1px solid rgba(255,216,150,.18);
}
.dialog-style-adventure #chat-list::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: min(540px, 88vw);
  height: 44px;
  transform: translateX(-50%);
  border-radius: 6px;
  background: linear-gradient(180deg, #3b2410, #1e1006);
  border: 1px solid rgba(222,170,82,.45);
  box-shadow: 0 24px 52px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,230,170,.16);
  opacity: .95;
}
.dialog-style-adventure #chat-list::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: min(190px, 36vw);
  height: 18px;
  transform: translateX(-50%);
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, #c89a44, #77501c);
  box-shadow: inset 0 2px 4px rgba(255,240,190,.25), 0 6px 18px rgba(0,0,0,.45);
}
.dialog-style-adventure .bubble-row {
  animation: pfp-box-card-rise .62s cubic-bezier(.2,.85,.2,1) both;
  z-index: 2;
}
@keyframes pfp-box-card-rise {
  0% { opacity: 0; transform: perspective(900px) translateY(42px) rotateX(62deg) scale(.92); filter: blur(2px); }
  58% { opacity: 1; transform: perspective(900px) translateY(-5px) rotateX(-5deg) scale(1.015); filter: blur(0); }
  100% { opacity: 1; transform: perspective(900px) translateY(0) rotateX(0deg) scale(1); }
}
.dialog-style-adventure .bubble {
  max-width: min(620px, 100%);
  background:
    linear-gradient(135deg, rgba(107,71,22,.13), transparent 24%, rgba(255,255,255,.18) 48%, transparent 72%),
    radial-gradient(circle at 20% 18%, rgba(110,62,16,.12), transparent 18%),
    linear-gradient(160deg, #f8ead0, #e6c884 72%, #d1aa61) !important;
  border-color: #805523 !important;
  border-radius: 8px !important;
  box-shadow:
    0 2px 0 #5a3512,
    0 20px 50px rgba(0,0,0,.72),
    inset 0 0 0 1px rgba(255,248,218,.5),
    inset 0 0 32px rgba(92,49,11,.18) !important;
}

#screen-dialog.dialog-style-letter {
  background:
    radial-gradient(circle at 50% 34%, rgba(191,135,67,.18), transparent 38%),
    linear-gradient(180deg, #25170b, #100904);
}
.dialog-style-letter #chat-list {
  margin: 10px auto;
  width: min(680px, calc(100% - 20px));
  border-radius: 5px;
  transform-origin: 50% 0;
  animation: pfp-letter-unfold-sheet .72s cubic-bezier(.2,.75,.2,1) both;
  box-shadow:
    0 30px 80px rgba(0,0,0,.62),
    0 0 0 1px rgba(92,52,18,.32),
    inset 0 0 52px rgba(113,66,20,.18);
}
@keyframes pfp-letter-unfold-sheet {
  0% { opacity: 0; transform: perspective(900px) rotateX(76deg) translateY(-24px) scaleY(.42); }
  55% { opacity: 1; transform: perspective(900px) rotateX(-7deg) translateY(4px) scaleY(1.03); }
  100% { opacity: 1; transform: perspective(900px) rotateX(0) translateY(0) scaleY(1); }
}
.dialog-style-letter #chat-list::after {
  box-shadow:
    inset 8px 0 26px rgba(98,56,18,.18),
    inset -8px 0 24px rgba(98,56,18,.12),
    inset 0 16px 32px rgba(255,246,210,.2),
    inset 0 -28px 36px rgba(92,50,13,.18);
}
.dialog-style-letter .bubble {
  font-size: clamp(.98rem, 1.8vw, 1.13rem);
  color: #301806;
}
.pfp-letter-env-overlay {
  background:
    radial-gradient(circle at 50% 62%, rgba(162,98,37,.32), transparent 34%),
    linear-gradient(180deg, #1f150b, #090604);
}
.pfp-env {
  filter: drop-shadow(0 30px 38px rgba(0,0,0,.68));
  perspective: 900px;
}
.pfp-env-body {
  background:
    linear-gradient(145deg, rgba(255,235,180,.2), transparent 22%),
    linear-gradient(165deg, #d7b173, #aa7834);
}
.pfp-env-flap {
  transform-origin: 50% 0;
  backface-visibility: hidden;
}
.pfp-env-flap.open {
  transform: rotateX(178deg);
  opacity: .18;
}
.pfp-env-paper.slide-out {
  transform: translateY(-82%) rotateX(-4deg);
}

#screen-dialog.dialog-style-radio {
  background:
    linear-gradient(90deg, #050705 0 18px, transparent 18px calc(100% - 18px), #050705 calc(100% - 18px)),
    radial-gradient(circle at 50% 10%, rgba(38,78,34,.26), transparent 34%),
    #080b08;
}
.dialog-style-radio #chat-list {
  margin: 10px 14px 8px;
  border: 8px solid #171916;
  border-bottom-width: 14px;
  border-radius: 16px;
  background:
    linear-gradient(rgba(123,255,120,.055), rgba(30,70,26,.09)),
    radial-gradient(circle at 48% 18%, rgba(106,255,95,.12), transparent 36%),
    #031103;
  box-shadow:
    inset 0 0 58px rgba(0,0,0,.95),
    inset 0 0 0 2px rgba(105,255,98,.05),
    0 16px 42px rgba(0,0,0,.68),
    0 0 0 1px #000;
}
.dialog-style-radio #chat-list::after {
  background:
    linear-gradient(180deg, transparent, rgba(110,255,110,.08), transparent),
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 2px, transparent 2px 5px);
  animation: pfp-radio-scan 3.8s linear infinite;
}
@keyframes pfp-radio-scan {
  from { background-position: 0 -120px, 0 0; }
  to { background-position: 0 240px, 0 0; }
}
.dialog-style-radio #dlg-topbar {
  border-radius: 0 0 18px 18px;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.04), 0 10px 28px rgba(0,0,0,.68);
}
.dialog-style-radio .bubble {
  font-size: clamp(.88rem, 1.6vw, 1rem) !important;
  text-transform: uppercase;
}
.dialog-style-radio .bubble::before {
  content: "RX ";
  color: rgba(0,255,65,.38);
}
.dialog-style-radio .bubble.player::before {
  content: "TX ";
}

#screen-dialog.dialog-style-mission {
  background:
    radial-gradient(circle at 82% 18%, rgba(255,82,52,.14), transparent 18%),
    linear-gradient(rgba(47,255,96,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47,255,96,.035) 1px, transparent 1px),
    #061009;
  background-size: auto, 32px 32px, 32px 32px, auto;
}
.dialog-style-mission #chat-list {
  margin: 12px;
  border: 1px solid rgba(64,255,105,.25);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(64,255,105,.12) 0 3px, transparent 3px),
    radial-gradient(circle at 12% 18%, rgba(64,255,105,.1), transparent 24%),
    rgba(4,14,8,.72);
  box-shadow: inset 0 0 60px rgba(0,0,0,.68), 0 24px 60px rgba(0,0,0,.45);
}
.dialog-style-mission #chat-list::before {
  content: "MISSION BRIEFING";
  position: absolute;
  top: 10px;
  right: 14px;
  color: rgba(61,255,106,.35);
  font-family: "Courier New", monospace;
  font-size: .62rem;
  letter-spacing: .18em;
}
.dialog-style-mission .bubble-row {
  animation: pfp-mission-lock .42s steps(5, end) both;
}
@keyframes pfp-mission-lock {
  0% { opacity: 0; transform: translateX(-16px); clip-path: inset(0 80% 0 0); }
  60% { opacity: 1; transform: translateX(0); clip-path: inset(0 0 0 0); }
  100% { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
}
.dialog-style-mission .bubble {
  border-radius: 6px !important;
  background:
    linear-gradient(135deg, rgba(61,255,106,.08), transparent 42%),
    rgba(7,27,13,.96) !important;
}

#screen-dialog.dialog-style-comic {
  background:
    radial-gradient(circle at 12% 18%, rgba(255,229,0,.55) 0 8%, transparent 8.4%),
    radial-gradient(circle, rgba(0,0,0,.12) 1px, transparent 1.6px),
    #fff4d0;
  background-size: auto, 12px 12px, auto;
}
.dialog-style-comic #chat-list {
  margin: 10px;
  border: 4px solid #080808;
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,236,157,.66)),
    radial-gradient(circle, rgba(0,0,0,.12) 1px, transparent 1.5px);
  background-size: auto, 9px 9px;
  box-shadow: 9px 9px 0 #111, 0 24px 50px rgba(0,0,0,.22);
}
.dialog-style-comic #chat-list::before {
  content: "ACTION!";
  position: absolute;
  top: 14px;
  right: 16px;
  transform: rotate(8deg);
  color: #e8192c;
  background: #ffe600;
  border: 3px solid #111;
  border-radius: 50%;
  padding: 12px 10px;
  font-weight: 900;
  font-size: .78rem;
  box-shadow: 4px 4px 0 #111;
  z-index: 0;
}
.dialog-style-comic .bubble-row {
  position: relative;
  z-index: 2;
  animation: pfp-comic-pop .36s cubic-bezier(.2,1.5,.35,1) both;
}
@keyframes pfp-comic-pop {
  0% { opacity: 0; transform: scale(.72) rotate(-4deg); }
  72% { opacity: 1; transform: scale(1.05) rotate(.8deg); }
  100% { opacity: 1; transform: scale(1) rotate(-.4deg); }
}
.dialog-style-comic .bubble {
  border-radius: 18px 18px 14px 18px !important;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,.95), transparent 26%),
    #fff !important;
}
.dialog-style-comic .bubble.player {
  background:
    radial-gradient(circle at 24% 18%, rgba(255,255,255,.85), transparent 24%),
    #d7f3ff !important;
}

@media (max-width: 560px) {
  .dialog-style-adventure #chat-list,
  .dialog-style-mission #chat-list,
  .dialog-style-radio #chat-list,
  .dialog-style-comic #chat-list {
    margin-left: 8px;
    margin-right: 8px;
  }
  .dialog-style-letter #chat-list {
    width: calc(100% - 16px);
    padding-left: 44px;
    padding-right: 16px;
  }
  .dialog-style-comic #chat-list::before {
    transform: scale(.82) rotate(8deg);
    transform-origin: 100% 0;
  }
}

/* Feinschliff: Brief voll auffalten + Comic-Weiterbutton */
.pfp-letter-env-scene {
  width: min(620px, 92vw);
  min-height: min(560px, 72vh);
  justify-content: center;
}
.pfp-env {
  width: min(330px, 76vw);
  height: min(194px, calc(76vw * .588));
  overflow: visible;
}
.pfp-env-paper {
  left: 50%;
  right: auto;
  width: 82%;
  height: 88%;
  transform: translateX(-50%) translateY(0) scaleY(.48);
  transform-origin: 50% 100%;
  transition:
    transform .62s cubic-bezier(.22,.68,0,1.08) .18s,
    width .55s cubic-bezier(.2,.75,.2,1),
    height .55s cubic-bezier(.2,.75,.2,1),
    bottom .55s cubic-bezier(.2,.75,.2,1),
    opacity .24s ease .16s,
    border-radius .35s ease;
}
.pfp-env-paper.slide-out {
  opacity: 1;
  transform: translateX(-50%) translateY(-82%) scaleY(.78) rotateX(-5deg);
}
.pfp-env-paper.slide-out.unfold {
  width: min(520px, 88vw);
  height: min(455px, 58vh);
  bottom: 48%;
  border-radius: 5px;
  transform: translateX(-50%) translateY(48%) scaleY(1) rotateX(0deg);
  box-shadow:
    0 34px 78px rgba(0,0,0,.58),
    0 0 0 1px rgba(98,58,18,.35),
    inset 0 0 42px rgba(112,63,18,.15);
}
.pfp-env-paper.slide-out.unfold::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(97,55,17,.24), transparent);
  box-shadow: 8px 0 18px rgba(70,42,14,.08);
}
.pfp-letter-env-overlay.fade-out {
  transition-duration: .52s;
}
.dialog-style-letter #chat-list {
  min-height: min(560px, calc(100dvh - 158px));
  max-height: calc(100dvh - 132px);
  overflow-y: auto;
}

.dialog-style-comic .chat-footer {
  background:
    linear-gradient(90deg, #ffe600 0 16px, transparent 16px calc(100% - 16px), #ffe600 calc(100% - 16px)),
    #ffe000 !important;
  border-top: 3px solid #000 !important;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom)) !important;
  box-shadow: 0 -6px 0 #111, 0 -12px 22px rgba(0,0,0,.18) !important;
}
.dialog-style-comic .chat-footer .btn.primary {
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,.28), transparent 24%),
    linear-gradient(180deg, #ff3348, #d80f25) !important;
  color: #fff !important;
  border: 3px solid #000 !important;
  border-radius: 5px !important;
  box-shadow: 5px 5px 0 #000 !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-shadow: 2px 2px 0 rgba(0,0,0,.35);
  transform: rotate(-.5deg);
}
.dialog-style-comic .chat-footer .btn.primary::before {
  content: ">> ";
}
.dialog-style-comic .chat-footer .btn.primary:hover:not(:disabled) {
  transform: translate(-1px,-2px) rotate(-.5deg) !important;
  box-shadow: 7px 7px 0 #000 !important;
}
.dialog-style-comic .chat-footer .btn.primary:active:not(:disabled) {
  transform: translate(4px,4px) rotate(-.5deg) !important;
  box-shadow: 1px 1px 0 #000 !important;
}

@media (max-width: 560px) {
  .pfp-letter-env-scene {
    width: 94vw;
    min-height: 70vh;
  }
  .pfp-env-paper.slide-out.unfold {
    width: 88vw;
    height: min(430px, 56vh);
  }
  .dialog-style-letter #chat-list {
    min-height: calc(100dvh - 148px);
    max-height: calc(100dvh - 118px);
  }
}

/* Realismus-Runde 2: deutlich getrennte Objekt-Layouts fuer neue Dialogtypen */
#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) #chat-list {
  min-height: 0;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble {
  overflow: hidden;
}

.dialog-style-diary #chat-list {
  background:
    radial-gradient(circle at 18% 18%, rgba(255,224,166,.16), transparent 24%),
    linear-gradient(115deg, #3a2415, #160d08 64%, #0d0805);
}
.dialog-style-diary .bubble-row {
  width: min(92vw, 760px) !important;
  max-width: 760px !important;
}
.dialog-style-diary .bubble-row .avatar { display: none !important; }
.dialog-style-diary .bubble-row > div:not(.avatar) { max-width: 100% !important; }
.dialog-style-diary .bubble {
  min-height: min(58vh, 470px);
  padding: 46px 42px 34px 72px !important;
  background:
    linear-gradient(90deg, #d2b476 0 42px, #f4dfaa 42px 50%, #ead09a 50% 52%, #f7e7bc 52% 100%) !important;
  border: 3px solid #5a361b !important;
  border-radius: 7px !important;
  box-shadow:
    0 30px 78px rgba(0,0,0,.65),
    inset 0 0 0 1px rgba(255,255,255,.35),
    inset 22px 0 34px rgba(83,47,20,.22),
    inset -22px 0 30px rgba(83,47,20,.14) !important;
  column-count: 2;
  column-gap: 56px;
  font-family: Georgia, "Times New Roman", serif !important;
}
.dialog-style-diary .bubble::before {
  content: "";
  position: absolute;
  left: calc(50% - 12px);
  top: 0;
  bottom: 0;
  width: 24px;
  background:
    linear-gradient(90deg, rgba(74,42,20,.28), rgba(255,255,255,.22), rgba(74,42,20,.3));
  box-shadow: -8px 0 20px rgba(65,36,17,.18), 8px 0 22px rgba(65,36,17,.18);
}
.dialog-style-diary .bubble::after {
  content: "private journal";
  position: absolute;
  right: 34px;
  bottom: 22px;
  color: rgba(86,44,16,.36);
  font-size: .82rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: .08em;
}

.dialog-style-dossier #chat-list {
  background:
    linear-gradient(130deg, rgba(25,16,7,.82), rgba(12,9,6,.95)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 18px);
}
.dialog-style-dossier .bubble-row {
  width: min(92vw, 700px) !important;
  max-width: 700px !important;
}
.dialog-style-dossier .bubble {
  min-height: 430px;
  margin-top: 24px;
  padding: 72px 34px 32px !important;
  background:
    linear-gradient(180deg, #c99343 0 62px, #f1d096 62px 84px, #f7e4b6 84px 100%) !important;
  border: 0 !important;
  border-radius: 4px 8px 8px 8px !important;
  box-shadow:
    0 32px 82px rgba(0,0,0,.68),
    18px 18px 0 rgba(113,69,20,.55),
    inset 0 0 0 2px rgba(93,53,13,.28) !important;
}
.dialog-style-dossier .bubble::before {
  content: "CASE FILE";
  position: absolute;
  top: -28px;
  left: 0;
  width: 210px;
  height: 48px;
  padding: 11px 18px;
  color: #4a2b0c;
  background: #d5a14f;
  border-radius: 8px 16px 0 0;
  font-weight: 900;
  letter-spacing: .14em;
}
.dialog-style-dossier .bubble::after {
  content: "CONFIDENTIAL";
  right: 28px;
  top: 112px;
  bottom: auto;
  color: rgba(158, 20, 32, .32);
  border: 4px solid rgba(158, 20, 32, .3);
  border-radius: 3px;
  font-size: 1.15rem;
  transform: rotate(-14deg);
}
.dialog-style-dossier .bubble-row::after {
  content: "";
  position: absolute;
  z-index: 5;
  right: 34px;
  top: 26px;
  width: 74px;
  height: 96px;
  background:
    linear-gradient(145deg, #e8e8e8, #aaa 54%, #707070 55%, #ddd);
  border-radius: 36px 36px 12px 12px;
  transform: rotate(14deg);
  opacity: .78;
  box-shadow: 0 8px 18px rgba(0,0,0,.28);
}

.dialog-style-newspaper #chat-list {
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,255,.08), transparent 32%),
    #111;
}
.dialog-style-newspaper .bubble-row {
  width: min(94vw, 760px) !important;
  max-width: 760px !important;
}
.dialog-style-newspaper .bubble-row .avatar { display: none !important; }
.dialog-style-newspaper .bubble {
  min-height: min(64vh, 520px);
  padding: 86px 34px 28px !important;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(50% - 1px), rgba(0,0,0,.18) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px) 100%),
    repeating-linear-gradient(0deg, #f3edda 0 18px, #e8dfc8 18px 19px) !important;
  border: 1px solid #1c1c1c !important;
  border-radius: 0 !important;
  column-count: 2;
  column-gap: 36px;
  font-family: Georgia, "Times New Roman", serif !important;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), 12px 10px 0 rgba(255,255,255,.08) !important;
}
.dialog-style-newspaper .bubble::before {
  content: "PFADFINDER KURIER";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 20px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 5px double #121212;
  border-bottom: 5px double #121212;
  color: #111;
  font-size: clamp(1.25rem, 4vw, 2.35rem);
  font-weight: 900;
  letter-spacing: .08em;
}
.dialog-style-newspaper .bubble::after {
  content: "SONDERAUSGABE";
  position: absolute;
  top: 78px;
  left: 34px;
  right: 34px;
  color: #111;
  border-bottom: 1px solid #111;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .22em;
  text-align: center;
}

.dialog-style-bottle #chat-list {
  background:
    radial-gradient(circle at 18% 18%, rgba(197,244,255,.2), transparent 18%),
    linear-gradient(180deg, #0b516c, #043144 52%, #051923);
}
.dialog-style-bottle .bubble-row {
  width: min(92vw, 760px) !important;
  max-width: 760px !important;
  justify-content: center;
}
.dialog-style-bottle .bubble-row::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: min(720px, 88vw);
  height: 220px;
  border: 10px solid rgba(178,236,226,.44);
  border-right-width: 54px;
  border-radius: 130px 70px 70px 130px;
  background:
    linear-gradient(90deg, rgba(197,255,241,.25), rgba(197,255,241,.08)),
    rgba(16, 91, 92, .22);
  transform: rotate(-7deg);
  box-shadow: inset 0 0 34px rgba(255,255,255,.18), 0 34px 80px rgba(0,0,0,.48);
}
.dialog-style-bottle .bubble {
  z-index: 2;
  width: min(560px, 74vw) !important;
  min-height: 250px;
  padding: 38px 46px !important;
  background:
    radial-gradient(ellipse at 50% 0, rgba(255,255,255,.48), transparent 32%),
    linear-gradient(90deg, #d4a973 0 24px, #f5dcad 24px calc(100% - 24px), #c9985d calc(100% - 24px)) !important;
  border: 2px solid #8c6230 !important;
  border-radius: 34px / 18px !important;
  transform: rotate(-3deg);
}

.dialog-style-treasure-map #chat-list {
  background:
    radial-gradient(circle at 22% 16%, rgba(255,218,117,.14), transparent 22%),
    radial-gradient(circle at 80% 78%, rgba(79,41,13,.38), transparent 28%),
    #1d1207;
}
.dialog-style-treasure-map .bubble-row {
  width: min(94vw, 780px) !important;
  max-width: 780px !important;
}
.dialog-style-treasure-map .bubble-row .avatar { display: none !important; }
.dialog-style-treasure-map .bubble {
  min-height: min(62vh, 520px);
  padding: 68px 46px 42px !important;
  background:
    radial-gradient(circle at 76% 26%, transparent 0 28px, rgba(137,82,27,.22) 29px 31px, transparent 32px),
    radial-gradient(circle at 22% 72%, rgba(68,112,63,.18), transparent 15%),
    linear-gradient(110deg, rgba(77,45,12,.2), transparent 32%),
    #dfbd75 !important;
  border: 0 !important;
  border-radius: 26px 9px 24px 12px !important;
  clip-path: polygon(3% 4%, 18% 1%, 31% 4%, 48% 2%, 64% 5%, 81% 2%, 97% 6%, 96% 92%, 81% 97%, 62% 93%, 44% 98%, 25% 94%, 5% 97%, 2% 78%, 5% 56%, 2% 34%);
  box-shadow: 0 34px 86px rgba(0,0,0,.62), inset 0 0 58px rgba(86,45,10,.26) !important;
}
.dialog-style-treasure-map .bubble::before {
  content: "";
  position: absolute;
  inset: 48px 66px 62px 54px;
  background:
    radial-gradient(circle at 72% 18%, #c91d1d 0 8px, transparent 9px),
    radial-gradient(circle at 72% 18%, transparent 0 18px, rgba(60,32,8,.45) 19px 21px, transparent 22px),
    radial-gradient(circle at 28% 76%, rgba(33,95,54,.5) 0 12px, transparent 13px),
    repeating-radial-gradient(ellipse at 42% 48%, transparent 0 22px, rgba(76,44,13,.35) 23px 25px, transparent 26px 47px);
  opacity: .56;
  pointer-events: none;
}
.dialog-style-treasure-map .bubble::after {
  right: 42px;
  top: 36px;
  width: 64px;
  height: 64px;
  opacity: .72;
}

.dialog-style-polaroid #chat-list {
  background:
    linear-gradient(120deg, rgba(255,255,255,.05), transparent 38%),
    #15181d;
}
.dialog-style-polaroid .bubble-row {
  width: min(88vw, 430px) !important;
  max-width: 430px !important;
}
.dialog-style-polaroid .bubble-row .avatar { display: none !important; }
.dialog-style-polaroid .bubble-row::before,
.dialog-style-polaroid .bubble-row::after {
  content: "";
  position: absolute;
  z-index: 5;
  width: 88px;
  height: 30px;
  background: rgba(235,221,174,.74);
  box-shadow: 0 4px 10px rgba(0,0,0,.18);
}
.dialog-style-polaroid .bubble-row::before { left: -18px; top: 8px; transform: rotate(-18deg); }
.dialog-style-polaroid .bubble-row::after { right: -18px; top: 16px; transform: rotate(16deg); }
.dialog-style-polaroid .bubble {
  min-height: 500px;
  padding: 340px 28px 42px !important;
  background: #fbfbf6 !important;
  border: 12px solid #fbfbf6 !important;
  border-bottom-width: 54px !important;
  border-radius: 3px !important;
  transform: rotate(-2.4deg);
}
.dialog-style-polaroid .bubble::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  height: 300px;
  background:
    radial-gradient(circle at 28% 26%, rgba(255,255,255,.5), transparent 18%),
    linear-gradient(145deg, #172033, #5b7480 48%, #c7a66a 49%, #2d3b2f 100%);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.dialog-style-polaroid .bubble::after {
  content: "found photo";
  position: absolute;
  left: 28px;
  bottom: 20px;
  color: rgba(31,41,55,.5);
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  transform: rotate(-1deg);
}

.dialog-style-phone #chat-list {
  background:
    radial-gradient(circle at 50% 12%, rgba(34,197,94,.22), transparent 22%),
    #02040a;
}
.dialog-style-phone .bubble-row {
  width: min(88vw, 390px) !important;
  max-width: 390px !important;
}
.dialog-style-phone .bubble-row .avatar { display: none !important; }
.dialog-style-phone .bubble {
  min-height: min(66vh, 600px);
  padding: 96px 30px 108px !important;
  border: 14px solid #070a12 !important;
  border-radius: 38px !important;
  background:
    radial-gradient(circle at 50% 86%, rgba(34,197,94,.2), transparent 18%),
    linear-gradient(180deg, #111827, #030712) !important;
  color: #ecfff3 !important;
  box-shadow: 0 0 0 3px #262c38, 0 32px 86px rgba(0,0,0,.78) !important;
}
.dialog-style-phone .bubble::before {
  content: "incoming call";
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  text-align: center;
  color: #22c55e;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.dialog-style-phone .bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 72px;
  height: 72px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #22c55e 0 55%, transparent 56%),
    #22c55e;
  box-shadow: 0 0 24px rgba(34,197,94,.6);
}

.dialog-style-video #chat-list {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 1px, transparent 1px 5px),
    #020202;
}
.dialog-style-video .bubble-row {
  width: min(94vw, 780px) !important;
  max-width: 780px !important;
}
.dialog-style-video .bubble-row .avatar { display: none !important; }
.dialog-style-video .bubble {
  min-height: min(58vh, 450px);
  padding: 76px 48px 58px !important;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.04), transparent 35%),
    #050505 !important;
  color: #fff !important;
  border: 4px solid #242424 !important;
  border-radius: 2px !important;
  box-shadow: 0 0 0 18px #0b0b0b, 0 34px 90px rgba(0,0,0,.82) !important;
}
.dialog-style-video .bubble::before {
  inset: 18px;
  border: 2px solid rgba(255,255,255,.42);
}
.dialog-style-video .bubble::after {
  content: "REC";
  position: absolute;
  top: 32px;
  right: 36px;
  color: #ff3232;
  font-weight: 900;
  letter-spacing: .15em;
}

.dialog-style-detective #chat-list {
  background:
    linear-gradient(45deg, rgba(135,29,29,.46) 0 2px, transparent 2px 48%),
    linear-gradient(-24deg, transparent 0 43%, rgba(135,29,29,.34) 43% 44%, transparent 44%),
    #6d4728;
}
.dialog-style-detective .bubble-row {
  width: min(92vw, 660px) !important;
  max-width: 660px !important;
}
.dialog-style-detective .bubble {
  min-height: 360px;
  padding: 52px 34px 34px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), transparent 24%),
    #eedfb7 !important;
  border: 0 !important;
  border-radius: 2px !important;
  transform: rotate(1.5deg);
  box-shadow: 0 28px 68px rgba(0,0,0,.55), 8px 10px 0 rgba(0,0,0,.08) !important;
}
.dialog-style-detective .bubble::before,
.dialog-style-detective .bubble::after {
  width: 32px;
  height: 32px;
  z-index: 2;
}
.dialog-style-detective .bubble-row::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: -60px;
  top: -36px;
  width: 170px;
  height: 130px;
  background:
    linear-gradient(145deg, #111 0 18px, transparent 18px),
    linear-gradient(180deg, #f4f4f4, #b6b6b6);
  border: 8px solid #f4f4f4;
  transform: rotate(-9deg);
  box-shadow: 0 18px 30px rgba(0,0,0,.35);
}
.dialog-style-detective .bubble-row::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: -44px;
  bottom: -28px;
  width: 142px;
  height: 104px;
  background: #f5f0df;
  transform: rotate(8deg);
  box-shadow: 0 12px 24px rgba(0,0,0,.28);
}

.dialog-style-safe #chat-list {
  background:
    radial-gradient(circle at center, #343b46 0 118px, #151a22 119px 220px, #080a0d 221px);
}
.dialog-style-safe .bubble-row {
  width: min(88vw, 470px) !important;
  max-width: 470px !important;
}
.dialog-style-safe .bubble-row .avatar { display: none !important; }
.dialog-style-safe .bubble {
  min-height: min(72vw, 470px);
  aspect-ratio: 1 / 1;
  padding: 112px 54px 64px !important;
  border-radius: 50% !important;
  background:
    radial-gradient(circle at 50% 50%, #252c35 0 24%, #49515d 25% 28%, #242a33 29% 55%, #687180 56% 58%, #2a303a 59%) !important;
  border: 10px solid #87909e !important;
  box-shadow:
    0 0 0 14px #1a1f27,
    0 38px 94px rgba(0,0,0,.78),
    inset 0 0 44px rgba(0,0,0,.55) !important;
}
.dialog-style-safe .bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 34px;
  width: 112px;
  height: 112px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    linear-gradient(0deg, transparent 45%, #c8d0dc 46% 54%, transparent 55%),
    linear-gradient(90deg, transparent 45%, #c8d0dc 46% 54%, transparent 55%),
    radial-gradient(circle, #111 0 18%, #8a95a4 19% 27%, #333b46 28%);
  box-shadow: 0 8px 18px rgba(0,0,0,.44);
}
.dialog-style-safe .bubble::after {
  content: "";
  position: absolute;
  right: 72px;
  bottom: 78px;
  width: 74px;
  height: 102px;
  background:
    radial-gradient(circle, #f4c430 0 5px, transparent 6px);
  background-size: 24px 24px;
  border: 2px solid rgba(244,196,48,.42);
  border-radius: 8px;
  opacity: .72;
}

.dialog-style-scanner #chat-list {
  background:
    linear-gradient(90deg, rgba(62,214,239,.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(62,214,239,.12) 1px, transparent 1px),
    #04121a;
  background-size: 32px 32px;
}
.dialog-style-scanner .bubble-row {
  width: min(94vw, 720px) !important;
  max-width: 720px !important;
}
.dialog-style-scanner .bubble {
  min-height: 420px;
  padding: 86px 40px 48px !important;
  background:
    linear-gradient(180deg, rgba(62,214,239,.09), transparent 22%),
    #071b25 !important;
  color: #d8fcff !important;
  border: 2px solid #3ed6ef !important;
  border-radius: 10px !important;
  font-family: "Courier New", monospace !important;
}
.dialog-style-scanner .bubble::before {
  content: "ANALYSE LAEUFT";
  position: absolute;
  top: 24px;
  left: 28px;
  color: #3ed6ef;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.dialog-style-gps #chat-list {
  background: linear-gradient(145deg, #11180f, #2a3a22 55%, #10150d);
}
.dialog-style-gps .bubble-row {
  width: min(88vw, 470px) !important;
  max-width: 470px !important;
}
.dialog-style-gps .bubble-row .avatar { display: none !important; }
.dialog-style-gps .bubble {
  min-height: min(68vh, 570px);
  padding: 112px 34px 92px !important;
  background:
    linear-gradient(180deg, #4f5d42 0 74px, #20271c 74px calc(100% - 70px), #4f5d42 calc(100% - 70px)) !important;
  border: 12px solid #151b13 !important;
  border-radius: 34px !important;
  color: #17220f !important;
  font-family: "Courier New", monospace !important;
  box-shadow: 0 0 0 3px #596851, 0 34px 86px rgba(0,0,0,.72) !important;
}
.dialog-style-gps .bubble::before {
  content: "";
  position: absolute;
  left: 30px;
  right: 30px;
  top: 86px;
  bottom: 86px;
  border: 5px solid #11180f;
  border-radius: 8px;
  background:
    linear-gradient(rgba(23,34,15,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,34,15,.18) 1px, transparent 1px),
    #b8d78a;
  background-size: 28px 28px;
  z-index: -1;
}
.dialog-style-gps .bubble::after {
  content: "GPS FIX 3D";
  position: absolute;
  top: 32px;
  left: 0;
  right: 0;
  color: #e8ff93;
  text-align: center;
  font-weight: 900;
  letter-spacing: .18em;
}

.dialog-style-compass #chat-list {
  background: radial-gradient(circle at center, #5b361d 0 120px, #140f0a 121px);
}
.dialog-style-compass .bubble-row {
  width: min(88vw, 510px) !important;
  max-width: 510px !important;
}
.dialog-style-compass .bubble-row .avatar { display: none !important; }
.dialog-style-compass .bubble {
  min-height: min(82vw, 510px);
  aspect-ratio: 1 / 1;
  padding: 150px 72px 78px !important;
  border-radius: 50% !important;
  background:
    radial-gradient(circle at 50% 50%, #f1d99e 0 42%, #c9964b 43% 50%, #593318 51% 57%, #c9964b 58%) !important;
  border: 12px solid #6a3f20 !important;
  box-shadow: 0 0 0 8px #d7b56b, 0 36px 88px rgba(0,0,0,.72), inset 0 0 42px rgba(87,49,20,.32) !important;
}
.dialog-style-compass .bubble::before {
  content: "N";
  position: absolute;
  top: 30px;
  left: 0;
  right: 0;
  text-align: center;
  color: #5b260f;
  font-weight: 900;
  font-size: 1.45rem;
}
.dialog-style-compass .bubble::after {
  top: 64px;
  height: 150px;
  width: 18px;
  background: linear-gradient(180deg, #d71920 0 50%, #f7ead0 51%);
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(24deg);
  opacity: .88;
}

.dialog-style-mystery #chat-list {
  background:
    radial-gradient(circle at 26% 24%, rgba(216,180,254,.22), transparent 22%),
    radial-gradient(circle at 80% 80%, rgba(67,18,104,.34), transparent 34%),
    #050510;
}
.dialog-style-mystery .bubble-row {
  width: min(90vw, 640px) !important;
  max-width: 640px !important;
}
.dialog-style-mystery .bubble {
  min-height: 390px;
  padding: 58px 42px !important;
  background:
    radial-gradient(circle at center, rgba(216,180,254,.12), transparent 54%),
    rgba(17, 12, 29, .92) !important;
  border: 2px solid rgba(216,180,254,.72) !important;
  border-radius: 18px !important;
  color: #f4e8ff !important;
  text-shadow: 0 0 14px rgba(216,180,254,.36);
}
.dialog-style-mystery .bubble::before {
  content: "";
  position: absolute;
  inset: -26px;
  background:
    radial-gradient(circle at 18% 22%, rgba(216,180,254,.28), transparent 18%),
    radial-gradient(circle at 76% 78%, rgba(129,60,216,.24), transparent 24%);
  filter: blur(12px);
  z-index: -1;
}

.dialog-style-terminal .bubble {
  min-height: 420px;
  padding: 72px 34px 34px !important;
  background:
    repeating-linear-gradient(0deg, rgba(118,255,138,.08) 0 2px, transparent 2px 5px),
    #020d05 !important;
  border: 4px solid #163f20 !important;
  box-shadow: 0 0 0 14px #050505, 0 34px 86px rgba(0,0,0,.78), inset 0 0 42px rgba(30,215,96,.16) !important;
}
.dialog-style-terminal .bubble::after {
  content: "ACCESS GRANTED";
  position: absolute;
  top: 22px;
  left: 30px;
  color: #76ff8a;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.dialog-style-emergency #chat-list {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 14px, transparent 14px 28px),
    #220507;
}
.dialog-style-emergency .bubble-row {
  width: min(94vw, 720px) !important;
  max-width: 720px !important;
}
.dialog-style-emergency .bubble {
  min-height: 380px;
  padding: 82px 38px 40px !important;
  background:
    linear-gradient(90deg, #b91c1c 0 24px, #fff1f2 24px calc(100% - 24px), #b91c1c calc(100% - 24px)) !important;
  border: 4px solid #7f1d1d !important;
  border-radius: 8px !important;
  color: #3b0709 !important;
}
.dialog-style-emergency .bubble::before {
  content: "EINSATZMELDUNG";
  position: absolute;
  top: 20px;
  left: 24px;
  right: 24px;
  padding: 10px 14px;
  color: #fff;
  background: #b91c1c;
  text-align: center;
  font-weight: 900;
  letter-spacing: .18em;
}
.dialog-style-emergency .bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -28px;
  width: 126px;
  height: 42px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #2563eb 0 50%, #dc2626 50%);
  border-radius: 22px 22px 8px 8px;
  box-shadow: 0 0 30px rgba(248,113,113,.48);
}

.dialog-style-inventory #chat-list {
  background:
    radial-gradient(circle at 50% 20%, rgba(242,192,95,.16), transparent 28%),
    #19140e;
}
.dialog-style-inventory .bubble-row {
  width: min(90vw, 620px) !important;
  max-width: 620px !important;
}
.dialog-style-inventory .bubble {
  min-height: 360px;
  padding: 92px 42px 40px !important;
  background:
    linear-gradient(180deg, #8a6331 0 70px, #ead8b6 70px) !important;
  border: 5px solid #3f2b14 !important;
  border-radius: 12px !important;
  color: #2a1b0d !important;
}
.dialog-style-inventory .bubble::before {
  top: 20px;
  width: 160px;
  height: 54px;
  background:
    linear-gradient(90deg, #3f2b14 0 18px, transparent 18px calc(100% - 18px), #3f2b14 calc(100% - 18px)),
    linear-gradient(180deg, #c59245, #6f4f27);
}
.dialog-style-inventory .bubble::after {
  content: "NEUER FUND";
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  color: #fff0c5;
  text-align: center;
  font-weight: 900;
  letter-spacing: .16em;
}

.dialog-style-riddle #chat-list {
  background:
    linear-gradient(45deg, rgba(124,58,237,.18) 25%, transparent 25% 75%, rgba(124,58,237,.18) 75%),
    #17112a;
  background-size: 56px 56px;
}
.dialog-style-riddle .bubble-row {
  width: min(90vw, 650px) !important;
  max-width: 650px !important;
}
.dialog-style-riddle .bubble {
  min-height: 380px;
  padding: 74px 42px 42px !important;
  background:
    radial-gradient(circle at 92% 16%, rgba(124,58,237,.18), transparent 15%),
    #f2e8ff !important;
  border: 4px solid #7c3aed !important;
  border-radius: 16px !important;
  color: #23113c !important;
}
.dialog-style-riddle .bubble::before {
  content: "?";
  position: absolute;
  top: 18px;
  right: 28px;
  color: rgba(124,58,237,.24);
  font-size: 6rem;
  font-weight: 900;
  line-height: .8;
}
.dialog-style-riddle .bubble::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 22px;
  width: 120px;
  height: 30px;
  background:
    radial-gradient(circle, #7c3aed 0 7px, transparent 8px);
  background-size: 30px 30px;
  opacity: .46;
}

.dialog-style-audio #chat-list {
  background:
    linear-gradient(90deg, rgba(96,165,250,.12) 0 3px, transparent 3px 14px),
    #080b12;
}
.dialog-style-audio .bubble-row {
  width: min(90vw, 620px) !important;
  max-width: 620px !important;
}
.dialog-style-audio .bubble {
  min-height: 370px;
  padding: 76px 40px 126px !important;
  background:
    linear-gradient(180deg, #1f2937 0 82px, #111827 82px) !important;
  color: #dbeafe !important;
  border: 5px solid #374151 !important;
  border-radius: 18px !important;
}
.dialog-style-audio .bubble::before {
  content: "HOERSPIEL";
  position: absolute;
  left: 26px;
  right: 26px;
  top: 26px;
  color: #bfdbfe;
  font-weight: 900;
  letter-spacing: .18em;
  text-align: center;
}
.dialog-style-audio .bubble::after {
  left: 34px;
  right: 34px;
  bottom: 34px;
  height: 72px;
  background:
    radial-gradient(circle at 20% 50%, #0b1020 0 32px, #93c5fd 33px 35px, transparent 36px),
    radial-gradient(circle at 80% 50%, #0b1020 0 32px, #93c5fd 33px 35px, transparent 36px),
    linear-gradient(90deg, #60a5fa 0 5px, transparent 5px 12px);
  background-size: auto, auto, 16px 100%;
  border: 2px solid #60a5fa;
  border-radius: 12px;
}

.dialog-style-ar #chat-list {
  background:
    linear-gradient(rgba(77,208,225,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77,208,225,.18) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(77,208,225,.14), transparent 44%),
    #031016;
  background-size: 42px 42px, 42px 42px, 100% 100%, 100% 100%;
}
.dialog-style-ar .bubble-row {
  width: min(94vw, 760px) !important;
  max-width: 760px !important;
}
.dialog-style-ar .bubble {
  min-height: 420px;
  padding: 74px 48px 52px !important;
  background: rgba(4, 24, 33, .54) !important;
  color: #e8fdff !important;
  border: 2px solid rgba(77,208,225,.86) !important;
  border-radius: 0 !important;
  box-shadow:
    0 0 0 1px rgba(77,208,225,.32),
    0 0 42px rgba(77,208,225,.22),
    inset 0 0 50px rgba(77,208,225,.08) !important;
}
.dialog-style-ar .bubble::before {
  content: "AR TARGET LOCK";
  position: absolute;
  top: 22px;
  left: 28px;
  color: #4dd0e1;
  font-family: "Courier New", monospace;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .18em;
}
.dialog-style-ar .bubble::after {
  content: "";
  position: absolute;
  inset: 18px;
  border:
    3px solid transparent;
  background:
    linear-gradient(#4dd0e1, #4dd0e1) left top / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) left top / 3px 72px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right top / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right top / 3px 72px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) left bottom / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) left bottom / 3px 72px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right bottom / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right bottom / 3px 72px no-repeat;
  opacity: .62;
  pointer-events: none;
}

@media (max-width: 560px) {
  .dialog-style-diary .bubble {
    column-count: 1;
    padding: 34px 22px 28px 46px !important;
  }
  .dialog-style-diary .bubble::before {
    left: 24px;
    width: 8px;
  }
  .dialog-style-newspaper .bubble {
    column-count: 1;
    padding: 78px 20px 24px !important;
  }
  .dialog-style-newspaper .bubble::before {
    font-size: 1.05rem;
  }
  .dialog-style-bottle .bubble-row::before {
    height: 180px;
  }
  .dialog-style-polaroid .bubble {
    min-height: 430px;
    padding-top: 270px !important;
  }
  .dialog-style-polaroid .bubble::before {
    height: 240px;
  }
  .dialog-style-phone .bubble {
    min-height: 610px;
  }
  .dialog-style-safe .bubble,
  .dialog-style-compass .bubble {
    width: min(92vw, 430px) !important;
    min-height: min(92vw, 430px);
    padding-left: 42px !important;
    padding-right: 42px !important;
  }
  .dialog-style-video .bubble,
  .dialog-style-ar .bubble {
    min-height: 360px;
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}

/* Dialog-System 2.0: zusaetzliche realistische Dialog-Oberflaechen */
#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) {
  --dialog-screen-bg: #111827;
  --dialog-header-bg: rgba(12, 18, 28, .94);
  --dialog-header-border: rgba(255,255,255,.16);
  --dialog-title: #f7fafc;
  --dialog-sub: rgba(247,250,252,.68);
  --dialog-list-bg: #101827;
  --dialog-card: #f8f2df;
  --dialog-ink: #1f2937;
  --dialog-border: rgba(31,41,55,.38);
  --dialog-accent: #d69e2e;
  --dialog-shadow: 0 28px 80px rgba(0,0,0,.52), 0 10px 24px rgba(0,0,0,.28);
  --dialog-radius: 8px;
  --dialog-mark: "";
  --dialog-overlay: transparent;
  --dialog-font: inherit;
  --dialog-button-bg: #1f2937;
  --dialog-button-color: #fff;
  --dialog-choice-bg: rgba(255,255,255,.08);
  --dialog-choice-color: #fff;
  --dialog-choice-border: rgba(255,255,255,.2);
  background: var(--dialog-screen-bg);
  perspective: 1200px;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .chat-header {
  background: var(--dialog-header-bg);
  border-bottom: 1px solid var(--dialog-header-border);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .chat-name {
  color: var(--dialog-title);
  font-family: var(--dialog-font);
  font-weight: 900;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .chat-sub {
  color: var(--dialog-sub);
  font-family: var(--dialog-font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) #chat-list {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 18px;
  background: var(--dialog-list-bg);
  isolation: isolate;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) #chat-list::before {
  content: var(--dialog-mark);
  position: absolute;
  top: 22px;
  right: 18px;
  z-index: 0;
  color: var(--dialog-accent);
  font-family: var(--dialog-font);
  font-weight: 900;
  font-size: .86rem;
  letter-spacing: .16em;
  opacity: .35;
  transform: rotate(5deg);
  pointer-events: none;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) #chat-list::after {
  content: "";
  position: absolute;
  inset: 18px;
  z-index: 0;
  background: var(--dialog-overlay);
  opacity: .9;
  pointer-events: none;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) #chat-list .bubble-row:not(:last-child) {
  display: none;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble-row {
  position: relative;
  z-index: 2;
  width: min(100%, 720px);
  max-width: 720px;
  animation: pfp-dialog-object-in .48s cubic-bezier(.18,.84,.24,1) both;
}

@keyframes pfp-dialog-object-in {
  0% { opacity: 0; transform: translateY(24px) rotateX(18deg) scale(.94); }
  70% { opacity: 1; transform: translateY(-3px) rotateX(-2deg) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) rotateX(0deg) scale(1); }
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble-row > div:not(.avatar) {
  width: 100%;
  max-width: min(88vw, 660px);
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble-row .avatar {
  width: 42px !important;
  height: 42px !important;
  border: 2px solid var(--dialog-accent) !important;
  border-radius: 8px !important;
  background: rgba(255,255,255,.12) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.24) !important;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .npc-label {
  color: var(--dialog-accent);
  font-family: var(--dialog-font);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 4px 6px;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble {
  width: 100%;
  min-height: 170px;
  background: var(--dialog-card) !important;
  color: var(--dialog-ink) !important;
  border: 2px solid var(--dialog-border) !important;
  border-radius: var(--dialog-radius) !important;
  box-shadow: var(--dialog-shadow) !important;
  font-family: var(--dialog-font) !important;
  font-size: 1rem !important;
  line-height: 1.58;
  padding: 20px !important;
  position: relative;
  transform: rotate(var(--dialog-tilt, 0deg));
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble.narrator {
  text-align: center;
  font-style: italic;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble.player {
  background: var(--dialog-player-card, var(--dialog-card)) !important;
  color: var(--dialog-player-ink, var(--dialog-ink)) !important;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .bubble-meta {
  color: var(--dialog-accent);
  font-family: var(--dialog-font);
  font-weight: 700;
  opacity: .72;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .chat-choices {
  background: var(--dialog-header-bg);
  border-top: 1px solid var(--dialog-header-border);
  gap: 10px;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .choice-btn {
  background: var(--dialog-choice-bg) !important;
  color: var(--dialog-choice-color) !important;
  border: 1px solid var(--dialog-choice-border) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.2);
  font-family: var(--dialog-font) !important;
  font-weight: 800;
  max-width: min(100%, 520px);
  text-align: left;
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .chat-footer {
  background: var(--dialog-header-bg);
  border-top: 1px solid var(--dialog-header-border);
}

#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .chat-footer .btn.primary {
  background: var(--dialog-button-bg) !important;
  color: var(--dialog-button-color) !important;
  border: 2px solid var(--dialog-accent) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  font-family: var(--dialog-font) !important;
  font-weight: 900;
}

.dialog-style-diary {
  --dialog-screen-bg: #25180e;
  --dialog-header-bg: linear-gradient(180deg, #3f2915, #26170c);
  --dialog-list-bg:
    linear-gradient(90deg, rgba(95,51,25,.42) 0 44px, transparent 44px),
    repeating-linear-gradient(0deg, rgba(80,52,25,.14) 0 1px, transparent 1px 28px),
    #8c6842;
  --dialog-card: linear-gradient(90deg, rgba(124,73,32,.18) 0 34px, transparent 34px), #f3dfb7;
  --dialog-ink: #2a1707;
  --dialog-border: #6d4321;
  --dialog-accent: #c58a43;
  --dialog-button-bg: linear-gradient(180deg, #7d4a26, #4a2814);
  --dialog-button-color: #fff2d6;
  --dialog-mark: "TAGEBUCH";
  --dialog-tilt: -.6deg;
  --dialog-overlay: linear-gradient(90deg, rgba(54,30,13,.32) 0 28px, transparent 28px 100%);
}

.dialog-style-dossier {
  --dialog-screen-bg: #2b261a;
  --dialog-header-bg: linear-gradient(180deg, #6b4b21, #3b2d19);
  --dialog-list-bg: linear-gradient(145deg, #4b351c, #1c1710);
  --dialog-card: linear-gradient(180deg, #efcf85 0 46px, #f8e7ba 46px);
  --dialog-ink: #211707;
  --dialog-border: #5b3a12;
  --dialog-accent: #b31420;
  --dialog-button-bg: #5b3a12;
  --dialog-button-color: #ffe8ad;
  --dialog-mark: "AKTE";
  --dialog-tilt: .5deg;
  --dialog-overlay: linear-gradient(90deg, transparent 0 60%, rgba(20,11,2,.16) 60% 62%, transparent 62%);
}
.dialog-style-dossier .bubble::after {
  content: "VERTRAULICH";
  position: absolute;
  right: 18px;
  bottom: 18px;
  color: rgba(160, 0, 18, .28);
  border: 3px solid rgba(160, 0, 18, .25);
  padding: 5px 9px;
  font-weight: 900;
  letter-spacing: .12em;
  transform: rotate(-12deg);
}

.dialog-style-newspaper {
  --dialog-screen-bg: #161616;
  --dialog-header-bg: linear-gradient(180deg, #2b2b2b, #111);
  --dialog-list-bg:
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 92px),
    #1d1d1d;
  --dialog-card: repeating-linear-gradient(0deg, #f7f1dc 0 20px, #efe8cf 20px 22px);
  --dialog-ink: #151515;
  --dialog-border: #2a2a2a;
  --dialog-accent: #111;
  --dialog-button-bg: #111;
  --dialog-button-color: #f7f1dc;
  --dialog-mark: "EXTRA";
  --dialog-font: Georgia, "Times New Roman", serif;
}
.dialog-style-newspaper .bubble::before {
  content: "";
  display: block;
  height: 12px;
  margin: -4px 0 12px;
  border-top: 4px double #111;
  border-bottom: 1px solid #111;
}

.dialog-style-bottle {
  --dialog-screen-bg: #052433;
  --dialog-header-bg: linear-gradient(180deg, #0f5260, #083240);
  --dialog-list-bg:
    radial-gradient(circle at 25% 20%, rgba(155,231,223,.24), transparent 30%),
    linear-gradient(160deg, #075067, #042231);
  --dialog-card: linear-gradient(90deg, #ead6a9 0 20px, #f8e8be 20px calc(100% - 20px), #d7bd8c calc(100% - 20px));
  --dialog-ink: #33230b;
  --dialog-border: #8a6632;
  --dialog-accent: #9be7df;
  --dialog-button-bg: #0e6170;
  --dialog-button-color: #eafffb;
  --dialog-mark: "FLASCHENPOST";
  --dialog-radius: 999px;
  --dialog-overlay: radial-gradient(ellipse at 50% 60%, rgba(155,231,223,.16), transparent 44%);
}

.dialog-style-treasure-map {
  --dialog-screen-bg: #1e1408;
  --dialog-header-bg: linear-gradient(180deg, #5c3814, #2a1707);
  --dialog-list-bg:
    radial-gradient(circle at 75% 22%, rgba(255,217,116,.15), transparent 22%),
    #3c250d;
  --dialog-card:
    radial-gradient(circle at 78% 24%, rgba(160,40,30,.16) 0 20px, transparent 21px),
    repeating-linear-gradient(135deg, rgba(101,65,24,.14) 0 2px, transparent 2px 18px),
    #e8ce91;
  --dialog-ink: #3a2409;
  --dialog-border: #724516;
  --dialog-accent: #d32626;
  --dialog-button-bg: #6c4015;
  --dialog-button-color: #ffe7a8;
  --dialog-mark: "X";
  --dialog-tilt: -1deg;
}
.dialog-style-treasure-map .bubble::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 45%, #c91d1d 45% 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #c91d1d 45% 55%, transparent 55%);
  opacity: .55;
}

.dialog-style-polaroid {
  --dialog-screen-bg: #14181f;
  --dialog-header-bg: linear-gradient(180deg, #3c4656, #1b2028);
  --dialog-list-bg: radial-gradient(circle at center, rgba(255,255,255,.08), transparent 42%), #12171f;
  --dialog-card: linear-gradient(180deg, #fff 0 74%, #f1efe8 74%);
  --dialog-ink: #1d2430;
  --dialog-border: #f7f7f7;
  --dialog-accent: #ffcf6a;
  --dialog-button-bg: #263242;
  --dialog-button-color: #fff6df;
  --dialog-mark: "POLAROID";
  --dialog-radius: 5px;
  --dialog-tilt: 1.2deg;
}
.dialog-style-polaroid .bubble {
  padding-top: 46px !important;
}
.dialog-style-polaroid .bubble::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 34%;
  background:
    radial-gradient(circle at 34% 32%, rgba(255,255,255,.42), transparent 18%),
    linear-gradient(135deg, #495867, #93a8ac);
  border-radius: 4px;
}

.dialog-style-phone {
  --dialog-screen-bg: #05070c;
  --dialog-header-bg: #0c1118;
  --dialog-list-bg: radial-gradient(circle at 50% 18%, rgba(74,222,128,.16), transparent 30%), #030508;
  --dialog-card: #101822;
  --dialog-ink: #e8fff0;
  --dialog-border: #1f2937;
  --dialog-accent: #22c55e;
  --dialog-button-bg: #16a34a;
  --dialog-button-color: #031008;
  --dialog-mark: "ANRUF";
  --dialog-radius: 22px;
  --dialog-player-card: #0e2a18;
  --dialog-player-ink: #d8ffe4;
}
.dialog-style-phone .bubble-row {
  max-width: 430px !important;
}
.dialog-style-phone .bubble {
  border-width: 8px !important;
  box-shadow: 0 0 0 3px #05070c, 0 24px 80px rgba(0,0,0,.7) !important;
}

.dialog-style-video {
  --dialog-screen-bg: #050505;
  --dialog-header-bg: #111;
  --dialog-list-bg:
    repeating-linear-gradient(0deg, rgba(255,255,255,.045) 0 1px, transparent 1px 4px),
    #050505;
  --dialog-card: #111;
  --dialog-ink: #f7f7f7;
  --dialog-border: #3a3a3a;
  --dialog-accent: #ff2d2d;
  --dialog-button-bg: #b91c1c;
  --dialog-button-color: #fff;
  --dialog-mark: "REC";
  --dialog-radius: 4px;
}
.dialog-style-video #chat-list::before {
  color: #ff2d2d;
  opacity: .95;
}
.dialog-style-video .bubble::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 2px;
  pointer-events: none;
}

.dialog-style-detective {
  --dialog-screen-bg: #2b1a0d;
  --dialog-header-bg: linear-gradient(180deg, #51321a, #261408);
  --dialog-list-bg:
    linear-gradient(45deg, transparent 48%, rgba(160,10,10,.38) 49% 51%, transparent 52%),
    linear-gradient(-21deg, transparent 46%, rgba(160,10,10,.28) 47% 49%, transparent 50%),
    #6b4826;
  --dialog-card: #f2e3bd;
  --dialog-ink: #2f1d0d;
  --dialog-border: #5d3b1d;
  --dialog-accent: #d71920;
  --dialog-button-bg: #4a2c16;
  --dialog-button-color: #ffe5bd;
  --dialog-mark: "SPUR";
  --dialog-tilt: -.8deg;
}
.dialog-style-detective .bubble::before,
.dialog-style-detective .bubble::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #cfa05f;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.dialog-style-detective .bubble::before { top: -12px; left: 34px; }
.dialog-style-detective .bubble::after { top: -10px; right: 42px; }

.dialog-style-safe {
  --dialog-screen-bg: #0f1115;
  --dialog-header-bg: linear-gradient(180deg, #3b414c, #141820);
  --dialog-list-bg: radial-gradient(circle at center, #2c333e 0 118px, #10141b 119px);
  --dialog-card: linear-gradient(160deg, #3a414b, #171b21);
  --dialog-ink: #e9eef6;
  --dialog-border: #8b95a5;
  --dialog-accent: #f4c430;
  --dialog-button-bg: #2f3743;
  --dialog-button-color: #f4c430;
  --dialog-mark: "LOCK";
  --dialog-radius: 50%;
  --dialog-overlay:
    radial-gradient(circle at 50% 50%, transparent 0 46px, rgba(244,196,48,.18) 47px 49px, transparent 50px 78px, rgba(255,255,255,.12) 79px 81px, transparent 82px);
}
.dialog-style-safe .bubble {
  min-height: 260px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dialog-style-scanner {
  --dialog-screen-bg: #06131a;
  --dialog-header-bg: linear-gradient(180deg, #103243, #07151c);
  --dialog-list-bg:
    linear-gradient(90deg, rgba(80,230,255,.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(80,230,255,.08) 1px, transparent 1px),
    #07151c;
  --dialog-card: rgba(9, 28, 38, .96);
  --dialog-ink: #c8fbff;
  --dialog-border: #3ed6ef;
  --dialog-accent: #3ed6ef;
  --dialog-button-bg: #0e4454;
  --dialog-button-color: #d9feff;
  --dialog-mark: "SCAN";
  --dialog-font: "Courier New", monospace;
}
.dialog-style-scanner .bubble::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  top: 18%;
  background: rgba(80,230,255,.72);
  box-shadow: 0 0 22px rgba(80,230,255,.8);
  animation: pfp-scan-line 2.1s linear infinite;
}
@keyframes pfp-scan-line {
  0% { top: 14%; }
  100% { top: 86%; }
}

.dialog-style-gps {
  --dialog-screen-bg: #1b241c;
  --dialog-header-bg: linear-gradient(180deg, #4a5a36, #1d281b);
  --dialog-list-bg:
    linear-gradient(rgba(148,196,84,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,196,84,.14) 1px, transparent 1px),
    #182219;
  --dialog-card: #b8d78a;
  --dialog-ink: #15200f;
  --dialog-border: #2b3b22;
  --dialog-accent: #e8ff93;
  --dialog-button-bg: #2f4926;
  --dialog-button-color: #e8ff93;
  --dialog-mark: "GPS";
  --dialog-font: "Courier New", monospace;
  --dialog-radius: 5px;
}

.dialog-style-compass {
  --dialog-screen-bg: #140f0a;
  --dialog-header-bg: linear-gradient(180deg, #5b361d, #21150b);
  --dialog-list-bg: radial-gradient(circle at 50% 50%, #d9b36b 0 86px, #3b2411 87px);
  --dialog-card: radial-gradient(circle at 50% 50%, #f1d99e, #c89b50);
  --dialog-ink: #2f1d0d;
  --dialog-border: #5b361d;
  --dialog-accent: #e11d48;
  --dialog-button-bg: #5b361d;
  --dialog-button-color: #fff0bf;
  --dialog-mark: "N";
  --dialog-radius: 50%;
}
.dialog-style-compass .bubble {
  min-height: 300px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.dialog-style-compass .bubble::after {
  content: "";
  position: absolute;
  top: 30px;
  left: 50%;
  width: 12px;
  height: 96px;
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
  background: #d71920;
  opacity: .62;
}

.dialog-style-mystery {
  --dialog-screen-bg: #070812;
  --dialog-header-bg: linear-gradient(180deg, #2b2144, #090914);
  --dialog-list-bg:
    radial-gradient(circle at 28% 22%, rgba(179,136,255,.2), transparent 24%),
    radial-gradient(circle at 68% 70%, rgba(86,30,140,.18), transparent 32%),
    #080812;
  --dialog-card: rgba(24,18,38,.94);
  --dialog-ink: #f3e8ff;
  --dialog-border: #8b5cf6;
  --dialog-accent: #d8b4fe;
  --dialog-button-bg: #4c1d95;
  --dialog-button-color: #f3e8ff;
  --dialog-mark: "???";
}
.dialog-style-mystery .bubble {
  animation: pfp-dialog-object-in .48s cubic-bezier(.18,.84,.24,1) both, pfp-mystery-flicker 3.2s linear infinite;
}
@keyframes pfp-mystery-flicker {
  0%, 97%, 100% { filter: brightness(1); }
  98% { filter: brightness(1.45); }
  99% { filter: brightness(.72); }
}

.dialog-style-terminal {
  --dialog-screen-bg: #000;
  --dialog-header-bg: #020c05;
  --dialog-list-bg:
    repeating-linear-gradient(0deg, rgba(90,255,128,.08) 0 1px, transparent 1px 4px),
    #010703;
  --dialog-card: #031107;
  --dialog-ink: #76ff8a;
  --dialog-border: #1ed760;
  --dialog-accent: #76ff8a;
  --dialog-button-bg: #041d0c;
  --dialog-button-color: #76ff8a;
  --dialog-mark: "ACCESS";
  --dialog-font: "Courier New", monospace;
  --dialog-radius: 3px;
}
.dialog-style-terminal .bubble::before {
  content: "> ";
  color: #b9ffc2;
}

.dialog-style-emergency {
  --dialog-screen-bg: #1b0507;
  --dialog-header-bg: linear-gradient(180deg, #7f1d1d, #260507);
  --dialog-list-bg:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 12px, transparent 12px 24px),
    #2a0709;
  --dialog-card: #fff1f2;
  --dialog-ink: #3b0709;
  --dialog-border: #dc2626;
  --dialog-accent: #ffb3b3;
  --dialog-button-bg: #dc2626;
  --dialog-button-color: #fff;
  --dialog-mark: "EINSATZ";
  --dialog-radius: 6px;
}
.dialog-style-emergency .chat-header {
  animation: pfp-emergency-pulse 1.2s ease-in-out infinite;
}
@keyframes pfp-emergency-pulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(127,29,29,.24); }
  50% { box-shadow: 0 10px 38px rgba(248,113,113,.55); }
}

.dialog-style-inventory {
  --dialog-screen-bg: #19140e;
  --dialog-header-bg: linear-gradient(180deg, #51402a, #21180f);
  --dialog-list-bg:
    radial-gradient(circle at 20% 22%, rgba(247,208,126,.16), transparent 24%),
    #2a2117;
  --dialog-card: linear-gradient(160deg, #ede0c6, #c9b286);
  --dialog-ink: #2a1b0d;
  --dialog-border: #6f5531;
  --dialog-accent: #f2c05f;
  --dialog-button-bg: #5c4323;
  --dialog-button-color: #ffe8ae;
  --dialog-mark: "FUND";
  --dialog-radius: 7px;
}
.dialog-style-inventory .bubble::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 82px;
  height: 34px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #6f5531, #3b2a16);
  border-radius: 8px 8px 2px 2px;
  box-shadow: 0 10px 18px rgba(0,0,0,.28);
}

.dialog-style-riddle {
  --dialog-screen-bg: #17112a;
  --dialog-header-bg: linear-gradient(180deg, #3d2a74, #17112a);
  --dialog-list-bg:
    linear-gradient(45deg, rgba(255,255,255,.04) 25%, transparent 25% 75%, rgba(255,255,255,.04) 75%),
    #21173e;
  --dialog-card: #f2e8ff;
  --dialog-ink: #23113c;
  --dialog-border: #7c3aed;
  --dialog-accent: #c4b5fd;
  --dialog-button-bg: #5b21b6;
  --dialog-button-color: #fff;
  --dialog-mark: "RAETSEL";
  --dialog-radius: 8px;
}

.dialog-style-audio {
  --dialog-screen-bg: #080b12;
  --dialog-header-bg: linear-gradient(180deg, #263044, #0b0e16);
  --dialog-list-bg:
    repeating-linear-gradient(90deg, rgba(96,165,250,.18) 0 3px, transparent 3px 12px),
    #0b1020;
  --dialog-card: #121827;
  --dialog-ink: #dbeafe;
  --dialog-border: #60a5fa;
  --dialog-accent: #93c5fd;
  --dialog-button-bg: #1d4ed8;
  --dialog-button-color: #fff;
  --dialog-mark: "AUDIO";
  --dialog-radius: 8px;
}
.dialog-style-audio .bubble::after {
  content: "";
  display: block;
  height: 34px;
  margin-top: 18px;
  background:
    linear-gradient(90deg, #60a5fa 0 6px, transparent 6px 12px),
    linear-gradient(90deg, transparent 0 2px, rgba(147,197,253,.45) 2px 5px, transparent 5px 10px);
  background-size: 16px 100%, 28px 100%;
  border-radius: 4px;
  opacity: .72;
}

.dialog-style-ar {
  --dialog-screen-bg: #07131a;
  --dialog-header-bg: rgba(7, 19, 26, .72);
  --dialog-list-bg:
    linear-gradient(rgba(77,208,225,.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77,208,225,.13) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(77,208,225,.16), transparent 48%),
    #07131a;
  --dialog-card: rgba(3, 23, 32, .72);
  --dialog-ink: #d6fbff;
  --dialog-border: rgba(77,208,225,.72);
  --dialog-accent: #4dd0e1;
  --dialog-button-bg: rgba(12, 84, 97, .9);
  --dialog-button-color: #e8fdff;
  --dialog-mark: "AR";
  --dialog-font: "Courier New", monospace;
  --dialog-radius: 8px;
}
.dialog-style-ar .bubble {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 560px) {
  #screen-dialog:is(
    .dialog-style-diary,
    .dialog-style-dossier,
    .dialog-style-newspaper,
    .dialog-style-bottle,
    .dialog-style-treasure-map,
    .dialog-style-polaroid,
    .dialog-style-phone,
    .dialog-style-video,
    .dialog-style-detective,
    .dialog-style-safe,
    .dialog-style-scanner,
    .dialog-style-gps,
    .dialog-style-compass,
    .dialog-style-mystery,
    .dialog-style-terminal,
    .dialog-style-emergency,
    .dialog-style-inventory,
    .dialog-style-riddle,
    .dialog-style-audio,
    .dialog-style-ar
  ) #chat-list {
    padding: 12px;
  }

  #screen-dialog:is(
    .dialog-style-diary,
    .dialog-style-dossier,
    .dialog-style-newspaper,
    .dialog-style-bottle,
    .dialog-style-treasure-map,
    .dialog-style-polaroid,
    .dialog-style-phone,
    .dialog-style-video,
    .dialog-style-detective,
    .dialog-style-safe,
    .dialog-style-scanner,
    .dialog-style-gps,
    .dialog-style-compass,
    .dialog-style-mystery,
    .dialog-style-terminal,
    .dialog-style-emergency,
    .dialog-style-inventory,
    .dialog-style-riddle,
    .dialog-style-audio,
    .dialog-style-ar
  ) .bubble {
    min-height: 150px;
    padding: 16px !important;
    font-size: .94rem !important;
  }

  .dialog-style-safe .bubble,
  .dialog-style-compass .bubble {
    min-height: 240px;
  }
}

/* Finaler Realismus-Override: diese Regeln stehen absichtlich ganz am Ende. */
#screen-dialog[class*="dialog-style-"] .bubble {
  transition: transform .18s ease, box-shadow .18s ease;
}

#screen-dialog.dialog-style-diary #chat-list {
  background: radial-gradient(circle at 22% 14%, rgba(255,220,151,.18), transparent 26%), linear-gradient(115deg, #3b2415, #130b07 70%) !important;
}
#screen-dialog.dialog-style-diary .bubble-row { width: min(94vw, 760px) !important; max-width: 760px !important; }
#screen-dialog.dialog-style-diary .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-diary .bubble-row > div:not(.avatar) { max-width: 100% !important; }
#screen-dialog.dialog-style-diary .bubble {
  min-height: min(62vh, 500px) !important;
  padding: 48px 42px 34px 72px !important;
  column-count: 2 !important;
  column-gap: 58px !important;
  background: linear-gradient(90deg, #d2b476 0 42px, #f4dfaa 42px 50%, #ead09a 50% 52%, #f7e7bc 52% 100%) !important;
  border: 3px solid #5a361b !important;
  border-radius: 7px !important;
  box-shadow: 0 34px 86px rgba(0,0,0,.68), inset 22px 0 34px rgba(83,47,20,.22), inset -22px 0 30px rgba(83,47,20,.14) !important;
  font-family: Georgia, "Times New Roman", serif !important;
}
#screen-dialog.dialog-style-diary .bubble::before {
  content: "" !important;
  position: absolute !important;
  left: calc(50% - 12px) !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 24px !important;
  background: linear-gradient(90deg, rgba(74,42,20,.28), rgba(255,255,255,.22), rgba(74,42,20,.3)) !important;
  box-shadow: -8px 0 20px rgba(65,36,17,.18), 8px 0 22px rgba(65,36,17,.18) !important;
}
#screen-dialog.dialog-style-diary .bubble::after {
  content: "private journal" !important;
  position: absolute !important;
  right: 34px !important;
  bottom: 22px !important;
  color: rgba(86,44,16,.36) !important;
  border: 0 !important;
  font-style: italic !important;
  transform: rotate(-1deg) !important;
}

#screen-dialog.dialog-style-dossier #chat-list {
  background: linear-gradient(130deg, rgba(25,16,7,.86), rgba(12,9,6,.96)), repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 18px) !important;
}
#screen-dialog.dialog-style-dossier .bubble-row { width: min(92vw, 700px) !important; max-width: 700px !important; }
#screen-dialog.dialog-style-dossier .bubble {
  min-height: 430px !important;
  margin-top: 28px !important;
  padding: 76px 34px 32px !important;
  background: linear-gradient(180deg, #c99343 0 62px, #f1d096 62px 84px, #f7e4b6 84px 100%) !important;
  border: 0 !important;
  border-radius: 4px 8px 8px 8px !important;
  box-shadow: 0 32px 82px rgba(0,0,0,.68), 18px 18px 0 rgba(113,69,20,.55), inset 0 0 0 2px rgba(93,53,13,.28) !important;
}
#screen-dialog.dialog-style-dossier .bubble::before {
  content: "CASE FILE" !important;
  position: absolute !important;
  top: -28px !important;
  left: 0 !important;
  width: 210px !important;
  height: 48px !important;
  padding: 11px 18px !important;
  color: #4a2b0c !important;
  background: #d5a14f !important;
  border-radius: 8px 16px 0 0 !important;
  font-weight: 900 !important;
  letter-spacing: .14em !important;
}
#screen-dialog.dialog-style-dossier .bubble::after {
  content: "CONFIDENTIAL" !important;
  top: 112px !important;
  right: 28px !important;
  bottom: auto !important;
  color: rgba(158,20,32,.32) !important;
  border: 4px solid rgba(158,20,32,.3) !important;
  border-radius: 3px !important;
  font-size: 1.15rem !important;
  transform: rotate(-14deg) !important;
}

#screen-dialog.dialog-style-newspaper #chat-list { background: radial-gradient(circle at 50% 0, rgba(255,255,255,.08), transparent 32%), #111 !important; }
#screen-dialog.dialog-style-newspaper .bubble-row { width: min(94vw, 760px) !important; max-width: 760px !important; }
#screen-dialog.dialog-style-newspaper .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-newspaper .bubble {
  min-height: min(64vh, 520px) !important;
  padding: 88px 34px 28px !important;
  column-count: 2 !important;
  column-gap: 36px !important;
  background: repeating-linear-gradient(90deg, transparent 0 calc(50% - 1px), rgba(0,0,0,.18) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px) 100%), repeating-linear-gradient(0deg, #f3edda 0 18px, #e8dfc8 18px 19px) !important;
  border: 1px solid #1c1c1c !important;
  border-radius: 0 !important;
  color: #111 !important;
  font-family: Georgia, "Times New Roman", serif !important;
}
#screen-dialog.dialog-style-newspaper .bubble::before {
  content: "PFADFINDER KURIER" !important;
  position: absolute !important;
  left: 28px !important;
  right: 28px !important;
  top: 20px !important;
  height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-top: 5px double #121212 !important;
  border-bottom: 5px double #121212 !important;
  color: #111 !important;
  font-size: clamp(1.25rem, 4vw, 2.35rem) !important;
  font-weight: 900 !important;
}
#screen-dialog.dialog-style-newspaper .bubble::after {
  content: "SONDERAUSGABE" !important;
  position: absolute !important;
  top: 78px !important;
  left: 34px !important;
  right: 34px !important;
  border-bottom: 1px solid #111 !important;
  color: #111 !important;
  text-align: center !important;
  transform: none !important;
}

#screen-dialog.dialog-style-bottle #chat-list {
  background: radial-gradient(circle at 18% 18%, rgba(197,244,255,.2), transparent 18%), linear-gradient(180deg, #0b516c, #043144 52%, #051923) !important;
}
#screen-dialog.dialog-style-bottle .bubble-row { width: min(92vw, 760px) !important; max-width: 760px !important; justify-content: center !important; }
#screen-dialog.dialog-style-bottle .bubble-row::before {
  content: "" !important;
  position: absolute !important;
  z-index: 1 !important;
  width: min(720px, 88vw) !important;
  height: 220px !important;
  border: 10px solid rgba(178,236,226,.44) !important;
  border-right-width: 54px !important;
  border-radius: 130px 70px 70px 130px !important;
  background: linear-gradient(90deg, rgba(197,255,241,.25), rgba(197,255,241,.08)), rgba(16,91,92,.22) !important;
  transform: rotate(-7deg) !important;
}
#screen-dialog.dialog-style-bottle .bubble {
  z-index: 2 !important;
  width: min(560px, 74vw) !important;
  min-height: 250px !important;
  padding: 38px 46px !important;
  background: radial-gradient(ellipse at 50% 0, rgba(255,255,255,.48), transparent 32%), linear-gradient(90deg, #d4a973 0 24px, #f5dcad 24px calc(100% - 24px), #c9985d calc(100% - 24px)) !important;
  border: 2px solid #8c6230 !important;
  border-radius: 34px / 18px !important;
  transform: rotate(-3deg) !important;
}

#screen-dialog.dialog-style-treasure-map #chat-list {
  background: radial-gradient(circle at 22% 16%, rgba(255,218,117,.14), transparent 22%), radial-gradient(circle at 80% 78%, rgba(79,41,13,.38), transparent 28%), #1d1207 !important;
}
#screen-dialog.dialog-style-treasure-map .bubble-row { width: min(94vw, 780px) !important; max-width: 780px !important; }
#screen-dialog.dialog-style-treasure-map .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-treasure-map .bubble {
  min-height: min(62vh, 520px) !important;
  padding: 68px 46px 42px !important;
  background: radial-gradient(circle at 76% 26%, transparent 0 28px, rgba(137,82,27,.22) 29px 31px, transparent 32px), radial-gradient(circle at 22% 72%, rgba(68,112,63,.18), transparent 15%), #dfbd75 !important;
  border: 0 !important;
  border-radius: 26px 9px 24px 12px !important;
  clip-path: polygon(3% 4%, 18% 1%, 31% 4%, 48% 2%, 64% 5%, 81% 2%, 97% 6%, 96% 92%, 81% 97%, 62% 93%, 44% 98%, 25% 94%, 5% 97%, 2% 78%, 5% 56%, 2% 34%) !important;
}
#screen-dialog.dialog-style-treasure-map .bubble::after {
  content: "" !important;
  position: absolute !important;
  right: 42px !important;
  top: 36px !important;
  width: 64px !important;
  height: 64px !important;
  background: linear-gradient(45deg, transparent 45%, #c91d1d 45% 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #c91d1d 45% 55%, transparent 55%) !important;
  border: 0 !important;
  opacity: .72 !important;
}

#screen-dialog.dialog-style-polaroid #chat-list { background: linear-gradient(120deg, rgba(255,255,255,.05), transparent 38%), #15181d !important; }
#screen-dialog.dialog-style-polaroid .bubble-row { width: min(88vw, 430px) !important; max-width: 430px !important; }
#screen-dialog.dialog-style-polaroid .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-polaroid .bubble {
  min-height: 500px !important;
  padding: 340px 28px 42px !important;
  background: #fbfbf6 !important;
  border: 12px solid #fbfbf6 !important;
  border-bottom-width: 54px !important;
  border-radius: 3px !important;
  transform: rotate(-2.4deg) !important;
}
#screen-dialog.dialog-style-polaroid .bubble::before {
  content: "" !important;
  position: absolute !important;
  top: 16px !important;
  left: 16px !important;
  right: 16px !important;
  height: 300px !important;
  background: radial-gradient(circle at 28% 26%, rgba(255,255,255,.5), transparent 18%), linear-gradient(145deg, #172033, #5b7480 48%, #c7a66a 49%, #2d3b2f 100%) !important;
  border-radius: 2px !important;
}
#screen-dialog.dialog-style-polaroid .bubble::after {
  content: "found photo" !important;
  position: absolute !important;
  left: 28px !important;
  bottom: 20px !important;
  color: rgba(31,41,55,.5) !important;
  border: 0 !important;
  font-family: "Segoe Print", cursive !important;
}

#screen-dialog.dialog-style-phone #chat-list { background: radial-gradient(circle at 50% 12%, rgba(34,197,94,.22), transparent 22%), #02040a !important; }
#screen-dialog.dialog-style-phone .bubble-row { width: min(88vw, 390px) !important; max-width: 390px !important; }
#screen-dialog.dialog-style-phone .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-phone .bubble {
  min-height: min(66vh, 600px) !important;
  padding: 96px 30px 108px !important;
  background: radial-gradient(circle at 50% 86%, rgba(34,197,94,.2), transparent 18%), linear-gradient(180deg, #111827, #030712) !important;
  border: 14px solid #070a12 !important;
  border-radius: 38px !important;
  color: #ecfff3 !important;
  box-shadow: 0 0 0 3px #262c38, 0 32px 86px rgba(0,0,0,.78) !important;
}
#screen-dialog.dialog-style-phone .bubble::before {
  content: "incoming call" !important;
  position: absolute !important;
  top: 28px !important;
  left: 0 !important;
  right: 0 !important;
  color: #22c55e !important;
  text-align: center !important;
  font-weight: 900 !important;
  letter-spacing: .2em !important;
}
#screen-dialog.dialog-style-phone .bubble::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  bottom: 28px !important;
  width: 72px !important;
  height: 72px !important;
  transform: translateX(-50%) !important;
  border-radius: 50% !important;
  background: #22c55e !important;
  border: 0 !important;
  box-shadow: 0 0 24px rgba(34,197,94,.6) !important;
}

#screen-dialog.dialog-style-video #chat-list { background: repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 1px, transparent 1px 5px), #020202 !important; }
#screen-dialog.dialog-style-video .bubble-row { width: min(94vw, 780px) !important; max-width: 780px !important; }
#screen-dialog.dialog-style-video .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-video .bubble {
  min-height: min(58vh, 450px) !important;
  padding: 76px 48px 58px !important;
  background: radial-gradient(circle at center, rgba(255,255,255,.04), transparent 35%), #050505 !important;
  color: #fff !important;
  border: 4px solid #242424 !important;
  border-radius: 2px !important;
  box-shadow: 0 0 0 18px #0b0b0b, 0 34px 90px rgba(0,0,0,.82) !important;
}
#screen-dialog.dialog-style-video .bubble::before {
  content: "" !important;
  position: absolute !important;
  inset: 18px !important;
  border: 2px solid rgba(255,255,255,.42) !important;
}
#screen-dialog.dialog-style-video .bubble::after {
  content: "REC" !important;
  position: absolute !important;
  top: 32px !important;
  right: 36px !important;
  color: #ff3232 !important;
  border: 0 !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-detective #chat-list {
  background: linear-gradient(45deg, rgba(135,29,29,.46) 0 2px, transparent 2px 48%), linear-gradient(-24deg, transparent 0 43%, rgba(135,29,29,.34) 43% 44%, transparent 44%), #6d4728 !important;
}
#screen-dialog.dialog-style-detective .bubble-row { width: min(92vw, 660px) !important; max-width: 660px !important; }
#screen-dialog.dialog-style-detective .bubble {
  min-height: 360px !important;
  padding: 52px 34px 34px !important;
  background: linear-gradient(180deg, rgba(255,255,255,.16), transparent 24%), #eedfb7 !important;
  border: 0 !important;
  border-radius: 2px !important;
  transform: rotate(1.5deg) !important;
}
#screen-dialog.dialog-style-detective .bubble::before,
#screen-dialog.dialog-style-detective .bubble::after {
  content: "" !important;
  position: absolute !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: #cfa05f !important;
  border: 0 !important;
}
#screen-dialog.dialog-style-detective .bubble::before { top: -12px !important; left: 34px !important; }
#screen-dialog.dialog-style-detective .bubble::after { top: -10px !important; right: 42px !important; }

#screen-dialog.dialog-style-safe #chat-list { background: radial-gradient(circle at center, #343b46 0 118px, #151a22 119px 220px, #080a0d 221px) !important; }
#screen-dialog.dialog-style-safe .bubble-row { width: min(88vw, 470px) !important; max-width: 470px !important; }
#screen-dialog.dialog-style-safe .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-safe .bubble {
  min-height: min(72vw, 470px) !important;
  aspect-ratio: 1 / 1 !important;
  padding: 112px 54px 64px !important;
  border-radius: 50% !important;
  background: radial-gradient(circle at 50% 50%, #252c35 0 24%, #49515d 25% 28%, #242a33 29% 55%, #687180 56% 58%, #2a303a 59%) !important;
  border: 10px solid #87909e !important;
  box-shadow: 0 0 0 14px #1a1f27, 0 38px 94px rgba(0,0,0,.78), inset 0 0 44px rgba(0,0,0,.55) !important;
}
#screen-dialog.dialog-style-safe .bubble::before {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  top: 34px !important;
  width: 112px !important;
  height: 112px !important;
  transform: translateX(-50%) !important;
  border-radius: 50% !important;
  background: linear-gradient(0deg, transparent 45%, #c8d0dc 46% 54%, transparent 55%), linear-gradient(90deg, transparent 45%, #c8d0dc 46% 54%, transparent 55%), radial-gradient(circle, #111 0 18%, #8a95a4 19% 27%, #333b46 28%) !important;
}
#screen-dialog.dialog-style-safe .bubble::after { content: "" !important; border: 0 !important; }

#screen-dialog.dialog-style-scanner .bubble {
  min-height: 420px !important;
  padding: 86px 40px 48px !important;
  background: linear-gradient(180deg, rgba(62,214,239,.09), transparent 22%), #071b25 !important;
  color: #d8fcff !important;
  border: 2px solid #3ed6ef !important;
  border-radius: 10px !important;
  font-family: "Courier New", monospace !important;
}
#screen-dialog.dialog-style-scanner .bubble::before {
  content: "ANALYSE LAEUFT" !important;
  position: absolute !important;
  top: 24px !important;
  left: 28px !important;
  color: #3ed6ef !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-gps .bubble-row { width: min(88vw, 470px) !important; max-width: 470px !important; }
#screen-dialog.dialog-style-gps .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-gps .bubble {
  min-height: min(68vh, 570px) !important;
  padding: 112px 34px 92px !important;
  background: linear-gradient(180deg, #4f5d42 0 74px, #b8d78a 74px calc(100% - 70px), #4f5d42 calc(100% - 70px)) !important;
  border: 12px solid #151b13 !important;
  border-radius: 34px !important;
  color: #17220f !important;
  font-family: "Courier New", monospace !important;
}
#screen-dialog.dialog-style-gps .bubble::before {
  content: "" !important;
  position: absolute !important;
  left: 30px !important;
  right: 30px !important;
  top: 86px !important;
  bottom: 86px !important;
  border: 5px solid #11180f !important;
  border-radius: 8px !important;
  background: linear-gradient(rgba(23,34,15,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(23,34,15,.18) 1px, transparent 1px), #b8d78a !important;
  background-size: 28px 28px !important;
  z-index: -1 !important;
}
#screen-dialog.dialog-style-gps .bubble::after {
  content: "GPS FIX 3D" !important;
  position: absolute !important;
  top: 32px !important;
  left: 0 !important;
  right: 0 !important;
  color: #e8ff93 !important;
  border: 0 !important;
  text-align: center !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-compass .bubble-row { width: min(88vw, 510px) !important; max-width: 510px !important; }
#screen-dialog.dialog-style-compass .bubble-row .avatar { display: none !important; }
#screen-dialog.dialog-style-compass .bubble {
  min-height: min(82vw, 510px) !important;
  aspect-ratio: 1 / 1 !important;
  padding: 150px 72px 78px !important;
  border-radius: 50% !important;
  background: radial-gradient(circle at 50% 50%, #f1d99e 0 42%, #c9964b 43% 50%, #593318 51% 57%, #c9964b 58%) !important;
  border: 12px solid #6a3f20 !important;
  box-shadow: 0 0 0 8px #d7b56b, 0 36px 88px rgba(0,0,0,.72), inset 0 0 42px rgba(87,49,20,.32) !important;
}
#screen-dialog.dialog-style-compass .bubble::before {
  content: "N" !important;
  position: absolute !important;
  top: 30px !important;
  left: 0 !important;
  right: 0 !important;
  text-align: center !important;
  color: #5b260f !important;
  font-size: 1.45rem !important;
}
#screen-dialog.dialog-style-compass .bubble::after {
  content: "" !important;
  top: 64px !important;
  height: 150px !important;
  width: 18px !important;
  border: 0 !important;
  background: linear-gradient(180deg, #d71920 0 50%, #f7ead0 51%) !important;
  transform: translateX(-50%) rotate(24deg) !important;
}

#screen-dialog.dialog-style-terminal .bubble {
  min-height: 420px !important;
  padding: 72px 34px 34px !important;
  background: repeating-linear-gradient(0deg, rgba(118,255,138,.08) 0 2px, transparent 2px 5px), #020d05 !important;
  border: 4px solid #163f20 !important;
  box-shadow: 0 0 0 14px #050505, 0 34px 86px rgba(0,0,0,.78), inset 0 0 42px rgba(30,215,96,.16) !important;
}
#screen-dialog.dialog-style-terminal .bubble::after {
  content: "ACCESS GRANTED" !important;
  position: absolute !important;
  top: 22px !important;
  left: 30px !important;
  color: #76ff8a !important;
  border: 0 !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-emergency .bubble {
  min-height: 380px !important;
  padding: 82px 38px 40px !important;
  background: linear-gradient(90deg, #b91c1c 0 24px, #fff1f2 24px calc(100% - 24px), #b91c1c calc(100% - 24px)) !important;
  border: 4px solid #7f1d1d !important;
  border-radius: 8px !important;
  color: #3b0709 !important;
}
#screen-dialog.dialog-style-emergency .bubble::before {
  content: "EINSATZMELDUNG" !important;
  position: absolute !important;
  top: 20px !important;
  left: 24px !important;
  right: 24px !important;
  padding: 10px 14px !important;
  color: #fff !important;
  background: #b91c1c !important;
  text-align: center !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-inventory .bubble {
  min-height: 360px !important;
  padding: 92px 42px 40px !important;
  background: linear-gradient(180deg, #8a6331 0 70px, #ead8b6 70px) !important;
  border: 5px solid #3f2b14 !important;
  border-radius: 12px !important;
  color: #2a1b0d !important;
}
#screen-dialog.dialog-style-inventory .bubble::after {
  content: "NEUER FUND" !important;
  position: absolute !important;
  top: 34px !important;
  left: 0 !important;
  right: 0 !important;
  color: #fff0c5 !important;
  border: 0 !important;
  text-align: center !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-riddle .bubble {
  min-height: 380px !important;
  padding: 74px 42px 42px !important;
  background: radial-gradient(circle at 92% 16%, rgba(124,58,237,.18), transparent 15%), #f2e8ff !important;
  border: 4px solid #7c3aed !important;
  border-radius: 16px !important;
  color: #23113c !important;
}
#screen-dialog.dialog-style-riddle .bubble::before {
  content: "?" !important;
  position: absolute !important;
  top: 18px !important;
  right: 28px !important;
  color: rgba(124,58,237,.24) !important;
  font-size: 6rem !important;
  font-weight: 900 !important;
}

#screen-dialog.dialog-style-audio .bubble {
  min-height: 370px !important;
  padding: 76px 40px 126px !important;
  background: linear-gradient(180deg, #1f2937 0 82px, #111827 82px) !important;
  color: #dbeafe !important;
  border: 5px solid #374151 !important;
  border-radius: 18px !important;
}
#screen-dialog.dialog-style-audio .bubble::before {
  content: "HOERSPIEL" !important;
  position: absolute !important;
  left: 26px !important;
  right: 26px !important;
  top: 26px !important;
  color: #bfdbfe !important;
  text-align: center !important;
  font-weight: 900 !important;
}
#screen-dialog.dialog-style-audio .bubble::after {
  content: "" !important;
  position: absolute !important;
  left: 34px !important;
  right: 34px !important;
  bottom: 34px !important;
  height: 72px !important;
  background: radial-gradient(circle at 20% 50%, #0b1020 0 32px, #93c5fd 33px 35px, transparent 36px), radial-gradient(circle at 80% 50%, #0b1020 0 32px, #93c5fd 33px 35px, transparent 36px), linear-gradient(90deg, #60a5fa 0 5px, transparent 5px 12px) !important;
  border: 2px solid #60a5fa !important;
  border-radius: 12px !important;
}

#screen-dialog.dialog-style-ar .bubble {
  min-height: 420px !important;
  padding: 74px 48px 52px !important;
  background: rgba(4,24,33,.54) !important;
  color: #e8fdff !important;
  border: 2px solid rgba(77,208,225,.86) !important;
  border-radius: 0 !important;
  box-shadow: 0 0 0 1px rgba(77,208,225,.32), 0 0 42px rgba(77,208,225,.22), inset 0 0 50px rgba(77,208,225,.08) !important;
}
#screen-dialog.dialog-style-ar .bubble::before {
  content: "AR TARGET LOCK" !important;
  position: absolute !important;
  top: 22px !important;
  left: 28px !important;
  color: #4dd0e1 !important;
  font-family: "Courier New", monospace !important;
  font-weight: 900 !important;
}
#screen-dialog.dialog-style-ar .bubble::after {
  content: "" !important;
  position: absolute !important;
  inset: 18px !important;
  border: 0 !important;
  background:
    linear-gradient(#4dd0e1, #4dd0e1) left top / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) left top / 3px 72px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right top / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right top / 3px 72px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) left bottom / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) left bottom / 3px 72px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right bottom / 72px 3px no-repeat,
    linear-gradient(#4dd0e1, #4dd0e1) right bottom / 3px 72px no-repeat !important;
  opacity: .62 !important;
}

@media (max-width: 560px) {
  #screen-dialog.dialog-style-diary .bubble,
  #screen-dialog.dialog-style-newspaper .bubble {
    column-count: 1 !important;
  }
  #screen-dialog.dialog-style-polaroid .bubble {
    min-height: 430px !important;
    padding-top: 270px !important;
  }
  #screen-dialog.dialog-style-polaroid .bubble::before {
    height: 240px !important;
  }
  #screen-dialog.dialog-style-safe .bubble,
  #screen-dialog.dialog-style-compass .bubble {
    width: min(92vw, 430px) !important;
    min-height: min(92vw, 430px) !important;
    padding-left: 42px !important;
    padding-right: 42px !important;
  }
}

/* Finaler Feinschliff nach Sichtpruefung: gewinnt gegen alle vorherigen Regeln. */
#screen-dialog:is(
  .dialog-style-diary,
  .dialog-style-dossier,
  .dialog-style-newspaper,
  .dialog-style-bottle,
  .dialog-style-treasure-map,
  .dialog-style-polaroid,
  .dialog-style-phone,
  .dialog-style-video,
  .dialog-style-detective,
  .dialog-style-safe,
  .dialog-style-scanner,
  .dialog-style-gps,
  .dialog-style-compass,
  .dialog-style-mystery,
  .dialog-style-terminal,
  .dialog-style-emergency,
  .dialog-style-inventory,
  .dialog-style-riddle,
  .dialog-style-audio,
  .dialog-style-ar
) .npc-label {
  display: none !important;
}

#screen-dialog.dialog-style-newspaper .bubble {
  padding-top: 126px !important;
}

#screen-dialog.dialog-style-newspaper .bubble::after {
  top: 84px !important;
}

#screen-dialog.dialog-style-gps .bubble {
  padding-left: 68px !important;
  padding-right: 68px !important;
}

@media (max-width: 560px) {
  #screen-dialog.dialog-style-newspaper .bubble {
    padding-top: 112px !important;
  }

  #screen-dialog.dialog-style-gps .bubble {
    padding-left: 44px !important;
    padding-right: 44px !important;
  }
}

/* Datei-Ende-Override: finaler 3D-Look fuer alle Dialogboxen. */
#screen-dialog[class*="dialog-style-"] #chat-list {
  perspective: 1250px !important;
  perspective-origin: 50% 36% !important;
}

#screen-dialog[class*="dialog-style-"] .bubble-row {
  transform-style: preserve-3d !important;
  filter: drop-shadow(0 22px 32px rgba(5, 10, 22, .25)) !important;
}

#screen-dialog[class*="dialog-style-"][class*="dialog-style-"] .bubble {
  transform: rotateX(4deg) rotateY(-4deg) rotateZ(0deg) translateZ(28px) !important;
  transform-style: preserve-3d !important;
  transform-origin: 50% 58% !important;
  backface-visibility: hidden !important;
  box-shadow:
    0 34px 62px rgba(6, 10, 22, .32),
    0 14px 22px rgba(6, 10, 22, .2),
    inset 0 1px 0 rgba(255, 255, 255, .42),
    inset 0 -16px 28px rgba(0, 0, 0, .08) !important;
  transition: transform .22s ease, box-shadow .22s ease, filter .22s ease !important;
}

#screen-dialog[class*="dialog-style-"][class*="dialog-style-"] .bubble:not(.narrator):hover {
  transform: rotateX(3deg) rotateY(-3deg) rotateZ(0deg) translateY(-3px) translateZ(42px) !important;
  box-shadow:
    0 42px 72px rgba(6, 10, 22, .36),
    0 18px 28px rgba(6, 10, 22, .23),
    inset 0 1px 0 rgba(255, 255, 255, .48),
    inset 0 -18px 32px rgba(0, 0, 0, .1) !important;
}

#screen-dialog.dialog-style-chat.dialog-style-chat .bubble { transform: rotateX(2deg) rotateY(-2deg) translateZ(16px) !important; }
#screen-dialog.dialog-style-adventure.dialog-style-adventure .bubble,
#screen-dialog.dialog-style-box.dialog-style-box .bubble { transform: rotateX(7deg) rotateY(-8deg) translateZ(34px) !important; }
#screen-dialog.dialog-style-letter.dialog-style-letter .bubble { transform: rotateX(5deg) rotateY(0deg) rotateZ(-.4deg) translateZ(30px) !important; }
#screen-dialog.dialog-style-radio.dialog-style-radio .bubble { transform: rotateX(6deg) rotateY(7deg) translateZ(32px) !important; }
#screen-dialog.dialog-style-mission.dialog-style-mission .bubble { transform: rotateX(4deg) rotateY(-7deg) translateZ(30px) !important; }
#screen-dialog.dialog-style-comic.dialog-style-comic .bubble { transform: rotateX(3deg) rotateY(-5deg) rotateZ(-.8deg) translateZ(34px) !important; }
#screen-dialog.dialog-style-diary.dialog-style-diary .bubble,
#screen-dialog.dialog-style-dossier.dialog-style-dossier .bubble,
#screen-dialog.dialog-style-newspaper.dialog-style-newspaper .bubble,
#screen-dialog.dialog-style-treasure-map.dialog-style-treasure-map .bubble { transform: rotateX(6deg) rotateY(-3deg) rotateZ(-.8deg) translateZ(32px) !important; }
#screen-dialog.dialog-style-bottle.dialog-style-bottle .bubble,
#screen-dialog.dialog-style-polaroid.dialog-style-polaroid .bubble { transform: rotateX(5deg) rotateY(-6deg) rotateZ(-1deg) translateZ(34px) !important; }
#screen-dialog.dialog-style-phone.dialog-style-phone .bubble,
#screen-dialog.dialog-style-video.dialog-style-video .bubble,
#screen-dialog.dialog-style-scanner.dialog-style-scanner .bubble,
#screen-dialog.dialog-style-gps.dialog-style-gps .bubble,
#screen-dialog.dialog-style-terminal.dialog-style-terminal .bubble,
#screen-dialog.dialog-style-audio.dialog-style-audio .bubble,
#screen-dialog.dialog-style-ar.dialog-style-ar .bubble { transform: rotateX(6deg) rotateY(6deg) translateZ(36px) !important; }
#screen-dialog.dialog-style-detective.dialog-style-detective .bubble,
#screen-dialog.dialog-style-safe.dialog-style-safe .bubble,
#screen-dialog.dialog-style-compass.dialog-style-compass .bubble,
#screen-dialog.dialog-style-mystery.dialog-style-mystery .bubble,
#screen-dialog.dialog-style-emergency.dialog-style-emergency .bubble,
#screen-dialog.dialog-style-inventory.dialog-style-inventory .bubble,
#screen-dialog.dialog-style-riddle.dialog-style-riddle .bubble { transform: rotateX(7deg) rotateY(-6deg) translateZ(34px) !important; }

#screen-dialog.dialog-style-comic.dialog-style-comic .chat-footer .btn.primary,
#screen-dialog.dialog-style-comic.dialog-style-comic .choice-btn {
  transform: perspective(560px) rotateX(5deg) rotateZ(-1deg) translateZ(14px) !important;
  transform-style: preserve-3d !important;
  box-shadow:
    5px 5px 0 #000,
    0 18px 28px rgba(0, 0, 0, .24),
    inset 0 1px 0 rgba(255, 255, 255, .5) !important;
}

@media (max-width: 560px) {
  #screen-dialog[class*="dialog-style-"][class*="dialog-style-"] .bubble {
    transform: rotateX(3deg) rotateY(-2deg) translateZ(18px) !important;
  }
}

/* NPC- und Tresor-Fix: Namen/Icon bleiben sichtbar, Tresor-Text bekommt ein lesbares Bedienfeld. */
#screen-dialog[class*="dialog-style-"] .bubble .bubble-text {
  position: relative;
  z-index: 3;
}

#screen-dialog[class*="dialog-style-"] .bubble-row {
  align-items: flex-start !important;
  gap: 12px !important;
}

#screen-dialog[class*="dialog-style-"] .bubble-row > div:not(.avatar) {
  min-width: 0 !important;
}

#screen-dialog[class*="dialog-style-"] .bubble-row .avatar {
  display: flex !important;
  flex: 0 0 38px !important;
  width: 38px !important;
  height: 38px !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 4px !important;
  border-radius: 12px !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.32), transparent 30%),
    linear-gradient(145deg, rgba(121,166,255,.92), rgba(37,63,156,.96)) !important;
  color: #fff !important;
  border: 1px solid rgba(213,225,255,.62) !important;
  box-shadow: 0 12px 24px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.3) !important;
  font-weight: 900 !important;
  overflow: hidden !important;
}

#screen-dialog[class*="dialog-style-"] .bubble-row .avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

#screen-dialog[class*="dialog-style-"] .npc-label {
  display: inline-flex !important;
  align-items: center !important;
  max-width: 100% !important;
  margin: 0 0 6px !important;
  padding: 4px 9px !important;
  border-radius: 999px !important;
  background: rgba(6, 10, 22, .74) !important;
  color: #eaf2ff !important;
  border: 1px solid rgba(185,209,255,.28) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.2) !important;
  font-size: .72rem !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;
  letter-spacing: .03em !important;
  text-transform: uppercase !important;
}

#screen-dialog[class*="dialog-style-"] .bubble-meta {
  display: block !important;
  opacity: .78 !important;
}

#screen-dialog.dialog-style-comic .npc-label {
  background: #ffe600 !important;
  color: #080808 !important;
  border: 3px solid #080808 !important;
  border-radius: 0 !important;
  box-shadow: 4px 4px 0 #080808 !important;
}

#screen-dialog.dialog-style-letter .npc-label,
#screen-dialog.dialog-style-diary .npc-label,
#screen-dialog.dialog-style-newspaper .npc-label,
#screen-dialog.dialog-style-treasure-map .npc-label {
  background: rgba(255,248,218,.86) !important;
  color: #3a2409 !important;
  border-color: rgba(98,65,28,.28) !important;
}

#screen-dialog.dialog-style-radio .npc-label,
#screen-dialog.dialog-style-terminal .npc-label,
#screen-dialog.dialog-style-scanner .npc-label,
#screen-dialog.dialog-style-gps .npc-label {
  background: rgba(0,18,12,.82) !important;
  color: #6dff88 !important;
  border-color: rgba(109,255,136,.34) !important;
  font-family: "Courier New", monospace !important;
}

#screen-dialog.dialog-style-safe .bubble-row {
  width: min(94vw, 610px) !important;
  max-width: 610px !important;
  align-items: flex-start !important;
}

#screen-dialog.dialog-style-safe .bubble-row > div:not(.avatar) {
  flex: 1 1 auto !important;
}

#screen-dialog.dialog-style-safe .bubble-row .avatar {
  background:
    radial-gradient(circle at 50% 48%, #111 0 28%, #f4c430 30% 35%, #333b46 36%),
    linear-gradient(145deg, #697280, #20262f) !important;
  border-color: rgba(244,196,48,.72) !important;
  color: #f4c430 !important;
}

#screen-dialog.dialog-style-safe .npc-label {
  background: linear-gradient(180deg, #f4c430, #a97712) !important;
  color: #171106 !important;
  border-color: #fff0a8 !important;
  text-shadow: none !important;
}

#screen-dialog.dialog-style-safe .bubble {
  color: #fff9df !important;
  text-align: center !important;
  font-weight: 900 !important;
  line-height: 1.35 !important;
  text-shadow: 0 2px 8px rgba(0,0,0,.88) !important;
  overflow: visible !important;
  isolation: isolate !important;
}

#screen-dialog.dialog-style-safe .bubble::before,
#screen-dialog.dialog-style-safe .bubble::after {
  z-index: 1 !important;
  pointer-events: none !important;
}

#screen-dialog.dialog-style-safe .bubble .bubble-text {
  display: block !important;
  position: relative !important;
  z-index: 4 !important;
  max-width: 285px !important;
  margin: 0 auto !important;
  padding: 14px 16px !important;
  background: rgba(7, 11, 17, .84) !important;
  border: 1px solid rgba(244,196,48,.66) !important;
  border-radius: 14px !important;
  box-shadow: 0 16px 32px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.12) !important;
}

@media (max-width: 560px) {
  #screen-dialog[class*="dialog-style-"] .bubble-row {
    gap: 9px !important;
  }

  #screen-dialog[class*="dialog-style-"] .bubble-row .avatar {
    flex-basis: 34px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
  }

  #screen-dialog.dialog-style-safe .bubble .bubble-text {
    max-width: 240px !important;
    padding: 12px 13px !important;
  }
}

/* Dialog-Finish: Detektivname, Abenteuerbox-Abstand und helleres Terminal. */
#screen-dialog.dialog-style-detective .bubble-row {
  position: relative !important;
  padding-top: 10px !important;
}

#screen-dialog.dialog-style-detective .bubble-row > div:not(.avatar) {
  position: relative !important;
  z-index: 4 !important;
}

#screen-dialog.dialog-style-detective .bubble-row .avatar {
  position: relative !important;
  z-index: 5 !important;
  background:
    radial-gradient(circle at 50% 44%, #fff4bd 0 22%, #7a3a18 24% 32%, #221208 34%),
    linear-gradient(145deg, #f2d58f, #8a4f24) !important;
  border: 2px solid #2b1608 !important;
  color: #2b1608 !important;
  box-shadow: 0 10px 20px rgba(0,0,0,.38), 0 0 0 3px rgba(238,223,183,.82) !important;
}

#screen-dialog.dialog-style-detective .npc-label {
  position: relative !important;
  z-index: 6 !important;
  display: inline-flex !important;
  margin: 0 0 10px 0 !important;
  background: #f7e8be !important;
  color: #261407 !important;
  border: 2px solid #4b2810 !important;
  border-radius: 4px !important;
  box-shadow: 4px 5px 0 rgba(0,0,0,.28) !important;
  font-family: Georgia, "Times New Roman", serif !important;
}

#screen-dialog.dialog-style-detective .bubble .bubble-text {
  color: #241205 !important;
  text-shadow: none !important;
}

#screen-dialog.dialog-style-adventure .bubble-row,
#screen-dialog.dialog-style-box .bubble-row {
  gap: 12px !important;
  padding-top: 8px !important;
}

#screen-dialog.dialog-style-adventure .bubble-row .avatar,
#screen-dialog.dialog-style-box .bubble-row .avatar {
  margin: 0 auto 8px !important;
  z-index: 6 !important;
  transform: translateY(0) !important;
}

#screen-dialog.dialog-style-adventure .bubble-row > div:not(.avatar),
#screen-dialog.dialog-style-box .bubble-row > div:not(.avatar) {
  position: relative !important;
  z-index: 4 !important;
  padding-top: 0 !important;
  width: 100% !important;
}

#screen-dialog.dialog-style-adventure .npc-label,
#screen-dialog.dialog-style-box .npc-label {
  display: flex !important;
  justify-content: center !important;
  width: fit-content !important;
  max-width: calc(100% - 24px) !important;
  margin: 0 auto 10px !important;
  padding: 6px 14px !important;
  background: linear-gradient(180deg, #ffe9a8, #c79532) !important;
  color: #261407 !important;
  border: 2px solid #3d2a10 !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.45) !important;
  text-shadow: none !important;
}

#screen-dialog.dialog-style-adventure .bubble,
#screen-dialog.dialog-style-box .bubble {
  padding-top: 26px !important;
}

#screen-dialog.dialog-style-terminal .bubble {
  color: #d8ffdf !important;
  background:
    repeating-linear-gradient(0deg, rgba(98,255,134,.07) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, rgba(9,44,19,.96), rgba(1,14,6,.98)) !important;
  text-shadow: 0 0 7px rgba(118,255,138,.82) !important;
  font-weight: 800 !important;
}

#screen-dialog.dialog-style-terminal .bubble .bubble-text {
  color: #d8ffdf !important;
}

#screen-dialog.dialog-style-terminal .npc-label {
  background: rgba(2, 26, 10, .95) !important;
  color: #baffc5 !important;
  border-color: rgba(118,255,138,.72) !important;
  text-shadow: 0 0 8px rgba(118,255,138,.72) !important;
}

#screen-dialog.dialog-style-terminal .bubble-row .avatar {
  color: #caffd2 !important;
  border-color: rgba(118,255,138,.7) !important;
  box-shadow: 0 0 18px rgba(118,255,138,.34), inset 0 1px 0 rgba(255,255,255,.18) !important;
}

@media (max-width: 560px) {
  #screen-dialog.dialog-style-adventure .bubble-row .avatar,
  #screen-dialog.dialog-style-box .bubble-row .avatar {
    margin-bottom: 6px !important;
  }

  #screen-dialog.dialog-style-adventure .npc-label,
  #screen-dialog.dialog-style-box .npc-label {
    max-width: calc(100% - 12px) !important;
    font-size: .68rem !important;
  }
}

/* Dialog-Lesbarkeit: Deko bleibt 3D, Text liegt klar auf einem ruhigen Lesefeld. */
#screen-dialog:is(
  .dialog-style-scanner,
  .dialog-style-compass,
  .dialog-style-treasure-map,
  .dialog-style-newspaper,
  .dialog-style-dossier
) .bubble {
  isolation: isolate !important;
  overflow: hidden !important;
}

#screen-dialog:is(
  .dialog-style-scanner,
  .dialog-style-compass,
  .dialog-style-treasure-map,
  .dialog-style-newspaper,
  .dialog-style-dossier
) .dialog-speaker {
  display: block !important;
  position: relative !important;
  z-index: 6 !important;
  margin: 0 0 9px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

#screen-dialog:is(
  .dialog-style-scanner,
  .dialog-style-compass,
  .dialog-style-treasure-map,
  .dialog-style-newspaper,
  .dialog-style-dossier
) .bubble .bubble-text {
  display: block !important;
  position: relative !important;
  z-index: 6 !important;
  margin-inline: auto !important;
  line-height: 1.45 !important;
  text-shadow: none !important;
}

#screen-dialog.dialog-style-scanner .bubble {
  min-height: min(62vh, 460px) !important;
  padding: 92px 34px 46px !important;
}

#screen-dialog.dialog-style-scanner .bubble::after {
  top: 64px !important;
  bottom: auto !important;
  height: 2px !important;
  opacity: .42 !important;
  animation: none !important;
  z-index: 1 !important;
}

#screen-dialog.dialog-style-scanner .bubble .bubble-text {
  max-width: 420px !important;
  padding: 14px 16px !important;
  color: #e6fdff !important;
  background: rgba(2, 16, 24, .72) !important;
  border: 1px solid rgba(62,214,239,.24) !important;
  border-radius: 10px !important;
  box-shadow: 0 14px 28px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.08) !important;
}

#screen-dialog.dialog-style-compass .bubble::after {
  z-index: 1 !important;
  opacity: .26 !important;
  transform: translateX(-50%) rotate(24deg) !important;
}

#screen-dialog.dialog-style-compass .dialog-speaker,
#screen-dialog.dialog-style-compass .bubble .bubble-text {
  color: #241507 !important;
}

#screen-dialog.dialog-style-compass .bubble .bubble-text {
  max-width: min(68vw, 310px) !important;
  padding: 12px 14px !important;
  background: rgba(255, 242, 192, .82) !important;
  border: 1px solid rgba(91,48,13,.18) !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 26px rgba(91,48,13,.14), inset 0 1px 0 rgba(255,255,255,.42) !important;
}

#screen-dialog.dialog-style-treasure-map .bubble::after {
  z-index: 1 !important;
  opacity: .34 !important;
  right: 34px !important;
  top: 34px !important;
}

#screen-dialog.dialog-style-treasure-map .dialog-speaker,
#screen-dialog.dialog-style-treasure-map .bubble .bubble-text {
  color: #33200b !important;
}

#screen-dialog.dialog-style-treasure-map .bubble .bubble-text {
  max-width: min(74vw, 430px) !important;
  padding: 13px 16px !important;
  background: rgba(255, 232, 169, .78) !important;
  border: 1px solid rgba(120,78,24,.22) !important;
  border-radius: 16px 12px 18px 10px !important;
  box-shadow: 0 12px 26px rgba(79,41,13,.16), inset 0 1px 0 rgba(255,255,255,.34) !important;
}

#screen-dialog.dialog-style-newspaper .bubble {
  column-count: 1 !important;
  column-gap: 0 !important;
  padding: 104px 34px 34px !important;
  background: repeating-linear-gradient(0deg, #f3edda 0 18px, #e8dfc8 18px 19px) !important;
}

#screen-dialog.dialog-style-newspaper .bubble::after {
  z-index: 1 !important;
}

#screen-dialog.dialog-style-newspaper .dialog-speaker,
#screen-dialog.dialog-style-newspaper .bubble .bubble-text {
  color: #111 !important;
}

#screen-dialog.dialog-style-newspaper .bubble .bubble-text {
  max-width: min(76vw, 450px) !important;
  padding: 4px 8px 8px !important;
  background: rgba(247,241,220,.72) !important;
}

#screen-dialog.dialog-style-dossier .bubble::after {
  z-index: 1 !important;
  opacity: .18 !important;
  top: 120px !important;
  right: 18px !important;
}

#screen-dialog.dialog-style-dossier .dialog-speaker,
#screen-dialog.dialog-style-dossier .bubble .bubble-text {
  color: #2b1a08 !important;
}

#screen-dialog.dialog-style-dossier .bubble .bubble-text {
  max-width: min(76vw, 420px) !important;
  padding: 14px 16px !important;
  background: rgba(255, 238, 189, .82) !important;
  border: 1px solid rgba(87,52,15,.18) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 28px rgba(96,56,14,.16), inset 0 1px 0 rgba(255,255,255,.38) !important;
}

@media (max-width: 560px) {
  #screen-dialog.dialog-style-scanner .bubble,
  #screen-dialog.dialog-style-newspaper .bubble,
  #screen-dialog.dialog-style-dossier .bubble {
    padding-left: 26px !important;
    padding-right: 26px !important;
  }

  #screen-dialog.dialog-style-compass .bubble {
    padding: 132px 42px 64px !important;
  }

  #screen-dialog.dialog-style-treasure-map .bubble {
    padding: 64px 34px 40px !important;
  }
}

#screen-dialog.dialog-style-compass .bubble {
  flex-direction: column !important;
}

#screen-dialog.dialog-style-compass .dialog-speaker,
#screen-dialog.dialog-style-treasure-map .dialog-speaker,
#screen-dialog.dialog-style-newspaper .dialog-speaker,
#screen-dialog.dialog-style-dossier .dialog-speaker {
  width: 100% !important;
  text-align: center !important;
}

#screen-dialog.dialog-style-dossier .bubble {
  overflow: visible !important;
}

#screen-dialog.dialog-style-dossier .bubble::before {
  z-index: 2 !important;
}

/* Final readability pass: keep the prop look, but never let lines cross text. */
#screen-dialog.dialog-style-diary .bubble {
  column-count: 1 !important;
  column-gap: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 76px 42px 44px !important;
  overflow: hidden !important;
}

#screen-dialog.dialog-style-diary .bubble::before {
  z-index: 1 !important;
  opacity: .22 !important;
}

#screen-dialog.dialog-style-diary .dialog-speaker {
  display: block !important;
  position: relative !important;
  z-index: 6 !important;
  width: 100% !important;
  margin: 0 0 10px !important;
  color: #2d1a08 !important;
  text-align: center !important;
}

#screen-dialog.dialog-style-diary .bubble .bubble-text {
  display: block !important;
  position: relative !important;
  z-index: 6 !important;
  max-width: min(70vw, 390px) !important;
  margin-inline: auto !important;
  padding: 12px 16px !important;
  color: #2d1a08 !important;
  background: rgba(255, 237, 184, .78) !important;
  border: 1px solid rgba(92,55,20,.16) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 28px rgba(91,55,20,.14), inset 0 1px 0 rgba(255,255,255,.36) !important;
  line-height: 1.45 !important;
  text-align: center !important;
  text-shadow: none !important;
}

#screen-dialog.dialog-style-letter #chat-list {
  padding-left: 86px !important;
  padding-right: 26px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

#screen-dialog.dialog-style-letter #chat-list::before {
  left: 48px !important;
  opacity: .42 !important;
  z-index: 0 !important;
}

#screen-dialog.dialog-style-letter .bubble-row {
  position: relative !important;
  z-index: 2 !important;
}

#screen-dialog.dialog-style-letter .bubble {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}

#screen-dialog.dialog-style-letter .bubble .bubble-text {
  display: block !important;
  position: relative !important;
  z-index: 4 !important;
}

#screen-dialog.dialog-style-ar #chat-list {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding-bottom: 24px !important;
}

#screen-dialog.dialog-style-ar .bubble {
  min-height: 0 !important;
  max-height: calc(100svh - 198px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  padding: 76px 44px 56px !important;
}

#screen-dialog.dialog-style-ar .bubble .bubble-text {
  display: block !important;
  position: relative !important;
  z-index: 6 !important;
  padding-bottom: 12px !important;
  overflow-wrap: anywhere !important;
}

#screen-dialog.dialog-style-ar .bubble::before,
#screen-dialog.dialog-style-ar .bubble::after {
  pointer-events: none !important;
}

@media (max-width: 560px) {
  #screen-dialog.dialog-style-diary .bubble {
    padding: 72px 28px 40px !important;
  }

  #screen-dialog.dialog-style-letter #chat-list {
    padding-left: 78px !important;
    padding-right: 20px !important;
  }

  #screen-dialog.dialog-style-letter #chat-list::before {
    left: 42px !important;
  }

  #screen-dialog.dialog-style-ar .bubble {
    max-height: calc(100svh - 184px) !important;
    padding-left: 34px !important;
    padding-right: 34px !important;
  }
}

/* Tagebuch: Sprecherlabel deutlich lesbar auf Papier setzen. */
#screen-dialog.dialog-style-diary .dialog-speaker {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  max-width: calc(100% - 32px) !important;
  margin: 0 auto 12px !important;
  padding: 5px 14px !important;
  color: #241204 !important;
  background: linear-gradient(180deg, rgba(255,245,204,.96), rgba(235,204,135,.94)) !important;
  border: 1px solid rgba(95,55,17,.28) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 18px rgba(74,42,20,.18), inset 0 1px 0 rgba(255,255,255,.62) !important;
  font-weight: 900 !important;
  text-align: center !important;
  text-shadow: 0 1px 0 rgba(255,255,255,.42) !important;
}

/* Dialog header: show only the station title on the left. */
#screen-dialog .chat-header #dlg-avatar {
  display: none !important;
}

#screen-dialog .chat-header #dlg-sub {
  display: none !important;
}

#screen-dialog .chat-header #btn-dlg-tts {
  display: none !important;
}

#screen-dialog .chat-header .chip.online {
  display: none !important;
}

#screen-dialog .chat-header .chat-meta {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#screen-dialog .chat-header #dlg-name {
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

/* Narrator label separation for every 3D dialog surface. */
#screen-dialog[class*="dialog-style-"] .bubble.narrator {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
}

#screen-dialog[class*="dialog-style-"] .bubble.narrator .dialog-speaker {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  line-height: 1.2 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

#screen-dialog[class*="dialog-style-"] .bubble.narrator .bubble-text {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
}

#screen-dialog.dialog-style-radio .bubble.narrator,
#screen-dialog.dialog-style-terminal .bubble.narrator {
  align-items: stretch !important;
  text-align: left !important;
}

#screen-dialog.dialog-style-radio .bubble.narrator .dialog-speaker,
#screen-dialog.dialog-style-terminal .bubble.narrator .dialog-speaker {
  margin-left: 0 !important;
  margin-right: 0 !important;
  justify-content: flex-start !important;
}

/* Player choices live directly below the current dialog text, not down in the footer. */
#screen-dialog #chat-list.has-inline-choices,
#screen-dialog #chat-list:has(> #chat-choices.inline-choices) {
  justify-content: flex-start !important;
  overflow-y: auto !important;
}

#screen-dialog #chat-list > #chat-choices.inline-choices {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  flex: 0 0 auto !important;
  flex-direction: column !important;
  align-self: center !important;
  gap: 10px !important;
  width: min(88vw, 430px) !important;
  max-width: 430px !important;
  margin: 12px auto 4px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  z-index: 20 !important;
  pointer-events: auto !important;
}

#screen-dialog #chat-list > #chat-choices.inline-choices[hidden] {
  display: none !important;
}

#screen-dialog #chat-list > #chat-choices.inline-choices .choice-btn {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 46px !important;
  text-align: center !important;
}

#screen-dialog #chat-list .bubble-row.choice-anchor:not(:last-child) {
  display: flex !important;
}

#screen-dialog.dialog-style-radio #chat-list > #chat-choices.inline-choices .choice-btn,
#screen-dialog.dialog-style-terminal #chat-list > #chat-choices.inline-choices .choice-btn {
  text-align: center !important;
}

/* Full-screen image sequence shown before a configured dialogue. */
#screen-dialog-prelude {
  flex-direction: column;
  min-height: 100dvh;
  background: #070a12;
  color: #f5f7ff;
}
.dialog-prelude-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
  border-bottom: 1px solid #30364a;
  background: #171b29;
}
.dialog-prelude-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}
.dialog-prelude-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #4b536d;
  border-radius: 999px;
  color: #dbe1f5;
  background: #222839;
  font-size: .8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.dialog-prelude-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  background: #03050a;
}
.dialog-prelude-stage img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 1100px;
  object-fit: contain;
  opacity: 0;
  transform: scale(.985);
  transition: opacity .24s ease, transform .32s ease;
  cursor: pointer;
}
.dialog-prelude-stage img.is-ready { opacity: 1; transform: scale(1); }
.dialog-prelude-error {
  width: min(88vw, 430px);
  padding: 18px;
  border: 1px solid #8e4650;
  border-radius: 8px;
  background: #261319;
  color: #ffd7dc;
  text-align: center;
}
.dialog-prelude-dots {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 7px;
  min-height: 22px;
  padding: 8px 16px 3px;
  background: #101421;
}
.dialog-prelude-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #515a73;
}
.dialog-prelude-dots span.active { width: 22px; border-radius: 5px; background: #7c9ff5; }
.dialog-prelude-footer {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #30364a;
  background: #171b29;
}
.dialog-prelude-footer .btn { min-height: 50px; }
.dialog-prelude-footer .btn.outline { flex: 0 0 112px; }
.dialog-prelude-footer .btn.primary { flex: 1 1 auto; }
@media (max-width: 520px) {
  .dialog-prelude-stage { padding: 8px; }
  .dialog-prelude-header { min-height: 54px; padding-inline: 14px; }
  .dialog-prelude-footer .btn.outline { flex-basis: 96px; }
}
