:root,
[data-theme='dark'] {
  /* Wird von BottomNav per Messung gesetzt (px); Fallback bis zur ersten Messung */
  --htbah-bottom-nav-reserve: 3.5rem;
  --htbah-top-nav-reserve: 0px;
  /* Zusätzliche Luft unter dem letzten Inhalt (alle Seiten mit .content) */
  --htbah-content-ende-luft: 3.25rem;
  --bg-image-url: url('assets/img/bg-desktop.png');
  --bg-overlay-color: rgba(2, 6, 23, 0.62);
  --bg-color: #0f172a;
  --text-color: #e5e7eb;
  --heading-color: #f9fafb;
  --paragraph-color: #cbd5f5;
  --list-color: #e2e8f0;
  --card-bg: #1e293b;
  --card-color: #f1f5f9;
  --border-color: #334155;
  --input-bg: #0f172a;
  --input-color: #f1f5f9;
  --placeholder-color: #64748b;
  --navbar-bg: #1e293b;
  --navbar-link: #cbd5f5;
  --primary-color: #509b4a;
  --success-color: #22c55e;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --secondary-color: #64748b;
  --modal-backdrop: rgba(2, 6, 23, 0.75);
  --modal-bg: #1e293b;
  --htbah-z-modal-base: 2000;
  --htbah-z-modal-wuerfel: 2060;
  --htbah-z-modal-generator: 4060;
  --htbah-z-modal-map: 4070;
  --htbah-z-modal-detail: 4080;
  --htbah-z-modal-crop-backdrop: 4990;
  --htbah-z-modal-crop: 5000;
}

[data-theme='light'] {
  --bg-overlay-color: rgba(248, 250, 252, 0.25);
  --bg-color: #f8fafc;
  --text-color: #0f172a;
  --heading-color: #0f172a;
  --paragraph-color: #334155;
  --list-color: #1e293b;
  --card-bg: #ffffff;
  --card-color: #0f172a;
  --border-color: #cbd5e1;
  --input-bg: #ffffff;
  --input-color: #0f172a;
  --placeholder-color: #64748b;
  --navbar-bg: #ffffff;
  --navbar-link: #334155;
  --primary-color: #336a2b;
  --success-color: #16a34a;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --secondary-color: #64748b;
  --modal-backdrop: rgba(15, 23, 42, 0.4);
  --modal-bg: #ffffff;
}

/* Dark-Theme: Bootstrap-Hilfstexte ausreichend kontrastreich halten */
[data-theme='dark'] .text-body-secondary,
[data-theme='dark'] .text-secondary,
[data-theme='dark'] .text-muted {
  color: var(--paragraph-color) !important;
}

html,
body {
  height: 100%;
  min-height: 100dvh;
  margin: 0;
}

body {
  background-color: var(--bg-color);
  background-image: linear-gradient(
      var(--bg-overlay-color),
      var(--bg-overlay-color)
    ),
    var(--bg-image-url);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text-color);
  font-size: 16px;
}

#app {
  padding-top: 2rem;
}

/* Lebenspunkte: Status-Banner (tot / bewusstlos) */
.htbah-lp-status-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.35;
  border-bottom: 1px solid rgba(15, 23, 42, 0.2);
}

@media (min-width: 992px) {
  .htbah-lp-status-banner {
    top: var(--htbah-top-nav-reserve, 0px);
  }
}

.htbah-lp-status-banner-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  text-align: center;
}

.htbah-lp-status-banner-text {
  flex: 1 1 12rem;
}

.htbah-lp-status-tot {
  background: var(--danger-color);
  color: #fff;
}

.htbah-lp-status-bewusstlos {
  background: var(--warning-color);
  color: #0f172a;
}

/* Spielleitung, Gruppen-Charakterblatt: LP-Status unter Titel, beim Scrollen kleben */
.htbah-sl-charakter-lp-status-sticky {
  position: sticky;
  top: 0;
  z-index: 1025;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.35;
  border-radius: 0.5rem;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.htbah-sl-charakter-lp-status-sticky__inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  text-align: center;
}

.htbah-sl-charakter-lp-status-sticky__text {
  flex: 1 1 12rem;
}

@media (min-width: 992px) {
  .htbah-sl-charakter-lp-status-sticky {
    top: var(--htbah-top-nav-reserve, 0px);
  }
}

.htbah-lp-status-banner-btn {
  flex-shrink: 0;
}

body.htbah-mit-lp-banner #app {
  padding-top: 3.5rem;
}

@media (max-width: 767.98px) {
  body.htbah-mit-lp-banner #app {
    padding-top: 5.85rem;
  }
}

@media (max-width: 767.98px) {
  #app {
    padding-top: 0.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  body.htbah-mit-lp-banner #app {
    padding-top: 5.85rem;
  }

  body.htbah-mit-lp-banner .content {
    padding-top: 4rem;
  }
}

@media (max-width: 991.98px) and (orientation: portrait) {
  :root,
  [data-theme='dark'],
  [data-theme='light'] {
    --bg-image-url: url('assets/img/bg-mobile-device-portrait.png');
  }
}

.card {
  background: var(--card-bg);
  color: var(--card-color);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--border-color);
}

h2,
h4,
h5 {
  color: var(--heading-color);
}

.htbah-page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.htbah-page-title-emoji {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.htbah-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.htbah-back-link:hover,
.htbah-back-link:focus-visible {
  text-decoration: underline;
  color: var(--primary-color);
}

.htbah-back-link .material-symbols-outlined {
  font-size: 1.15rem;
  line-height: 1;
}

p {
  color: var(--paragraph-color);
  margin-bottom: 6px;
}

ul {
  padding-left: 16px;
}

li {
  color: var(--list-color);
  margin-bottom: 4px;
}

input:not([type='checkbox']):not([type='radio']),
select {
  background: var(--input-bg) !important;
  color: var(--input-color) !important;
  border: 1px solid var(--border-color) !important;
}

input:not([type='checkbox']):not([type='radio']).is-valid,
select.is-valid {
  border-color: var(--bs-form-valid-border-color, var(--success-color)) !important;
}

input:not([type='checkbox']):not([type='radio']).is-invalid,
select.is-invalid {
  border-color: var(--bs-form-invalid-border-color, var(--danger-color)) !important;
}

input::placeholder {
  color: var(--placeholder-color);
}

.btn-primary {
  background: var(--primary-color);
  border: none;
}

.btn-success {
  background: var(--success-color);
  border: none;
}

.btn-danger {
  background: var(--danger-color);
  border: none;
}

.btn-warning {
  background: var(--warning-color);
  border: none;
  color: #111827;
}

.btn-secondary {
  background: var(--secondary-color);
  border: none;
}

/* Buttons mit Icon + Text (Bootstrap „labeled“, vgl. CodeHim-Tutorial) */
.btn.btn-labeled {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: nowrap;
  padding: 0;
  padding-inline-end: var(--bs-btn-padding-x);
  line-height: var(--bs-btn-line-height);
  text-align: start;
  vertical-align: middle;
}

/* Slot-Inhalt vertikal zentrieren (Stretch allein richtet Text oben aus) */
.btn.btn-labeled > .btn-labeled-text {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.btn.btn-labeled > .btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: var(--bs-btn-padding-y) 0.65rem;
  margin-inline-end: 0.5rem;
  background: rgba(0, 0, 0, 0.14);
  border-radius: var(--bs-btn-border-radius) 0 0 var(--bs-btn-border-radius);
}

[data-theme='light'] .btn.btn-labeled > .btn-label {
  background: rgba(0, 0, 0, 0.08);
}

.btn.btn-labeled > .btn-label .material-symbols-outlined {
  font-size: 1.25rem;
  line-height: 1;
}

.btn.btn-labeled > .btn-label .btn-labeled-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.btn.btn-labeled.w-100 {
  width: 100%;
  justify-content: flex-start;
}

.htbah-wuerfeln-btn {
  min-height: calc((var(--bs-btn-line-height) * 1em) + (var(--bs-btn-padding-y) * 2) + (var(--bs-btn-border-width) * 2));
}

/* Erfolgsmeldungen: oben mittig, über UI inkl. Modals und unterer Leiste */
.htbah-erfolgs-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  max-width: min(92vw, 28rem);
  box-sizing: border-box;
}

.htbah-weltenbau-thumb-wrap {
  display: block;
  border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
  overflow: hidden;
  background: var(--bs-secondary-bg);
}

.htbah-weltenbau-thumb {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: contain;
  vertical-align: middle;
}

.htbah-weltenbau-karte-menu {
  flex: 0 0 auto;
  z-index: 2;
}

.htbah-weltenbau-karte-kopf {
  min-height: 2.25rem;
}

.htbah-weltenbau-karte-menu .material-symbols-outlined {
  font-size: 1.5rem;
  line-height: 1;
}

.htbah-weltenbau-karte-menu-button {
  border: none;
  background: transparent;
  color: var(--text-color);
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
}

.htbah-weltenbau-karte-menu-button:hover,
.htbah-weltenbau-karte-menu-button:focus-visible {
  background: var(--bs-tertiary-bg);
}

.htbah-weltenbau-titel {
  /* Rechts exakt bis an den linken Rand des Falafel-Buttons führen. */
  padding-right: 2.5rem !important;
}

.htbah-weltenbau-meta-zeile {
  font-size: 0.72rem;
  line-height: 1.2;
}

.htbah-weltenbau-generator-card {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.htbah-weltenbau-extern-tab-icon {
  font-size: 1.05rem;
  line-height: 1;
  vertical-align: -0.15em;
}

.htbah-weltenbau-generator-card:hover,
.htbah-weltenbau-generator-card:focus-visible {
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.htbah-weltenbau-pill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--card-bg) 92%, var(--bs-tertiary-bg) 8%);
}

.htbah-weltenbau-pill-tabs .nav-item {
  flex: 1 1 12rem;
  min-width: 0;
}

.htbah-weltenbau-pill-tab {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 0.55rem !important;
  padding: 0.45rem 0.75rem;
  color: var(--navbar-link);
  font-weight: 600;
  background: transparent;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.htbah-weltenbau-pill-tab:hover,
.htbah-weltenbau-pill-tab:focus-visible {
  color: var(--heading-color);
  border-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
  background: color-mix(in srgb, var(--primary-color) 18%, transparent);
}

.htbah-weltenbau-pill-tab.active {
  color: var(--heading-color);
  border-color: color-mix(in srgb, var(--primary-color) 58%, transparent);
  background: color-mix(in srgb, var(--primary-color) 22%, transparent);
  box-shadow: none;
}

.htbah-npc-feld-anheben {
  margin-top: -0.35rem;
}

@media (max-width: 575.98px) {
  .htbah-weltenbau-pill-tabs {
    gap: 0.35rem;
    padding: 0.35rem;
  }

  .htbah-weltenbau-pill-tabs .nav-item {
    flex-basis: 100%;
  }

  .htbah-weltenbau-pill-tab {
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
  }
}

.htbah-generator-modal-layer {
  z-index: var(--htbah-z-modal-generator);
}

.htbah-generator-modal-window {
  width: min(94vw, 1300px);
  height: min(88dvh, 920px);
  min-width: min(320px, 100vw);
  min-height: min(260px, 100vh);
}

.htbah-generator-modal-content {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  min-height: 0;
  background: #fff;
}

.htbah-weltenbau-map-layer {
  z-index: var(--htbah-z-modal-map);
}

.htbah-weltenbau-map-window {
  width: min(96vw, 1400px);
  height: min(92dvh, 940px);
  min-width: min(320px, 100vw);
  min-height: min(260px, 100vh);
}

.htbah-weltenbau-map-content {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.htbah-weltenbau-map-canvas {
  width: 100%;
  height: 100%;
  min-height: 360px;
  overflow: hidden;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px) 0 0 / 32px 32px,
    #fff;
  cursor: grab;
  touch-action: none;
}

.htbah-weltenbau-map-header {
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch !important;
}

.htbah-weltenbau-map-title {
  width: 100%;
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htbah-weltenbau-map-actions {
  width: 100%;
  flex: 0 0 100%;
  justify-content: flex-start !important;
  flex-wrap: wrap;
  align-content: flex-start;
  column-gap: 0.35rem;
  row-gap: 0.35rem;
  overflow: visible;
}

.htbah-weltenbau-map-actions > .btn-group,
.htbah-weltenbau-map-actions > .regelwerk-icon-button,
.htbah-weltenbau-map-actions > .btn-close {
  flex: 0 0 auto;
}

.htbah-map-suche-wrap {
  position: relative;
  width: min(360px, 44vw);
  min-width: 180px;
}

.htbah-map-suche-input {
  min-width: 180px;
}

@media (max-width: 860px) {
  .htbah-map-suche-wrap {
    width: 100%;
    min-width: 0;
    order: -1;
  }

  .htbah-map-suche-input {
    min-width: 0;
  }
}

.htbah-map-suche-treffer {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: min(46dvh, 320px);
  overflow: auto;
  padding: 0.2rem;
}

.htbah-map-suche-treffer-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.42rem 0.5rem;
  border-radius: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.htbah-map-suche-treffer-item:hover,
.htbah-map-suche-treffer-item:focus-visible {
  background: rgba(13, 110, 253, 0.12);
}

.htbah-weltenbau-map-canvas:active {
  cursor: grabbing;
}

.htbah-weltenbau-map-stage {
  position: relative;
  width: 12000px;
  height: 9000px;
}

.htbah-weltenbau-map-hintergrund {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #fff;
  background-position: center center;
  background-repeat: no-repeat;
  /* Ganzes Bild sichtbar halten; verhindert Abschneiden bei Hoch-/Querformat-Mix. */
  background-size: contain;
}

.htbah-weltenbau-map-grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px) 0 0 / 32px 32px;
}

.htbah-weltenbau-map-edges {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  color: #5c636a;
}

.htbah-map-node {
  position: absolute;
  z-index: 3;
  min-height: 54px;
  text-align: left;
  border: 2px solid #adb5bd;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  box-shadow: 0 0.1rem 0.25rem rgba(0, 0, 0, 0.12);
  user-select: none;
}

.htbah-map-ort-bild {
  position: absolute;
  z-index: 2;
  border: 2px solid rgba(108, 117, 125, 0.65);
  border-radius: 0.45rem;
  overflow: hidden;
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.16);
  background: #fff;
}

.htbah-map-element-locked {
  border-color: rgba(13, 110, 253, 0.95);
  box-shadow:
    0 0 0 2px rgba(13, 110, 253, 0.35),
    0 0.2rem 0.5rem rgba(0, 0, 0, 0.16);
}

.htbah-map-element-ausgewaehlt {
  outline: 3px solid rgba(25, 135, 84, 0.95);
  outline-offset: 1px;
  box-shadow:
    0 0 0 4px rgba(25, 135, 84, 0.35),
    0 0.35rem 0.9rem rgba(0, 0, 0, 0.22);
}

.htbah-map-ort-bild img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.htbah-map-element-lock-button {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(73, 80, 87, 0.92);
  color: #fff;
  pointer-events: auto;
  transform: scale(1);
  transition:
    transform 180ms ease,
    background-color 180ms ease;
  z-index: 5;
  touch-action: none;
  font-size: 15px;
  line-height: 1;
}

.htbah-map-element-lock-button.is-locked {
  background: rgba(220, 53, 69, 0.96);
}

.htbah-map-element-lock-button.is-unlocked {
  background: rgba(25, 135, 84, 0.96);
}

.htbah-map-element-lock-button:hover,
.htbah-map-element-lock-button:focus-visible {
  background: rgba(13, 110, 253, 0.95);
}

.htbah-map-ort-bild-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  border: 0;
  background: linear-gradient(135deg, transparent 0 45%, rgba(13, 110, 253, 0.95) 46% 100%);
  cursor: nwse-resize;
  padding: 0;
  z-index: 4;
}

.htbah-map-ort-bild-resize:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.htbah-map-auswahl-rahmen {
  position: fixed;
  z-index: 20;
  border: 1px dashed rgba(25, 135, 84, 0.95);
  background: rgba(25, 135, 84, 0.12);
  pointer-events: none;
}

.htbah-map-node-ort {
  border-color: #6c757d;
  font-weight: 600;
}

.htbah-map-node-charakter {
  border-color: #0d6efd;
}

.htbah-map-node-drag-hover {
  transform: scale(1.06);
  transform-origin: center;
  border-color: #0d6efd !important;
  box-shadow:
    0 0 0 2px rgba(13, 110, 253, 0.55),
    0 0.35rem 0.85rem rgba(0, 0, 0, 0.18);
  z-index: 3;
}

.htbah-map-node-charakter .d-flex.align-items-center.gap-2 {
  gap: calc(0.5rem * var(--htbah-node-scale, 1));
}

.htbah-map-charakterbild {
  width: calc(36px * var(--htbah-node-scale, 1));
  height: calc(36px * var(--htbah-node-scale, 1));
  object-fit: cover;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.htbah-map-charakter-avatar-wrap {
  position: relative;
  width: calc(36px * var(--htbah-node-scale, 1));
  height: calc(36px * var(--htbah-node-scale, 1));
  flex: 0 0 auto;
}

.htbah-map-charakter-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

.htbah-map-charakter-status {
  position: absolute;
  top: calc(-10px * var(--htbah-node-scale, 1));
  right: calc(-8px * var(--htbah-node-scale, 1));
  width: calc(20px * var(--htbah-node-scale, 1));
  height: calc(20px * var(--htbah-node-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(14px * var(--htbah-node-scale, 1));
  line-height: 1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.htbah-charakter-status-alert {
  position: sticky;
  top: 0;
  z-index: 5;
}

.htbah-map-charakterbild--gross {
  width: 48px;
  height: 48px;
}

.htbah-weltenbau-map-detail {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  width: min(34rem, calc(100vw - 1.7rem));
  max-height: calc(100vh - 1.7rem);
  overflow: auto;
  z-index: var(--htbah-z-modal-detail);
  pointer-events: auto;
}

.htbah-weltenbau-charakter-modal-window {
  width: min(50vw, 640px);
  height: min(88dvh, 820px);
  min-width: min(420px, 100vw);
  min-height: min(320px, 100vh);
  z-index: calc(var(--htbah-z-modal-detail) + 1);
}

.htbah-weltenbau-charakter-modal-body {
  max-height: 72vh;
  overflow: auto;
}

.htbah-charakter-journal-host.quill-editor-host {
  min-height: 22vh;
}

@media (max-width: 991.98px) {
  .htbah-weltenbau-map-header {
    cursor: default;
    touch-action: auto;
  }

  .htbah-weltenbau-map-title {
    font-size: 0.95rem;
  }

  .htbah-weltenbau-map-actions {
    padding-bottom: 0.1rem;
  }
}

@media (max-width: 768px) {
  .htbah-weltenbau-map-window {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
  }

  .htbah-weltenbau-charakter-modal-window {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
  }

  .htbah-weltenbau-charakter-modal-body {
    max-height: calc(100dvh - 3.2rem);
  }
}

/* Globale Bildbetrachter-Fenster (Weltenbau u. a.) */
.htbah-bb-host {
  position: relative;
  z-index: 4050;
  pointer-events: none;
}

.htbah-bb-fenster {
  pointer-events: auto;
  max-width: calc(100vw - 8px);
  max-height: calc(100vh - 8px);
}

.htbah-bb-fenster-fs {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  resize: none !important;
  border-radius: 0 !important;
}

.htbah-bb-kopf {
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  touch-action: none;
}

.htbah-bb-griff {
  flex-shrink: 0;
  opacity: 0.7;
  font-size: 1.1rem;
}

.htbah-bb-rumpf {
  flex: 1 1 auto;
  min-height: 0;
}

.htbah-bb-viewport {
  flex: 1 1 auto;
  overflow: auto;
  width: 100%;
  min-height: 0;
  touch-action: pan-x pan-y pinch-zoom;
  background: var(--bs-secondary-bg);
}

.htbah-bb-resize-handle {
  z-index: 4;
}

.navbar-fixed {
  position: fixed;
  z-index: 1040;
  inset-inline: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--navbar-bg);
  border-top: 1px solid var(--border-color);
}

.htbah-bottom-nav-inner {
  overflow-x: hidden;
  width: 100%;
}

.htbah-bottom-nav-inner > a,
.htbah-bottom-nav-inner > button {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.35rem 0.4rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  line-height: 1;
}

.navbar-fixed a {
  color: var(--navbar-link);
  text-decoration: none;
  font-size: 20px;
}

.navbar-fixed button {
  color: var(--navbar-link);
  text-decoration: none;
  font-size: 20px;
  background: transparent;
  border: none;
  padding: 0;
}

/* Mobile Bottom-Nav: Buttons exakt wie Router-Links rendern */
.htbah-bottom-nav-inner > button {
  border: 1px solid transparent;
  padding: 0.35rem 0.4rem;
}

.navbar-fixed a.router-link-active {
  color: var(--primary-color);
}

.htbah-bottom-nav-inner > a,
.htbah-bottom-nav-inner > button {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.htbah-bottom-nav-inner > a.router-link-active {
  color: var(--heading-color);
  background: color-mix(in srgb, var(--primary-color) 22%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 58%, transparent);
}

.htbah-bottom-nav-inner > button.htbah-nav-button-active {
  color: var(--heading-color);
  background: color-mix(in srgb, var(--primary-color) 22%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 58%, transparent);
}

.htbah-bottom-nav-inner > button:hover {
  color: var(--heading-color);
  background: color-mix(in srgb, var(--primary-color) 18%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
}

.navbar-fixed button:hover {
  color: var(--primary-color);
}

.htbah-top-nav-desktop {
  width: 100%;
  min-height: 58px;
  padding: 0.35rem 1rem;
  gap: 0.85rem;
}

.htbah-top-nav-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0.2rem;
  border-radius: 0.5rem;
}

.htbah-top-nav-logo img {
  display: block;
  height: 2rem;
  width: auto;
}

.htbah-top-nav-menu {
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: thin;
}

.htbah-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  padding: 0.35rem 0.55rem;
  color: var(--navbar-link);
  text-decoration: none;
  background: transparent;
  font-size: 0.9rem;
  white-space: nowrap;
}

.htbah-nav-item-emoji {
  font-size: 1rem;
  line-height: 1;
}

.htbah-nav-item-label {
  font-size: 0.84rem;
  line-height: 1.2;
  font-weight: 600;
}

.htbah-top-nav-menu .htbah-nav-item.router-link-active {
  color: var(--heading-color);
  background: color-mix(in srgb, var(--primary-color) 22%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 58%, transparent);
}

.htbah-top-nav-menu .htbah-nav-item.htbah-nav-button-active {
  color: var(--heading-color);
  background: color-mix(in srgb, var(--primary-color) 22%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 58%, transparent);
}

.htbah-top-nav-menu button.htbah-nav-item {
  border: 1px solid transparent;
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
}

.htbah-top-nav-menu button.htbah-nav-item:hover {
  color: var(--heading-color);
  background: color-mix(in srgb, var(--primary-color) 18%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
}

/* Platz unter dem scrollbaren Inhalt: gemessene Navbar-Höhe + extra Luft + Home-Indikator (iOS) */
.content {
  padding-bottom: calc(
    var(--htbah-bottom-nav-reserve)
    + var(--htbah-content-ende-luft)
    + env(safe-area-inset-bottom, 0px)
  );
}

@media (min-width: 992px) {
  .navbar-fixed {
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
  }

  #app {
    padding-top: calc(var(--htbah-top-nav-reserve) + 0.75rem);
  }

  .content {
    padding-top: 0;
    padding-bottom: var(--htbah-content-ende-luft);
  }

  body.htbah-mit-lp-banner #app {
    padding-top: calc(var(--htbah-top-nav-reserve) + 4.1rem);
  }
}

.abstandshalter {
  height: 10vh;
}

.navbar-fixed {
  min-height: 50px;
}

.regelwerk-modal-layer {
  position: fixed;
  inset: 0;
  z-index: var(--htbah-z-modal-base);
  pointer-events: none;
}

/* Würfelbeutel: schwebend ohne Backdrop, über der unteren Navigation */
.htbah-wuerfel-beutel-layer {
  z-index: var(--htbah-z-modal-wuerfel);
}

.htbah-wuerfel-beutel-window.regelwerk-modal-window {
  width: min(94vw, 520px);
  height: min(86vh, 700px);
  max-height: min(90dvh, 720px);
  overflow: hidden;
}

.regelwerk-modal-window {
  position: absolute;
  top: 0;
  left: 0;
  width: min(90vw, 1200px);
  height: 85vh;
  min-width: min(320px, 100vw);
  min-height: min(280px, 100vh);
  resize: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  background: var(--modal-bg);
  pointer-events: auto;
}

.regelwerk-modal-header {
  cursor: move;
  user-select: none;
  touch-action: none;
}

.regelwerk-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--text-color);
  text-decoration: none;
  opacity: 0.65;
  line-height: 1;
}

.regelwerk-icon-button:hover,
.regelwerk-icon-button:focus-visible {
  opacity: 1;
}

.regelwerk-icon-button .material-symbols-outlined {
  font-size: 1.25rem;
}

.regelwerk-modal-window-fullscreen {
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  resize: none;
}

.regelwerk-modal-window-fullscreen .regelwerk-modal-header {
  cursor: default;
  touch-action: auto;
}

.regelwerk-modal-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1.5rem;
  height: 1.5rem;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 3;
}

.regelwerk-modal-resize-handle::before {
  content: '';
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  width: 0.9rem;
  height: 0.9rem;
  border-right: 2px solid var(--text-color);
  border-bottom: 2px solid var(--text-color);
  border-bottom-right-radius: 2px;
  opacity: 0.55;
}

.regelwerk-modal-content {
  flex: 1;
  width: 100%;
  border: none;
}

/* Spielleiter: Abenteuerbuch (FAB + Quill im schwebenden Fenster) */
.abenteuerbuch-modal-window {
  max-height: 90vh;
}

.abenteuerbuch-modal-editor-wrap {
  flex: 1 1 auto;
  min-height: 12rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.abenteuerbuch-quill-host.quill-editor-host {
  min-height: 0 !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.abenteuerbuch-quill-host .ql-container.ql-snow {
  flex: 1 1 auto;
  min-height: 8rem;
  overflow-y: auto;
}

.regelwerk-modal-window .ql-snow .ql-picker-options {
  z-index: 2100;
}

.abenteuerbuch-modal-footer {
  border-color: var(--border-color) !important;
  background: var(--card-bg);
}

.modal-content {
  background: var(--modal-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.modal-header,
.modal-footer {
  border-color: var(--border-color);
}

/* Mobile: Modale starten einheitlich in voller Bildschirmbreite */
@media (max-width: 767.98px) {
  .modal .modal-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
  }

  .modal .modal-content {
    width: 100%;
  }

  .regelwerk-modal-window {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
    left: 0 !important;
  }
}

/* Lokaler-Speicher-Hinweis: auf schmalen Viewports zentrieren, Inhalt bei Bedarf scrollen */
@media (max-width: 575.98px) {
  #htbahLokalerSpeicherHinweisModal.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  #htbahLokalerSpeicherHinweisModal .modal-dialog {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #htbahLokalerSpeicherHinweisModal .modal-content {
    max-height: min(100dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #htbahLokalerSpeicherHinweisModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.form-check-input {
  border-color: var(--border-color);
}

.theme-toggle-input {
  width: 2.8em;
  height: 1.4em;
  cursor: pointer;
}

.action-card {
  display: block;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.action-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.action-card-arrow {
  color: var(--primary-color);
  font-size: 28px;
  flex-shrink: 0;
  align-self: center;
}

/* Kleine Utility-Klasse, wird in Startseiten-Karten verwendet */
.min-w-0 {
  min-width: 0;
}

.charakterbild-vorschau {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
}

.charakterbild-vorschau-klein {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
}

.charakterbild-platzhalter {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paragraph-color);
  background: var(--input-bg);
}

.charakterbild-platzhalter-klein {
  width: 100%;
  border-radius: inherit;
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paragraph-color);
  background: var(--input-bg);
  aspect-ratio: 3 / 4;
}

.charakterbild-platzhalter-klein .material-symbols-outlined {
  font-size: 2.4rem;
}

.cropper-image {
  max-width: 100%;
  max-height: 60vh;
  display: block;
}

.htbah-weltenbau-import-cropper-wrap {
  min-height: min(72vh, 760px);
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#weltenbauBildImportModal {
  z-index: var(--htbah-z-modal-crop);
}

#weltenbauBildImportModal .modal-dialog {
  max-width: min(96vw, 1500px);
}

#weltenbauBildImportModal .modal-body {
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

#weltenbauBildImportModal .htbah-weltenbau-import-modal-body {
  min-height: min(84vh, 900px);
  display: flex;
  flex-direction: column;
}

#weltenbauBildImportModal .htbah-weltenbau-import-cropper-wrap .cropper-container {
  width: 100% !important;
  height: 100% !important;
}

#weltenbauBildImportModal .cropper-image {
  width: auto;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 992px) {
  .charakterbild-modal-bildbereich .cropper-image {
    max-height: 50vh;
  }

  .charakterbild-modal-bildbereich .charakterbild-vorschau,
  .charakterbild-modal-bildbereich .charakterbild-platzhalter {
    width: auto;
    max-width: 100%;
    max-height: 50vh;
    margin-left: auto;
    margin-right: auto;
  }
}

.quill-editor-host {
  min-height: 60vh;
}

.entitaet-quill-editor-host.quill-editor-host {
  min-height: 30vh;
}

.quill-editor-host .ql-toolbar.ql-snow,
.quill-editor-host .ql-container.ql-snow {
  border-color: var(--border-color);
}

.quill-editor-host .ql-toolbar.ql-snow {
  background: var(--card-bg);
}

.quill-editor-host .ql-container.ql-snow {
  background: var(--input-bg);
}

.quill-editor-host .ql-editor {
  color: var(--text-color);
}

.quill-editor-host .ql-editor.ql-blank::before {
  color: var(--placeholder-color);
}

.htbah-bestaetigen-beschreibung {
  white-space: pre-line;
}

/* Charakter (schmale Viewports): Punkte + Fähigkeiten-Progressbar bleiben beim Scrollen sichtbar */
@media (max-width: 767.98px) {
  .htbah-faehigkeiten-punkte-sticky {
    position: sticky;
    top: 0;
    z-index: 1020;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    box-shadow: 0 6px 12px -10px rgba(15, 23, 42, 0.65);
  }

  body.htbah-mit-lp-banner .htbah-faehigkeiten-punkte-sticky {
    top: 3rem;
  }

  [data-theme='light'] .htbah-faehigkeiten-punkte-sticky {
    box-shadow: 0 6px 12px -10px rgba(15, 23, 42, 0.18);
  }
}

.faehigkeiten-tabelle {
  --bs-table-bg: transparent;
  color: var(--card-color);
  font-size: 0.875rem;
}

.faehigkeiten-tabelle thead th {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.8rem;
  border-color: var(--border-color);
}

.faehigkeiten-tabelle tbody td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  border-color: var(--border-color);
}

/* Charakter: Summe / Begabung / Geistesblitz als Badges */
.faehigkeiten-stat-badges-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

@media (min-width: 576px) {
  .faehigkeiten-stat-badges-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

.faehigkeiten-stat-badges-row > .faehigkeiten-stat-gruppe {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  min-width: 0;
}

.faehigkeiten-stat-badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.35em 0.55em;
  line-height: 1.25;
  border: 1px solid transparent;
}

.faehigkeiten-stat-badge-summe {
  background: rgba(59, 130, 246, 0.22) !important;
  color: var(--heading-color) !important;
  border-color: rgba(59, 130, 246, 0.45);
}

.faehigkeiten-stat-badge-begabung {
  background: rgba(34, 197, 94, 0.2) !important;
  color: var(--heading-color) !important;
  border-color: rgba(34, 197, 94, 0.42);
}

.faehigkeiten-stat-badge-geistesblitz {
  background: rgba(245, 158, 11, 0.22) !important;
  color: var(--heading-color) !important;
  border-color: rgba(245, 158, 11, 0.48);
}

.faehigkeiten-stat-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--secondary-color);
  line-height: 1;
  opacity: 0.9;
  flex-shrink: 0;
}

.faehigkeiten-stat-info-btn:hover {
  opacity: 1;
  color: var(--primary-color);
  background: rgba(59, 130, 246, 0.12);
}

.faehigkeiten-stat-info-btn .material-symbols-outlined {
  font-size: 1.125rem;
}

.faehigkeiten-wuerfel-emoji {
  font-size: 1.125rem;
  line-height: 1;
}

.faehigkeiten-stat-info-panel {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--input-bg);
  font-size: 0.8125rem;
  border-left: 3px solid var(--border-color);
  color: var(--paragraph-color);
}

.faehigkeiten-stat-info-panel.mt-0 {
  margin-top: 0;
}

.faehigkeiten-stat-info-panel ul li {
  color: var(--list-color);
}

.faehigkeiten-stat-info-panel--begabung {
  border-left-color: var(--success-color);
}

.faehigkeiten-stat-info-panel--geistesblitz {
  border-left-color: var(--warning-color);
}

.inventar-tabelle-wrap {
  font-size: 0.875rem;
}

.inventar-mobile-list {
  font-size: 0.875rem;
}

.inventar-mobile-card {
  border-color: var(--border-color);
  background: var(--card-bg);
}

.inventar-tabelle {
  --bs-table-bg: transparent;
  color: var(--card-color);
}

.inventar-tabelle thead th {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.8rem;
  border-color: var(--border-color);
}

.inventar-tabelle tbody td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  border-color: var(--border-color);
  vertical-align: top;
}

.inventar-col-art {
  width: 7.5rem;
  max-width: 9rem;
  vertical-align: middle;
}

.inventar-col-name {
  width: 18%;
  max-width: 9rem;
}

.inventar-col-werte {
  width: 12rem;
  min-width: 9rem;
  vertical-align: middle;
}

.inventar-typ-badge {
  font-weight: 600;
  font-size: 0.7rem;
}

.inventar-col-aktion {
  width: 1%;
}

.vor-nachteile-tabelle .vn-col-vorteil,
.vor-nachteile-tabelle .vn-col-nachteil {
  width: 45%;
  min-width: 8rem;
}

.vor-nachteile-karte-wrap {
  font-size: 0.875rem;
}

.vor-nachteile-karte-tabelle thead th.vn-col-vorteil {
  border-left: 3px solid var(--success-color);
  padding-left: 0.65rem;
}

.vor-nachteile-karte-tabelle thead th.vn-col-nachteil {
  border-left: 3px solid var(--danger-color);
  padding-left: 0.65rem;
}

.vor-nachteile-karte-tabelle tbody td.vn-col-vorteil {
  border-left: 3px solid color-mix(in srgb, var(--success-color) 42%, transparent);
}

.vor-nachteile-karte-tabelle tbody td.vn-col-nachteil {
  border-left: 3px solid color-mix(in srgb, var(--danger-color) 42%, transparent);
}

.vor-nachteile-karte-vorschau {
  max-height: 7.5rem;
}

.inventar-beschreibung-vorschau {
  max-height: 4.25rem;
  overflow: auto;
  line-height: 1.35;
  word-break: break-word;
}

.inventar-beschreibung-vorschau:empty {
  min-height: 1.25rem;
}

.inventar-beschreibung-quill {
  min-height: unset !important;
}

.inventar-beschreibung-quill.inventar-quill-toolbar--hidden .ql-toolbar.ql-snow {
  display: none !important;
}

.inventar-beschreibung-quill .ql-toolbar.ql-snow {
  padding: 2px 4px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.inventar-beschreibung-quill .ql-toolbar.ql-snow .ql-formats {
  margin-right: 4px;
}

.inventar-beschreibung-quill .ql-container.ql-snow {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.inventar-beschreibung-quill .ql-editor {
  min-height: 4rem;
  max-height: 9rem;
  overflow-y: auto;
  padding: 6px 8px;
  font-size: 0.875rem;
}

.inventar-mobile-editor-block .inventar-beschreibung-quill .ql-container.ql-snow {
  min-height: 6rem;
}

.inventar-waffen-referenz {
  font-size: 0.78rem;
}

.inventar-waffen-referenz-tabelle td {
  padding: 0.18rem 0.35rem;
  border-color: color-mix(in srgb, var(--border-color) 70%, transparent);
  vertical-align: top;
}

/* Quill Farb-Picker über Bootstrap-Modal legen */
.modal .ql-snow .ql-picker-options {
  z-index: 1060;
}

.wuerfel-ergebnis-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.wuerfel-ergebnis-chip-w10 {
  background: rgba(59, 130, 246, 0.2);
  color: var(--text-color);
  border: 1px solid rgba(59, 130, 246, 0.5);
}

.wuerfel-ergebnis-chip-w100 {
  background: rgba(34, 197, 94, 0.2);
  color: var(--text-color);
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.htbah-dice-color-input {
  min-height: 2.25rem;
  padding: 0.2rem;
}

.htbah-wuerfel-audio-range {
  min-width: 4.5rem;
  max-width: 11rem;
  height: 0.35rem;
}

.htbah-wuerfel-audio-mute-ico {
  font-size: 1.35rem;
  line-height: 1;
  vertical-align: middle;
}

.htbah-dice-box-wrap {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--primary-color) 8%, var(--card-bg));
}

.htbah-dice-box {
  width: 100%;
  height: 14rem;
}

.htbah-dice-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.initiative-modal-begabung-card {
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  border: 1px solid var(--border-color);
}

.initiative-modal-ergebnis {
  background: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

[data-theme='dark'] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* W100-Probe (Regelwerk): Ergebnisfarben */
.probe-wurf-ziel-card {
  background: color-mix(in srgb, var(--primary-color) 10%, transparent);
  border: 1px solid var(--border-color);
}

.probe-wurf-ergebnis {
  border-color: var(--border-color) !important;
}

.probe-wurf-ergebnis-hinweis {
  opacity: 0.92;
}

.probe-wurf-ergebnis--kritisch-erfolg {
  background: rgba(16, 185, 129, 0.28) !important;
  border-color: rgba(16, 185, 129, 0.55) !important;
  color: var(--heading-color);
}

.probe-wurf-ergebnis--gut {
  background: rgba(34, 197, 94, 0.22) !important;
  border-color: rgba(34, 197, 94, 0.45) !important;
}

.probe-wurf-ergebnis--mittel {
  background: rgba(234, 179, 8, 0.2) !important;
  border-color: rgba(234, 179, 8, 0.42) !important;
}

.probe-wurf-ergebnis--schlecht {
  background: rgba(249, 115, 22, 0.2) !important;
  border-color: rgba(249, 115, 22, 0.45) !important;
}

.probe-wurf-ergebnis--kritisch-misserfolg {
  background: rgba(220, 38, 38, 0.28) !important;
  border-color: rgba(220, 38, 38, 0.5) !important;
  color: var(--heading-color);
}

.parade-ruestung-info-card {
  background: #ffffff !important;
  border: 1px solid var(--border-color);
  color: #1f2937;
}

.faehigkeiten-probe-wuerfel-btn {
  color: rgba(34, 197, 94, 0.95);
}

.faehigkeiten-probe-wuerfel-btn:hover {
  color: var(--primary-color);
  background: rgba(34, 197, 94, 0.15);
}

/* Startseite: Hero-Kopf */
.htbah-start-hero {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.75rem;
  text-align: left;
}

.htbah-start-hero-logo-wrap {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.htbah-start-hero-logo {
  display: block;
  width: auto;
  height: 100%;
  max-height: 4.25rem;
}

.htbah-start-hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.htbah-start-hero-title {
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--heading-color);
}

.htbah-start-hero-subtitle {
  font-size: 0.95rem;
  line-height: 1.3;
}

@media (max-width: 767.98px) {
  .htbah-start-hero {
    width: 100%;
    justify-content: center;
  }

  .htbah-start-hero-title {
    font-size: clamp(1.05rem, 0.85rem + 1.1vw, 1.3rem);
  }

  .htbah-start-hero-subtitle {
    font-size: 0.86rem;
  }

  /* Startseiten-Karten: auf Mobile nie überlagern, stattdessen sauber umbrechen */
  .action-card .text-truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  .action-card .htbah-start-card-charaktername {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.28;
  }

  .action-card .action-card-arrow {
    align-self: center;
    margin-top: 0;
  }
}

/* Startseite: Charaktername auf der Aktionskarte */
.htbah-start-card-kicker {
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

.htbah-start-card-charaktername {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--heading-color);
}

/* Moduswahl Startseite: lange Titel, auf schmalen Viewports kleiner skalieren */
.htbah-start-card-charaktername.htbah-start-card-modus-titel {
  font-size: clamp(0.9rem, 2.4vw + 0.62rem, 1.35rem);
  line-height: 1.3;
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .htbah-start-card-charaktername.htbah-start-card-modus-titel {
    font-size: clamp(0.82rem, 0.4rem + 0.95vw, 1rem);
    line-height: 1.2;
  }
}

.htbah-start-card-avatar {
  position: relative;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.htbah-start-card-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.htbah-start-card-avatar-emoji {
  font-size: 1.85rem;
  line-height: 1;
}

/* Startseite: gespeicherte Charaktere nach LP-Status einfärben */
.htbah-start-charakterkarte--bewusstlos {
  background: var(--card-bg);
  border-color: #f59e0b;
  border-width: 3px;
}

.htbah-start-charakterkarte--tot {
  background: var(--card-bg);
  border-color: #dc2626;
  border-width: 3px;
}

.htbah-charakterbild-status-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
}

.htbah-charakterbild-status-wrap--leer {
  border: 1px dashed var(--bs-secondary-color);
  border-radius: 0.85rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.htbah-charakterbild-status-wrap--leer:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary-color) 70%, #ffffff 30%);
  outline-offset: 2px;
}

.htbah-charakterbild-status-wrap--drop-aktiv {
  background-color: color-mix(in srgb, var(--primary-color) 16%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 55%, var(--bs-secondary-color) 45%);
}

.htbah-charakter-stammdaten-row .charakterbild-vorschau-klein,
.htbah-charakter-stammdaten-row .charakterbild-platzhalter-klein {
  border: none;
}

@media (min-width: 992px) {
  .htbah-charakter-stammdaten-row .htbah-charakterbild-spalte {
    --htbah-charakterbild-hoehe: 233px;
    display: flex;
    justify-content: center;
  }

  .htbah-charakter-stammdaten-row .htbah-charakterbild-einheit {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
  }

  .htbah-charakter-stammdaten-row .htbah-charakterbild-vorschau-wrap {
    height: auto;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .htbah-charakter-stammdaten-row .htbah-charakterbild-status-wrap {
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
  }

  .htbah-charakter-stammdaten-row .charakterbild-vorschau-klein,
  .htbah-charakter-stammdaten-row .charakterbild-platzhalter-klein {
    width: auto;
    height: var(--htbah-charakterbild-hoehe);
    max-width: min(42vw, 390px);
    max-height: var(--htbah-charakterbild-hoehe);
    aspect-ratio: 3 / 4;
    margin-left: 0;
    margin-right: 0;
    border: none;
  }

  .htbah-charakter-stammdaten-row .charakterbild-vorschau-klein {
    object-fit: contain;
    object-position: center;
  }

  .htbah-charakter-stammdaten-row .htbah-charakterbild-einheit > .btn {
    width: 100% !important;
  }
}

.htbah-charakter-zustand-overlay {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font-size: 0.9rem;
  line-height: 1;
}

.htbah-charakter-zustand-overlay--gross {
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.35rem;
  top: 0.4rem;
  right: 0.4rem;
}

.htbah-charakter-zustand-overlay--mini {
  width: 0.75rem;
  height: 0.75rem;
  font-size: 0.5rem;
  top: -0.32rem;
  right: -0.32rem;
  border-width: 0;
  background: transparent;
  box-shadow: none;
}

.htbah-pill-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

/* Spielleiter-Gruppe: Statusfarbgebung für Charakter-Pills */
.htbah-weltenbau-pill-tab.htbah-sl-pill-status-bewusstlos {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.14);
}

.htbah-weltenbau-pill-tab.htbah-sl-pill-status-bewusstlos.active {
  border-color: rgba(245, 158, 11, 0.78);
  background: rgba(245, 158, 11, 0.28);
}

.htbah-weltenbau-pill-tab.htbah-sl-pill-status-tot {
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(220, 38, 38, 0.14);
}

.htbah-weltenbau-pill-tab.htbah-sl-pill-status-tot.active {
  border-color: rgba(220, 38, 38, 0.8);
  background: rgba(220, 38, 38, 0.28);
}

/* Charakter-Seite: prominenter Name */
.htbah-charakter-name-input {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.3;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  background-color: var(--input-bg);
  color: var(--input-color);
  border-color: var(--border-color);
}

.htbah-charakter-name-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.htbah-charakter-name-input::placeholder {
  color: var(--placeholder-color);
  font-weight: 400;
}

.htbah-pdf-export-gruppe {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.htbah-pdf-export-gruppe-btn,
.htbah-pdf-export-gruppe-select {
  width: 100%;
}

@media (max-width: 767.98px) {
  .htbah-pdf-export-gruppe {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  }
}

@media (min-width: 768px) {
  .htbah-pdf-export-gruppe {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
  }

  .htbah-pdf-export-gruppe-btn {
    flex: 1 1 auto;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  .htbah-pdf-export-gruppe-theme-wrap {
    flex: 0 0 220px;
    max-width: 220px;
  }

  .htbah-pdf-export-gruppe-select {
    flex: 0 0 220px;
    max-width: 220px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

/* Wetter-Badge (schwebend, über der Bottom-Nav) */
.htbah-atmosphaere-badge {
  position: fixed;
  z-index: 1038;
  right: 0.65rem;
  bottom: calc(
    var(--htbah-bottom-nav-reserve, 3.5rem) + 0.35rem + env(safe-area-inset-bottom, 0px)
  );
  display: flex;
  max-width: min(17.5rem, calc(100vw - 1.25rem));
  align-items: stretch;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.18),
    0 0 0 1px color-mix(in srgb, var(--atmosphaere-akzent, var(--primary-color)) 35%, transparent);
  background: color-mix(in srgb, var(--bs-body-bg) 92%, var(--atmosphaere-akzent, var(--primary-color)) 8%);
  touch-action: manipulation;
}

.htbah-sicherheits-fab-stack {
  position: fixed;
  top: calc(var(--htbah-top-nav-reserve, 0px) + env(safe-area-inset-top, 0px) + 0.6rem);
  left: max(0.6rem, env(safe-area-inset-left, 0px));
  z-index: 1045;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

body.htbah-mit-lp-banner .htbah-sicherheits-fab-stack {
  top: calc(var(--htbah-top-nav-reserve, 0px) + env(safe-area-inset-top, 0px) + 4.2rem);
}

@media (max-width: 767.98px) {
  .htbah-sicherheits-fab-stack {
    top: calc(var(--htbah-top-nav-reserve, 0px) + env(safe-area-inset-top, 0px) + 3.75rem);
  }

  body.htbah-mit-lp-banner .htbah-sicherheits-fab-stack {
    top: calc(var(--htbah-top-nav-reserve, 0px) + env(safe-area-inset-top, 0px) + 7.1rem);
  }
}

.htbah-sicherheits-fab {
  position: relative;
  z-index: auto;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 4px solid #b91c1c;
  background: #fff;
  color: #b91c1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 8px 18px rgba(127, 29, 29, 0.42);
}

.htbah-sicherheits-fab:hover,
.htbah-sicherheits-fab:focus-visible {
  filter: brightness(1.06);
}

.htbah-sicherheits-quill {
  min-height: 12rem;
}

.htbah-sicherheits-readonly-card {
  border-radius: 0.4rem;
}

.htbah-sicherheits-readonly-card .ql-toolbar,
.htbah-sicherheits-readonly-card .ql-snow .ql-toolbar {
  display: none !important;
}

.htbah-sicherheits-readonly .ql-toolbar,
.htbah-sicherheits-readonly .ql-snow .ql-toolbar {
  display: none !important;
}


.htbah-atmosphaere-badge--custom-pos {
  right: auto;
  bottom: auto;
}

.htbah-atmosphaere-badge__drag {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  padding: 0 0.15rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: -0.12em;
  color: var(--secondary-color);
  background: color-mix(in srgb, var(--atmosphaere-akzent, var(--primary-color)) 14%, transparent);
}

.htbah-atmosphaere-badge__drag:active {
  cursor: grabbing;
}

.htbah-atmosphaere-badge__tap {
  flex: 1 1 auto;
  margin: 0;
  padding: 0.45rem 0.55rem 0.45rem 0.35rem;
  border: none;
  background: transparent;
  color: var(--text-color);
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
  cursor: pointer;
}

.htbah-atmosphaere-badge__tap:hover {
  filter: brightness(1.04);
}

.htbah-atmosphaere-badge__line {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.htbah-atmosphaere-badge__emoji {
  flex-shrink: 0;
}

.htbah-atmosphaere-badge__txt {
  font-weight: 500;
  word-break: break-word;
}

.htbah-atmosphaere-badge__hint {
  opacity: 0.9;
  font-weight: 500;
}

@media (min-width: 992px) {
  .htbah-atmosphaere-badge {
    max-width: min(26.25rem, calc(100vw - 1.25rem));
    border-radius: 1.125rem;
  }

  .htbah-atmosphaere-badge__drag {
    width: 2.625rem;
    padding: 0 0.225rem;
    font-size: 1.125rem;
  }

  .htbah-atmosphaere-badge__tap {
    padding: 0.675rem 0.825rem 0.675rem 0.525rem;
    font-size: 1.17rem;
  }

  .htbah-atmosphaere-badge__line {
    gap: 0.525rem;
  }
}

.htbah-atmosphaere-modal .htbah-atmosphaere-pill {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border-color);
}

.htbah-atmosphaere-modal .htbah-atmosphaere-pill--wetter {
  align-items: flex-start;
}

.zufallstabellen-mobile-card {
  border-radius: 0.75rem;
  border-color: var(--border-color);
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
}

.zufallstabellen-mobile-card--klickbar .card-body {
  cursor: pointer;
}

.zufallstabellen-tabellenzeile-klickbar {
  cursor: pointer;
}

.zufallstabellen-tabellenzeile-klickbar:hover {
  background-color: color-mix(in srgb, var(--bs-primary) 6%, transparent);
}

.zufallstabellen-detail-sheet {
  display: grid;
  grid-template-columns: minmax(6.75rem, 11rem) 1fr;
  column-gap: 0.85rem;
  row-gap: 0.45rem;
  align-items: start;
}

.zufallstabellen-detail-sheet > dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
  line-height: 1.35;
  padding-top: 0.2rem;
}

.zufallstabellen-detail-sheet > dd {
  margin: 0;
  min-width: 0;
}

.zufallstabellen-detail-dd-plain {
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.zufallstabellen-detail-richtext {
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.zufallstabellen-detail-richtext :first-child {
  margin-top: 0;
}

.zufallstabellen-detail-richtext :last-child {
  margin-bottom: 0;
}

.zufallstabellen-detail-richtext img {
  max-width: 100%;
  height: auto;
}

.zufallstabellen-richtext-vorschau {
  max-height: 8rem;
  overflow: auto;
  line-height: 1.35;
  word-break: break-word;
}

.zufallstabellen-richtext-vorschau :first-child {
  margin-top: 0;
}

.zufallstabellen-richtext-vorschau :last-child {
  margin-bottom: 0;
}

.zufallstabellen-mobile-slides {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x mandatory;
}

.zufallstabellen-mobile-slide {
  flex: 0 0 7.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.6rem;
  overflow: hidden;
  background: var(--bs-secondary-bg);
  padding: 0;
  scroll-snap-align: start;
}

.zufallstabellen-mobile-slide img {
  display: block;
  width: 100%;
  height: 5.5rem;
  object-fit: cover;
}

.zufallstabellen-medium-karte {
  background: var(--bs-body-bg);
}

.zufallstabellen-medium-thumb-button,
.zufallstabellen-galerie-thumb {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 0.6rem;
  overflow: hidden;
  padding: 0;
  background: var(--bs-secondary-bg);
}

.zufallstabellen-medium-thumb-button img,
.zufallstabellen-galerie-thumb img {
  display: block;
  width: 100%;
  height: 9.5rem;
  object-fit: cover;
}

.htbah-begegnung-ergebnis-body {
  max-height: min(52vh, 26rem);
  overflow-y: auto;
}

.htbah-begegnung-modal .htbah-begegnung-ergebnis-body .zufallstabellen-mobile-slide {
  flex: 0 0 9.5rem;
}

.htbah-begegnung-modal .htbah-begegnung-ergebnis-body .zufallstabellen-mobile-slide img {
  height: 7.5rem;
  object-fit: contain;
}

.htbah-entitaet-bereich {
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: .6rem;
  padding: .5rem;
  margin-bottom: .5rem;
  background: var(--bs-body-bg);
  box-shadow: 0 .3rem .9rem rgba(15, 23, 42, 0.12);
}

.htbah-entitaet-bereich-titel {
  font-size: .8rem;
  font-weight: 800;
  margin-bottom: .4rem;
  color: var(--bs-secondary-color);
}

@media (max-width: 991.98px) {
  .htbah-entitaet-bereich {
    padding: .48rem;
    margin-bottom: .48rem;
  }

  .htbah-entitaet-bereich .row.g-2 {
    --bs-gutter-x: .55rem;
    --bs-gutter-y: .45rem;
  }

  .htbah-entitaet-bereich .form-control,
  .htbah-entitaet-bereich .form-select {
    font-size: .9rem;
  }

  .htbah-entitaet-bereich .form-floating > .form-control,
  .htbah-entitaet-bereich .form-floating > .form-select {
    min-height: calc(2.56rem + 2px);
    height: calc(2.56rem + 2px);
    padding-top: 1rem;
    padding-bottom: .34rem;
  }

  .htbah-entitaet-bereich .form-floating > label {
    padding: .52rem .62rem;
    font-size: .79rem;
  }
}

@media (max-width: 767.98px) {
  .htbah-entitaet-bereich {
    padding: .4rem;
    margin-bottom: .4rem;
  }

  .htbah-entitaet-bereich .row.g-2 {
    --bs-gutter-x: .45rem;
    --bs-gutter-y: .35rem;
  }

  .htbah-entitaet-bereich .form-control,
  .htbah-entitaet-bereich .form-select {
    font-size: .88rem;
  }

  .htbah-entitaet-bereich .form-floating > .form-control,
  .htbah-entitaet-bereich .form-floating > .form-select {
    min-height: calc(2.38rem + 2px);
    height: calc(2.38rem + 2px);
    padding-top: .92rem;
    padding-bottom: .28rem;
  }

  .htbah-entitaet-bereich .form-floating > label {
    padding: .46rem .58rem;
    font-size: .76rem;
  }
}

