*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #0c0a14;
  --bg-mid: #16122a;
  --bg-card: #241c3d;
  --pink: #c9a86c;
  --pink-dark: #9a7340;
  --purple: #7b5ea8;
  --blue: #4a8fa8;
  --teal: #3d9a8b;
  --mint: #5a9a7a;
  --gold: #e8c468;
  --text: #f2ebe3;
  --text-dim: #9a90b0;
  --shadow: rgba(0,0,0,0.5);
  --glow-pink: 0 0 20px rgba(201,168,108,0.45);
  --glow-purple: 0 0 20px rgba(61,154,139,0.4);
  --glow-gold: 0 0 24px rgba(232,196,104,0.35);
  --hand-card-width: 122px;
  /* Gegner/Helden brauchen mehr Breite (Portrait + Intent), sonst wirken sie schmaler als Handkarten */
  --entity-card-width: 148px;
  --entity-compact-width: 110px;
  --entity-tile-width: clamp(104px, 24vw, 138px);
  --entity-minion-tile-width: clamp(78px, 17vw, 100px);
  --entity-minion-tile-width-large: clamp(104px, 24vw, 132px);
  --card-back-image: image-set(
    url('/assets/card-back.webp') type('image/webp') 1x,
    url('/assets/card-back.png') 1x,
    url('/assets/card-back@2x.png') 2x
  );
}

html, body {
  height: 100vh;
  font-family: 'Nunito', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  /* Textmarkierung stört Drag&Drop / Wisch-Scroll — nur Eingabefelder bleiben markierbar */
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(ellipse at 50% 0%, #1a1428 0%, var(--bg-deep) 72%);
}

input,
textarea,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

img,
svg,
.card,
.entity-card {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Kampf-Portraits: Long-Press soll kein System-Menü (Teilen/Speichern) öffnen.
   Klicks/Zielwahl laufen über die Entity-Karte. */
.entity-portrait img,
.char-portrait-battle,
.enemy-portrait-battle,
.entity-portrait {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

.entity-portrait img,
.char-portrait-battle,
.enemy-portrait-battle {
  pointer-events: none;
}

#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

body.perf-lite #particles {
  display: none !important;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: star-twinkle ease-in-out infinite;
  pointer-events: none;
}

.star.star-warm {
  background: #ffe9b8;
}

@keyframes star-twinkle {
  0%, 100% { opacity: 0.14; }
  50% { opacity: 0.82; }
}

.shooting-star {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.15) 18%,
    rgba(255, 255, 255, 0.95) 72%,
    rgba(220, 235, 255, 0.55) 100%
  );
  opacity: 0;
  transform-origin: right center;
  --shoot-angle: -35deg;
  --shoot-travel: 280px;
  animation: shooting-star 1.15s ease-out forwards;
  pointer-events: none;
}

@keyframes shooting-star {
  0% {
    opacity: 0;
    transform: rotate(var(--shoot-angle)) translateX(12px) scaleX(0.25);
  }
  12% { opacity: 1; }
  100% {
    opacity: 0;
    transform: rotate(var(--shoot-angle)) translateX(calc(-1 * var(--shoot-travel))) scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .star { animation: none; opacity: 0.35; }
  .shooting-star { display: none; }
  .entity-sprite,
  .combat-top .entity-sprite,
  .combat-mid .entity-sprite {
    animation: none !important;
  }
}

.screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--ng-legal-footer-reserve, 0px);
  z-index: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.screen.active { display: flex; }

/* Die globale Navigationsleiste (ninenine-nav) laeuft mit reserveSpace:false,
   d.h. sie reserviert KEINEN Body-Platz. Damit Titel/Inhalte nicht unter der
   fixen Leiste (Hoehe --ng-nav-h) verschwinden, halten diese Titel-Screens oben
   die Navi-Hoehe frei und richten ihren Inhalt am oberen Rand aus. */
#screen-character.active,
#screen-end.active {
  justify-content: flex-start;
  padding-top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1.25rem);
}

#screen-character.active {
  overflow-x: hidden;
  overflow-y: auto;
}
/* Titel: oben starten + Navi-Höhe freihalten, damit bei vielen Speicher-Slots
   nach oben zum Logo gescrollt werden kann (justify-content:center würde den
   oberen Rand abschneiden). Inhalt wird per auto-Margin zentriert, solange Platz ist. */
#screen-title.active {
  justify-content: flex-start;
  /* env(safe-area-inset-top) ergänzen, sonst rutscht das Logo auf iPhones mit
     Notch/Dynamic Island unter die Statusleiste/Navi und wird oben abgeschnitten. */
  padding-top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1.25rem);
  padding-bottom: calc(0.75rem + var(--safe-bottom));
}
#screen-reward.active,
#screen-relic.active,
#screen-relic-trade.active,
#screen-outcome.active {
  justify-content: flex-start;
  padding-top: var(--hud-toolbar-clearance);
}

#screen-outcome .outcome-panel {
  width: min(640px, 100%);
  max-height: min(78vh, 720px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1.35rem 1.4rem;
}

#screen-outcome .outcome-body {
  flex: 1 1 auto;
}

#screen-outcome #btn-outcome-continue {
  align-self: center;
  min-width: 12rem;
  margin-top: 0.25rem;
}

/* Logo-aligned UI chrome */
.mystic-panel {
  position: relative;
  background: linear-gradient(165deg, rgba(30, 24, 52, 0.98), rgba(12, 10, 20, 0.98));
  box-shadow:
    0 0 28px rgba(232, 196, 104, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.55);
}

.mystic-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(232, 196, 104, 0.6),
    rgba(61, 154, 139, 0.45),
    rgba(123, 94, 168, 0.35),
    rgba(232, 196, 104, 0.4)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.game-icon-img {
  width: 1.65rem;
  height: 1.65rem;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}

.game-icon-img.gi-sm {
  width: 1.15rem;
  height: 1.15rem;
}

.game-icon-img.gi-xs {
  width: 0.95rem;
  height: 0.95rem;
}

.game-icon-img.gi-lg {
  width: 3.25rem;
  height: 3.25rem;
}


.entity-status-emoji .game-icon-img,
.entity-block-icon .game-icon-img,
.entity-damage-icon .game-icon-img,
.entity-intent-block-icon .game-icon-img,
.status-popover-icon .game-icon-img {
  width: 1.25rem;
  height: 1.25rem;
}

.entity-intent-head .game-icon-img {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-block;
  vertical-align: -0.2em;
  margin-right: 0.15rem;
}

.entity-intent-chip .game-icon-img,
.entity-incoming-chip .game-icon-img,
.entity-minion-chip .game-icon-img,
.entity-enemy-energy .game-icon-img,
.entity-intent-cost .game-icon-img {
  width: 0.95rem;
  height: 0.95rem;
  display: inline-block;
  vertical-align: -0.18em;
}

.end-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  aspect-ratio: 3 / 2;
  margin: 0 auto 0.75rem;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
}

.end-emoji .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none;
}

.relic-badge .game-icon-img,
.relic-badge-btn .game-icon-img {
  width: 1.15rem;
  height: 1.15rem;
  display: inline-block;
  vertical-align: -0.2em;
  margin-right: 0.2rem;
}

.hud-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Zonen-Icon im HUD-Übersichtsbutton (ersetzt das Karten-Icon und zeigt die
   aktuelle Zone an). */
.hud-zone-icon {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}

.hud-icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(232, 196, 104, 0.42);
  background: linear-gradient(145deg, rgba(36, 28, 52, 0.96), rgba(12, 10, 20, 0.94));
  color: var(--gold);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 14px rgba(232, 196, 104, 0.18),
    inset 0 0 18px rgba(61, 154, 139, 0.07);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.hud-icon-btn:hover {
  transform: scale(1.06);
  border-color: rgba(232, 196, 104, 0.75);
  box-shadow:
    0 0 20px rgba(232, 196, 104, 0.28),
    inset 0 0 18px rgba(61, 154, 139, 0.12);
}

.audio-control-wrap {
  position: relative;
  pointer-events: auto;
}

.audio-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(240px, 78vw);
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  z-index: 950;
  pointer-events: auto;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.audio-panel label,
.audio-panel input {
  pointer-events: auto;
  cursor: pointer;
}

.audio-panel-title {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.65rem;
  color: var(--gold);
}

.audio-toggle-row,
.audio-volume-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  color: var(--text);
}

.audio-toggle-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.audio-toggle-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
}

.audio-volume-row input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: grab;
}

.audio-volume-row strong {
  color: var(--gold);
  font-weight: 700;
}

.sound-toggle .icon-off { display: none; }
.sound-toggle.muted .icon-on { display: none; }
.sound-toggle.muted .icon-off { display: block; }
.sound-toggle.muted .hud-icon,
.sound-toggle.partial .hud-icon { stroke: var(--text-dim); opacity: 0.72; }
.sound-toggle.partial .icon-on { display: block; }

.almanach-toggle .hud-icon {
  stroke: #f0a0a8;
}

.almanach-toggle:hover .hud-icon {
  stroke: #ffc8cc;
}

/* Buttons — mystic frame */
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  font-size: 1rem;
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(232, 196, 104, 0.75),
    rgba(61, 154, 139, 0.5),
    rgba(123, 94, 168, 0.45),
    rgba(232, 196, 104, 0.55)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(0); filter: none; }

.btn-primary {
  background: linear-gradient(160deg, #e8c468 0%, #c9a86c 45%, #9a7340 100%);
  color: #1a1208;
  box-shadow: var(--glow-gold), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
  background: linear-gradient(160deg, #3d2858 0%, #2a3a5a 50%, #1e4a48 100%);
  color: #f2ebe3;
  box-shadow: var(--glow-purple), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-lg {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1rem 2.5rem;
  border-radius: 14px;
}

.btn-back {
  background: linear-gradient(160deg, rgba(30, 24, 48, 0.9), rgba(12, 10, 20, 0.95));
  color: var(--text-dim);
  margin-top: 1.5rem;
}

.btn-back:hover { color: var(--gold); }

.btn-ready {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
  background: linear-gradient(160deg, #4a7a62, #2e5a48);
  color: #e8f5ec;
  font-size: 1.1rem;
}

.btn-ready.is-ready {
  background: linear-gradient(160deg, #e8c468, #c9a86c);
  color: #1a1208;
  box-shadow: var(--glow-gold);
}

.btn-ready:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-end-turn {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  background: linear-gradient(160deg, #e8c468, #b8863a);
  color: #1a1208;
  font-size: 1rem;
  margin-top: 0.5rem;
  align-self: center;
  box-shadow: var(--glow-gold), 0 4px 16px rgba(0, 0, 0, 0.35);
}

.btn-end-turn.is-unend {
  background: linear-gradient(160deg, #8eb8d8, #4a6f8a);
  color: #0c1520;
  box-shadow: 0 0 18px rgba(110, 170, 210, 0.35), 0 4px 16px rgba(0, 0, 0, 0.35);
}

.entity-enemy-energy {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f0e2a8;
  text-align: center;
  margin: 0.15rem 0 0.2rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.entity-intent-stack {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  width: 100%;
}

.entity-intent-cost {
  margin-left: 0.35rem;
  font-size: 0.78em;
  opacity: 0.9;
  color: #ffe7a0;
}

.entity-intent-row.intent-followup {
  opacity: 0.92;
}

#hand-zone .card.turn-ended-wait {
  opacity: 0.72;
  filter: saturate(0.85);
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  letter-spacing: 0.03em;
}

.gold-coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.15em;
  font-size: 0.75em;
  font-weight: 800;
  color: #1a1208;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #e8c468 55%, #9a7340);
  border-radius: 50%;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.25);
  vertical-align: middle;
}

.icon-medallion {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.14), transparent 45%),
    radial-gradient(circle, rgba(36, 28, 52, 0.95), rgba(12, 10, 20, 0.98));
  border: 2px solid rgba(232, 196, 104, 0.38);
  box-shadow:
    0 0 14px rgba(232, 196, 104, 0.18),
    inset 0 0 12px rgba(61, 154, 139, 0.1);
}

/* Title */
.title-container {
  text-align: center;
  width: 100%;
}

/* Vertikal zentrieren, solange Platz ist — aber OHNE den oberen Rand
   abzuschneiden, wenn der Inhalt (z. B. mit "Fortsetzen"-Slots) höher als der
   Bildschirm wird. Flexible Pseudo-Spacer schrumpfen bei Overflow auf 0 und
   richten den Inhalt dann oben aus (margin:auto hat hier auf iOS Safari einen
   Clipping-Bug, deshalb dieser Weg). */
#screen-title.active::before,
#screen-title.active::after {
  content: '';
  flex: 1 1 auto;
  min-height: 0;
}

.title-sakura {
  font-size: 4rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.game-title {
  font-family: 'Cinzel', serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--gold), #d4b87a, var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0.5rem 0;
  text-shadow: none;
}

.game-title span { font-size: 2.35rem; }

.subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.title-buttons {
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.title-buttons:not([hidden]) {
  display: flex;
}

#server-offline-notice[hidden] {
  display: none !important;
}

#title-buttons[hidden] {
  display: none !important;
}

.alert {
  max-width: 28rem;
  margin: 0 auto 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  text-align: left;
  line-height: 1.45;
}

.alert strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.alert p {
  margin: 0;
  color: inherit;
  opacity: 0.92;
}

.alert-danger {
  background: rgba(72, 18, 22, 0.92);
  border: 2px solid rgba(232, 90, 106, 0.75);
  color: #ffd4d8;
  box-shadow:
    0 0 18px rgba(232, 90, 106, 0.22),
    inset 0 0 14px rgba(0, 0, 0, 0.35);
}

.title-buttons-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-almanach {
  background: linear-gradient(160deg, #c84858 0%, #8a2848 45%, #481828 100%);
  color: #ffe8e8;
  box-shadow: 0 0 20px rgba(232, 120, 104, 0.35), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-almanach:hover {
  box-shadow: 0 0 28px rgba(232, 120, 104, 0.5), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-stats {
  background: linear-gradient(160deg, #3aa6b0 0%, #1f6f86 45%, #123a52 100%);
  color: #e6fbff;
  box-shadow: 0 0 20px rgba(80, 200, 220, 0.35), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-stats:hover {
  box-shadow: 0 0 28px rgba(80, 200, 220, 0.5), 0 4px 20px rgba(0, 0, 0, 0.4);
}

h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
  text-align: center;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Name input */
.name-input-wrap { margin-bottom: 1.5rem; }

.name-input-wrap input,
.join-form input,
#lobby-player-name,
#join-room-code {
  font-family: inherit;
  font-size: 1.1rem;
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  border: 2px solid rgba(201,168,108,0.28);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  outline: none;
  text-align: center;
}

.name-input-wrap input,
#join-room-code {
  width: 220px;
}

.name-input-wrap input:focus,
.join-form input:focus { border-color: var(--gold); box-shadow: var(--glow-gold); }

/* Charakterauswahl – von oben scrollen (nicht zentrieren) */
#screen-character {
  justify-content: flex-start;
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

#screen-character::-webkit-scrollbar {
  display: block;
  width: 8px;
  height: 8px;
}

#screen-character::-webkit-scrollbar-thumb {
  background: rgba(232, 196, 104, 0.35);
  border-radius: 999px;
}

#screen-character h2 {
  flex-shrink: 0;
}

#screen-character .name-input-wrap,
#screen-character .btn-back {
  flex-shrink: 0;
}

/* Character grid */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  max-width: 1000px;
  width: 100%;
  flex-shrink: 0;
}

.char-card {
  position: relative;
  background: linear-gradient(165deg, rgba(36, 28, 52, 0.72), rgba(12, 10, 20, 0.82));
  border: 2px solid rgba(232, 196, 104, 0.18);
  border-radius: 18px;
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.char-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(232, 196, 104, 0.55);
  box-shadow: var(--glow-gold), 0 10px 28px rgba(0, 0, 0, 0.4);
}

.char-card.char-locked {
  opacity: 0.78;
  filter: saturate(0.75);
}
.char-card.char-locked:hover {
  transform: translateY(-2px);
}
.char-locked-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.4rem;
  border-radius: 6px;
  background: rgba(20, 24, 40, 0.92);
  border: 1px solid rgba(232, 196, 104, 0.55);
  color: #ffe9a8;
}
.character-nyen-balance {
  text-align: center;
  font-size: 0.85rem;
  color: #c9e4ff;
  margin: 0.35rem 0 0.75rem;
}
.char-card.char-taken {
  cursor: not-allowed;
  filter: grayscale(0.85);
  opacity: 0.45;
  border-color: rgba(160, 160, 170, 0.25);
}

.char-card.char-taken:hover {
  transform: none;
  border-color: rgba(160, 160, 170, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.char-taken-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f4e6c0;
  background: rgba(20, 16, 30, 0.85);
  border: 1px solid rgba(232, 196, 104, 0.4);
}

.char-avatar {
  width: 140px;
  height: 180px;
  border-radius: 18px;
  margin: 0 auto 0.8rem;
  overflow: hidden;
  border: 3px solid;
  background: linear-gradient(180deg, rgba(36,28,52,0.5) 0%, rgba(0,0,0,0.35) 100%);
  box-shadow: 0 6px 20px rgba(0,0,0,0.45), inset 0 0 24px rgba(232,196,104,0.06);
}

.char-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 8%;
  display: block;
  transition: transform 0.3s ease;
}

.char-card:hover .char-portrait {
  transform: scale(1.05);
}

.char-portrait-sm {
  width: 56px;
  height: 64px;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 12px;
  display: block;
}

.char-portrait-battle {
  width: 96px;
  height: 108px;
  object-fit: cover;
  object-position: center 12%;
  border-radius: 14px;
  display: block;
}

.enemy-portrait-battle {
  width: 96px;
  height: 108px;
  object-fit: cover;
  object-position: center 12%;
  border-radius: 14px;
  display: block;
}

.lp-avatar {
  display: flex;
  justify-content: center;
}

.char-card h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}
.char-card .char-title { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.35rem; }

.char-zone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.char-emoji-portrait {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  line-height: 1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--char-color, #888) 28%, transparent), rgba(0, 0, 0, 0.35));
}

.char-story-zone {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--gold);
  margin-top: 0.25rem;
}

.char-card-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.55rem;
}

.char-story-btn,
.char-info-btn {
  display: block;
  flex: 1 1 0;
  width: auto;
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.char-guide-section {
  margin: 0 0 0.95rem;
}

.char-guide-section:last-child {
  margin-bottom: 0;
}

.char-guide-section h3 {
  margin: 0 0 0.28rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.char-guide-section p,
.char-guide-section ul {
  margin: 0;
}

.char-guide-section ul {
  padding-left: 1.1rem;
}

.char-guide-section li {
  margin: 0 0 0.28rem;
}

.char-guide-section li:last-child {
  margin-bottom: 0;
}

.char-story-modal .char-story-panel {
  max-width: 520px;
}

.char-story-portrait-wrap {
  flex-shrink: 0;
  margin-bottom: 0.85rem;
}

.char-story-portrait-frame {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid;
  background: linear-gradient(180deg, rgba(36,28,52,0.5) 0%, rgba(0,0,0,0.35) 100%);
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}

.char-story-portrait {
  width: 100%;
  height: 100%;
  object-position: center center;
  display: block;
}

.char-story-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-top: 0.55rem;
}

.char-story-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.char-story-title {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.char-story-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-dim);
  padding-right: 0.2rem;
  -webkit-overflow-scrolling: touch;
}

.char-story-body p {
  margin: 0 0 0.85rem;
}

.char-story-body p:last-child {
  margin-bottom: 0;
}

/* Lobby */
.lobby-screen {
  align-items: center;
  justify-content: center;
}

#screen-lobby-hub.lobby-screen {
  justify-content: flex-start;
  padding-top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.75rem + 0.5rem);
  padding-bottom: var(--safe-bottom);
}

#screen-waiting.lobby-screen {
  justify-content: flex-start;
  padding-top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.75rem + 0.5rem);
  padding-bottom: var(--safe-bottom);
}

.lobby-screen-title {
  width: 100%;
  max-width: 320px;
  margin-bottom: 1rem;
}

.lobby-panel {
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.lobby-hub-name {
  width: 100%;
  max-width: 320px;
  margin-bottom: 0.75rem;
}

#screen-lobby-hub #lobby-player-name {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  display: block;
}

.lobby-hub-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
  max-width: 320px;
  margin-bottom: 0.5rem;
}

.lobby-code-panel {
  width: 100%;
  max-width: 320px;
  margin-bottom: 0.5rem;
}

#screen-lobby-hub .btn-back {
  width: 100%;
  max-width: 320px;
}

.lobby-code-panel[hidden] {
  display: none !important;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.join-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.join-form input {
  flex: 1;
  min-width: 0;
}

.lobby-slot-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.lobby-player-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  min-width: 0;
}

.lp-kick {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: #ffd0d0;
  background: rgba(220, 70, 70, 0.22);
  border: 1px solid rgba(255, 120, 120, 0.45);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.7;
  transition: background 0.15s, opacity 0.15s, transform 0.15s;
}

.lp-kick:hover {
  opacity: 1;
  background: rgba(220, 70, 70, 0.45);
  transform: scale(1.1);
}

.lobby-player-slot.ready {
  border-color: color-mix(in srgb, var(--mint) 55%, transparent);
}

.lobby-player-slot.disconnected {
  border-color: rgba(255, 184, 77, 0.5);
  background: rgba(255, 184, 77, 0.08);
  opacity: 0.85;
}

.lobby-player-slot.disconnected .lp-status {
  color: #ffb84d;
  font-weight: 700;
}

.lobby-player-slot-mine {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.lobby-player-slot-mine:hover {
  border-color: color-mix(in srgb, var(--pink) 55%, transparent);
  background: rgba(255, 158, 200, 0.08);
  transform: translateY(-2px);
}

.lobby-player-slot-mine.has-hero {
  border-style: solid;
}

.lp-you {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.lp-hero-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pink);
  margin-top: 0.15rem;
}

.lobby-wait-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.55rem;
  min-height: 1.2rem;
}

.waiting-actions.lobby-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

.waiting-actions.lobby-panel .btn {
  width: 100%;
}

.visibility-opt:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lobby-hero-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 2px dashed rgba(255, 158, 200, 0.45);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  font-family: inherit;
  color: var(--text);
  width: 100%;
}

.lobby-hero-pick:hover {
  border-color: var(--pink);
  background: rgba(255, 158, 200, 0.1);
  transform: translateY(-2px);
}

.lobby-hero-pick.has-hero {
  border-style: solid;
  border-color: color-mix(in srgb, var(--pink) 55%, transparent);
  cursor: pointer;
}

.lobby-hero-pick-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lobby-hero-pick-name {
  font-size: 1rem;
  font-weight: 800;
}

.lobby-hero-pick-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.lp-avatar-empty {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--text-dim);
  margin: 0 auto 0.3rem;
}

.room-visibility {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.room-visibility-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.room-visibility-toggle {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}

.visibility-opt {
  flex: 1;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.55rem 0.4rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.visibility-opt.active {
  border-color: color-mix(in srgb, var(--purple) 65%, transparent);
  background: rgba(200, 126, 255, 0.18);
  color: var(--text);
  box-shadow: 0 0 14px rgba(200, 126, 255, 0.25);
}

.room-visibility-hint {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
}

.room-visibility-badge {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
}

.room-visibility-badge.is-private {
  color: #ffc8a8;
}

.room-visibility-badge.is-friends {
  color: #9ee0c8;
}

.room-code-display {
  background: rgba(255,255,255,0.08);
  padding: 0.85rem 1rem;
  border-radius: 16px;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  text-align: center;
}

.room-code-display strong {
  font-size: 2rem;
  letter-spacing: 0.3em;
  color: var(--pink);
  margin-left: 0.5rem;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  max-width: 700px;
}

.lobby-player {
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 140px;
  border: 2px solid transparent;
}

.lobby-player.ready { border-color: var(--mint); }
.lobby-player .lp-avatar { display: flex; justify-content: center; margin-bottom: 0.3rem; }
.lobby-player .lp-name { font-weight: 700; margin: 0.3rem 0; }
.lobby-player .lp-status { font-size: 0.8rem; color: var(--text-dim); }

.waiting-actions { display: flex; gap: 1rem; }

.btn-accent {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
  background: linear-gradient(160deg, #e8c468, #b8863a);
  color: #1a1208;
  box-shadow: var(--glow-gold), 0 4px 18px rgba(0, 0, 0, 0.35);
}


.room-browser {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 320px;
}

.room-browser h3 {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
  text-align: center;
}

#friend-room-browser {
  margin-top: 1.15rem;
}

#friend-room-browser h3 {
  color: #9ee0c8;
}

.room-list { display: flex; flex-direction: column; gap: 0.5rem; }

.room-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(255,255,255,0.06);
  padding: 0.6rem 1rem;
  border-radius: 12px;
}

.room-host { flex: 1; color: var(--text); font-size: 0.9rem; font-weight: 700; }
.room-slots { font-size: 0.85rem; color: var(--mint); white-space: nowrap; }
.room-empty { color: var(--text-dim); text-align: center; font-size: 0.9rem; }

:root {
  /* Die globale Navi-Leiste ist jetzt var(--ng-nav-h) + Notch-Inset hoch.
     Deshalb den Inset addieren (nicht max), sonst entfaellt der Abstand. */
  --hud-toolbar-clearance: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.5rem + 3.15rem);
  --hud-toolbar-inset-start: max(2.85rem, calc(0.5rem + env(safe-area-inset-left)));
  --hud-toolbar-inset-end: max(2.85rem, calc(0.5rem + env(safe-area-inset-right)));
  /* Unterer Abstand fuer den Home-Indicator. Seit html/body 100vh nutzen, deckt
     der Hintergrund die Safe-Area unten ab (kein "schwarzer Balken" mehr), daher
     darf hier wieder der volle Inset stehen: er hebt nur den Inhalt/Button ueber
     die Gestenleiste, der Hintergrund laeuft weiter bis zur Unterkante. */
  --safe-bottom: max(0.35rem, calc(env(safe-area-inset-bottom, 0px) * 0.6));
}

/* Spiel-HUD sitzt unter der globalen Navigationsleiste (ninenine-nav).
   Identitaet (Username/Logout) liefert jetzt die globale Leiste. */
#auth-bar { display: none !important; }
.hud-toolbar {
  position: fixed;
  top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.5rem);
  left: max(0.5rem, env(safe-area-inset-left));
  right: max(0.5rem, env(safe-area-inset-right));
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.hud-toolbar-left,
.hud-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  pointer-events: none;
}

.hud-toolbar-right {
  justify-content: flex-end;
}

.hud-toolbar .hud-btn {
  pointer-events: auto;
}

.quit-run-btn {
  border-color: rgba(255, 126, 126, 0.5);
  box-shadow:
    0 0 14px rgba(255, 126, 126, 0.15),
    inset 0 0 18px rgba(61, 154, 139, 0.05);
}

.quit-run-btn .hud-icon {
  stroke: #ffb0b0;
}

.quit-run-btn:hover {
  border-color: rgba(255, 126, 126, 0.8);
  box-shadow: 0 0 20px rgba(255, 126, 126, 0.25);
}

/* --- Beenden / Speichern Modal -------------------------------------- */
.quit-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem) 1rem 1rem;
  background: rgba(6, 10, 12, 0.78);
  backdrop-filter: blur(4px);
  z-index: 10050;
}

.quit-modal-panel {
  width: min(26rem, 100%);
  padding: 1.6rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.quit-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.45rem;
  margin: 0;
}

.quit-modal-text {
  margin: 0;
  line-height: 1.45;
  opacity: 0.92;
}

.quit-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.3rem;
}

.quit-modal-hint {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.7;
  line-height: 1.4;
}

.replace-vote-waiting {
  opacity: 0.85;
}

.room-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.room-item-looking {
  font-size: 0.78rem;
  color: #9ee0c8;
}

.btn-danger {
  background: linear-gradient(160deg, #c84858 0%, #8a2030 45%, #4a1020 100%);
  color: #ffe2e2;
  box-shadow: 0 0 18px rgba(232, 90, 106, 0.3), 0 4px 18px rgba(0, 0, 0, 0.4);
}

.btn-danger:hover {
  box-shadow: 0 0 26px rgba(232, 90, 106, 0.45), 0 4px 18px rgba(0, 0, 0, 0.4);
}

/* --- "Spiel fortsetzen" im Titel ------------------------------------ */
.btn-continue {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: linear-gradient(160deg, #4fae8c 0%, #2d7a66 45%, #134a3e 100%);
  color: #eafff6;
  box-shadow: 0 0 22px rgba(79, 174, 140, 0.4), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-continue:hover {
  box-shadow: 0 0 30px rgba(79, 174, 140, 0.55), 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Zonenbild vorne im Fortsetzen-Button */
.btn-continue-zone {
  flex: 0 0 5.2rem;
  width: 5.2rem;
  min-height: 100%;
  background-color: rgba(0, 0, 0, 0.35);
  background-size: cover;
  background-position: center;
  box-shadow: inset -12px 0 18px rgba(0, 0, 0, 0.45);
  border-right: 1px solid rgba(232, 196, 104, 0.22);
}

.btn-continue-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.7rem 1rem;
  min-width: 0;
}

/* Koop-Fortsetzung (vom Host geöffneter Run) — farblich abgesetzt. */
.btn-coop-resume {
  background: linear-gradient(160deg, #b87edf 0%, #7b5ca8 45%, #3a2c5a 100%);
  color: #f3ecff;
  box-shadow: 0 0 22px rgba(184, 126, 255, 0.42), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-coop-resume:hover {
  box-shadow: 0 0 30px rgba(184, 126, 255, 0.58), 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Laufendes Spiel (Gerätewechsel Desktop → Handy) — klar vom Speicherplatz abgesetzt. */
.btn-live-resume {
  background: linear-gradient(160deg, #6db38a 0%, #3d7a58 45%, #1e3d2c 100%);
  color: #eef8f1;
  box-shadow: 0 0 22px rgba(109, 179, 138, 0.42), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-live-resume:hover {
  box-shadow: 0 0 30px rgba(109, 179, 138, 0.58), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-continue-label {
  display: block;
  font-family: 'Cinzel', serif;
  text-align: center;
}

.btn-continue-meta {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.85;
  letter-spacing: 0.02em;
  text-align: center;
}

.continue-slots {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.continue-slot-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.continue-slot-row .btn-continue {
  flex: 1 1 auto;
}

/* Kleiner Schriftrollen-Button neben "Fortsetzen" — öffnet die Speicherstand-Info. */
.btn-save-info {
  flex-shrink: 0;
  width: 3.6rem;
  padding: 0;
  background: linear-gradient(160deg, #e0c078 0%, #ad8447 45%, #5f4620 100%);
  box-shadow: 0 0 16px rgba(224, 192, 120, 0.4), 0 4px 18px rgba(0, 0, 0, 0.4);
}

.btn-save-info:hover {
  box-shadow: 0 0 24px rgba(224, 192, 120, 0.6), 0 4px 18px rgba(0, 0, 0, 0.4);
}

.btn-save-info .game-icon-img {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.save-info-players {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.save-info-player-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.save-info-player-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-info-player-hero {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.save-info-player-offline {
  flex-shrink: 0;
  font-size: 0.9rem;
  opacity: 0.7;
}

/* --- Speicherplatz-Auswahl im Beenden-Modal ------------------------- */
.quit-save-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(61, 154, 139, 0.08);
  border: 1px solid rgba(61, 154, 139, 0.25);
}
.quit-save-section[hidden] {
  display: none;
}

.quit-save-label {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  opacity: 0.9;
}

.quit-save-bound {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.quit-save-bound[hidden] {
  display: none;
}

.quit-save-bound-info {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  color: #eafff6;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(12, 10, 20, 0.45);
  border: 1px solid rgba(79, 174, 140, 0.35);
}

.quit-save-primary {
  width: 100%;
  background: linear-gradient(160deg, #4fae8c 0%, #2d7a66 45%, #134a3e 100%);
  color: #eafff6;
  box-shadow: 0 0 18px rgba(79, 174, 140, 0.3), 0 4px 18px rgba(0, 0, 0, 0.4);
}

.quit-save-slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quit-save-slots[hidden] {
  display: none;
}

.quit-save-slot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.6rem 0.85rem;
  text-align: left;
  background: linear-gradient(160deg, #2c5d52 0%, #1c4036 60%, #102a24 100%);
  color: #eafff6;
  border: 1px solid rgba(79, 174, 140, 0.4);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.quit-save-slot:hover {
  border-color: rgba(79, 174, 140, 0.8);
  box-shadow: 0 0 18px rgba(79, 174, 140, 0.35);
}

.quit-save-slot.is-occupied {
  background: linear-gradient(160deg, #5a4a22 0%, #3c3014 60%, #261d0c 100%);
  border-color: rgba(232, 196, 104, 0.45);
}

.quit-save-slot.is-occupied:hover {
  border-color: rgba(232, 196, 104, 0.85);
  box-shadow: 0 0 18px rgba(232, 196, 104, 0.3);
}

.quit-slot-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

.quit-slot-meta {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.85;
}

.title-logo {
  width: min(280px, 78vw);
  height: auto;
  object-fit: contain;
  margin: 0 auto 1.75rem;
  display: block;
  /* Kein filter: drop-shadow() — iOS Safari rendert gestapelte drop-shadows auf
     (großen/WebP-)Bildern fehlerhaft und platziert den Glow als losgelösten
     Fleck oberhalb des Logos. Das Logo bringt seinen Glow ohnehin selbst mit. */
  user-select: none;
  -webkit-user-drag: none;
}

/* Dungeon Map – unten nach oben; Zonen-Hintergrund wie im Kampf (statt Sterne) */
#screen-map {
  --zone-bg: none;
  --zone-color: #c87eff;
  --map-panel-width: min(400px, 100%);
  justify-content: flex-start;
  padding: var(--hud-toolbar-clearance) 0 0;
  overflow-y: auto;
  gap: 0.25rem;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.2) 38%, rgba(0,0,0,0.35) 72%, rgba(0,0,0,0.65) 100%),
    var(--zone-bg) center / cover no-repeat;
  transition: background 0.6s ease;
}

/* --- Koop-Wegpunkt-Auslosung (Roulette) ---------------------------------- */
.map-node.reveal-cand .node-outer {
  opacity: 1 !important;
  stroke: #ffe9a8 !important;
  stroke-width: 3 !important;
  animation: prCandPulse 1s ease-in-out infinite;
}

.map-node.reveal-active {
  filter: drop-shadow(0 0 9px #ffe08a) drop-shadow(0 0 18px #ffd86a);
}

.map-node.reveal-active .node-outer {
  opacity: 1 !important;
  stroke: #fff2c4 !important;
  stroke-width: 5 !important;
}

.map-node.reveal-winner {
  filter: drop-shadow(0 0 14px #ffd86a) drop-shadow(0 0 30px #ffb84d);
  animation: prWinnerPop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.map-node.reveal-winner .node-outer {
  opacity: 1 !important;
  stroke: #ffd86a !important;
  stroke-width: 6 !important;
}

@keyframes prCandPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes prWinnerPop {
  0% { filter: drop-shadow(0 0 4px #ffd86a); }
  45% { filter: drop-shadow(0 0 22px #fff0bd) drop-shadow(0 0 40px #ffb84d); }
  100% { filter: drop-shadow(0 0 14px #ffd86a) drop-shadow(0 0 30px #ffb84d); }
}

.path-reveal-overlay {
  position: absolute;
  top: calc(var(--hud-toolbar-clearance, 64px) + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.1rem;
  border-radius: 16px;
  background: rgba(20, 14, 34, 0.82);
  border: 1px solid rgba(255, 216, 106, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 0 22px rgba(255, 216, 106, 0.12);
  backdrop-filter: blur(6px);
  pointer-events: none;
  max-width: min(92vw, 520px);
  animation: prOverlayIn 0.25s ease-out both;
}

@keyframes prOverlayIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.path-reveal-overlay .pr-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
  color: #ffe9a8;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.path-reveal-overlay.pr-decided .pr-title {
  color: #fff4cf;
  animation: prTitlePulse 0.5s ease-out;
}

@keyframes prTitlePulse {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.path-reveal-overlay .pr-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.path-reveal-overlay .pr-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.82rem;
  font-weight: 700;
  color: #e8e0ff;
  transition: opacity 0.25s, border-color 0.25s, background 0.25s, transform 0.25s;
}

.path-reveal-overlay .pr-chip .pr-chip-voters {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim, #b4a9d0);
}

.path-reveal-overlay .pr-chip.pr-chip-win {
  background: rgba(255, 216, 106, 0.2);
  border-color: rgba(255, 216, 106, 0.7);
  color: #fff4cf;
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(255, 216, 106, 0.35);
}

.path-reveal-overlay .pr-chip.pr-chip-lose {
  opacity: 0.4;
}

.map-header--compact {
  width: 100%;
  max-width: none;
  margin-bottom: 0.15rem;
}

.map-header--compact .combat-zone-bar {
  padding-top: 0.15rem;
  padding-bottom: 0.1rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  flex-wrap: nowrap;
  justify-content: safe center;
  overflow-x: auto;
  scrollbar-width: none;
}

.map-header--compact .combat-zone-bar::-webkit-scrollbar {
  display: none;
}

.map-header--compact .combat-hud-chip {
  flex: 0 0 auto;
}

.combat-hud-chip--stat {
  cursor: default;
}

.combat-hud-chip--stat:hover {
  background: rgba(10, 8, 20, 0.58);
  box-shadow: none;
  transform: none;
}

.combat-hud-chip-value--wide {
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-hp-chip .char-icon-xs {
  width: 1.05rem;
  height: 1.05rem;
}

.map-relics { font-size: 0.78rem; color: var(--gold); font-weight: 600; }

#map-players-hp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

.map-hp-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.map-hp-entry.disconnected {
  opacity: 0.7;
}

.map-hp-entry.disconnected .map-hp-value {
  color: var(--text-dim);
}

.map-hp-value {
  font-weight: 700;
}

.disconnect-badge {
  font-size: 0.75rem;
  line-height: 1;
}

.disconnect-notice {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 0.65rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 184, 77, 0.45);
  background: rgba(255, 184, 77, 0.12);
  color: #ffd699;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
}

.entity-ally.disconnected {
  opacity: 0.72;
  filter: grayscale(0.35);
}

.entity-ally.disconnected .entity-disconnect {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffb84d;
  margin-top: 0.15rem;
}

.entity-ally .entity-name .disconnect-badge {
  margin-left: 0.25rem;
}

.section-label {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 1rem 0 0.5rem;
  font-weight: 700;
}

.zone-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
  max-width: 520px;
}

.zone-grid-sm .zone-card { width: 72px; padding: 0.4rem; }
.zone-grid-sm .zone-icon { font-size: 1.4rem; }
.zone-grid-sm .zone-name { font-size: 0.6rem; }

.zone-card {
  width: 88px;
  padding: 0.6rem 0.4rem;
  background: rgba(20, 12, 40, 0.8);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.zone-card:hover { transform: translateY(-2px); }
.zone-card.selected {
  background: rgba(255, 224, 126, 0.12);
  box-shadow: 0 0 16px rgba(255, 224, 126, 0.25);
}

.zone-icon { font-size: 1.8rem; margin-bottom: 0.2rem; }
.zone-icon .game-icon-img {
  width: 1.8rem;
  height: 1.8rem;
  margin: 0 auto;
}
.zone-name { font-size: 0.7rem; font-weight: 700; }

.waiting-zone { margin-bottom: 1rem; }
.waiting-zone-label { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 0.5rem; }

/* Scrollbars sind überall unsichtbar: gescrollt wird per Wisch-Geste (Touch nativ,
   Maus via DragScroll-Utility weiter unten) statt über eine sichtbare Leiste. */
.screen,
.dungeon-map,
.shop-offers,
.shop-sell-list,
.deck-modal-list,
.almanach-list,
.combat-log-list,
.char-story-body,
.relic-modal-list,
.almanach-tabs,
.run-info-body,
.stats-body,
.rest-recycle-list,
.rest-upgrade-grid,
.combat-field,
.hand-zone,
.auth-gate {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.screen::-webkit-scrollbar,
.dungeon-map::-webkit-scrollbar,
.shop-offers::-webkit-scrollbar,
.shop-sell-list::-webkit-scrollbar,
.deck-modal-list::-webkit-scrollbar,
.almanach-list::-webkit-scrollbar,
.combat-log-list::-webkit-scrollbar,
.char-story-body::-webkit-scrollbar,
.relic-modal-list::-webkit-scrollbar,
.almanach-tabs::-webkit-scrollbar,
.run-info-body::-webkit-scrollbar,
.stats-body::-webkit-scrollbar,
.rest-recycle-list::-webkit-scrollbar,
.rest-upgrade-grid::-webkit-scrollbar,
.combat-field::-webkit-scrollbar,
.hand-zone::-webkit-scrollbar,
.auth-gate::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Wisch-Scroll per Maus (DragScroll in ui.js): Greifhand-Cursor als Hinweis, dass
   man wie mit dem Finger ziehen kann. Nur bei echten Mauszeigern relevant (Touch
   scrollt ohnehin nativ per Wisch-Geste). Muss dieselben Container treffen wie
   DRAG_SCROLL_SELECTOR in ui.js. */
@media (pointer: fine) {
  .char-story-body,
  .combat-log-list,
  .deck-modal-list,
  .relic-modal-list,
  .almanach-tabs,
  .run-info-body,
  .stats-body,
  .rest-recycle-list,
  .rest-upgrade-grid,
  .dungeon-map,
  #screen-shop.active,
  #screen-character.active,
  .map-header--compact .combat-zone-bar {
    cursor: grab;
  }
  #screen-shop.active .shop-buy-btn,
  #screen-shop.active .shop-card-offer .card,
  #screen-shop.active .shop-leave-btn,
  #screen-shop.active button,
  #screen-character.active .char-card,
  #screen-character.active button {
    cursor: pointer;
  }
}
.drag-scrolling {
  cursor: grabbing !important;
  user-select: none;
}

/* Shop */
#screen-shop.active {
  justify-content: flex-start;
  align-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1.75rem);
  scroll-padding-top: 0.35rem;
}

#screen-shop .shop-panel {
  flex: 0 0 auto;
}

#screen-shop .shop-offers,
#screen-shop .shop-sell-list {
  max-height: none;
  overflow: visible;
}

.shop-panel {
  max-width: 720px;
  width: 100%;
  padding: 1.5rem;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.shop-card-grid {
  width: 100%;
  margin-bottom: 1rem;
}

.shop-card-offer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: var(--hand-card-width);
  max-width: var(--hand-card-width);
}

.shop-card-offer.cant-afford {
  opacity: 0.55;
}

.shop-card-offer.is-bargain {
  outline: 1px solid rgba(232, 196, 104, 0.55);
  outline-offset: 3px;
  border-radius: 10px;
  padding: 0.2rem 0.15rem 0.15rem;
}

.shop-bargain-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.2rem;
  z-index: 2;
  background: linear-gradient(135deg, #c45a2a, #e8c468);
  color: #1a1208;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.shop-card-offer .shop-buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 2.1rem;
  line-height: 1.1;
}

.shop-card-offer .shop-buy-btn.is-bargain-price {
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
}

.shop-price-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}

.shop-price-was {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(26, 18, 8, 0.55);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  line-height: 1;
}

.shop-price-now {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.shop-price-coin {
  font-size: 0.9em;
  line-height: 1;
}

.shop-card-offer .shop-buy-btn,
.shop-card-offer .shop-sell-btn {
  width: 100%;
  min-width: 0;
}

.shop-card-offer .shop-offer-locked {
  font-size: 0.62rem;
  text-align: center;
  margin: 0;
}

.shop-sell-list.shop-card-grid {
  max-height: none;
  overflow: visible;
}

.shop-leave-btn {
  align-self: center;
  margin-top: 0.5rem;
}

.shop-stats {
  margin-bottom: 1.2rem;
}

.shop-gold {
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.shop-party-hp {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.shop-hp-entry {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-hp-entry.is-me {
  border-color: rgba(255, 224, 126, 0.28);
  background: rgba(255, 224, 126, 0.06);
}

.shop-hp-name {
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 3.5rem;
  flex-shrink: 0;
}

.shop-hp-bar {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  overflow: hidden;
  min-width: 0;
}

.shop-hp-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.shop-hp-value {
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  flex-shrink: 0;
  min-width: 3.2rem;
  text-align: right;
}

.shop-hp-value.low {
  color: #ffb8b8;
}

.shop-offer-heal-preview {
  font-size: 0.72rem;
  color: #7effb3;
  margin-top: 0.2rem;
  font-weight: 700;
}

.shop-offer-heal-preview.full {
  color: var(--text-dim);
  font-weight: 600;
}

.shop-offers {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.shop-offer {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(160deg, rgba(32, 24, 52, 0.95), rgba(12, 10, 20, 0.98));
  border: none;
  border-radius: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.shop-offer::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, rgba(232, 196, 104, 0.45), rgba(61, 154, 139, 0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.shop-offer:hover:not(.cant-afford) {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 16px rgba(232, 196, 104, 0.12);
}

.shop-offer.cant-afford { opacity: 0.55; }
.shop-offer.type-relic::before {
  background: linear-gradient(135deg, rgba(232, 196, 104, 0.6), rgba(200, 150, 80, 0.4));
}
.shop-offer.type-card::before {
  background: linear-gradient(135deg, rgba(100, 160, 220, 0.45), rgba(61, 154, 139, 0.4));
}
.shop-offer.type-heal::before {
  background: linear-gradient(135deg, rgba(90, 180, 130, 0.5), rgba(61, 154, 139, 0.4));
}

.shop-offer-icon {
  width: 2.75rem;
  aspect-ratio: 3 / 2;
  font-size: 1.45rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  border: 2px solid rgba(232, 196, 104, 0.32);
  box-shadow: 0 0 12px rgba(232, 196, 104, 0.12);
  overflow: hidden;
}

.shop-offer-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-offer-info { flex: 1; text-align: left; }
.shop-offer-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.shop-offer-desc { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.15rem; }
.shop-offer-rarity { font-size: 0.65rem; color: var(--gold); margin-top: 0.2rem; text-transform: uppercase; }

.shop-offer-kind.service,
.shop-offer-kind.relic {
  font-size: 0.65rem;
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.shop-offer-kind.service { color: #7effb3; }
.shop-offer-kind.relic { color: #c9b8ff; }

.shop-buy-btn { flex-shrink: 0; min-width: 72px; }

.shop-sell {
  width: 100%;
  max-width: none;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.shop-sell-title {
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--gold);
}

.shop-sell-hint,
.shop-sell-empty {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
}

.shop-sell-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.shop-sell-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.shop-sell-card.is-curse {
  border-color: rgba(170, 68, 68, 0.45);
  background: rgba(80, 20, 20, 0.18);
}

.shop-sell-card.cant-afford {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-sell-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  aspect-ratio: 3 / 2;
  background: transparent;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.shop-sell-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.shop-sell-info { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.shop-sell-name { font-weight: 700; font-size: 0.88rem; }
.shop-sell-meta { font-size: 0.72rem; color: var(--text-dim); }
.shop-sell-price { font-weight: 800; font-size: 0.85rem; color: var(--gold); flex-shrink: 0; }
.shop-sell-card.is-curse .shop-sell-price { color: #ff8a8a; }

/* Deck-Anzeige */

.combat-log-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + var(--ng-nav-h, 56px));
}

.combat-log-modal-panel {
  width: 100%;
  max-width: 420px;
  /* Feste Höhe (nicht nur max-height): sonst wachsen die Listen mit dem
     Inhalt, das Panel clippt — und innen lässt sich nichts mehr scrollen. */
  height: min(70vh, calc(100dvh - var(--ng-nav-h, 56px) - 2.5rem));
  max-height: min(70vh, calc(100dvh - var(--ng-nav-h, 56px) - 2.5rem));
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
}

.combat-log-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  flex-shrink: 0;
}

.combat-log-modal-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  background: linear-gradient(90deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.combat-log-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.combat-log-list {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
  font-size: 0.82rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.28);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.combat-log-list[hidden] {
  display: none !important;
}

.combat-log-list p { margin-bottom: 0.35rem; }

.combat-log-empty {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 1rem 0;
}

.log-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
  flex-shrink: 0;
}

.log-tab {
  flex: 1 1 auto;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.log-tab:hover { color: var(--text); }

.log-tab.is-active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.run-log-list p {
  margin-bottom: 0.4rem;
  padding-left: 0.55rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.run-log-list p.log-combat { border-left-color: #c0566a; }
.run-log-list p.log-victory { border-left-color: var(--gold); color: var(--text); }
.run-log-list p.log-gold { border-left-color: #e0b94e; }
.run-log-list p.log-reward { border-left-color: var(--teal); }
.run-log-list p.log-shop { border-left-color: #6ea8d8; }
.run-log-list p.log-rest { border-left-color: #6aaa68; }
.run-log-list p.log-event { border-left-color: #9b8ac8; }
.run-log-list p.log-quest { border-left-color: #e8c468; }

.deck-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Navi-Leiste oben freihalten, sonst verdeckt sie den Modal-Kopf */
  padding-top: calc(1rem + var(--ng-nav-h, 56px));
}

.deck-modal-panel {
  width: 100%;
  max-width: 420px;
  max-height: min(80vh, calc(100dvh - var(--ng-nav-h, 56px) - 2.5rem));
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  padding: 1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
}

/* Eigenes Deck zeigt jetzt ein Kartengrid wie der Almanach — braucht mehr
   Breite als die schmalen Listen-Popups (Übersicht, Speicherstand, …). */
#deck-modal .deck-modal-panel {
  max-width: min(680px, 96vw);
}

.deck-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.deck-modal-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  margin: 0;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-close-deck {
  background: rgba(20, 12, 40, 0.5);
  border: 1px solid rgba(232, 196, 104, 0.25);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}

.btn-close-deck:hover {
  color: var(--gold);
  border-color: rgba(232, 196, 104, 0.5);
}

.deck-modal-stats {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0 0 0.6rem;
}

.deck-modal-powers {
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 224, 126, 0.08);
  border-radius: 8px;
}

.deck-powers-label { font-weight: 700; }

.deck-modal-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.2rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.deck-row-wrap {
  border-radius: 10px;
  overflow: hidden;
}

.deck-row-wrap.expanded .deck-row {
  background: rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.deck-row-wrap.expanded .deck-row-chevron {
  transform: rotate(90deg);
  color: var(--gold);
}

.deck-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: none;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.deck-row:active {
  background: rgba(255, 255, 255, 0.1);
}

.deck-row-chevron {
  font-size: 1.1rem;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}

.deck-row.type-curse { opacity: 0.85; border-left-color: #884444; }
.deck-row.type-status { opacity: 0.9; border-left-color: #888888; }
.deck-row.type-power { border-left-color: var(--gold); }

.deck-row-icon {
  width: 2rem;
  aspect-ratio: 3 / 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 4px;
  overflow: hidden;
}

.deck-row-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.deck-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.deck-row-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.deck-row-meta {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.deck-row-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
  margin-top: 0.15rem;
}

@media (hover: hover) and (pointer: fine) {
  .deck-row-desc { display: none; }
}

.deck-row-count {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--gold);
  flex-shrink: 0;
}

.deck-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 1.5rem;
}

.deck-row-detail {
  display: none;
  padding: 0 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(255, 224, 126, 0.4);
}

.deck-row-wrap.expanded .deck-row-detail {
  display: block;
}

/* Deck-Modal: Beschreibung nur im aufgeklappten Detail, nicht in der Zeile */
.deck-modal-list .deck-row-desc {
  display: none;
}

.deck-modal-list .deck-row-wrap.expanded .deck-row-meta {
  display: none;
}

.deck-detail-panel {
  padding: 0.65rem 0.75rem;
  background: rgba(10, 6, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  text-align: left;
}

.deck-detail-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.deck-detail-head-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-detail-head-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}

.deck-detail-meta-line {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
}

.deck-detail-desc-line {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.4;
}

.deck-detail-card {
  position: relative;
  padding: 0.85rem 0.9rem 0.75rem;
  background: rgba(10, 6, 24, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  text-align: center;
}

.deck-detail-cost {
  position: absolute;
  top: 0.5rem;
  left: 0.55rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1028;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-detail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  aspect-ratio: 3 / 2;
  margin: 0.2rem auto 0.35rem;
  background: transparent;
  border-radius: 6px;
  overflow: hidden;
}

.deck-detail-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.deck-detail-name {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.deck-detail-rarity {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.deck-detail-rarity.rarity-basic { background: rgba(180,180,180,0.2); color: #ccc; }
.deck-detail-rarity.rarity-common { background: rgba(158,200,255,0.2); color: #9ec8ff; }
.deck-detail-rarity.rarity-uncommon { background: rgba(126,255,179,0.2); color: #7effb3; }
.deck-detail-rarity.rarity-rare { background: rgba(255,224,126,0.25); color: var(--gold); }
.deck-detail-rarity.rarity-curse { background: rgba(136,68,68,0.3); color: #cc8888; }

.deck-detail-desc {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
}

.relic-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + var(--ng-nav-h, 56px));
}

.relic-modal-panel {
  width: 100%;
  max-width: 420px;
  max-height: min(75vh, calc(100dvh - var(--ng-nav-h, 56px) - 2.5rem));
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
}

.relic-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.relic-modal-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.relic-modal-stats {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.relic-modal-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.almanach-modal-panel {
  width: 100%;
  max-width: min(720px, 96vw);
  max-height: min(85vh, 85dvh);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.almanach-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  flex-shrink: 0;
  padding-bottom: 0.65rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid rgba(232, 196, 104, 0.12);
  -webkit-overflow-scrolling: touch;
  /* Keine sichtbare Scrollbar — Scrollen per Mausrad / Ziehen / Touch */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.almanach-tabs::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.almanach-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 196, 104, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.almanach-tab .char-icon-xs {
  width: 1.1rem;
  height: 1.1rem;
}

.almanach-tab-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.almanach-tab.active {
  color: var(--gold);
  border-color: rgba(232, 196, 104, 0.55);
  background: rgba(255, 224, 126, 0.1);
}

.almanach-list .almanach-row .deck-row-desc {
  display: block;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}

.almanach-list .almanach-row.is-locked {
  opacity: 0.72;
  filter: grayscale(0.35);
}

.almanach-list .almanach-row.is-locked .deck-row-name {
  letter-spacing: 0.08em;
}

.almanach-unlock-hint {
  margin: 0.4rem 0.75rem 0.75rem;
  color: var(--text-muted, #a8a0b8);
  font-size: 0.9rem;
  line-height: 1.4;
}

.almanach-list .almanach-relic-row .deck-row-desc {
  display: block;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}

.almanach-list .deck-row-wrap {
  overflow: visible;
  flex-shrink: 0;
}

.almanach-list .deck-row-wrap.expanded .deck-row-desc {
  display: none;
}

.almanach-list {
  padding-bottom: 1.5rem;
}

.almanach-list .deck-row-chevron {
  display: inline-flex;
}

.almanach-glossary-heading {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0.85rem 0 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(232, 196, 104, 0.15);
}

.almanach-glossary-list .almanach-glossary-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.almanach-glossary-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.35rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(255, 255, 255, 0.18);
}

.almanach-glossary-row.kind-buff {
  border-left-color: rgba(126, 255, 179, 0.55);
}

.almanach-glossary-row.kind-debuff {
  border-left-color: rgba(255, 158, 200, 0.55);
}

.almanach-glossary-row.kind-keyword {
  border-left-color: rgba(232, 196, 104, 0.55);
}

.almanach-glossary-row.kind-resource {
  border-left-color: rgba(120, 190, 255, 0.55);
}

.almanach-glossary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
}

.almanach-glossary-icon .game-icon-img {
  width: 1.35rem;
  height: 1.35rem;
}

.almanach-glossary-info {
  flex: 1;
  min-width: 0;
}

.almanach-glossary-label {
  display: block;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.almanach-relic-list {
  gap: 0.45rem;
}

.almanach-relic-row {
  cursor: default;
}

.almanach-relic-row:hover {
  transform: none;
}

.almanach-relic-row.rarity-uncommon {
  border-left-color: rgba(61, 154, 139, 0.65);
}

.almanach-relic-row.rarity-rare {
  border-left-color: rgba(232, 196, 104, 0.8);
}

/* ---- Almanach: Toolbar (Zurück-Button, Suche, Typ-Filter) ---- */
.almanach-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.almanach-toolbar[hidden] {
  display: none;
}

.almanach-back-btn {
  align-self: flex-start;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 196, 104, 0.35);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.almanach-back-btn:hover,
.almanach-back-btn:focus-visible {
  border-color: rgba(232, 196, 104, 0.6);
  background: rgba(255, 224, 126, 0.1);
}

.almanach-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.almanach-search-input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 196, 104, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-light, #f2ebe3);
  font-family: inherit;
  font-size: 0.82rem;
}

.almanach-search-input:focus {
  outline: none;
  border-color: rgba(232, 196, 104, 0.6);
  background: rgba(0, 0, 0, 0.35);
}

.almanach-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.almanach-type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex-shrink: 0;
}

.almanach-filter-chip {
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.almanach-filter-chip:hover,
.almanach-filter-chip:focus-visible {
  border-color: rgba(232, 196, 104, 0.4);
}

.almanach-filter-chip.active {
  color: var(--gold);
  border-color: rgba(232, 196, 104, 0.6);
  background: rgba(255, 224, 126, 0.12);
}

.almanach-filter-chip.upgrade-view-toggle.active {
  border-color: rgba(160, 220, 255, 0.65);
  color: #c8e8ff;
  background: rgba(100, 180, 255, 0.14);
}

.rest-upgrade-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.15rem 0 0.55rem;
}

/* ---- Almanach: Helden-Übersicht (Kacheln) ---- */
.almanach-list.almanach-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.6rem;
  align-content: start;
  padding-top: 0.5rem;
}

.almanach-hero-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.4rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 196, 104, 0.25);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.almanach-hero-tile:hover,
.almanach-hero-tile:focus-visible {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.08);
}

.almanach-hero-avatar {
  width: 3.4rem;
  height: 3.4rem;
  aspect-ratio: 1 / 1;
  flex: 0 0 3.4rem;
  border-radius: 50%;
  border: 2px solid rgba(232, 196, 104, 0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}

.almanach-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.almanach-hero-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: #f5ebe0;
  line-height: 1.2;
}

.almanach-hero-title {
  font-size: 0.64rem;
  color: var(--text-dim);
  line-height: 1.2;
}

.almanach-list.almanach-zone-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

/*
 * Zonenkacheln: Flex NICHT am <button> (iOS stapelt Kinder oft übereinander).
 * Layout liegt am inneren Wrapper .almanach-zone-tile-inner.
 */
.almanach-zone-tile {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
  font: inherit;
  overflow: visible;
}

.almanach-zone-tile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  width: 100%;
  padding: 0.55rem 0.4rem 0.5rem;
  box-sizing: border-box;
}

.almanach-zone-meta {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: center;
}

.almanach-zone-tile .almanach-hero-name,
.almanach-zone-tile .almanach-hero-title {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0 0.15rem;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  -webkit-text-fill-color: currentColor;
}

.almanach-zone-tile .almanach-hero-name {
  font-size: 0.74rem;
  color: #f5ebe0;
  -webkit-text-fill-color: #f5ebe0;
  margin-bottom: 0.1rem;
}

.almanach-zone-tile .almanach-hero-title {
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-dim);
}

/* Zonen-Medaillons haben den Rahmen schon im Asset — kein extra CSS-Kreis. */
.almanach-zone-avatar {
  border: none !important;
  background: transparent;
  position: relative;
  overflow: hidden;
  flex: 0 0 3.6rem;
  width: 3.6rem;
  height: 3.6rem;
  aspect-ratio: 1 / 1;
}

.almanach-zone-avatar .almanach-zone-icon,
.almanach-zone-avatar img.almanach-zone-icon,
.almanach-zone-avatar .game-icon-img.almanach-zone-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

/* ---- Almanach: Karten als echte Kartenkacheln ---- */
.almanach-list.almanach-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--hand-card-width));
  gap: 0.7rem 0.55rem;
  align-content: start;
  justify-content: center;
  justify-items: center;
  /* Platz für den Hover-Lift der obersten Kartenreihe (.card:hover translateY(-12px)
     + leichte Skalierung), sonst wird sie am oberen Rand abgeschnitten. */
  padding-top: 1.4rem;
}

.almanach-card-grid .card.almanach-card-tile {
  width: var(--hand-card-width);
  min-width: var(--hand-card-width);
  max-width: var(--hand-card-width);
}

.almanach-card-grid .card.almanach-card-tile.is-locked {
  cursor: pointer;
  opacity: 0.7;
  filter: grayscale(0.5);
}

.almanach-card-grid .card.almanach-card-tile.is-locked:hover {
  transform: none;
}

.almanach-card-tile .card-desc.almanach-lock-hint {
  font-style: italic;
  color: var(--text-dim);
  overflow: visible;
}

/* Freigeschaltete Unlock-Karten: kleines 🔓-Badge (Meisterschaft/Epoche). */
.almanach-unlock-badge {
  position: absolute;
  top: 2.15rem;
  right: 0.28rem;
  z-index: 4;
  min-width: 1.35rem;
  padding: 0.12rem 0.28rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: #1a1208;
  background: linear-gradient(145deg, #ffe9a8, #e8c468 55%, #9a7340);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  white-space: nowrap;
}

.card.card-zoom .almanach-unlock-badge {
  font-size: 0.72rem;
  min-width: 1.6rem;
  padding: 0.16rem 0.38rem;
}

.almanach-zoom-unlock {
  margin: 0.15rem 0 0;
  max-width: 22rem;
  text-align: center;
  color: var(--gold);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* ---- Almanach: Vergrößerte Karten-Detailansicht (Zoom-Popup) ---- */
.card-detail-popup-inner.almanach-zoom {
  max-width: 24rem;
}

.card.card-zoom {
  width: min(230px, 66vw);
  min-width: 0;
  max-width: min(230px, 66vw);
  min-height: 300px;
  padding: 0;
  cursor: default;
}

.card.card-zoom:hover {
  transform: none;
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.45),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.card.card-zoom .card-header {
  min-height: 2.6rem;
  padding: 0.42rem 2.15rem 0.36rem;
}

.card.card-zoom .card-cost {
  left: 0.5rem;
  width: 28px;
  height: 28px;
  font-size: 0.92rem;
  border-radius: 6px;
}

.card.card-zoom .card-header-label {
  font-size: 0.58rem;
}

.card.card-zoom .card-header-label.rarity {
  font-size: 0.52rem;
}

.card.card-zoom .card-pool-icon,
.card.card-zoom .card-pool-icon.is-empty,
.card.card-zoom .card-header .char-icon-card {
  right: 0.5rem;
  width: 1.7rem;
  height: 1.7rem;
}

.card.card-zoom .card-body {
  padding: 0.45rem 0.7rem 0.7rem;
}

.card.card-zoom .card-icon {
  width: 4.6rem;
  height: 4.6rem;
  font-size: 2.1rem;
  margin: 0.35rem 0 0.28rem;
}

.card.card-zoom .card-name {
  font-size: 1rem;
}

.card.card-zoom .card-desc {
  font-size: 0.86rem;
  line-height: 1.4;
}

.card.card-zoom .card-type-badge {
  font-size: 0.62rem;
  padding: 0.18rem 0.5rem;
}

.card.card-zoom.is-locked {
  align-items: center;
  justify-content: center;
  min-height: 200px;
  opacity: 0.85;
}

.card.card-zoom.is-locked .card-icon {
  font-size: 2.6rem;
  margin: 0 0 0.5rem;
}

.almanach-zoom-meta {
  margin: 0;
  max-width: 22rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.4;
}

.entity-minion-badge {
  align-self: center;
  margin-top: 0.15rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #d8c8ff;
  background: rgba(40, 28, 64, 0.85);
  border: 1px solid rgba(180, 150, 255, 0.35);
  border-radius: 999px;
}

.entity-enemy.entity-minion {
  opacity: 0.96;
}

.entity-enemy.entity-minion.entity-tile {
  --entity-tile-width: var(--entity-minion-tile-width);
}

.entity-enemy.entity-minion .entity-name {
  font-size: 0.82rem;
}

.entity-intent-row.summon {
  border-color: rgba(180, 140, 255, 0.45);
}

.almanach-glossary-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.relic-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: linear-gradient(160deg, rgba(32, 24, 48, 0.75), rgba(12, 10, 20, 0.85));
  border-radius: 10px;
  border: 1px solid rgba(232, 196, 104, 0.15);
  border-left: 3px solid rgba(232, 196, 104, 0.45);
}

.relic-row.rarity-uncommon { border-left-color: rgba(61, 154, 139, 0.65); }
.relic-row.rarity-rare { border-left-color: rgba(232, 196, 104, 0.8); }

.relic-row-icon {
  width: 2.2rem;
  aspect-ratio: 3 / 2;
  font-size: 1.15rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: transparent;
  border: 2px solid rgba(232, 196, 104, 0.28);
  box-shadow: 0 0 8px rgba(232, 196, 104, 0.1);
  overflow: hidden;
}

.relic-row-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.relic-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.relic-row-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.relic-row-meta {
  font-size: 0.68rem;
  color: var(--gold);
  text-transform: uppercase;
}

.relic-row-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.relic-empty {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0.5rem;
}

/* --- Übersicht / Run-Info-Modal ------------------------------------- */
.run-info-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  min-height: 0;
}

.run-info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(160deg, rgba(32, 24, 48, 0.75), rgba(12, 10, 20, 0.85));
  border-radius: 10px;
  border: 1px solid rgba(232, 196, 104, 0.15);
  border-left: 3px solid color-mix(in srgb, var(--zone-color, var(--purple)) 60%, transparent);
}

.run-info-row-icon {
  width: 2.2rem;
  aspect-ratio: 3 / 2;
  font-size: 1.3rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.run-info-row-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.run-info-row-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.run-info-row-label {
  font-size: 0.68rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.run-info-row-value {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.run-info-row-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.run-info-hp-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(160deg, rgba(32, 24, 48, 0.75), rgba(12, 10, 20, 0.85));
  border-radius: 10px;
  border: 1px solid rgba(232, 196, 104, 0.15);
}

.run-info-hp-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.run-info-hp-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.run-info-hp-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-info-hp-value {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

/* --- Statistik-Fenster ------------------------------------------------- */
.stats-body {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
  min-height: 0;
  padding-right: 0.2rem;
}

.stats-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stats-h {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold, #e8c468);
  border-bottom: 1px solid rgba(232, 196, 104, 0.2);
  padding-bottom: 0.3rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.stats-card {
  background: linear-gradient(160deg, rgba(32, 24, 48, 0.75), rgba(12, 10, 20, 0.85));
  border: 1px solid rgba(232, 196, 104, 0.15);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  text-align: center;
}

.stats-card-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  line-height: 1.1;
}

.stats-card-label {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
}

.stats-card-sub {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
}

.stats-hero-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stats-hero-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
}

.stats-hero-name {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 120px;
  min-width: 0;
  font-weight: 600;
}

.stats-hero-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-hero-stat {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.stats-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.stats-board {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}

.stats-board-title {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  color: var(--gold, #e8c468);
}

.stats-board-hint {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
}

.stats-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stats-board-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.stats-board-row.is-me {
  background: rgba(232, 196, 104, 0.14);
  outline: 1px solid rgba(232, 196, 104, 0.35);
}

.stats-rank {
  flex-shrink: 0;
  width: 1.4rem;
  text-align: center;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

.stats-board-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-board-score {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.stats-loading,
.stats-empty {
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 1rem 0;
  font-size: 0.9rem;
}

.combat-header {
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  width: 100%;
}

.combat-powers {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  padding: 0.15rem 1rem 0.3rem;
  min-height: 0;
}

.combat-powers-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--zone-color) 55%, var(--gold));
  white-space: nowrap;
}

.combat-powers-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.power-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.5rem 0.22rem 0.38rem;
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(36, 28, 52, 0.92), rgba(16, 12, 28, 0.95));
  border: 1px solid color-mix(in srgb, var(--zone-color) 45%, rgba(232, 196, 104, 0.35));
  box-shadow: 0 0 12px color-mix(in srgb, var(--zone-color) 22%, transparent);
  font-size: 0.72rem;
  font-weight: 700;
  color: #f0ecff;
  line-height: 1;
}

.power-badge--compact {
  padding: 0.16rem 0.34rem;
  gap: 0.15rem;
}

.power-badge-name {
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.power-stack {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--zone-color) 35%, rgba(232, 196, 104, 0.45));
  color: #1a1028;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
}

.entity-powers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.22rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0.28rem 0.12rem 0.06rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.combat-relics {
  text-align: center;
  padding: 0 1rem 0.35rem;
  min-height: 1.4rem;
}

.combat-relics .relic-badge {
  cursor: pointer;
  transition: transform 0.15s;
}

.combat-relics .relic-badge:hover {
  transform: scale(1.15);
}

.map-relics .relic-badge-btn:hover {
  text-decoration-color: var(--gold);
}

.map-relics { font-size: 0.78rem; color: var(--gold); font-weight: 600; }

#map-waypoint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 1.05rem;
  text-shadow: 0 0 12px rgba(255,255,255,0.15);
}

/* Event-Screen */
.event-panel {
  max-width: 520px;
  padding: 1.5rem;
  border-radius: 18px;
  text-align: center;
}

.event-panel h2,
.shop-panel h2 {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.event-story {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  margin: 1rem 0 0.75rem;
  text-align: left;
}

.event-vote-hint {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 0.65rem;
  line-height: 1.35;
}

.event-vote-status {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  text-align: left;
}

.event-vote-chip {
  display: block;
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.event-vote-chip.mine {
  border-color: rgba(255, 224, 126, 0.45);
  color: var(--text);
}

.event-vote-chip.pending {
  font-style: italic;
  opacity: 0.75;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rest-recycle-hint {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.rest-back-btn {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 0.85rem auto 0;
}

.rest-recycle-empty,
.rest-recycle-done {
  text-align: center;
  color: var(--text-dim);
  padding: 0.75rem 0;
}

.rest-recycle-list {
  max-height: min(42vh, 320px);
  overflow-y: auto;
}

.rest-upgrade-grid {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-top: 0.75rem;
}

.rest-upgrade-offer .almanach-card-tile {
  cursor: pointer;
}

.upgrade-confirm {
  position: fixed;
  inset: 0;
  z-index: 10070;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem)
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(6, 8, 14, 0.84);
  backdrop-filter: blur(5px);
}

.upgrade-confirm[hidden] {
  display: none;
}

.upgrade-confirm-inner {
  width: min(26rem, 100%);
  padding: 1.1rem 1.15rem 1.05rem;
  border-radius: 16px;
  border: 1px solid rgba(232, 196, 104, 0.35);
  background:
    linear-gradient(160deg, rgba(42, 36, 28, 0.96), rgba(18, 20, 28, 0.97)),
    radial-gradient(ellipse at top, rgba(232, 196, 104, 0.12), transparent 55%);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(232, 196, 104, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.upgrade-confirm-title {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f0e6d4;
}

.upgrade-confirm-hint {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(242, 235, 227, 0.7);
  text-align: center;
}

.upgrade-confirm-cards {
  display: flex;
  justify-content: center;
  width: 100%;
}

.upgrade-confirm-cards .card-zoom {
  width: min(210px, 70vw);
}

.upgrade-confirm-fallback {
  margin: 0.5rem 0;
  color: var(--text-dim);
  text-align: center;
}

.upgrade-confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  margin-top: 0.15rem;
}

.minion-recall-confirm {
  z-index: 10080;
}

.upgrade-confirm-actions .btn {
  min-width: 7rem;
}

.card.is-upgraded .card-name,
.card-zoom.is-upgraded .card-name {
  color: #ffe9b0;
}

/* Recycle-Karten zeigen jetzt zusaetzlich die Beschreibung (was die Karte kann). */
.shop-sell-desc {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.9;
  line-height: 1.3;
  margin-top: 0.15rem;
  white-space: normal;
}
.rest-recycle-list .shop-sell-card {
  align-items: flex-start;
}
.rest-recycle-list .shop-sell-icon,
.rest-recycle-list .shop-sell-price {
  margin-top: 0.1rem;
}

.combat-discard-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 196, 96, 0.45);
  background: rgba(24, 16, 8, 0.82);
}

.combat-discard-picker[hidden] {
  display: none !important;
}

.combat-discard-picker-hint {
  margin: 0;
  font-size: 0.92rem;
  color: #ffd9a0;
}

.combat-discard-picker-count {
  font-size: 0.88rem;
  color: var(--text-dim);
}

.combat-discard-picker .btn-discard-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hand-zone.discard-pick-mode .card {
  cursor: pointer;
}

.hand-zone.discard-pick-mode .card.discard-picked {
  outline: 2px solid #ffc460;
  outline-offset: 2px;
  box-shadow: 0 0 14px rgba(255, 196, 96, 0.35);
}

.hand-zone.discard-pick-mode .card:not(.discard-picked):hover {
  transform: translateY(-4px);
}

.btn-event-choice {
  width: 100%;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, rgba(36, 28, 52, 0.85), rgba(20, 12, 40, 0.9));
  border: 2px solid rgba(232, 196, 104, 0.28);
  border-radius: 12px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.btn-event-choice:hover:not(:disabled) {
  background: rgba(184, 126, 255, 0.3);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.btn-event-choice.selected {
  border-color: var(--gold);
  background: rgba(255, 224, 126, 0.14);
  box-shadow: 0 0 14px rgba(255, 224, 126, 0.2);
}

.btn-event-choice:disabled {
  opacity: 0.72;
  cursor: default;
  transform: none;
}

/* Relikte */
.relic-hint {
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}

.relic-rewards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 1.5rem;
}

.relic-trade-panel {
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.relic-trade-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.relic-trade-col h3 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  color: var(--gold);
}

.relic-trade-select {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(20, 12, 40, 0.9);
  border: 1px solid rgba(255, 224, 126, 0.3);
  color: var(--text);
}

.relic-trade-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.relic-trade-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 224, 126, 0.25);
  background: rgba(20, 12, 40, 0.75);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.relic-trade-chip.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

.relic-trade-chip-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  margin-top: 0.05rem;
}

.relic-trade-chip-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.relic-trade-chip-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--gold);
}

.relic-trade-chip-desc {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-dim);
}

.relic-trade-wait {
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .relic-trade-columns { grid-template-columns: 1fr; }
}

.relic-card {
  box-sizing: border-box;
  width: 168px;
  min-height: 12.5rem;
  padding: 0.95rem 0.85rem 0.85rem;
  background: rgba(20, 12, 40, 0.9);
  border: 2px solid rgba(255, 224, 126, 0.4);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.relic-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(255, 224, 126, 0.2);
}

.relic-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  aspect-ratio: 3 / 2;
  background: transparent;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto 0.4rem;
  flex-shrink: 0;
}

.relic-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.relic-name {
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
  line-height: 1.2;
}
.relic-desc {
  flex: 1 1 auto;
  width: 100%;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
  overflow-wrap: anywhere;
  hyphens: auto;
  margin: 0 0 0.45rem;
}
.relic-rarity {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.35rem;
  font-size: 0.65rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.relic-badge {
  display: inline-block;
  font-size: 1.1rem;
  margin-right: 0.3rem;
  cursor: help;
}

.card.curse {
  opacity: 0.88;
  background: linear-gradient(168deg, rgba(48, 16, 20, 0.98), rgba(18, 6, 10, 0.99));
}

.card.curse::before {
  background: rgba(196, 214, 236, 0.42);
}

.card.curse .card-cost {
  background: linear-gradient(145deg, #cc8888, #884444);
  color: #1a0808;
}

.card.curse .card-icon {
  --glyph-color: #cc8888;
}

.card.status-card,
.card.status {
  opacity: 0.92;
  background: linear-gradient(168deg, rgba(40, 40, 48, 0.98), rgba(16, 16, 22, 0.99));
}

.card.status-card::before,
.card.status::before {
  background: rgba(196, 214, 236, 0.42);
}

.card.status-card .card-cost,
.card.status .card-cost {
  background: linear-gradient(145deg, #bbbbbb, #777777);
  color: #1a1a1a;
}

.card-type-glyph.type-status { color: #bbbbbb; --glyph-color: #bbbbbb; }


.entity-overheal,
.entity-petals,
.entity-block-res,
.entity-chi,
.entity-tide,
.entity-tempo,
.entity-frost,
.entity-momentum,
.entity-toxin,
.entity-starlight,
.entity-embers,
.entity-bastion,
.entity-aftershock,
.entity-shimmer,
.entity-bladeflow,
.entity-wildgrowth,
.entity-exhaust,
.entity-omen {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  transition: filter 0.12s ease;
  line-height: 1;
  white-space: nowrap;
}

.entity-resource-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.entity-resource-icon .game-icon-img {
  width: 1.2rem;
  height: 1.2rem;
}
.entity-resource-amt {
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.entity-overheal { color: #ff8eb8; }
.entity-petals { color: #ffb8d8; }
.entity-block-res { color: #9ec8ff; }
.entity-chi { color: #a8e8c0; }
.entity-chi-dial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--chi-bg, #8c8c8c);
  color: var(--chi-fg, #1a1a1a);
  font-size: 0.52rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.entity-chi-named {
  gap: 0.32rem;
}
.entity-chi-named .entity-chi-dial {
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.62rem;
  flex-shrink: 0;
}
.entity-chi-dial-name {
  color: #e8f0ea;
  font-weight: 600;
}
.entity-tide-ebb { color: #7ec8f0; }
.entity-tide-flow { color: #58d0e0; }
.entity-tempo { color: #ff9ec8; }
.entity-frost { color: #98d8f8; }
.entity-momentum { color: #ffd88a; }
.entity-momentum-break { color: #ffb060; box-shadow: 0 0 0 1px rgba(255, 140, 60, 0.7); }
.entity-toxin { color: #8ee85c; }
.entity-starlight { color: #c8a8ff; }
.entity-embers { color: #ff8a5c; }
.entity-bastion,
.entity-aftershock { color: #7effc8; }
.entity-shimmer { color: #e8c880; }
.entity-exhaust { color: #c8a8e0; }
.entity-omen { color: #b8c8f0; }
.entity-omen--attack,
.entity-omen--skill,
.entity-omen--power {
  border-radius: 0.28rem;
  padding: 0.06rem 0.12rem;
}
.entity-omen--attack { background: rgba(255, 90, 110, 0.38); color: #ff8a9a; }
.entity-omen--skill { background: rgba(80, 150, 255, 0.38); color: #8ec8ff; }
.entity-omen--power { background: rgba(232, 196, 104, 0.38); color: var(--gold); }
.entity-bladeflow { color: #d87820; }
.entity-wildgrowth { color: #8fcf5a; }

.entity-overheal:hover,
.entity-overheal:focus-visible,
.entity-petals:hover,
.entity-petals:focus-visible,
.entity-block-res:hover,
.entity-block-res:focus-visible,
.entity-chi:hover,
.entity-chi:focus-visible,
.entity-tide:hover,
.entity-tide:focus-visible,
.entity-tempo:hover,
.entity-tempo:focus-visible,
.entity-frost:hover,
.entity-frost:focus-visible,
.entity-momentum:hover,
.entity-momentum:focus-visible,
.entity-toxin:hover,
.entity-toxin:focus-visible,
.entity-starlight:hover,
.entity-starlight:focus-visible,
.entity-embers:hover,
.entity-embers:focus-visible,
.entity-bastion:hover,
.entity-bastion:focus-visible,
.entity-aftershock:hover,
.entity-aftershock:focus-visible,
.entity-exhaust:hover,
.entity-exhaust:focus-visible,
.entity-omen:hover,
.entity-omen:focus-visible,
.entity-shimmer:hover,
.entity-shimmer:focus-visible,
.entity-bladeflow:hover,
.entity-bladeflow:focus-visible,
.entity-wildgrowth:hover,
.entity-wildgrowth:focus-visible {
  filter: brightness(1.3);
  outline: none;
}

.entity-ally.drop-valid {
  outline: 2px dashed rgba(126, 255, 179, 0.65);
}

.entity-ally.drop-hover {
  outline: 2px solid #7effb3;
  box-shadow: 0 0 14px rgba(126, 255, 179, 0.35);
}

/* Karten-Typ-Glyphen — klar lesbar */
.card-type-glyph,
.offer-type-glyph,
.relic-name-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: 'Cinzel', serif;
  font-weight: 800;
  line-height: 1;
  color: var(--glyph-color, var(--gold));
  text-shadow: 0 0 10px color-mix(in srgb, var(--glyph-color, var(--gold)) 45%, transparent);
}

.card-type-glyph { font-size: 1.45rem; }
.card-type-glyph.type-attack { color: #ff8a9a; --glyph-color: #ff8a9a; }
.card-type-glyph.type-skill { color: #8ec8ff; --glyph-color: #8ec8ff; }
.card-type-glyph.type-power { color: var(--gold); --glyph-color: var(--gold); }
.card-type-glyph.type-curse { color: #cc8888; --glyph-color: #cc8888; }

.offer-type-glyph {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(12, 10, 20, 0.9);
  border: 2px solid rgba(232, 196, 104, 0.3);
  font-size: 1.1rem;
}

.offer-type-glyph.type-relic { color: var(--gold); }
.offer-type-glyph.type-heal { color: #7effb3; font-size: 1.35rem; }

.relic-name-glyph {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 28, 52, 0.95), rgba(10, 8, 18, 0.98));
  border: 2px solid rgba(232, 196, 104, 0.35);
  font-size: 1rem;
  color: var(--gold);
}

.relic-badge-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.25rem;
  border-radius: 6px;
  background: rgba(232, 196, 104, 0.12);
  border: 1px solid rgba(232, 196, 104, 0.3);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--gold);
}

.entity-status-abbr,
.status-popover-abbr {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.entity-status-abbr {
  display: block;
  margin-bottom: 0.1rem;
}

.entity-status-icon.buff .entity-status-abbr,
.status-popover-abbr.buff { color: #9ec8ff; }

.entity-status-icon.debuff .entity-status-abbr,
.status-popover-abbr.debuff { color: #ff9ec8; }

.entity-block-icon,
.entity-damage-icon,
.entity-intent-block-icon {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold);
  opacity: 0.9;
}

.entity-damage-icon { color: #ff9a9a; }

.relic-badge-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0.2rem 0 0;
  color: var(--gold);
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline dotted transparent;
}

.relic-badge-btn:active {
  opacity: 0.75;
}

.card-pool-badge,
.shop-offer-pool {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  font-weight: 700;
}

.shop-offer-locked {
  font-size: 0.65rem;
  color: #ff7e7e;
  margin-top: 0.2rem;
  font-weight: 700;
}

.dungeon-wrapper {
  position: relative;
  width: var(--map-panel-width);
  max-width: var(--map-panel-width);
  margin-bottom: 1rem;
  --zone-color: #c87eff;
  /* Kein Milchglas: Zonenbild scheint durch; Rahmen hält die Karte */
  background: transparent;
  border: 2px solid color-mix(in srgb, var(--zone-color) 55%, transparent);
  border-radius: 22px;
  padding: 0.6rem 0.4rem 1rem;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    0 0 24px color-mix(in srgb, var(--zone-color) 30%, transparent);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Leichter Innenrand-Blur (nur am Rand, Mitte klar) */
.dungeon-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 11px;
  pointer-events: none;
  z-index: 1;
  background: rgba(8, 6, 14, 0.14);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--zone-color) 22%, rgba(255, 255, 255, 0.08));
}

.dungeon-wrapper > * {
  position: relative;
  z-index: 2;
}

.dungeon-zone-cap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: calc(100% - 0.5rem);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  padding: 0.5rem 0.85rem;
  position: relative;
  z-index: 3;
  border-radius: 14px;
  background:
    linear-gradient(
      180deg,
      rgba(10, 8, 16, 0.82) 0%,
      rgba(16, 12, 24, 0.88) 100%
    );
  border: 1px solid color-mix(in srgb, var(--zone-color) 50%, rgba(232, 196, 104, 0.28));
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 0 22px color-mix(in srgb, var(--zone-color) 24%, transparent);
  backdrop-filter: blur(8px);
}

.dungeon-zone-cap::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.dungeon-zone-cap__line {
  flex: 1;
  height: 1px;
  min-width: 12px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--zone-color) 55%, rgba(232, 196, 104, 0.45)),
    transparent
  );
  opacity: 0.85;
}

.dungeon-zone-cap__text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.2;
}

.dungeon-zone-cap__text .game-icon-img {
  width: 1.1rem;
  height: 1.1rem;
}

.dungeon-zone-cap--exit {
  margin-bottom: 0.45rem;
}

.dungeon-zone-cap--exit .dungeon-zone-cap__text {
  color: #ffe9a8;
  text-shadow:
    0 0 14px rgba(255, 224, 126, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.65);
}

.dungeon-zone-cap--entrance {
  margin-top: 0.5rem;
  padding: 0.58rem 0.95rem;
  background:
    linear-gradient(
      180deg,
      rgba(12, 10, 18, 0.78) 0%,
      rgba(8, 14, 18, 0.9) 100%
    );
  border-color: color-mix(in srgb, var(--zone-color) 58%, rgba(126, 200, 184, 0.35));
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 26px color-mix(in srgb, var(--zone-color) 30%, transparent);
}

.dungeon-zone-cap--entrance .dungeon-zone-cap__text {
  color: color-mix(in srgb, var(--zone-color) 35%, #b8ffe0);
  text-shadow:
    0 0 12px color-mix(in srgb, var(--zone-color) 40%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.65);
}

.dungeon-label-top,
.dungeon-label-bottom {
  position: relative;
  z-index: 2;
}

.dungeon-map-shell {
  position: relative;
  width: 100%;
  min-height: 380px;
  max-height: 58vh;
  isolation: isolate;
}

.dungeon-map-shell > .dungeon-map {
  width: 100%;
  height: 100%;
  min-height: inherit;
  max-height: inherit;
}

.dungeon-zone-cap.dungeon-zone-cap--toolbar {
  position: absolute;
  left: 0.4rem;
  bottom: 0.5rem;
  z-index: 8;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.36rem;
  width: auto;
  max-width: none;
  margin: 0;
  margin-top: 0;
  padding: 0.46rem 0.34rem;
  border-radius: 999px;
  pointer-events: auto;
}

.dungeon-zone-cap.dungeon-zone-cap--toolbar::before {
  border-radius: 999px;
  inset: 4px;
}

.map-draw-toolbar {
  display: none;
}

.map-draw-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.28rem;
  height: 2.28rem;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--zone-color) 35%, rgba(255, 255, 255, 0.14));
  background: rgba(8, 10, 16, 0.55);
  padding: 0.1rem;
  line-height: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.map-draw-btn .map-draw-icon {
  width: 1.38rem;
  height: 1.38rem;
  object-fit: contain;
  pointer-events: none;
}

.map-draw-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.map-draw-btn.active {
  background: color-mix(in srgb, var(--zone-color, #c87eff) 28%, rgba(8, 10, 16, 0.72));
  border-color: color-mix(in srgb, var(--zone-color, #c87eff) 62%, rgba(232, 196, 104, 0.35));
  box-shadow:
    0 0 14px color-mix(in srgb, var(--zone-color, #c87eff) 32%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.map-draw-btn--danger.active {
  background: rgba(255, 90, 90, 0.22);
  border-color: rgba(255, 140, 140, 0.45);
}

.dungeon-map.draw-mode .map-node.available {
  pointer-events: none;
}

.dungeon-map.draw-mode .dungeon-svg {
  cursor: crosshair;
  touch-action: none;
}

.dungeon-map.erase-mode .map-node.available {
  pointer-events: none;
}

.dungeon-map.erase-mode .dungeon-svg {
  cursor: cell;
  touch-action: none;
}

.map-doodles,
.map-doodle-preview {
  pointer-events: none;
}

.map-doodle-stroke {
  opacity: 0.88;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.35));
}

.map-doodle-preview .preview-draw {
  opacity: 0.65;
}

.map-doodle-preview .preview-erase {
  stroke: rgba(255, 255, 255, 0.55) !important;
  stroke-width: 22 !important;
  opacity: 0.35;
  stroke-linecap: round;
}

.dungeon-map {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 14px;
  background: transparent;
}

.dungeon-svg {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

.map-paths {
  opacity: 1;
}

.map-conn-outer,
.map-conn-inner {
  pointer-events: none;
}

.map-paths .map-conn-active-anim {
  animation: conn-flow 2s linear infinite;
}


.map-node .node-icon,
.map-node .node-glyph {
  pointer-events: none;
}

.map-node .node-icon image {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.map-heroes {
  pointer-events: none;
}

.map-node-labels {
  pointer-events: none;
}

.map-heroes .char-icon-marker {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.65));
}

.map-heroes .party-marker-hero {
  filter: drop-shadow(0 0 8px rgba(232, 196, 104, 0.9));
  animation: bob 2s ease-in-out infinite;
}

.map-heroes .party-marker-hero .char-icon-marker-plate {
  stroke: rgba(232, 196, 104, 0.95);
  stroke-width: 1.6;
}

.map-heroes .map-vote-hero {
  filter: drop-shadow(0 0 6px rgba(160, 200, 255, 0.7));
  opacity: 0.95;
}

.map-node.available:hover circle.node-bg {
  filter: url(#glow-strong);
}

.map-error {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem;
  font-size: 0.95rem;
}

@keyframes conn-flow {
  to { stroke-dashoffset: -22; }
}

/* SVG Knoten */
.map-node { transition: opacity 0.3s; }
.map-node .node-bg { transition: all 0.25s; }

.map-node.available {
  cursor: pointer;
}

.map-node.visited:not(.current):not(.available) {
  opacity: 0.55;
}

.map-entrance-party {
  pointer-events: none;
}

.map-entrance-party .party-marker-entrance {
  filter: drop-shadow(0 0 8px rgba(232, 196, 104, 0.85));
  animation: bob 2s ease-in-out infinite;
}

.map-entrance-party .party-marker-entrance .char-icon-marker-plate {
  stroke: rgba(232, 196, 104, 0.95);
  stroke-width: 1.6;
}

.map-node.available .node-outer {
  animation: node-ring 1.6s ease-in-out infinite;
}

@keyframes node-ring {
  0%, 100% { opacity: 0.5; stroke-width: 2; }
  50% { opacity: 1; stroke-width: 3; }
}

.map-node.quest-marked .node-outer {
  stroke: #ffd86a;
  opacity: 1;
  animation: quest-map-pulse 1.8s ease-in-out infinite;
}

.map-node.quest-marked .quest-map-marker {
  filter: drop-shadow(0 0 4px rgba(255, 216, 106, 0.85));
  pointer-events: none;
}

@keyframes quest-map-pulse {
  0%, 100% { opacity: 0.7; stroke-width: 2.5; }
  50% { opacity: 1; stroke-width: 3.5; }
}

.char-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.12), transparent 42%),
    radial-gradient(circle, color-mix(in srgb, var(--icon-color) 85%, #1a1428), rgba(12, 10, 20, 0.95));
  border: 2px solid color-mix(in srgb, var(--icon-accent) 70%, rgba(232, 196, 104, 0.5));
  box-shadow:
    0 0 10px color-mix(in srgb, var(--icon-color) 45%, transparent),
    0 0 6px rgba(232, 196, 104, 0.15);
  vertical-align: middle;
  line-height: 1;
  flex-shrink: 0;
}

.char-icon + .char-pool-name {
  margin-left: 0.22rem;
}

.char-icon-xs {
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.78rem;
}

.char-icon-tag {
  width: 1.05rem;
  height: 1.05rem;
  font-size: 0.62rem;
}

.char-icon-sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.95rem;
}

.char-icon-img {
  padding: 0;
  overflow: hidden;
  background: var(--icon-color);
  border: 2px solid var(--icon-accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--icon-color) 55%, transparent);
}

.char-icon-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  border-radius: 50%;
  transform: scale(1.12);
}

.char-icon-marker-img {
  pointer-events: none;
}

.char-icon-marker {
  pointer-events: none;
}

.char-icon-marker-emoji {
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
}

.node-label,
.node-label-bg {
  pointer-events: none;
}

.map-footer {
  flex: 0 0 auto;
  width: var(--map-panel-width);
  max-width: var(--map-panel-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.35rem 0 max(0.5rem, env(safe-area-inset-bottom));
  /* Kein dunkler Footer-Block — wirkte unter dem abgerundeten Button wie ein Schatten. */
  background: transparent;
  position: relative;
  z-index: 5;
  /* Footer selbst nicht die Map zusammen — nur die Event-Box scrollt. */
  min-width: 0;
}

.map-event {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  background: rgba(10, 8, 18, 0.82);
  border: 1px solid rgba(232, 196, 104, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 0.8rem 1.5rem;
  border-radius: 16px;
  text-align: center;
  font-size: 0.95rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* Große Nachrichten (z. B. Kartenverbesserung) scrollen hier,
     statt die Map-Box per Flex zu erdrücken. */
  max-height: min(32vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.map-event--outcome {
  align-items: stretch;
  padding: 0.65rem 0.9rem;
  background: rgba(8, 6, 16, 0.9);
}

.map-event--outcome .event-outcome {
  width: 100%;
}

.map-event--outcome .event-gain--cards {
  background: rgba(0, 0, 0, 0.35);
}

.event-outcome-banner {
  width: min(520px, 100%);
  margin: 0 auto 1rem;
}

.event-outcome {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
}

.event-outcome--compact {
  gap: 0.35rem;
}

.event-outcome-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold);
  text-align: center;
}

.event-outcome--compact .event-outcome-title {
  font-size: 0.76rem;
}

.event-outcome-narrative,
.event-outcome-player-head {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.event-outcome--compact .event-outcome-narrative,
.event-outcome--compact .event-outcome-player-head {
  font-size: 0.82rem;
}

.event-outcome-players {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.event-outcome-player {
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.event-outcome-gains {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.event-gain {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

/* Alte Text-Chips zu Auftrag/Fluch wirken klickbar (Detail per CardMeta). */
.event-gain--reward:not(.event-gain--cards),
.event-gain--negative:not(.event-gain--cards) {
  cursor: pointer;
}
.event-gain--reward:not(.event-gain--cards):hover,
.event-gain--negative:not(.event-gain--cards):hover {
  filter: brightness(1.12);
}

.event-gain--positive {
  color: #b8ffe0;
  background: rgba(72, 168, 120, 0.18);
  border-color: rgba(126, 255, 179, 0.28);
}

.event-gain--negative {
  color: #ffb8b8;
  background: rgba(168, 72, 72, 0.18);
  border-color: rgba(255, 126, 126, 0.28);
}

.event-gain--reward {
  color: #ffe9a8;
  background: rgba(168, 136, 72, 0.2);
  border-color: rgba(255, 224, 126, 0.32);
}

.event-gain--neutral {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.event-gain--cards {
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
}

.event-gain-cards-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffe9a8;
}

/* Bereits erhaltene Belohnung (nach der Wahl) — grün statt gold. */
.event-gain--received .event-gain-cards-label {
  color: #b8ffe0;
}

.event-gain--received .event-outcome-card-mini {
  border-color: rgba(126, 255, 179, 0.4);
  background: rgba(72, 168, 120, 0.16);
}

.event-outcome-card-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.event-outcome-card-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.45rem 0.28rem 0.35rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  min-width: 0;
}

.event-outcome-card-mini-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.event-outcome-card-mini-meta {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.event-outcome-card-mini-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: #f4f0ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 8.5rem;
}

.event-outcome-card-mini-cost {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
}

.event-outcome-card-mini.is-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.event-outcome-card-mini.is-clickable:hover,
.event-outcome-card-mini.is-clickable:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  outline: none;
}

/* --- Karten-Detail-Popup (Tippen auf erhaltene Karte) ------------------ */
.card-detail-popup {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem)
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(6, 8, 14, 0.8);
  backdrop-filter: blur(4px);
}

.card-detail-popup[hidden] {
  display: none;
}

.card-detail-popup-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  max-width: 22rem;
  width: 100%;
}

.card-detail-popup-close {
  align-self: center;
}

.entity-detail-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 0.45rem;
  width: min(100%, 16rem);
}

.entity-detail-actions .btn {
  width: 100%;
}

.entity-detail-popup {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem)
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(6, 8, 14, 0.8);
  backdrop-filter: blur(4px);
}

.entity-detail-popup[hidden] {
  display: none;
}

.entity-detail-popup-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 22rem;
  width: 100%;
}

.entity-detail-card {
  position: relative;
  isolation: isolate;
  width: min(240px, 72vw);
  min-width: 0;
  max-width: 240px;
  flex: none;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.85rem 0.75rem 0.7rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(168deg, rgba(42, 32, 58, 0.98), rgba(14, 10, 22, 0.99));
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.45),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.entity-detail-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(
    145deg,
    rgba(232, 196, 104, 0.65),
    rgba(61, 154, 139, 0.35),
    rgba(123, 94, 168, 0.4),
    rgba(232, 196, 104, 0.45)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

.entity-detail-card.entity-enemy {
  background: linear-gradient(168deg, rgba(72, 28, 42, 0.98), rgba(22, 10, 18, 0.99));
}

.entity-detail-card.entity-ally {
  background: linear-gradient(168deg, rgba(28, 48, 72, 0.98), rgba(10, 18, 32, 0.99));
}

.entity-detail-art {
  width: 7rem;
  height: 7.6rem;
  margin: 0.35rem 0 0.45rem;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 auto;
}

.entity-detail-art img,
.entity-detail-popup .char-portrait-battle,
.entity-detail-popup .enemy-portrait-battle,
.entity-detail-popup .summon-portrait-battle {
  width: 7rem;
  height: 7.6rem;
  object-fit: cover;
  object-position: center 12%;
  display: block;
}

.entity-detail-name {
  width: 100%;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  writing-mode: horizontal-tb;
  white-space: normal;
  overflow-wrap: anywhere;
}

.entity-detail-stats {
  width: 100%;
  margin-top: 0.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  text-align: center;
  color: var(--text);
}

.entity-detail-stats .entity-block {
  position: static;
}

.entity-detail-stats .entity-enemy-energy {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  margin: 0;
  font-size: 0.88rem;
}

.entity-detail-stats .entity-enemy-energy .game-icon-img {
  width: 1.2rem;
  height: 1.2rem;
}

.entity-detail-note {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-dim);
  text-align: center;
}

.entity-detail-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
}

.entity-detail-chips .entity-block {
  position: static;
}

.entity-detail-body {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.entity-detail-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-dim);
  text-align: center;
}

.entity-detail-card .card-meta {
  width: 100%;
  margin-top: 0.55rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.entity-detail-meta-line {
  margin: 0;
  max-width: 22rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.4;
}

.entity-detail-meta-line .char-icon {
  vertical-align: middle;
}

#btn-enter-node,
.map-enter-btn {
  width: 100%;
  border-radius: 14px;
}

#btn-enter-node {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--zone-color) 75%, #e8c468),
    color-mix(in srgb, var(--zone-color) 55%, #1a1428)
  );
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  box-shadow:
    0 4px 18px color-mix(in srgb, var(--zone-color) 42%, transparent),
    0 0 20px color-mix(in srgb, var(--zone-color) 22%, transparent);
  transition: transform 0.15s, box-shadow 0.25s ease, background 0.4s ease, border-color 0.4s ease;
}

#btn-enter-node:not(:disabled):hover {
  box-shadow:
    0 6px 24px color-mix(in srgb, var(--zone-color) 55%, transparent),
    0 0 28px color-mix(in srgb, var(--zone-color) 30%, transparent);
}

#btn-enter-node:disabled {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--zone-color) 38%, #2a2038),
    color-mix(in srgb, var(--zone-color) 22%, #1a1428)
  );
  border-color: color-mix(in srgb, var(--zone-color) 28%, transparent);
  box-shadow: none;
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

/* Combat */
#screen-combat {
  --zone-bg: none;
  --zone-color: #c87eff;
  /* Schmaler als globales --safe-bottom: Hand tiefer, Zonen-BG bleibt in der PWA-Safe-Area sichtbar. */
  --combat-safe-bottom: max(0.1rem, calc(env(safe-area-inset-bottom, 0px) * 0.22));
  padding: var(--hud-toolbar-clearance) 0 0;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.2) 38%, rgba(0,0,0,0.28) 72%, rgba(0,0,0,0.22) 100%),
    var(--zone-bg);
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  transition: background 0.6s ease;
}

.combat-arena {
  /* Breite für Resonanz + Stapel + Zug-Ende; Feld hält rechts Abstand (Status/Absichten). */
  --combat-rail-width: 2.75rem;
  --combat-rail-gap: 0.32rem;
  --combat-rail-reserve: calc(var(--combat-rail-width) + var(--combat-rail-gap) + env(safe-area-inset-right, 0px));
  --combat-hand-min: 198px;
  --combat-hand-pad-top: 0.35rem;
  --combat-hand-block: calc(var(--combat-hand-min) + var(--combat-hand-pad-top) + var(--combat-safe-bottom) + 1.4rem);
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.combat-fx-layer {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: visible;
}

.combat-zone-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.35rem var(--hud-toolbar-inset-end) 0.2rem var(--hud-toolbar-inset-start);
  color: var(--text);
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px color-mix(in srgb, var(--zone-color) 55%, transparent);
}

.combat-hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--zone-color) 42%, rgba(255, 255, 255, 0.14));
  background: rgba(10, 8, 20, 0.58);
  color: inherit;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.combat-hud-chip:hover,
.combat-hud-chip.active {
  background: rgba(22, 16, 36, 0.88);
  box-shadow: 0 0 14px color-mix(in srgb, var(--zone-color) 38%, transparent);
}

.combat-hud-chip:active {
  transform: scale(0.96);
}

.combat-hud-chip-value {
  font-size: 0.82em;
  letter-spacing: 0.03em;
}

.combat-field {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: clamp(0.65rem, 2.5vh, 1.35rem);
  padding: 0.5rem var(--combat-rail-reserve) 0.5rem 0.85rem;
  overflow: hidden;
  background: radial-gradient(
    ellipse at 50% 45%,
    color-mix(in srgb, var(--zone-color) 22%, transparent) 0%,
    transparent 72%
  );
}

/* Rechts: Resonanz oben, Zug beenden mittig, Stapel unterhalb der Helden — über der Hand. */
.combat-side-rail {
  position: absolute;
  top: 0.2rem;
  right: max(0.15rem, env(safe-area-inset-right, 0px));
  bottom: var(--combat-hand-block);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.2rem;
  width: var(--combat-rail-width);
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  pointer-events: none;
  padding-bottom: 5px;
}

.combat-side-rail::-webkit-scrollbar {
  display: none;
}

.combat-side-rail > *,
.combat-side-rail-top,
.combat-side-rail-mid,
.combat-side-rail-bottom,
.combat-side-rail-piles {
  pointer-events: auto;
}

.combat-side-rail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  width: 100%;
  flex: 0 0 auto;
}

.combat-side-rail-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 2.4rem;
  width: 100%;
}

.combat-side-rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  width: 100%;
  flex: 0 0 auto;
  margin-top: auto;
}

.combat-side-rail-piles {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  width: 100%;
}

.combat-side-rail .combat-pile {
  width: 100%;
  padding-bottom: 0;
  gap: 0.12rem;
}

.combat-side-rail .combat-pile-btn {
  gap: 0.1rem;
}

.combat-side-rail .combat-pile-stack {
  width: 2.05rem;
  height: 2.75rem;
}

.combat-side-rail .combat-pile-card {
  width: 1.9rem;
  height: 2.55rem;
}

.combat-side-rail .combat-pile-label {
  font-size: 0.42rem;
  max-width: 2.7rem;
  letter-spacing: 0.02em;
}

.combat-side-rail .combat-pile-count {
  font-size: 0.55rem;
  min-width: 1rem;
  padding: 0.06rem 0.16rem;
}

.combat-side-rail .btn-end-turn {
  width: 100%;
  margin: 0;
  align-self: stretch;
  flex-shrink: 0;
  padding: 0.34rem 0.1rem;
  font-size: 0.54rem;
  line-height: 1.12;
  letter-spacing: 0.02em;
  white-space: normal;
  border-radius: 8px;
}

.combat-energy-display,
#energy-display {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-width: 0;
  width: 100%;
  padding: 0.22rem 0.1rem;
  border-radius: 8px;
  font-size: 0.64rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  background:
    linear-gradient(165deg, rgba(36, 28, 58, 0.92), rgba(12, 10, 20, 0.94));
  border: 1px solid rgba(232, 196, 104, 0.28);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.1;
}

.combat-energy-bolt {
  font-size: 0.85em;
  line-height: 1;
}

.combat-energy-bolt .game-icon-img {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

.combat-energy-value {
  font-size: 0.95em;
  line-height: 1;
}

.combat-top {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  width: 100%;
  max-width: 100%;
}

.enemy-zone {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.45rem;
  justify-content: safe center;
  align-items: flex-start;
  width: max-content;
  min-width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.combat-mid {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
  gap: 0.55rem;
  min-height: 0;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
  margin-top: auto;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.ally-zone {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.45rem;
  justify-content: safe center;
  align-items: flex-end;
  width: max-content;
  min-width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.combat-bottom {
  /* Verlauf nach unten transparent → Zonen-Hintergrund bleibt in der Safe-Area sichtbar. */
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--zone-color) 14%, rgba(26, 16, 53, 0.55)) 0%,
    color-mix(in srgb, var(--zone-color) 8%, rgba(26, 16, 53, 0.22)) 52%,
    transparent 100%
  );
  border-top: 1px solid color-mix(in srgb, var(--zone-color) 32%, transparent);
  /* Handkarten bündig an den Bildschirmrändern (kein seitliches Padding). */
  padding: 0.35rem 0 var(--combat-safe-bottom);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 4;
}

#screen-combat .btn-end-turn {
  box-shadow: 0 4px 16px color-mix(in srgb, var(--zone-color) 28%, transparent);
}

.combat-resonance {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  max-width: none;
  padding: 0.28rem 0.14rem;
  border-radius: 10px;
  box-sizing: border-box;
  background:
    linear-gradient(165deg, rgba(36, 28, 58, 0.92), rgba(12, 10, 20, 0.94));
  border: 1px solid rgba(232, 196, 104, 0.22);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-weight: 800;
  color: #f5ebe0;
  overflow: hidden;
}

.combat-resonance::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(232, 196, 104, 0.08), transparent 42%, rgba(61, 154, 139, 0.07));
  pointer-events: none;
  z-index: 0;
}

.combat-resonance.has-charge {
  border-color: rgba(232, 196, 104, 0.42);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.35),
    0 0 16px rgba(232, 196, 104, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.combat-resonance > * {
  position: relative;
  z-index: 1;
}

.combat-resonance.resonance-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.combat-resonance.resonance-clickable:hover,
.combat-resonance.resonance-clickable:focus-visible {
  border-color: rgba(232, 196, 104, 0.65);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(232, 196, 104, 0.22);
  outline: none;
}

.combat-resonance-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  opacity: 0.9;
  filter: drop-shadow(0 0 6px rgba(232, 196, 104, 0.35));
}

.combat-resonance-icon .game-icon-img,
.combat-resonance-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.combat-resonance-meter {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
}

.combat-resonance-pip {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.combat-resonance-pip.filled {
  background: linear-gradient(145deg, #fff1c4, #e8c468 55%, #c9a24a);
  border-color: rgba(255, 230, 160, 0.75);
  box-shadow: 0 0 8px rgba(232, 196, 104, 0.55);
}

.combat-resonance-tracks {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.16rem;
  margin: 0;
}

.combat-resonance-track {
  display: inline-flex;
  width: 0.88rem;
  height: 0.88rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.58rem;
  line-height: 1;
}

.combat-resonance-track .game-icon-img,
.combat-resonance-track img {
  width: 0.62rem;
  height: 0.62rem;
  object-fit: contain;
}

.zone-skill-row {
  display: inline-flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem;
  margin: 0.06rem 0 0;
  padding: 0.28rem 0 0;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.zone-skill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Etwas mehr Tip-Fläche, ohne die Leiste zu sprengen. */
  min-width: 1.7rem;
  min-height: 1.5rem;
  padding: 0.1rem 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, opacity 0.12s ease, filter 0.12s ease;
}

.zone-skill-cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1a1420;
  background: linear-gradient(145deg, #d8c8a0, #8a7a5a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.zone-skill-btn.ready .zone-skill-cost {
  background: linear-gradient(145deg, #fff1c4, #e8c468 55%, #c9a24a);
  border-color: rgba(232, 196, 104, 0.75);
  box-shadow: 0 0 8px rgba(232, 196, 104, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.zone-skill-btn.ready:hover {
  transform: translateY(-1px);
}

.zone-skill-btn.ready:hover .zone-skill-cost {
  box-shadow: 0 0 12px rgba(232, 196, 104, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.zone-skill-btn.locked {
  opacity: 0.5;
  cursor: pointer;
}

.zone-skill-btn.used {
  opacity: 0.38;
  filter: grayscale(0.55);
  cursor: pointer;
}

.zone-skill-btn.used .zone-skill-cost {
  text-decoration: line-through;
  text-decoration-color: rgba(26, 20, 32, 0.55);
}

.zone-skill-confirm {
  position: fixed;
  inset: 0;
  z-index: 10070;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem)
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(6, 8, 14, 0.82);
  backdrop-filter: blur(5px);
}

.zone-skill-confirm[hidden] {
  display: none;
}

.zone-skill-confirm-inner {
  width: min(22rem, 100%);
  padding: 1.15rem 1.2rem 1.05rem;
  border-radius: 16px;
  border: 1px solid rgba(232, 196, 104, 0.35);
  background:
    linear-gradient(160deg, rgba(42, 36, 28, 0.96), rgba(18, 20, 28, 0.97)),
    radial-gradient(ellipse at top, rgba(232, 196, 104, 0.12), transparent 55%);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(232, 196, 104, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.zone-skill-confirm-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.zone-skill-confirm-cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #2a2010;
  background: linear-gradient(145deg, #fff1c4, #e8c468 55%, #c9a24a);
  box-shadow: 0 0 10px rgba(232, 196, 104, 0.4);
  flex-shrink: 0;
}

.zone-skill-confirm-title {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f0e6d4;
  line-height: 1.25;
}

.zone-skill-confirm-desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(242, 235, 227, 0.92);
}

.zone-skill-confirm-status {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(232, 196, 104, 0.85);
}

.zone-skill-confirm-hint {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: rgba(242, 235, 227, 0.55);
}

.zone-skill-confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.zone-skill-confirm-actions .btn {
  min-width: 6.5rem;
}

.zone-skill-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.zone-skill-target-chip {
  appearance: none;
  border: 1px solid rgba(232, 196, 104, 0.35);
  background: rgba(18, 16, 28, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}

.zone-skill-target-chip:hover,
.zone-skill-target-chip:focus-visible {
  border-color: rgba(232, 196, 104, 0.7);
  box-shadow: 0 0 10px rgba(232, 196, 104, 0.28);
}

.zone-skill-target-chip.selected {
  background: linear-gradient(145deg, rgba(232, 196, 104, 0.28), rgba(42, 32, 18, 0.9));
  border-color: #e8c468;
  color: #fff4d6;
  box-shadow: 0 0 12px rgba(232, 196, 104, 0.4);
}

.zone-blessing-hero {
  display: flex;
  justify-content: center;
  margin-bottom: 0.6rem;
}

.zone-blessing-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  border: 2px solid rgba(232, 196, 104, 0.45);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(0, 0, 0, 0.25);
}

.zone-blessing-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zone-blessing-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
}

.zone-blessing-choice-label {
  font-weight: 800;
  color: var(--gold);
}

.zone-blessing-choice-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.35;
}

.zone-blessing-choice-tradeoff {
  font-size: 0.72rem;
  color: #e8a0a8;
  font-weight: 700;
}

.almanach-zone-hero-banner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 196, 104, 0.28);
  background: rgba(255, 224, 126, 0.06);
}

.almanach-zone-hero-avatar {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  border: 2px solid rgba(232, 196, 104, 0.4);
  background: rgba(0, 0, 0, 0.25);
}

.almanach-zone-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.almanach-zone-hero-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.almanach-zone-hero-info strong {
  color: var(--gold);
  font-size: 1rem;
}

.almanach-zone-hero-info span {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.almanach-zone-hero-info p {
  margin: 0.25rem 0 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.35;
}

.almanach-tradeoff {
  color: #e8a0a8;
  font-style: normal;
  font-weight: 700;
}

.almanach-cost-chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 196, 104, 0.45);
  background: rgba(255, 224, 126, 0.1);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  vertical-align: middle;
}

.almanach-zone-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.almanach-enemy-row.tier-elite .almanach-glossary-label {
  color: #c8a0ff;
}

.almanach-enemy-row.tier-boss .almanach-glossary-label {
  color: #ffb070;
}

.almanach-enemy-row.tier-dungeon .almanach-glossary-label {
  color: #9ad0ff;
}

.almanach-enemy-row {
  align-items: flex-start;
  gap: 0.75rem;
}

.almanach-enemy-art {
  width: 4.2rem;
  height: 4.2rem;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(232, 196, 104, 0.28);
  font-size: 1.7rem;
}

.almanach-enemy-art img.almanach-enemy-portrait,
.almanach-enemy-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.almanach-enemy-info {
  min-width: 0;
  flex: 1;
}

.almanach-enemy-attacks-label {
  margin: 0.35rem 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.almanach-intent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.almanach-intent-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.7rem;
  color: #f0e6d8;
  line-height: 1.2;
}

.almanach-intent-chip.type-attack,
.almanach-intent-chip.type-aoe {
  border-color: rgba(255, 120, 100, 0.4);
  background: rgba(255, 90, 70, 0.12);
}

.almanach-intent-chip.type-defend {
  border-color: rgba(120, 180, 255, 0.4);
  background: rgba(90, 150, 255, 0.12);
}

.almanach-intent-chip.type-buff {
  border-color: rgba(120, 220, 140, 0.4);
  background: rgba(80, 200, 120, 0.12);
}

.almanach-intent-chip.type-debuff,
.almanach-intent-chip.type-status,
.almanach-intent-chip.type-sandpit {
  border-color: rgba(200, 140, 255, 0.4);
  background: rgba(160, 100, 255, 0.12);
}

.almanach-intent-chip.type-summon {
  border-color: rgba(255, 210, 120, 0.45);
  background: rgba(255, 200, 90, 0.12);
}

.almanach-intent-empty {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.almanach-section-intro {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(232, 196, 104, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.4;
}

.almanach-meta-line {
  margin: 0.15rem 0 0.25rem;
  font-size: 0.68rem;
  color: var(--gold);
  opacity: 0.9;
}

.almanach-event-choices {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.almanach-event-choice {
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.74rem;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.almanach-event-choice strong {
  color: #f5ebe0;
}

.almanach-event-effects {
  color: var(--gold);
  font-weight: 700;
}

.almanach-event-choice em {
  color: var(--text-dim);
  font-style: normal;
}

.almanach-dungeon-notes {
  margin-top: 0.35rem;
  color: var(--text-dim);
  font-size: 0.74rem;
  line-height: 1.4;
}

.almanach-search-row-alone {
  width: 100%;
}

.entity-tactic-trait {
  position: absolute;
  top: 0.28rem;
  right: 0.28rem;
  z-index: 3;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.12rem 0.22rem;
  border-radius: 999px;
  background: rgba(20, 12, 36, 0.82);
  border: 1px solid rgba(200, 120, 255, 0.45);
  cursor: help;
}

.combat-hand-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: var(--combat-hand-min, 168px);
}

.combat-hand-row .hand-zone {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
}

.combat-pile-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
}

.combat-pile-column .combat-pile {
  width: 4.6rem;
  padding-bottom: 0;
}

.combat-pile {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  width: 4.6rem;
  padding-bottom: 0.15rem;
}

.combat-pile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.combat-pile-btn:hover .combat-pile-stack,
.combat-pile-btn:focus-visible .combat-pile-stack {
  transform: scale(1.05);
}

.combat-pile-btn:focus-visible {
  outline: 2px solid rgba(232, 196, 104, 0.55);
  outline-offset: 2px;
  border-radius: 10px;
}

.pile-card-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(232, 196, 104, 0.45);
}

.pile-card-row + .pile-card-row {
  margin-top: 0.35rem;
}

.pile-card-row-icon {
  flex-shrink: 0;
}

.pile-card-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.pile-card-row-name {
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.pile-card-row-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.25;
}

.pile-order-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #3a2800;
  background: var(--gold);
  vertical-align: middle;
}

.pile-card-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.pile-order-tag--above {
  margin: 0;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1200;
  background: linear-gradient(180deg, #ffe29a 0%, #e8c468 55%, #c9a04a 100%);
  border: 1px solid rgba(255, 244, 200, 0.9);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.45);
  line-height: 1.15;
  white-space: nowrap;
}

.pile-card-slot--next .almanach-card-tile {
  box-shadow:
    0 0 0 2px rgba(232, 196, 104, 0.7),
    0 4px 16px rgba(0, 0, 0, 0.4);
}

.combat-pile-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  text-align: center;
  line-height: 1.15;
  max-width: 4.8rem;
}

.combat-pile-stack {
  position: relative;
  width: 3.35rem;
  height: 4.55rem;
}

.combat-pile-card {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 3.1rem;
  height: 4.2rem;
  border-radius: 10px;
  border: 2px solid rgba(232, 196, 104, 0.42);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

.combat-pile-card--back {
  background-color: transparent;
  background-image: var(--card-back-image);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-color: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.draw-pile-stack .combat-pile-card--back:nth-child(1) {
  top: 0;
  transform: rotate(-4deg);
  z-index: 1;
}

.draw-pile-stack .combat-pile-card--back:nth-child(2) {
  top: 0.12rem;
  transform: rotate(2deg);
  z-index: 2;
}

.draw-pile-stack .combat-pile-card--back:nth-child(3) {
  top: 0.24rem;
  transform: rotate(-1deg);
  z-index: 3;
}

.combat-pile-card--back::after {
  content: none;
}

.combat-pile-card--top {
  top: 0.1rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.1), transparent 42%),
    linear-gradient(160deg, rgba(28, 20, 44, 0.96), rgba(12, 10, 20, 0.98));
}

.combat-pile-card--empty {
  top: 0.1rem;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(8, 8, 14, 0.35);
  box-shadow: none;
}

.combat-pile-top-icon {
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.combat-pile-count {
  position: absolute;
  right: -0.35rem;
  bottom: -0.2rem;
  z-index: 5;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: rgba(12, 10, 20, 0.92);
  border: 1px solid rgba(232, 196, 104, 0.55);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.exhaust-pile-stack .combat-pile-count {
  border-color: rgba(168, 120, 255, 0.65);
}

.combat-pile-card--exhaust {
  border-color: rgba(168, 120, 255, 0.55) !important;
  box-shadow:
    inset 0 0 0 2000px rgba(72, 36, 110, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.45);
}

.combat-pile-card--exhaust.combat-pile-card--back::after {
  content: none;
}

.exhaust-pile .combat-pile-label {
  color: rgba(200, 160, 255, 0.88);
}

.hand-zone {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  min-height: var(--combat-hand-min, 198px);
  align-items: flex-end;
  padding: 0.85rem 0 0.5rem;
  margin: 0;
  overflow: visible;
}

/* Entity (enemy/ally) */
.entity {
  text-align: center;
  position: relative;
  transition: transform 0.3s, box-shadow 0.2s, border-color 0.2s;
}

.entity-card {
  width: var(--entity-card-width);
  min-width: var(--entity-card-width);
  max-width: var(--entity-card-width);
  box-sizing: border-box;
  padding: 0.55rem 0.55rem 0.7rem;
  overflow: visible;
  flex: 0 0 var(--entity-card-width);
}

.entity-card.entity-enemy {
  width: var(--entity-card-width);
  min-width: var(--entity-card-width);
  max-width: var(--entity-card-width);
}

.entity-card.entity-compact {
  width: var(--entity-compact-width);
  min-width: var(--entity-compact-width);
  max-width: var(--entity-compact-width);
  flex: 0 0 var(--entity-compact-width);
  padding: 0.4rem 0.32rem 0.48rem;
  cursor: pointer;
}

.entity-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0.4rem;
  width: 100%;
}

.entity-row-minions {
  gap: 0.32rem;
}

.entity-hero-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  min-width: min-content;
  flex: 0 0 auto;
  width: auto;
}

.entity-enemy-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.28rem;
  min-width: min-content;
  flex: 0 0 auto;
  width: auto;
}

.entity-summon-perch {
  display: flex;
  justify-content: center;
}

.entity-summon-perch .entity-summons {
  margin: 0;
}

.entity-card.entity-tile {
  width: var(--entity-tile-width);
  min-width: var(--entity-tile-width);
  max-width: var(--entity-tile-width);
  flex: 0 0 var(--entity-tile-width);
  padding: 2px;
  border-radius: 10px;
  cursor: pointer;
  background: #141820;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  overflow: visible;
}

.entity-tile-body {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: none;
}

.entity-tile-art {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.entity-tile .entity-portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
}

.entity-tile .entity-portrait img,
.entity-tile .char-portrait-battle,
.entity-tile .enemy-portrait-battle,
.entity-tile .summon-portrait-battle,
.entity-tile .entity-portrait-emoji {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 14%;
  border-radius: 0;
}

.entity-hp-rail {
  position: relative;
  flex: 0 0 5px;
  margin-left: 1px;
  z-index: 2;
  pointer-events: none;
}

.entity-hp-rail-value {
  display: block;
  min-width: 0;
  padding: 0;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-align: center;
  letter-spacing: -0.03em;
}

.entity-hp-rail-track {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.entity-hp-rail-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

.entity-tile-side {
  flex: 0 0 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 0px 2px 2px;
  z-index: 2;
}

.entity-tile-side-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.entity-tile-side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  width: 100%;
}

.entity-tile-art-top {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: calc(100% - 6px);
}

.entity-tile-art-badges {
  position: absolute;
  left: 2px;
  bottom: 1px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  width: 100%;
}

.entity-tile-chips {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 18px);
}

.entity-tile .entity-block {
  position: static;
  top: auto;
  right: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.1rem 0.32rem;
  border-radius: 999px;
  background: rgba(16, 28, 56, 0.88);
  color: #fff;
  border: 1px solid rgba(120, 180, 255, 0.4);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
}

.entity-tile .entity-block-icon {
  font-size: 0.62rem;
}

.entity-tile .entity-block-icon .game-icon-img {
  width: 0.95rem;
  height: 0.95rem;
}

.entity-intent-chip,
.entity-incoming-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.1rem 0.32rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(16, 12, 22, 0.86);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.entity-intent-chip.attack,
.entity-incoming-chip {
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(70, 16, 22, 0.88);
}

.entity-incoming-chip.incoming-debuff {
  border-color: rgba(180, 140, 255, 0.55);
  background: rgba(42, 20, 70, 0.92);
}

.entity-intent-chip.defend,
.entity-intent-chip.planned {
  border-color: rgba(120, 180, 255, 0.4);
  background: rgba(16, 28, 56, 0.88);
}

.entity-intent-chip.status {
  border-color: rgba(180, 140, 255, 0.45);
  background: rgba(40, 16, 56, 0.88);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-minion-chip {
  position: absolute;
  left: 50%;
  top: 4px;
  z-index: 3;
  transform: translateX(-50%);
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  background: rgba(28, 16, 48, 0.9);
  border: 1px solid rgba(180, 150, 255, 0.4);
  color: #e0d4ff;
  font-size: 0.58rem;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}

.entity-role-badges {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}

.entity-role-badges .entity-role-badge {
  position: static;
}

.entity-role-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.entity-tile > .entity-role-badge {
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
}

.entity-role-badge .game-icon-img {
  width: 0.85rem;
  height: 0.85rem;
}

.entity-role-guard {
  box-shadow: none;
}

.entity-role-striker {
  border-color: rgba(255, 170, 110, 0.55);
  background: rgba(40, 18, 10, 0.9);
}

.entity-role-debuff {
  border-color: rgba(180, 150, 255, 0.5);
  background: rgba(28, 16, 48, 0.9);
}

.entity-role-fused {
  border-color: rgba(232, 196, 104, 0.55);
  background: rgba(36, 28, 12, 0.92);
}

.entity-role-minion {
  border-color: rgba(180, 200, 220, 0.35);
  font-size: 0.72rem;
  line-height: 1;
}

.entity-status-dots {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 4;
  display: flex;
  gap: 2px;
  pointer-events: none;
}

.entity-status-dot {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.entity-tile-side .entity-status-dot {
  width: 14px;
  height: 14px;
}

.entity-tile-side .entity-status-dot .game-icon-img {
  width: 14px;
  height: 14px;
}

.entity-status-dot.incoming {
  opacity: 0.72;
}

.entity-status-dot .game-icon-img {
  width: 16px;
  height: 16px;
}

.entity-tile.entity-self {
  border-color: rgba(232, 196, 104, 0.42);
  box-shadow: 0 0 0 1px rgba(232, 196, 104, 0.28), 0 4px 12px rgba(0, 0, 0, 0.32);
}

.entity-tile.current-turn {
  border-color: rgba(232, 196, 104, 0.62);
  box-shadow: 0 0 0 1px rgba(232, 196, 104, 0.38), 0 4px 14px rgba(0, 0, 0, 0.36);
}

.entity-tile.turn-ended {
  opacity: 0.72;
}

.entity-tile.dead {
  filter: grayscale(0.7);
  opacity: 0.5;
}

.entity-tile.targeted {
  border-color: rgba(255, 110, 110, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 110, 110, 0.45), 0 0 10px rgba(255, 80, 80, 0.22);
}

.entity-tile .entity-overheal,
.entity-tile .entity-petals,
.entity-tile .entity-block-res,
.entity-tile .entity-chi:not(.entity-chi-dial),
.entity-tile .entity-tide,
.entity-tile .entity-tempo,
.entity-tile .entity-frost,
.entity-tile .entity-momentum,
.entity-tile .entity-toxin,
.entity-tile .entity-starlight,
.entity-tile .entity-embers,
.entity-tile .entity-bastion,
.entity-tile .entity-aftershock,
.entity-tile .entity-exhaust,
.entity-tile .entity-omen,
.entity-tile .entity-shimmer,
.entity-tile .entity-bladeflow,
.entity-tile .entity-wildgrowth {
  margin-top: 0;
  flex-direction: column;
  gap: 1px;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
}

.entity-tile .entity-chi-dial {
  margin-top: 0;
  flex-direction: row;
}
.entity-tile-side .entity-resource-icon .game-icon-img {
  width: 0.95rem;
  height: 0.95rem;
}

.entity-card.entity-bar {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
  padding: 0.38rem 0.5rem 0.38rem 0.38rem;
  text-align: left;
  overflow: visible;
}

.entity-card.entity-bar.entity-bar-sm {
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
}

.entity-bar.entity-minion {
  transform: none;
  opacity: 1;
}

.entity-bar-body {
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 0.5rem;
  padding: 0 !important;
}

.entity-bar .entity-portrait {
  flex: 0 0 70px;
  width: 70px;
  height: 80px;
  overflow: hidden;
  border-radius: 10px;
}

.entity-bar .char-portrait-battle,
.entity-bar .enemy-portrait-battle,
.entity-bar .entity-portrait img,
.entity-bar .entity-portrait-emoji {
  width: 70px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center 12%;
}

.entity-bar.entity-bar-sm .char-portrait-battle,
.entity-bar.entity-bar-sm .enemy-portrait-battle {
  width: 70px;
  height: 80px;
}

.entity-bar-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.16rem;
}

.entity-bar-head {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
}

.entity-bar-head-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  flex-shrink: 0;
}

.entity-bar-head-end .entity-overheal,
.entity-bar-head-end .entity-petals,
.entity-bar-head-end .entity-chi,
.entity-bar-head-end .entity-tide,
.entity-bar-head-end .entity-tempo,
.entity-bar-head-end .entity-frost,
.entity-bar-head-end .entity-momentum,
.entity-bar-head-end .entity-toxin,
.entity-bar-head-end .entity-starlight,
.entity-bar-head-end .entity-embers,
.entity-bar-head-end .entity-bastion,
.entity-bar-head-end .entity-aftershock,
.entity-bar-head-end .entity-exhaust,
.entity-bar-head-end .entity-omen,
.entity-bar-head-end .entity-shimmer,
.entity-bar-head-end .entity-bladeflow,
.entity-bar-head-end .entity-wildgrowth {
  margin-top: 0;
}

.entity-bar-head-end .entity-enemy-energy {
  margin: 0;
  padding: 0.08rem 0.32rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.entity-bar .entity-name {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-bar .entity-block {
  position: static;
  top: auto;
  right: auto;
  flex-shrink: 0;
}

.entity-bar .entity-tactic-trait {
  position: static;
  top: auto;
  right: auto;
  flex-shrink: 0;
}

.entity-bar .entity-minion-badge {
  align-self: auto;
  margin: 0;
  flex-shrink: 0;
}

.entity-bar .entity-hp-row {
  margin: 0;
}

.entity-bar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
}

.entity-bar .entity-intent-row,
.entity-bar .entity-enemy-energy,
.entity-bar .entity-status-row,
.entity-bar .entity-damage-row,
.entity-bar .entity-summons,
.entity-bar .entity-disconnect {
  width: auto;
  max-width: 100%;
  margin: 0;
}

.entity-bar .entity-intent-row {
  padding: 0.14rem 0.4rem;
}

.entity-bar .entity-intent-row.compact {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.entity-bar .entity-intent-row.compact .entity-intent-head {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-bar .entity-intent-head {
  margin: 0;
  font-size: 0.72rem;
}

.entity-bar .entity-status-row {
  justify-content: flex-start;
  padding: 0;
}

.entity-bar .entity-damage-row {
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-radius: 999px;
}

.entity-bar .entity-enemy-energy {
  text-align: left;
}

.entity-bar .entity-summons {
  margin-top: 0;
  justify-content: flex-start;
}

.entity-bar .entity-summons-fused {
  flex-direction: row;
  align-items: center;
}

.entity-compact .char-portrait-battle,
.entity-compact .enemy-portrait-battle {
  width: 70px;
  height: 80px;
}

.entity-compact .entity-name {
  font-size: 0.72rem;
  padding: 0 0.08rem;
}

.entity-compact .entity-hp-row {
  margin-top: 0.22rem;
  gap: 0.22rem;
}

.entity-compact .entity-hp-bar {
  height: 7px;
}

.entity-compact .entity-hp-row .entity-hp-text {
  font-size: 0.62rem;
  min-width: 2.2rem;
}

.entity-compact .entity-intent-row {
  padding: 0.16rem 0.28rem;
  margin-top: 0.2rem;
}

.entity-compact .entity-intent-head {
  font-size: 0.62rem;
  margin: 0;
  line-height: 1.2;
}

.entity-compact .entity-status-row {
  margin-top: 0.18rem;
  gap: 0.12rem;
}

.entity-compact .entity-damage-row {
  margin-top: 0.18rem;
  padding: 0.14rem 0.32rem;
}

.entity-enemy .entity-intent-row.compact .entity-intent-sub {
  text-transform: none;
  letter-spacing: 0;
  word-break: break-word;
  line-height: 1.25;
}

.entity-enemy .entity-name {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  padding: 0 0.15rem;
  width: 100%;
  overflow-wrap: anywhere;
}

.entity-enemy .entity-hp-row .entity-hp-text {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.entity-enemy .entity-hp-bar {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  height: 9px;
}

.entity-enemy .entity-intent-row.attack,
.entity-enemy .entity-intent-row.aoe {
  background: rgba(72, 18, 28, 0.94);
  border: 1px solid rgba(255, 120, 100, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.entity-enemy .entity-intent-row.defend {
  background: rgba(18, 36, 72, 0.94);
  border-color: rgba(120, 170, 255, 0.4);
}

.entity-enemy .entity-intent-row.buff {
  background: rgba(18, 52, 36, 0.94);
  border-color: rgba(120, 220, 160, 0.4);
}

.entity-enemy .entity-intent-row.debuff {
  background: rgba(44, 18, 72, 0.94);
  border-color: rgba(180, 120, 255, 0.4);
}

.entity-enemy .entity-intent-row.status {
  background: rgba(36, 36, 44, 0.94);
  border-color: rgba(180, 180, 190, 0.45);
}

.entity-enemy .entity-intent-head {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.entity-enemy .entity-intent-value-lg {
  font-size: 1.15rem;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 120, 100, 0.35);
  margin: 0.05rem 0 0.1rem;
}

.entity-enemy .entity-intent-sub {
  color: #ffc8c8;
}

.entity-enemy .entity-intent-pill {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 150, 130, 0.38);
  min-width: 3rem;
  padding: 0.32rem 0.42rem;
}

.entity-enemy .entity-intent-pill-dmg {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 100, 100, 0.4);
}

.entity-enemy .entity-intent-pill-name {
  color: #ffe0e0;
  font-weight: 800;
}

.entity-ally .entity-name {
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.entity-ally .entity-hp-row .entity-hp-text {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.entity-ally .entity-hp-bar {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  height: 8px;
}

button.entity-sandpit.entity-status-icon {
  align-self: center;
  margin-top: 0.25rem;
  color: #f0d080;
  background: rgba(60, 40, 10, 0.85);
  border-color: rgba(200, 160, 80, 0.45);
  cursor: pointer;
}

button.entity-sandpit.entity-status-icon:hover,
button.entity-sandpit.entity-status-icon.active {
  border-color: rgba(240, 208, 128, 0.75);
  box-shadow: 0 0 10px rgba(200, 160, 80, 0.35);
}

.entity-summons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.entity-summons-live {
  gap: 0.35rem;
  align-items: stretch;
  padding-top: 0.55rem;
}

.entity-summons-live.has-large {
  align-items: flex-end;
  gap: 0.32rem;
}

.entity-summon-perch .entity-summons-live {
  gap: 0.28rem;
}

.entity-summon-perch .entity-summons-live.has-large {
  gap: 0.26rem;
}

.entity-ally-minion.entity-tile {
  --entity-tile-width: var(--entity-minion-tile-width);
}

.entity-ally-minion.entity-tile.is-large {
  --entity-tile-width: var(--entity-minion-tile-width-large);
  border-color: rgba(232, 196, 104, 0.38);
  box-shadow: 0 0 0 1px rgba(232, 196, 104, 0.22), 0 4px 12px rgba(0, 0, 0, 0.32);
}

.entity-ally-minion.drop-valid {
  box-shadow: 0 0 0 2px rgba(180, 220, 160, 0.7);
}

.entity-ally-minion.targeted {
  box-shadow: 0 0 0 2px rgba(232, 120, 96, 0.7);
}

.ally-minion-recall {
  background: linear-gradient(160deg, #e8c468 0%, #c9a04a 48%, #8a6828 100%);
  color: #1a1208;
  border: 1px solid rgba(255, 236, 180, 0.5);
  box-shadow: 0 0 16px rgba(232, 196, 104, 0.28), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.ally-minion-recall:hover {
  box-shadow: 0 0 22px rgba(232, 196, 104, 0.42), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.takara-mark {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  z-index: 3;
  display: flex;
  width: 1.05rem;
  height: 1.05rem;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 0.25rem;
}

.takara-mark input {
  margin: 0;
  width: 0.85rem;
  height: 0.85rem;
  accent-color: #e8c468;
}

.entity-summons-fused {
  flex-direction: column;
  gap: 0.1rem;
}

.summon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.35);
}

.summon-slot.filled,
.summon-slot.summon-fused {
  color: #e8e0ff;
  border-color: rgba(180, 160, 220, 0.45);
  background: rgba(60, 40, 90, 0.65);
}

button.summon-slot {
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.summon-slot:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(180, 160, 220, 0.55);
}

button.summon-slot.active {
  box-shadow: 0 0 0 2px rgba(232, 196, 104, 0.75);
}

.summon-fused-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: #d8c8f8;
  text-align: center;
  max-width: 5.5rem;
  line-height: 1.15;
}

.entity-ally .entity-damage-row {
  width: auto;
  align-self: center;
  max-width: calc(100% - 0.4rem);
  padding: 0;
  margin-top: 0.3rem;
  gap: 0;
  overflow: hidden;
  background: rgba(72, 18, 28, 0.88);
  border: 1px solid rgba(255, 120, 100, 0.35);
}

.entity-ally .entity-damage-row.compact {
  padding: 0;
  margin-top: 0.26rem;
  border-radius: 999px;
  gap: 0;
}

.entity-ally .entity-damage-row.compact .entity-damage-seg {
  padding: 0.12rem 0.32rem;
}

.entity-bar .entity-damage-seg {
  padding: 0.12rem 0.34rem;
}

.entity-ally .entity-damage-row.compact .entity-damage-icon {
  font-size: 0.7rem;
}

.entity-ally .entity-damage-row.compact .entity-damage-value {
  font-size: 0.76rem;
}

.entity-ally .entity-damage-row.compact .entity-damage-label {
  font-size: 0.48rem;
}

.entity-card-body {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 0 0.24rem 0.16rem;
}

.entity-portrait {
  display: flex;
  justify-content: center;
  align-items: center;
}

.entity-hp-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.35rem;
}

.entity-hp-row .entity-hp-bar {
  flex: 1;
  width: auto;
  min-width: 0;
  margin: 0;
}

.entity-hp-row .entity-hp-text {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  min-width: 2.6rem;
  text-align: right;
}

.entity-damage-row {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 80, 80, 0.22);
  border: 1px solid rgba(255, 140, 140, 0.25);
  line-height: 1.2;
}

.entity-damage-seg {
  display: inline-flex;
  align-items: center;
  gap: 0.14rem;
  padding: 0.14rem 0.4rem;
}

.entity-damage-seg-atk {
  background: transparent;
}

.entity-damage-row.split {
  border-color: rgba(255, 120, 100, 0.4);
}

.entity-damage-seg-def {
  gap: 0.1rem;
  padding: 0.14rem 0.38rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #c8dcff;
  background: rgba(40, 70, 140, 0.92);
  border-left: 1px solid rgba(180, 210, 255, 0.22);
}

.entity-damage-icon { font-size: 0.85rem; }

.entity-damage-value {
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffd0d0;
}

.entity-damage-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: #ffb8b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.entity-status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.22rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.32rem;
  padding: 0 0.06rem 0.04rem;
}

.entity-status-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.14rem 0.34rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  border: none;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.15s, transform 0.15s;
}

.entity-status-icon:hover {
  transform: scale(1.05);
}

.entity-status-icon.active,
.entity-tip-btn.active {
  box-shadow: 0 0 0 2px var(--gold);
}

.entity-tip-btn {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button.entity-intent-row,
button.entity-damage-row {
  width: 100%;
  max-width: 100%;
  font: inherit;
  color: inherit;
  text-align: center;
}

button.entity-damage-row {
  appearance: none;
}

button.power-badge {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--zone-color) 45%, rgba(232, 196, 104, 0.35));
  font: inherit;
  color: inherit;
}

button.entity-block {
  appearance: none;
  font: inherit;
  color: inherit;
}

.entity-status-icon.buff {
  background: rgba(72, 196, 120, 0.28);
  color: #c8ffd8;
  border: 1px solid rgba(120, 230, 160, 0.35);
}

.entity-status-icon.debuff {
  background: rgba(168, 96, 255, 0.26);
  color: #ecd4ff;
  border: 1px solid rgba(200, 140, 255, 0.35);
}

.entity-status-icon.incoming {
  border-style: dashed;
  opacity: 0.92;
}

.entity-status-emoji { font-size: 0.72rem; }

.entity-status-amt {
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.entity-intent-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0.34rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entity-intent-row.attack,
.entity-intent-row.aoe {
  background: rgba(255, 90, 90, 0.16);
  border-color: rgba(255, 130, 130, 0.22);
}

.entity-intent-row.defend {
  background: rgba(90, 150, 255, 0.16);
  border-color: rgba(130, 180, 255, 0.22);
}

.entity-intent-row.buff {
  background: rgba(80, 200, 120, 0.16);
  border-color: rgba(120, 230, 160, 0.22);
}

.entity-intent-row.debuff {
  background: rgba(168, 96, 255, 0.16);
  border-color: rgba(200, 140, 255, 0.22);
}

.entity-intent-head {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.entity-intent-row.buff .entity-intent-head,
.entity-intent-row.defend .entity-intent-head,
.entity-intent-row.debuff .entity-intent-head,
.entity-intent-row.status:not(:has(.entity-intent-target)) .entity-intent-head,
.entity-intent-row.summon .entity-intent-head {
  margin-bottom: 0;
}

.entity-intent-targets {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.entity-intent-hit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.66rem;
  line-height: 1.2;
}

.entity-intent-hit-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-intent-hit-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  flex-shrink: 0;
  margin-left: 0.25rem;
}

.entity-intent-hit-dmg {
  font-weight: 800;
  color: #ffc8c8;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.entity-intent-hit-base {
  color: var(--text-dim);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.entity-intent-hit-arrow {
  color: var(--text-dim);
  font-size: 0.58rem;
  opacity: 0.7;
}

.entity-intent-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
  background: rgba(90, 150, 255, 0.3);
  border: 1px solid rgba(120, 180, 255, 0.38);
  color: #c8e0ff;
  font-weight: 800;
  font-size: 0.58rem;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.entity-intent-block-icon {
  font-size: 0.62rem;
  line-height: 1;
}

.entity-intent-block-amt {
  font-variant-numeric: tabular-nums;
}

.entity-intent-value,
.entity-intent-target {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}

.entity-intent-value-lg {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffd0d0;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.entity-intent-row.defend .entity-intent-value-lg { color: #c8e0ff; }
.entity-intent-row.buff .entity-intent-value-lg { color: #c8ffd8; }
.entity-intent-row.debuff .entity-intent-value-lg { color: #e8d0ff; }

.entity-intent-sub {
  font-size: 0.62rem;
  font-weight: 700;
  color: #ffb8b8;
  line-height: 1.3;
  margin-top: 0.12rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.entity-intent-row.compact .entity-intent-targets {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

.entity-intent-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.22rem 0.38rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 140, 140, 0.2);
  gap: 0.08rem;
}

.entity-intent-pill-dmg {
  font-size: 0.95rem;
  font-weight: 900;
  color: #ffd0d0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.entity-intent-pill-name {
  font-size: 0.62rem;
  font-weight: 700;
  color: #f0d0d0;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  max-width: 4.5rem;
}

.entity-enemy .entity-intent-head {
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.entity-enemy .entity-intent-hit-name {
  color: #f0e0e8;
}

.entity-targetable.selected {
  transform: scale(1.04);
  box-shadow:
    0 0 22px rgba(232, 196, 104, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.5);
}

.entity-sprite {
  font-size: 3.5rem;
  animation: bob 3s ease-in-out infinite;
}

.entity-sprite.ally {
  font-size: 2.5rem;
  display: flex;
  justify-content: center;
  margin: 0 auto;
}

.entity-ally-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -6px, 0); }
}

@keyframes bob-subtle {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -3px, 0); }
}

.combat-top .entity-sprite,
.combat-mid .entity-sprite {
  animation: bob-subtle 3s ease-in-out infinite;
}

.combat-mid .entity-ally {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.entity-name {
  font-weight: 700;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  line-height: 1.2;
  width: 100%;
  word-break: break-word;
}

.entity-hp-bar {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  overflow: hidden;
}

.entity-hp-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s;
}

.entity-hp-text { font-size: 0.75rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.entity-block {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  background: var(--blue);
  color: #1a3060;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.18rem 0.38rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
  line-height: 1;
  white-space: nowrap;
}

.entity-block-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  line-height: 1;
}

.entity-block-amt {
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.entity-intent {
  font-size: 0.8rem;
  margin-top: 0.2rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: rgba(255,100,100,0.2);
}

.entity-intent-detail {
  max-width: 160px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.35;
  font-size: 0.72rem;
  text-align: center;
}

.entity-incoming {
  font-size: 0.72rem;
  margin-top: 0.35rem;
  padding: 0.25rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 100, 100, 0.22);
  color: #ffc8c8;
  font-weight: 700;
  line-height: 1.3;
}

.entity-incoming.debuff {
  background: rgba(180, 120, 255, 0.22);
  color: #e0c8ff;
  font-weight: 600;
  font-size: 0.68rem;
}

.entity-ally.targeted {
  box-shadow:
    0 0 0 2px rgba(255, 120, 120, 0.5),
    0 0 22px rgba(255, 120, 120, 0.32),
    0 8px 24px rgba(0, 0, 0, 0.5);
}

.entity-aimed-mark {
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 90, 90, 0.65));
}

.entity.dead { opacity: 0.3; filter: grayscale(1); }

.entity-ally.turn-ended:not(.dead) {
  filter: grayscale(0.82) brightness(0.78);
  opacity: 0.78;
}

.entity-targetable {
  cursor: pointer;
}

.entity-card.entity-targetable:not(.entity-bar) {
  padding: 0.5rem 0.55rem 0.64rem;
}

.entity-targetable:hover:not(.dead):not(.selected) {
  transform: translateY(-4px) scale(1.03);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(232, 196, 104, 0.22);
}

.entity-card.entity-bar.entity-targetable:hover:not(.dead):not(.selected) {
  transform: none;
  box-shadow:
    0 0 0 2px rgba(232, 196, 104, 0.42),
    0 8px 22px rgba(0, 0, 0, 0.45);
}

.entity-target-badge {
  position: absolute;
  top: -0.35rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #3a2800;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Cards — mystic tarot frame (hand + combat entities) */
.card,
.entity-card {
  position: relative;
  isolation: isolate;
  border: none;
  border-radius: 10px;
  background: linear-gradient(168deg, rgba(42, 32, 58, 0.98), rgba(14, 10, 22, 0.99));
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.45),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.entity-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  padding: 2px;
  background: linear-gradient(
    145deg,
    rgba(232, 196, 104, 0.65),
    rgba(61, 154, 139, 0.35),
    rgba(123, 94, 168, 0.4),
    rgba(232, 196, 104, 0.45)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* Spielkarten: dünner heller Innenrahmen wie im Muster, folgt den Ecken. */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: rgb(152, 135, 86);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#998a5a 0 0) content-box, linear-gradient(#e8c468 0 0);
    mask-composite: add, add;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

.card::after {
  content: none;
}

.entity-card::after {
  content: none;
}

.card {
  width: var(--hand-card-width);
  min-width: var(--hand-card-width);
  max-width: var(--hand-card-width);
  min-height: 198px;
  height: auto;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-shrink: 0;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}

.card:hover:not(.disabled) {
  transform: translateY(-12px) scale(1.05);
  z-index: 10;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(232, 196, 104, 0.22);
}

.card.disabled { opacity: 0.45; cursor: not-allowed; }
.card.selected-target-mode {
  box-shadow: 0 0 22px rgba(232, 196, 104, 0.45), 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ---- Karten per Drag & Drop ausspielen ---- */
.card.card-draggable {
  cursor: grab;
  /* pan-x: seitliches Scrollen der Hand bleibt nativ (flüssig, mit Schwung).
     Sobald ein vertikaler Drag aktiviert wird, blockiert ein non-passive
     touchmove-Listener das native Scrollen, damit der Drag beim seitlichen
     Nachzielen nicht abbricht (siehe _beginCardDrag/_dragMove in ui.js). */
  touch-action: pan-x;
}
.card.dragging {
  opacity: 0.3;
  transform: none !important;
}
.combat-drag-ghost {
  position: fixed;
  margin: 0;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -55%) scale(0.92) rotate(-2deg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), 0 0 28px rgba(232, 196, 104, 0.3);
  opacity: 0.95;
}

.entity.drop-valid {
  box-shadow: 0 0 0 2px rgba(120, 230, 140, 0.55), 0 0 18px rgba(80, 220, 120, 0.4);
  border-radius: 12px;
}
.entity.drop-hover {
  box-shadow: 0 0 0 3px rgba(150, 255, 170, 0.9), 0 0 26px rgba(90, 240, 130, 0.65);
  transform: translateY(-4px) scale(1.05);
  border-radius: 12px;
}

/* Während des Kartenzugs: Zielkarte nicht wegspringen lassen (Mac-Trackpad
   verliert sonst den Treffer knapp vor dem Ablegen). Chips fangen den Zeiger nicht. */
body.combat-card-dragging {
  user-select: none;
  -webkit-user-select: none;
}
body.combat-card-dragging .hand-zone {
  touch-action: none;
}
body.combat-card-dragging .entity.drop-hover {
  transform: none;
}
body.combat-card-dragging .entity button,
body.combat-card-dragging .entity [data-entity-tip],
body.combat-card-dragging .entity .entity-status-icon,
body.combat-card-dragging .entity-intent-chip,
body.combat-card-dragging .entity-incoming-chip {
  pointer-events: none;
}
.entity.drop-dim {
  opacity: 0.4;
  filter: grayscale(0.5);
}

.combat-drag-tip {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  transform: translate(-50%, -100%);
  min-width: 132px;
  max-width: 260px;
  padding: 0.5rem 0.7rem;
  background: rgba(14, 12, 22, 0.96);
  border: 1px solid rgba(232, 196, 104, 0.45);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  text-align: center;
  opacity: 0;
  transition: opacity 0.1s;
}
.combat-drag-tip.show { opacity: 1; }
.combat-drag-tip-total {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #ffe9a8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.combat-drag-tip-lethal {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ff8a8a;
  background: rgba(255, 70, 70, 0.16);
  border: 1px solid rgba(255, 110, 110, 0.5);
  border-radius: 6px;
  padding: 0.05rem 0.3rem;
}
.combat-drag-tip-hits {
  display: block;
  font-size: 0.72rem;
  color: #c7d0e0;
  margin-top: 0.1rem;
}
.combat-drag-tip-break {
  font-size: 0.68rem;
  color: #9aa6bd;
  margin-top: 0.2rem;
  line-height: 1.3;
}
.combat-drag-tip--block {
  border-color: rgba(120, 180, 255, 0.5);
}
.combat-drag-tip--block .combat-drag-tip-total {
  color: #b8d8ff;
}
.combat-drag-tip--buff {
  border-color: rgba(180, 220, 140, 0.5);
}
.combat-drag-tip--buff .combat-drag-tip-total {
  color: #d8f0b8;
  font-size: 0.95rem;
}

/* Einfluss-Zähler auf der Heldenkarte */
.entity-powers-toggle {
  margin-top: 0.32rem;
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  padding: 0.1rem 0.42rem;
  background: rgba(120, 160, 255, 0.16);
  border: 1px solid rgba(140, 180, 255, 0.4);
  border-radius: 999px;
  color: #cfe0ff;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.entity-powers-toggle:hover { transform: scale(1.08); background: rgba(120, 160, 255, 0.26); }
.entity-powers-toggle-icon { font-size: 0.8rem; line-height: 1; }

/* Einfluss-Liste im Popover */
.influence-list { display: flex; flex-direction: column; gap: 0.55rem; text-align: left; }
.influence-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.influence-icon { flex-shrink: 0; margin-top: 0.1rem; }
.influence-text { display: flex; flex-direction: column; gap: 0.1rem; }
.influence-name { font-weight: 700; color: #ffe9a8; font-size: 0.86rem; }
.influence-desc { font-size: 0.78rem; color: #b9c2d6; line-height: 1.35; }
.influence-empty { color: #9aa6bd; font-style: italic; }

.card-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  min-height: 1.7rem;
  padding: 0.34rem 1.7rem 0.28rem;
  border-bottom: 1px solid rgb(152, 135, 86);
}

.card-header-labels {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: calc(100% - 0.2rem);
  line-height: 1.15;
  text-align: center;
}

.card-header-label {
  font-family: 'Nunito', sans-serif;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(248, 246, 242, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.card-header-label.rarity {
  font-size: 0.42rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(248, 246, 242, 0.72);
}

.card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 0.42rem 0.42rem 0.48rem;
  box-sizing: border-box;
}

.card-cost {
  position: absolute;
  top: 50%;
  left: 0.325rem;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  clip-path: none;
  border-radius: 50%;
  background: #282444;
  color: #d1a652;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  z-index: 4;
  line-height: 1;
  border: 1px solid #988756;
  margin-top: 1px;
  padding-top: 1px;
}

/* Text statt Zahl (Auftrag/Fluch): schmales Label im Header. */
.card-cost.is-label {
  width: auto;
  min-width: 20px;
  height: auto;
  padding: 0.1rem 0.18rem;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  min-height: 20px;
}

.card.card-zoom .card-cost.is-label {
  font-size: 0.52rem;
  padding: 0.14rem 0.28rem;
}

.card-pool-icon {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.card-pool-icon.is-empty {
  visibility: hidden;
}

.card-header .char-icon {
  border-radius: 50%;
  overflow: hidden;
  color: #e8c468;
  padding-bottom: 3px;
}

.char-icon-card {
  width: 20px;
  height: 20px;
  font-size: 0.62rem;
}

.card-pool-icon .char-icon-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-icon {
  --glyph-color: var(--gold);
  width: 3.35rem;
  height: 3.35rem;
  font-size: 1.7rem;
  line-height: 1;
  z-index: 3;
}

.card .card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  aspect-ratio: 1;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--glyph-color) 50%, transparent));
}

.card .card-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
  width: 100%;
  padding: 0 0.15rem 0.2rem;
  color: #fff;
  z-index: 3;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.card-footer {
  margin-top: auto;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.14rem;
  padding-top: 0.12rem;
}

.card-desc {
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  line-height: 1.38;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-word;
  hyphens: auto;
  scrollbar-width: thin;
  padding: 0 0.05rem;
}

.card-desc::-webkit-scrollbar {
  width: 3px;
}

.card-desc::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

.card-meta {
  flex-shrink: 0;
  width: 100%;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(232, 196, 104, 0.18);
  text-align: center;
  z-index: 3;
}

.card .card-meta {
  padding-top: 0.08rem;
  border-top: none;
}

.card-hint-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.16rem;
  width: 100%;
  flex-shrink: 0;
}

.card-hint-chip {
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.14rem 0.3rem;
  border-radius: 0.5rem;
  background: rgba(60, 40, 90, 0.6);
  border: 1px solid rgba(180, 160, 220, 0.4);
  color: #ece4ff;
  white-space: nowrap;
}

.card-hint-chip.atk {
  background: rgba(120, 40, 40, 0.55);
  border-color: rgba(230, 140, 120, 0.45);
}

.card-hint-chip.def {
  background: rgba(40, 70, 110, 0.55);
  border-color: rgba(140, 180, 230, 0.45);
}

.card-hint-chip.dbf {
  background: rgba(70, 60, 40, 0.55);
  border-color: rgba(200, 180, 120, 0.45);
}

.card-hint-chip.fuse {
  background: rgba(90, 70, 30, 0.6);
  border-color: rgba(232, 196, 104, 0.5);
  color: #ffe7a8;
}

.card-hint-chip.summon {
  background: rgba(60, 40, 90, 0.65);
  border-color: rgba(180, 160, 220, 0.5);
}

.card-type-badge {
  display: inline-block;
  font-size: 0.44rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(242, 235, 227, 0.65);
  flex-shrink: 0;
  line-height: 1.2;
}

.card-type-badge.rarity {
  color: var(--gold);
  font-weight: 700;
  border-color: rgba(232, 196, 104, 0.25);
  background: rgba(232, 196, 104, 0.08);
}

.card-type-badge.count {
  color: #cfe8f0;
  font-weight: 700;
  border-color: rgba(140, 200, 220, 0.3);
  background: rgba(140, 200, 220, 0.1);
}

.card-type-badge.enchant {
  color: #d8c8f0;
  font-weight: 700;
  border-color: rgba(180, 150, 220, 0.35);
  background: rgba(140, 100, 200, 0.12);
}

.card-type-badge.upgrade {
  color: #e8c468;
  font-weight: 700;
  border-color: rgba(232, 196, 104, 0.3);
  background: rgba(232, 196, 104, 0.1);
}

.card.attack,
.entity-card.entity-enemy {
  background: linear-gradient(168deg, rgba(72, 28, 42, 0.98), rgba(22, 10, 18, 0.99));
}
.entity-card.entity-enemy::before {
  background: linear-gradient(168deg, rgba(72, 28, 42, 0.98), rgba(22, 10, 18, 0.99));
}

.card.skill,
.entity-card.entity-ally {
  background: linear-gradient(168deg, rgba(28, 48, 72, 0.98), rgba(10, 18, 32, 0.99));
}
.entity-card.entity-ally::before {
  background: linear-gradient(168deg, rgba(28, 48, 72, 0.98), rgba(10, 18, 32, 0.99));
}

.card.power {
  background: linear-gradient(168deg, rgba(48, 28, 72, 0.98), rgba(18, 10, 32, 0.99));
}

.reward-wait {
  text-align: center;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 2rem 1rem;
  max-width: 420px;
}

/* Reward */
#screen-reward {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

#screen-reward h2 {
  margin-bottom: 1rem;
  text-align: center;
}

.reward-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 520px;
}

.reward-cards .card {
  width: var(--hand-card-width);
  min-width: var(--hand-card-width);
  max-width: var(--hand-card-width);
  height: auto;
  padding: 0;
  overflow: hidden;
}

.reward-cards .card-header {
  padding: 0.28rem 0.32rem 0.2rem;
}

.reward-cards .card-body {
  padding: 0.28rem 0.4rem 0.4rem;
}

.reward-cards .card-icon {
  font-size: 1.9rem;
  width: 3.1rem;
  height: 3.1rem;
  margin: 0.28rem 0 0.14rem;
}

.reward-cards .card .card-icon {
  width: 3.1rem;
  height: 3.1rem;
}

.reward-cards .card-name {
  font-size: 0.72rem;
}

.reward-cards .card-desc {
  flex: 0 1 auto;
  min-height: 0;
  font-size: 0.56rem;
  line-height: 1.34;
  max-height: none;
  overflow: hidden;
}

.reward-cards .card-meta {
  flex-shrink: 0;
  margin-top: 0.12rem;
  width: 100%;
  padding-top: 0.1rem;
  border-top: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.reward-cards .card-type-badge {
  font-size: 0.46rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* End screen */
.end-content { text-align: center; margin-bottom: 1.5rem; }
.end-content .end-emoji { margin-bottom: 1rem; }
.end-content h2 { font-size: 2.5rem; -webkit-text-fill-color: var(--pink); }
.end-content p { color: var(--text-dim); font-size: 1.1rem; margin-top: 0.5rem; line-height: 1.45; }

.end-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 320px;
}

.end-actions .btn { width: 100%; }

.end-score {
  margin: 1.25rem auto 0.5rem;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  background: rgba(255, 224, 126, 0.12);
  border: 1px solid rgba(255, 224, 126, 0.28);
  max-width: 280px;
}

.end-score-total {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.end-score-label {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.end-score-meta {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-top: 0.65rem;
  line-height: 1.4;
}

.end-score-breakdown {
  width: 100%;
  max-width: 280px;
  margin: 0.55rem auto 0.35rem;
  text-align: left;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.end-score-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.end-score-row--mod { color: #e8a0a0; }
.end-score-nyen {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: #c9e4ff;
  line-height: 1.35;
}
.end-score-nyen-line--got {
  color: #ffe9a8;
  font-weight: 700;
}
.end-score-players {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.45;
}

/* Status popover */
.status-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10070;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(8, 4, 18, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.status-popover-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.status-popover {
  width: min(100%, 320px);
  background: linear-gradient(160deg, rgba(45, 27, 94, 0.98), rgba(26, 16, 53, 0.98));
  border: 2px solid rgba(200, 126, 255, 0.42);
  border-radius: 16px;
  padding: 1rem 1.05rem 0.9rem;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.55);
}

.status-popover-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.status-popover-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.status-popover-title {
  line-height: 1.25;
}

.status-popover-planned {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
}

.status-popover-desc {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.45;
  margin-bottom: 0.85rem;
}
.status-popover-desc .gi-inline,
.almanach-glossary-desc .gi-inline {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.18em;
  display: inline-block;
}
.resonance-track-inline {
  white-space: nowrap;
}

.status-popover-close {
  width: 100%;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.62rem 0.75rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #ffb347);
  color: #3a2800;
  cursor: pointer;
}

.status-popover-close:active {
  transform: scale(0.98);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(2rem + var(--ng-legal-footer-reserve, 0px) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(160px);
  background: rgba(255,100,100,0.9);
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  z-index: 100;
  transition: transform 0.3s, opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Combat FX */
@keyframes damage-flash {
  0%, 100% { filter: none; }
  50% { filter: brightness(2) saturate(0); }
}

@keyframes combat-hit {
  0%, 100% { filter: none; transform: translateX(0) rotate(0); }
  12% { filter: brightness(2.15) saturate(0.4) hue-rotate(-8deg); transform: translateX(6px) rotate(-1.2deg); }
  32% { filter: brightness(1.55); transform: translateX(-7px) rotate(1deg); }
  52% { filter: brightness(1.28); transform: translateX(4px) rotate(-0.4deg); }
  74% { filter: brightness(1.08); transform: translateX(-2px); }
}

@keyframes combat-block-pulse {
  0% { box-shadow: 0 0 0 rgba(100, 180, 255, 0); filter: brightness(1); }
  40% { box-shadow: 0 0 24px rgba(100, 180, 255, 0.75); filter: brightness(1.12); }
  100% { box-shadow: 0 0 0 rgba(100, 180, 255, 0); filter: brightness(1); }
}

@keyframes combat-heal-pulse {
  0% { box-shadow: 0 0 0 rgba(90, 230, 140, 0); filter: brightness(1); }
  40% { box-shadow: 0 0 26px rgba(90, 230, 140, 0.7); filter: brightness(1.18) saturate(1.15); }
  100% { box-shadow: 0 0 0 rgba(90, 230, 140, 0); filter: brightness(1); }
}

@keyframes combat-buff-pulse {
  0% { box-shadow: 0 0 0 rgba(232, 196, 104, 0); filter: brightness(1); }
  40% { box-shadow: 0 0 26px rgba(232, 196, 104, 0.72); filter: brightness(1.16); }
  100% { box-shadow: 0 0 0 rgba(232, 196, 104, 0); filter: brightness(1); }
}

@keyframes combat-enemy-lunge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(14px) scale(1.03); }
}

@keyframes combat-ally-lunge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px) scale(1.03); }
}

@keyframes combat-pile-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.entity.hit,
.entity.combat-hit { animation: combat-hit 0.52s ease; transition: none; }

.entity.combat-block { animation: combat-block-pulse 0.55s ease; transition: none; }
.entity.combat-heal { animation: combat-heal-pulse 0.55s ease; transition: none; }
.entity.combat-buff { animation: combat-buff-pulse 0.55s ease; transition: none; }
.entity.combat-attack-lunge { transition: none; }

.entity-enemy.combat-attack-lunge { animation: combat-enemy-lunge 0.38s ease; }
.entity-ally.combat-attack-lunge { animation: combat-ally-lunge 0.38s ease; }

.draw-pile-stack.combat-draw-pulse,
.discard-pile-stack.combat-discard-pulse {
  animation: combat-pile-pulse 0.4s ease;
}

.combat-fx-ghost {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.38s ease;
  transform: translate(0, 0) scale(1);
  opacity: 1;
}

.combat-fx-ghost--draw {
  background-color: transparent;
  background-image: var(--card-back-image);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.combat-fx-ghost--discard {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.14), transparent 38%),
    linear-gradient(145deg, rgba(42, 28, 72, 0.98), rgba(18, 12, 32, 0.98));
  border: 2px solid rgba(232, 196, 104, 0.42);
}

.hand-zone .card.combat-fx-card-hidden {
  opacity: 0;
  transform: scale(0.82);
  pointer-events: none;
}

.hand-zone .card.combat-fx-card-reveal {
  animation: combat-card-reveal 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes combat-card-reveal {
  from {
    opacity: 0;
    transform: scale(0.72) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes combat-floater-rise {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.72); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.14); }
  100% { opacity: 0; transform: translate(-50%, -54px) scale(1); }
}

@keyframes combat-burst-fade {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.combat-floater {
  position: absolute;
  z-index: 10020;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.7),
    0 0 14px rgba(0, 0, 0, 0.65);
  animation: combat-floater-rise 1.15s ease-out forwards;
}

.combat-floater--dmg { color: #ff6b6b; }
.combat-floater--heal { color: #7dff9a; }
.combat-floater--block { color: #7ecbff; }
.combat-floater--poison { color: #b6ff6a; }
.combat-floater--burn { color: #ff9a3c; }
.combat-floater--status { color: #e8c36a; }
.combat-floater--buff { color: #ffe08a; }
.combat-floater--debuff { color: #d4a0ff; }

.combat-burst {
  position: absolute;
  z-index: 10010;
  pointer-events: none;
  border-radius: 14px;
  animation: combat-burst-fade 0.55s ease-out forwards;
}

.combat-burst--hit {
  background: radial-gradient(circle at 50% 38%, rgba(255, 70, 50, 0.55), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(255, 90, 70, 0.55);
}

.combat-burst--heal {
  background: radial-gradient(circle at 50% 38%, rgba(80, 230, 130, 0.5), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(90, 230, 140, 0.5);
}

.combat-burst--block {
  background: radial-gradient(circle at 50% 38%, rgba(90, 180, 255, 0.5), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(110, 190, 255, 0.55);
}

.combat-burst--poison {
  background: radial-gradient(circle at 50% 38%, rgba(150, 230, 70, 0.48), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(160, 230, 80, 0.5);
}

.combat-burst--burn {
  background: radial-gradient(circle at 50% 38%, rgba(255, 140, 40, 0.52), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(255, 150, 50, 0.55);
}

.combat-burst--status,
.combat-burst--debuff {
  background: radial-gradient(circle at 50% 38%, rgba(190, 120, 255, 0.48), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(200, 140, 255, 0.5);
}

.combat-burst--buff {
  background: radial-gradient(circle at 50% 38%, rgba(232, 196, 104, 0.48), transparent 72%);
  box-shadow: inset 0 0 0 2px rgba(232, 196, 104, 0.55);
}

/* Desktop-Kampf: Gegner oben, Helden unten. Leiste größer. */
@media (min-width: 720px) {
  .combat-arena {
    --combat-rail-width: 3.85rem;
    --combat-rail-gap: 0.55rem;
  }

  .combat-field {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 1.2rem;
    padding: 0.75rem var(--combat-rail-reserve) 0.75rem 1.4rem;
  }

  .combat-top {
    order: 0;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .combat-mid {
    order: 0;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin-top: auto;
  }

  .entity-bar .char-portrait-battle,
  .entity-bar .enemy-portrait-battle {
    width: 70px;
    height: 80px;
  }

  .combat-side-rail {
    gap: 0.32rem;
  }

  .combat-resonance {
    padding: 0.38rem 0.18rem;
    gap: 0.28rem;
    font-size: 0.88rem;
    border-radius: 12px;
  }

  .combat-resonance-icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  .combat-resonance-pip {
    width: 0.62rem;
    height: 0.62rem;
  }

  .combat-resonance-track {
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.72rem;
  }

  .combat-resonance-track .game-icon-img,
  .combat-resonance-track img {
    width: 0.82rem;
    height: 0.82rem;
  }

  .zone-skill-btn {
    min-width: 2.15rem;
    min-height: 1.9rem;
  }

  .zone-skill-cost {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.72rem;
  }

  .combat-side-rail .btn-end-turn {
    padding: 0.48rem 0.14rem;
    font-size: 0.7rem;
    border-radius: 10px;
  }

  .combat-energy-display,
  #energy-display {
    font-size: 0.82rem;
    padding: 0.32rem 0.14rem;
    border-radius: 10px;
  }

  .combat-side-rail .combat-pile-stack {
    width: 2.85rem;
    height: 3.85rem;
  }

  .combat-side-rail .combat-pile-card {
    width: 2.65rem;
    height: 3.55rem;
    border-radius: 8px;
  }

  .combat-side-rail .combat-pile-label {
    font-size: 0.55rem;
    max-width: 3.7rem;
  }

  .combat-side-rail .combat-pile-count {
    font-size: 0.7rem;
    min-width: 1.15rem;
    padding: 0.08rem 0.2rem;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .screen {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) var(--safe-bottom) max(0.75rem, env(safe-area-inset-left));
  }

  #screen-map.active,
  #screen-shop.active,
  #screen-event.active,
  #screen-reward.active,
  #screen-relic.active,
  #screen-rest.active,
  #screen-outcome.active {
    padding-top: var(--hud-toolbar-clearance);
  }

  #screen-shop.active {
    padding-bottom: var(--safe-bottom);
  }

  #screen-shop .shop-panel {
    width: 100%;
    max-width: 100%;
    padding: 0.35rem 0.5rem 1rem;
    box-sizing: border-box;
  }

  #screen-shop h2 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
  }

  #screen-shop .shop-stats {
    margin-bottom: 0.85rem;
  }

  :root {
    --hud-toolbar-clearance: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.35rem + 2.95rem);
    --hud-toolbar-inset-start: max(2.65rem, calc(0.35rem + env(safe-area-inset-left)));
    --hud-toolbar-inset-end: max(10.5rem, calc(0.35rem + env(safe-area-inset-right)));
  }

  #screen-combat.active {
    /* Unten KEIN safe-area-inset mehr: das uebernimmt .combat-bottom selbst,
       sonst wird der Home-Indicator-Abstand doppelt gezaehlt (grosse Luecke). */
    padding:
      var(--hud-toolbar-clearance)
      0
      0
      0;
    overflow: hidden;
  }

  #screen-combat .combat-arena {
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }

  #screen-character.active {
    padding-top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.5rem + 0.5rem);
    padding-bottom: var(--safe-bottom);
  }

  #screen-character h2 {
    font-size: 1.45rem;
    margin-bottom: 0.75rem;
  }

  #screen-character .name-input-wrap {
    margin-bottom: 0.75rem;
  }

  .character-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .char-card {
    padding: 1rem;
  }

  #screen-character .btn-back {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }

  .hud-toolbar {
    top: calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.35rem);
    left: max(0.35rem, env(safe-area-inset-left));
    right: max(0.35rem, env(safe-area-inset-right));
    gap: 0.35rem;
  }

  .hud-toolbar-left,
  .hud-toolbar-right {
    gap: 0.3rem;
  }

  .hud-toolbar .hud-icon-btn {
    width: 36px;
    height: 36px;
  }

  .hud-toolbar .hud-icon {
    width: 17px;
    height: 17px;
  }

  .hud-toolbar .hud-zone-icon {
    width: 26px;
    height: 26px;
  }

  .title-logo {
    width: min(240px, 72vw);
    margin-bottom: 1.25rem;
  }
  #screen-reward {
    width: 100%;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    box-sizing: border-box;
  }

  #screen-reward h2 {
    font-size: 1.35rem;
    padding: 0 0.35rem;
    margin-bottom: 0.85rem;
  }

  #screen-reward .btn-secondary {
    width: min(100%, 280px);
    margin-top: 0.25rem;
  }

  .reward-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    padding: 0;
    overflow: visible;
    box-sizing: border-box;
  }

  .reward-cards .card {
    width: var(--hand-card-width);
    min-width: var(--hand-card-width);
    max-width: var(--hand-card-width);
    padding: 0;
  }

  .reward-cards .card-icon {
    font-size: 1.65rem;
    width: 2.6rem;
    height: 2.6rem;
    margin: 0.22rem 0 0.1rem;
  }

  .reward-cards .card .card-icon {
    width: 2.6rem;
    height: 2.6rem;
  }

  .reward-cards .card-name {
    font-size: 0.62rem;
    line-height: 1.2;
  }

  .reward-cards .card-desc {
    font-size: 0.52rem;
    line-height: 1.3;
  }

  .reward-cards .card-meta {
    padding-top: 0.08rem;
    gap: 0.08rem;
  }

  .reward-cards .card-type-badge {
    font-size: 0.44rem;
  }
  .entity-sprite { font-size: 2.5rem; }

  .map-header--compact {
    margin-bottom: 0.1rem;
  }

  .map-header--compact .combat-zone-bar {
    gap: 0.35rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    justify-content: safe center;
  }

  .combat-hud-chip-value--wide {
    max-width: 4.2rem;
  }

  #screen-map.active {
    justify-content: flex-start;
    overflow-y: auto;
    /* Unten KEIN safe-area-inset: das uebernimmt .map-footer selbst.
       Sonst wird der Home-Indicator-Abstand doppelt gezaehlt (grosse Luecke). */
    padding-bottom: 0;
    min-height: 0;
  }

  .dungeon-wrapper {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    /* Map behält nutzbare Mindesthöhe, auch wenn die Nachrichten-Box groß ist. */
    min-height: min(48vh, 320px);
    margin-bottom: 0.2rem;
    padding-bottom: 0.75rem;
    max-width: 100%;
    width: 100%;
  }

  .dungeon-map-shell {
    flex: 1 1 auto;
    min-height: 200px;
    max-height: none;
  }

  .map-footer {
    gap: 0.3rem;
    padding: 0.25rem 0 var(--safe-bottom);
    width: 100%;
    max-width: 100%;
  }

  .map-event {
    max-height: min(28vh, 220px);
  }

  .dungeon-zone-cap.dungeon-zone-cap--toolbar {
    left: 0.28rem;
    bottom: 0.38rem;
    padding: 0.38rem 0.28rem;
    gap: 0.28rem;
  }

  .map-draw-btn {
    width: 2rem;
    height: 2rem;
  }

  .map-draw-btn .map-draw-icon {
    width: 1.22rem;
    height: 1.22rem;
  }

  .dungeon-zone-cap--entrance:not(.dungeon-zone-cap--toolbar) {
    flex-shrink: 0;
    margin-top: 0.35rem;
  }

  #btn-enter-node {
    width: 100%;
    font-size: 1rem;
    padding: 0.85rem 1rem;
  }

  .combat-zone-bar {
    font-size: 0.78rem;
    padding: 0.25rem var(--hud-toolbar-inset-end) 0.1rem var(--hud-toolbar-inset-start);
    line-height: 1.35;
  }

  .combat-powers {
    padding: 0.1rem 0.5rem 0.2rem;
    gap: 0.25rem 0.35rem;
  }

  .combat-powers-label {
    font-size: 0.62rem;
    width: 100%;
    text-align: center;
  }

  .power-badge-name {
    display: none;
  }

  .combat-relics {
    padding: 0 0.5rem 0.2rem;
    font-size: 0.8rem;
  }

  .combat-arena {
    --combat-rail-width: 2.55rem;
    --combat-rail-gap: 0.72rem;
    --combat-hand-min: 145px;
    --combat-hand-pad-top: 0.2rem;
  }

  .combat-field {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: clamp(0.45rem, 1.6vh, 0.75rem);
    padding: 0.3rem var(--combat-rail-reserve) 0.5rem 0.35rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-padding-top: 0.25rem;
    scroll-padding-bottom: 0.5rem;
  }

  .combat-side-rail {
    top: 0.15rem;
    bottom: var(--combat-hand-block);
    height: auto;
    max-height: none;
    gap: 0.16rem;
  }

  .combat-side-rail-mid {
    min-height: 2.1rem;
  }

  .combat-side-rail-bottom {
    gap: 0.18rem;
  }

  .combat-resonance {
    padding: 0.22rem 0.1rem;
    gap: 0.16rem;
  }

  .combat-energy-display,
  #energy-display {
    min-width: 0;
    font-size: 0.68rem;
    padding: 0.2rem 0.08rem;
  }

  .combat-energy-bolt .game-icon-img {
    width: 1.15rem;
    height: 1.15rem;
  }

  .combat-side-rail .combat-pile-stack {
    width: 1.9rem;
    height: 2.55rem;
  }

  .combat-side-rail .combat-pile-card {
    width: 1.75rem;
    height: 2.35rem;
  }

  .combat-side-rail .btn-end-turn {
    padding: 0.3rem 0.08rem;
    font-size: 0.5rem;
  }

  .zone-skill-row {
    gap: 0.32rem;
  }

  .zone-skill-btn {
    min-width: 1.75rem;
    min-height: 1.55rem;
  }

  .zone-skill-cost {
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.58rem;
  }

  .combat-top,
  .combat-mid {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
  }

  .combat-mid {
    margin-top: auto;
  }

  .enemy-zone {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: safe center;
    align-items: flex-start;
    gap: 0.35rem;
    width: max-content;
    min-width: 100%;
    max-width: none;
  }

  .ally-zone {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: safe center;
    align-items: flex-end;
    gap: 0.35rem;
    width: max-content;
    min-width: 100%;
    max-width: none;
  }

  .enemy-zone .entity-sprite { font-size: 1.85rem; }

  .entity-sprite { font-size: 2.2rem; }

  .entity-name {
    font-size: 0.68rem;
  }

  .entity-hp-bar { height: 6px; }

  .entity-hp-row .entity-hp-text { font-size: 0.62rem; min-width: 2.35rem; }

  .entity-damage-value { font-size: 0.82rem; }

  .entity-damage-label { font-size: 0.55rem; }

  .entity-status-icon {
    font-size: 0.6rem;
    padding: 0.1rem 0.28rem;
  }

  .enemy-zone .entity-card.entity-bar,
  .enemy-zone .entity-card.entity-bar:only-child,
  .ally-zone .entity-card.entity-bar,
  .ally-zone .entity-ally.entity-bar-sm {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  :root {
    --entity-tile-width: 118px;
  }

  .entity-card.entity-tile,
  .enemy-zone .entity-card.entity-tile,
  .ally-zone .entity-ally.entity-tile {
    flex: 0 0 var(--entity-tile-width);
    width: var(--entity-tile-width);
    min-width: var(--entity-tile-width);
    max-width: var(--entity-tile-width);
  }

  .entity-ally-minion.entity-tile,
  .entity-enemy.entity-minion.entity-tile {
    --entity-tile-width: var(--entity-minion-tile-width);
  }

  .entity-ally-minion.entity-tile.is-large {
    --entity-tile-width: var(--entity-minion-tile-width-large);
  }

  .entity-hero-col,
  .entity-enemy-col {
    flex: 0 0 auto;
    width: auto;
  }

  .entity-tile .char-portrait-battle,
  .entity-tile .enemy-portrait-battle,
  .entity-tile .summon-portrait-battle,
  .entity-tile .entity-portrait img {
    width: 100%;
    height: 100%;
  }

  .entity-tile .entity-block,
  .entity-ally.entity-tile .entity-block,
  .entity-enemy.entity-tile .entity-block {
    position: static;
    top: auto;
    right: auto;
    padding: 0.1rem 0.32rem;
    font-size: 0.62rem;
    gap: 0.12rem;
    border-radius: 999px;
    box-shadow: none;
  }

  .entity-tile .entity-block-icon,
  .entity-ally.entity-tile .entity-block-icon,
  .entity-enemy.entity-tile .entity-block-icon {
    font-size: 0.62rem;
  }

  .entity-bar .char-portrait-battle,
  .entity-bar .enemy-portrait-battle {
    width: 70px;
    height: 80px;
  }

  .entity-bar.entity-bar-sm .char-portrait-battle,
  .entity-bar.entity-bar-sm .enemy-portrait-battle {
    width: 70px;
    height: 80px;
  }

  .enemy-zone {
    overflow: visible;
    padding: 0.15rem 0;
  }

  .combat-top {
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
  }

  .entity-ally .entity-block {
    top: -4px;
    right: -4px;
    padding: 0.14rem 0.3rem;
    font-size: 0.66rem;
    gap: 0.1rem;
    border-radius: 7px;
  }

  .entity-bar .entity-block {
    position: static;
    top: auto;
    right: auto;
  }

  .entity-ally .entity-block-icon {
    font-size: 0.64rem;
  }

  .entity-enemy .entity-block {
    top: -4px;
    right: -4px;
    padding: 0.14rem 0.3rem;
    font-size: 0.66rem;
    gap: 0.1rem;
  }

  .entity-enemy .entity-block-icon {
    font-size: 0.64rem;
  }

  .entity-enemy .entity-hp-row .entity-hp-text {
    font-size: 0.72rem;
    min-width: 2.6rem;
    color: #fff;
  }

  .entity-enemy .entity-hp-bar {
    height: 8px;
  }

  .entity-enemy .entity-name {
    font-size: 0.84rem;
  }

  .entity-enemy .entity-portrait.entity-sprite {
    font-size: 1.55rem;
    margin: 0.22rem 0 0.1rem;
  }

  .entity-enemy .entity-portrait.entity-sprite .enemy-portrait-battle {
    width: 70px;
    height: 80px;
  }

  .entity-tile.entity-enemy .entity-portrait.entity-sprite {
    margin: 0;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .entity-tile.entity-enemy .entity-portrait.entity-sprite .enemy-portrait-battle,
  .entity-tile .entity-portrait.entity-sprite .char-portrait-battle,
  .entity-tile .entity-portrait.entity-sprite .enemy-portrait-battle {
    width: 100%;
    height: 100%;
    margin: 0;
  }

  .entity-enemy .entity-intent-row {
    padding: 0.32rem 0.46rem;
    margin-top: 0.32rem;
  }

  .entity-enemy .entity-intent-head {
    font-size: 0.68rem;
    margin-bottom: 0.16rem;
    line-height: 1.2;
  }

  .entity-enemy .entity-intent-hit {
    font-size: 0.64rem;
    gap: 0.18rem;
    align-items: center;
  }

  .entity-enemy .entity-intent-hit-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
  }

  .entity-enemy .entity-intent-hit-right {
    gap: 0.22rem;
    margin-left: 0.15rem;
  }

  .entity-enemy .entity-intent-hit-dmg {
    font-size: 0.7rem;
  }

  .entity-enemy .entity-intent-block {
    padding: 0.08rem 0.24rem;
    font-size: 0.54rem;
    gap: 0.08rem;
  }

  .entity-enemy .entity-intent-block-icon {
    font-size: 0.58rem;
  }

  .combat-party-multi .char-portrait-battle {
    width: 70px;
    height: 80px;
  }

  .combat-party-multi .entity-ally .entity-sprite.ally {
    margin: 0 auto;
  }


  .char-portrait-battle,
  .enemy-portrait-battle {
    width: 78px;
    height: 90px;
  }

  .entity-bar .entity-portrait.entity-sprite {
    margin: 0;
  }

  .entity-bar .entity-portrait.entity-sprite .char-portrait-battle,
  .entity-bar .entity-portrait.entity-sprite .enemy-portrait-battle,
  .combat-party-multi .entity-bar .char-portrait-battle {
    width: 70px;
    height: 80px;
  }

  .entity-bar .entity-intent-row {
    padding: 0.14rem 0.36rem;
    margin-top: 0;
  }

  .ally-zone .entity-targetable.selected,
  .enemy-zone .entity-targetable.selected {
    transform: scale(1.03);
    box-shadow:
      0 0 18px rgba(232, 196, 104, 0.4),
      0 6px 20px rgba(0, 0, 0, 0.45);
  }

  .entity-intent {
    margin-top: 0.12rem;
    padding: 0.12rem 0.25rem;
  }

  .combat-bottom {
    flex: 0 0 auto;
    margin-top: auto;
    justify-content: flex-start;
    padding: 0.2rem 0 var(--combat-safe-bottom);
    overflow: visible;
  }

  .combat-hand-row {
    gap: 0;
    min-height: var(--combat-hand-min, 148px);
    width: 100%;
  }

  .combat-pile {
    width: 3.5rem;
    flex-shrink: 0;
  }

  .combat-pile-label {
    font-size: 0.5rem;
    max-width: 3.6rem;
  }

  .combat-pile-stack {
    width: 2.85rem;
    height: 3.95rem;
  }

  .combat-pile-card {
    width: 2.65rem;
    height: 3.65rem;
  }

  /* Nur die Handkarten sind auf Mobil schmaler; Belohnungs-, Almanach- und
     Deck-Karten bleiben bei 122px. Der Drag-Schatten hängt am <body> statt in
     der Handzone und braucht die Breite deshalb separat. */
  .hand-zone,
  .combat-drag-ghost {
    --hand-card-width: 96px;
  }

  .hand-zone {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    justify-content: safe center;
    align-items: flex-end;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    min-height: var(--combat-hand-min, 168px);
    max-width: 100%;
    width: 100%;
    padding: 0.65rem 0 0.3rem;
    margin: 0;
    gap: 0.45rem;
    mask-image: none;
  }

  :root {
    --entity-card-width: 124px;
    --entity-compact-width: 96px;
    --entity-tile-width: 118px;
  }

  .hand-zone .card,
  .combat-drag-ghost {
    width: var(--hand-card-width);
    min-width: var(--hand-card-width);
    max-width: var(--hand-card-width);
    min-height: 145px;
    height: auto;
    max-height: none;
    padding: 0;
    scroll-snap-align: center;
    flex-shrink: 0;
    overflow: hidden;
  }

  .hand-zone .card-header,
  .combat-drag-ghost .card-header {
    min-height: 1.7rem;
    padding: 0.26rem 1.45rem 0.2rem;
  }

  .hand-zone .card-header-label,
  .combat-drag-ghost .card-header-label {
    font-size: 0.4rem;
    letter-spacing: 0.06em;
  }

  .hand-zone .card-header-label.rarity,
  .combat-drag-ghost .card-header-label.rarity {
    font-size: 0.34rem;
  }

  .hand-zone .card-body,
  .combat-drag-ghost .card-body {
    padding: 0.16rem 0.28rem 0.28rem;
  }

  .hand-zone .card-footer,
  .combat-drag-ghost .card-footer {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding-top: 0.1rem;
    overflow: hidden;
  }

  .hand-zone .card-desc,
  .combat-drag-ghost .card-desc {
    flex: 0 1 auto;
    min-height: 0;
    font-size: 0.5rem;
    line-height: 1.28;
    max-height: none;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
  }

  .hand-zone .card-meta,
  .combat-drag-ghost .card-meta {
    flex-shrink: 0;
    margin-top: 0.06rem;
    width: 100%;
    padding-top: 0;
    border-top: none;
    text-align: center;
  }

  .hand-zone .card-type-badge,
  .combat-drag-ghost .card-type-badge {
    font-size: 0.42rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
  }

  .hand-zone .card-cost,
  .combat-drag-ghost .card-cost {
    left: 0.28rem;
    width: 16px;
    height: 16px;
    font-size: 0.62rem;
    border-radius: 3px;
  }

  .hand-zone .card-icon,
  .combat-drag-ghost .card-icon {
    font-size: 1.4rem;
    width: 2rem;
    height: 2rem;
    margin: 0;
  }

  .hand-zone .card .card-icon,
  .combat-drag-ghost .card-icon {
    width: 2rem;
    height: 2rem;
  }

  .hand-zone .card-name,
  .combat-drag-ghost .card-name {
    font-size: 0.62rem;
    line-height: 1.2;
  }

  .hand-zone .card-pool-icon,
  .hand-zone .card-pool-icon.is-empty,
  .hand-zone .char-icon-card,
  .combat-drag-ghost .card-pool-icon,
  .combat-drag-ghost .card-pool-icon.is-empty,
  .combat-drag-ghost .char-icon-card {
    right: 0.28rem;
    width: 16px;
    height: 16px;
  }

  .hand-zone .char-icon-card,
  .combat-drag-ghost .char-icon-card {
    font-size: 0.55rem;
  }

  .hand-zone .card:hover:not(.disabled) {
    transform: translateY(-6px) scale(1.03);
  }

  /* Zug-beenden sitzt mittig zwischen Resonanz und unterem Block. */
  #screen-combat .btn-end-turn {
    width: 100%;
    margin: 0;
  }

  .deck-modal,
  .relic-modal,
  .almanach-modal,
  .combat-log-modal {
    align-items: stretch;
    /* Navi-Leiste (ninenine-nav, reserveSpace:false) oben freihalten,
       sonst verschwindet der Modal-Kopf hinter der Leiste. */
    padding:
      calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 0.65rem)
      max(0.5rem, env(safe-area-inset-right))
      var(--safe-bottom)
      max(0.5rem, env(safe-area-inset-left));
  }

  .deck-modal-panel,
  .relic-modal-panel,
  .almanach-modal-panel,
  .combat-log-modal-panel {
    height: 100%;
    max-height: 100%;
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Almanach-Zonenkacheln: Name + Untertitel unter dem Icon */
  .almanach-list.almanach-zone-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.5rem;
  }

  .almanach-zone-tile-inner {
    padding: 0.55rem 0.4rem 0.5rem;
    gap: 0.4rem;
  }

  .almanach-zone-avatar {
    flex-basis: 3.8rem;
    width: 3.8rem;
    height: 3.8rem;
  }

  .almanach-zone-tile .almanach-hero-name {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .almanach-zone-tile .almanach-hero-title {
    font-size: 0.68rem;
    line-height: 1.25;
  }
}

/* ===== NINE-NINE Auth: Login-Gate, Auth-Bar, gesperrtes Namensfeld ===== */
.auth-gate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--ng-legal-footer-reserve, 0px);
  z-index: 5000;
  display: flex;
  /* "safe center" zentriert, wenn Platz da ist, richtet aber bei Overflow oben aus
     (statt das Logo oben abzuschneiden – align-items:center hat diesen Clipping-Bug). */
  align-items: safe center;
  justify-content: center;
  /* Oben Navi-Höhe + Notch freihalten, sonst verdeckt die fixe Navileiste/Notch
     im PWA das Logo am Panel-Kopf. overflow-y für sehr kleine Screens. */
  padding:
    calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem)
    max(1.25rem, env(safe-area-inset-right, 0px))
    max(1.25rem, env(safe-area-inset-bottom, 0px))
    max(1.25rem, env(safe-area-inset-left, 0px));
  overflow-y: auto;
  background: radial-gradient(circle at 50% 30%, rgba(40, 22, 70, 0.92), rgba(8, 6, 18, 0.97));
  backdrop-filter: blur(4px);
}

.auth-gate[hidden] {
  display: none;
}

.auth-gate-panel {
  width: min(420px, 100%);
  padding: 2rem 1.6rem;
  text-align: center;
  border-radius: 18px;
}

.auth-gate-logo {
  max-width: 220px;
  height: auto;
  margin-bottom: 0.5rem;
  /* Kein drop-shadow: vermeidet den iOS-Safari-Render-Bug (losgelöster Glow-Fleck). */
}

.auth-gate-title {
  margin: 0.4rem 0 0.6rem;
  font-family: 'Cinzel', serif;
}

.auth-gate-text {
  margin: 0 0 1.3rem;
  opacity: 0.85;
  line-height: 1.5;
}

.auth-gate-error {
  margin-top: 1rem;
  color: #ff9a9a;
}

.auth-gate-error[hidden] {
  display: none;
}

.auth-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(20, 14, 38, 0.55);
  border: 1px solid rgba(180, 150, 255, 0.25);
  font-size: 0.85rem;
}

.auth-bar[hidden] {
  display: none;
}

.auth-username {
  font-weight: 700;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-logout {
  color: #c9b8ff;
  text-decoration: none;
  opacity: 0.8;
  font-size: 0.78rem;
}

.auth-logout:hover {
  opacity: 1;
  text-decoration: underline;
}

.name-input-wrap--locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.name-input-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.name-input-wrap--locked input[readonly] {
  text-align: center;
  cursor: default;
  opacity: 0.95;
  background: rgba(20, 14, 38, 0.5);
}

/* Helden-Kauf (statt window.confirm) */
.buy-character-confirm {
  position: fixed;
  inset: 0;
  z-index: 10072;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--ng-nav-h, 56px) + env(safe-area-inset-top, 0px) + 1rem)
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background: rgba(6, 8, 14, 0.86);
  backdrop-filter: blur(6px);
}
.buy-character-confirm[hidden] { display: none; }

.buy-character-confirm-inner {
  position: relative;
  width: min(22rem, 100%);
  overflow: hidden;
  padding: 1.25rem 1.2rem 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(232, 196, 104, 0.38);
  background:
    linear-gradient(165deg, rgba(36, 30, 48, 0.97), rgba(14, 16, 24, 0.98));
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(232, 196, 104, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.buy-character-confirm-art {
  position: absolute;
  inset: 0;
  background-image: var(--buy-char-zone-art);
  background-size: cover;
  background-position: center;
  opacity: 0.22;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.85), transparent 72%);
}

.buy-character-confirm-portrait {
  position: relative;
  z-index: 1;
  width: 5.6rem;
  height: 5.6rem;
  border-radius: 50%;
  border: 3px solid #e8c468;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  margin-bottom: 0.25rem;
}
.buy-character-confirm-portrait img,
.buy-character-confirm-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.buy-character-confirm-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f3e8d4;
}
.buy-character-confirm-subtitle {
  position: relative;
  z-index: 1;
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: rgba(242, 235, 227, 0.72);
}

.buy-character-confirm-pack {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0.25rem 0 0.45rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.buy-character-confirm-pack-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 196, 104, 0.75);
  margin-bottom: 0.2rem;
}
.buy-character-confirm-pack-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.28rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f0e6d4;
}
.buy-character-confirm-plus {
  opacity: 0.55;
  font-weight: 500;
}

.buy-character-confirm-costs {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.35rem;
}
.buy-character-confirm-cost-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: rgba(242, 235, 227, 0.78);
}
.buy-character-confirm-cost-row strong {
  color: #ffe9a8;
  font-weight: 800;
}
.buy-character-confirm-cost-row strong.is-short {
  color: #ff9a9a;
}
.buy-character-confirm-cost-row--after strong {
  color: #c9e4ff;
}
.buy-character-confirm-short {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #ffb4b4;
}

.buy-character-confirm-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  margin-top: 0.35rem;
}
.buy-character-confirm-actions .btn {
  min-width: 7.2rem;
}
