/* Player stats top-left */
#player-hud {
  position: absolute;
  /* Bezpośrednio pod radarem (10px + 160px + 8px odstępu) — bez pustej luki. */
  top: 178px;
  right: 10px;
  min-width: 254px;
  width: 254px;
  box-sizing: border-box;
  height: auto;
  max-height: none;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-scroll-thumb) var(--ui-scroll-track);
}

.hud-title {
  font-size: 13px;
  font-weight: 700;
  color: #e0e6ed;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lvl-badge {
  font-size: 10px;
  font-weight: 500;
  color: #8fb8d8;
  background: var(--ui-insert);
  padding: 1px 5px;
  border-radius: 0;
  border: 1px solid #2d3748;
}

/* SŁAWA (Fame) — główny wyznacznik prestiżu, wyeksponowany w nagłówku. */
.fame-badge {
  font-size: 11px;
  font-weight: 700;
  color: #d8c27a;
  background: var(--ui-insert);
  padding: 1px 6px;
  border-radius: 0;
  border: 1px solid #3a4454;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Dyskretny badge poziomu (POZ) osadzony wewnątrz paska EXP. */
.exp-level-badge {
  position: absolute;
  right: 3px;
  top: 1px;
  font-size: 9px;
  line-height: 10px;
  padding: 0 4px;
  background: rgba(17, 21, 28, 0.78);
  border-color: #2d3748;
  z-index: 2;
}

.bar-container {
  background: #15181f;
  height: 12px;
  border-radius: 0;
  border: 1px solid #2d3748;
  overflow: hidden;
  margin-bottom: 4px;
  position: relative;
}

/* Stonowane, jednolite paski HP / MP / EXP (bez jaskrawych gradientów) */
.hp-bar-fill {
  background: #b3514f;
  height: 100%;
  width: 100%;
  transition: width 0.08s ease-out;
}

.mp-bar-fill {
  background: #4a6fa5;
  height: 100%;
  width: 100%;
  transition: width 0.08s ease-out;
}

.exp-bar-fill {
  background: #5d7f9e;
  height: 100%;
  width: 0%;
  transition: width 0.15s ease-out;
}

.bar-text {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  font-size: 9px;
  line-height: 12px;
  text-align: center;
  font-weight: 500;
  color: #e0e6ed;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.3px;
}

/* Panel statystyk — domyślnie zwinięty; rozwija się po najechaniu na belkę
   [ 📊 STATYSTYKI ] lub nagłówek HUD. */
.stats-panel {
  position: relative;
}

.stats-toggle {
  font-size: 10px;
  font-weight: 700;
  color: var(--ui-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 0;
  cursor: help;
  user-select: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  font-size: 11px;
  color: #a9b1d6;
  background: rgba(20, 22, 29, 0.6);
  border-radius: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  padding: 0 5px;
  transition: all 0.2s ease;
}

.stats-panel:hover .stats-grid,
.hud-title:hover ~ .stats-panel .stats-grid {
  max-height: 500px;
  opacity: 1;
  margin-bottom: 4px;
  padding: 3px 5px;
}

.stat-badge {
  display: flex;
  justify-content: space-between;
}

.stat-badge span:first-child {
  color: #8fa3bf;
  font-weight: 700;
}

.stat-badge.maxed span:first-child {
  color: #d8c27a;
}

.stat-badge.maxed span:last-child {
  color: #d8c27a !important;
  font-weight: 700;
  text-shadow: none;
}

/* === KOMPAKTOWY PANEL: ukryj WIS / VIT oraz dublujące się LIFE / MANA. ===
   Pełna lista 8 statystyk z limitami klasowymi dostępna po najechaniu
   myszą na nagłówek "CZARODZIEJ [0/8 MAX]". */
/* LIFE / MANA są redundantne z paskami HP / MP — zostają ukryte. */
#badge-life,
#badge-mana {
  display: none;
}

/* Nagłówek z licznikiem [X/8 MAX] — kursor podpowiada interaktywność. */
.hud-title {
  cursor: help;
}
/* Controls helper top-right */
#controls-panel {
  bottom: 20px;
  left: 20px;
  font-size: 11px;
  color: var(--ui-text-muted);
  line-height: 1.6;
}

#controls-panel kbd {
  background: var(--ui-insert);
  border: 1px solid #3a4454;
  border-radius: 0;
  padding: 1px 5px;
  color: #9aa5b4; /* jasne etykiety klawiszy na ciemnym insert-cie */
  font-family: inherit;
}

#zone-badge {
  font-weight: 700;
  color: #8fb8d8;
  display: inline-block;
  margin-bottom: 4px;
}

/* Stonowanie wbudowanego złotego koloru z index.html (licznik lochów) */
#completed-dungeons-badge {
  color: #d8c27a !important;
  font-weight: 700;
}

#sound-toggle {
  margin-top: 8px;
  background: var(--ui-btn);
  border: 1px solid #2d3748;
  color: var(--ui-text-muted);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 0;
  display: block;
  width: 100%;
}

#sound-toggle:hover {
  background: var(--ui-btn-hover);
  color: #e0e6ed;
}

/* Stonowanie wbudowanych stylów przycisku RESET z index.html */
#reset-character-btn {
  background: #241c20 !important;
  border: 1px solid #5a3a3e !important;
  color: #cf9a9a !important;
  border-radius: 0 !important;
}

#reset-character-btn:hover {
  background: #33262b !important;
  color: #e0e6ed !important;
}

/* Boss HP Bar at Top */
#boss-hud {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 450px;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
  z-index: 60;
}

.boss-title {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #c98a4b;
  letter-spacing: 2px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 6px;
}

.boss-bar-wrap {
  background: #15181f;
  border: 1px solid #3a4454;
  height: 20px;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.boss-bar-fill {
  background: #a8552f;
  height: 100%;
  width: 100%;
  transition: width 0.1s ease-out;
}

.boss-bar-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  line-height: 20px;
  font-size: 11px;
  font-weight: 500;
  color: #e0e6ed;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* Floating combat text layer */
#damage-text-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

/* Pływające liczby — Roboto, stonowane kolory, wyłącznie ciemny cień
   dla czytelności na tle sceny 3D (bez neonowych poświat). */
.floating-damage {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 700;
  color: #e0607c;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
}

.floating-damage.player-hurt {
  color: #d9534f;
  font-size: 24px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
}

.floating-damage.crit {
  font-size: 24px;
  color: #e8d48b;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
}

.floating-damage.exp {
  font-size: 16px;
  color: #8fb8d8;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
}

/* Współdzielone EXP z zabójstw botów — fioletowy akcent. */
.floating-damage.exp-shared {
  font-size: 16px;
  color: #b57fe0;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
}

.floating-damage.heal {
  font-size: 20px;
  color: #7fae95;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
}

.floating-damage.stat-boost {
  font-size: 22px;
  color: #d8c27a;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.95);
}

.floating-damage.levelup {
  font-size: 32px;
  letter-spacing: 2px;
  font-weight: 900;
  color: #d8c27a;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.95);
}

/* Portal Interaction Prompt */
#portal-prompt {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 20, 26, 0.95); /* unoszony nad sceną 3D — ciemne celowo (Faza 7.5) */
  border: 1px solid #3a4454;
  color: #e0e6ed;
  padding: 10px 22px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  display: none;
  pointer-events: none;
  box-shadow: none;
  text-shadow: none;
  animation: pulsePortal 1.2s infinite alternate;
}

@keyframes pulsePortal {
  from { transform: translateX(-50%) scale(1.0); }
  to { transform: translateX(-50%) scale(1.06); }
}

/* Death Screen Overlay (Graveyard / Permadeath) */
#death-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 16, 0.94);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: auto;
}

#death-screen-content {
  background: rgba(18, 20, 26, 0.96);
  border: 1px solid #5a3a3e;
  border-radius: 0;
  padding: 28px 36px;
  min-width: 380px;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  animation: deathModalAppear 0.5s ease-out;
}

@keyframes deathModalAppear {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.0);
    opacity: 1;
  }
}

.death-title {
  font-size: 36px;
  font-weight: 900;
  color: #c0524e;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: none;
  margin-bottom: 18px;
}

.death-stats {
  background: rgba(20, 22, 29, 0.8);
  border: 1px solid #2d3748;
  border-radius: 0;
  padding: 12px 16px;
  margin-bottom: 14px;
  text-align: left;
}

.death-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(45, 55, 72, 0.5);
}

.death-stat-row:last-child {
  border-bottom: none;
}

.death-stat-label {
  color: #9aa5b4; /* jasna etykieta na ciemnej wstawce .death-stats (Faza 7.5) */
  font-weight: 500;
  letter-spacing: 0.5px;
}

.death-stat-value {
  color: #e0e6ed;
  font-weight: 700;
  font-size: 14px;
}

.death-fame {
  color: #d8c27a !important;
  text-shadow: none;
  font-size: 15px;
}

.death-total-fame {
  color: #8fb8d8 !important;
  text-shadow: none;
  font-size: 15px;
}

.death-info {
  font-size: 11px;
  color: var(--ui-text-muted);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: rgba(90, 58, 62, 0.15);
  border: 1px solid rgba(90, 58, 62, 0.4);
  border-radius: 0;
}

#death-screen button {
  background: #2a3548;
  border: 1px solid #4a6fa5;
  color: #e0e6ed;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 0;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#death-screen button:hover {
  background: #33405a;
  box-shadow: none;
}


/* Hurt Screen Flash */
#hurt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 50px rgba(255, 0, 0, 0);
  pointer-events: none;
  transition: box-shadow 0.08s ease-out;
}

/* === WINIETA NISKIEGO POZIOMU ZDROWIA (Low HP Alert, HP <= 25%) ===
   Pulsujący czerwony cień na krawędziach ekranu — nakładany, gdy gracza
   trzeba natychmiast ostrzec (ucieczka klawiszem Nexusa / potka). */
.low-hp-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(180, 20, 20, 0.55) 100%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.low-hp-vignette.active {
  animation: lowHpVignettePulse 1.1s ease-in-out infinite;
}

@keyframes lowHpVignettePulse {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 0.6; }
}

/* Custom Crosshair on floor */
/* Celownik: subtelny, jasny (bez złotego glowa); okrągły kształt
   jest celowo zachowany — to wskaźnik celowania, nie panel UI. */
#cursor-reticle {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border: 2px solid rgba(224, 230, 237, 0.75);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: none;
  display: none;
}

#cursor-reticle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  margin-left: -2px;
  background: #e0e6ed;
  border-radius: 50%;
}

/* ===== MINIMAPA (RADAR) — góra-prawa ===== */
#minimap-container {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 160px;
  height: 160px;
  border: 1px solid #2d3748;
  border-radius: 0;
  background: rgba(18, 20, 26, 0.95);
  box-shadow: none;
  overflow: hidden;
  /* KRYTYCZNE: #ui-container ma pointer-events:none, więc bez tego radar
     nie dostaje hovera ani wheel — scroll-zoom nie działał. */
  pointer-events: auto;
}
#minimap-container:hover {
  border-color: #d8c27a;
  cursor: zoom-in;
}
#minimap-container.minimap-hover #minimap-label {
  color: #d8c27a;
}
#minimap-canvas {
  display: block;
  width: 160px;
  height: 160px;
}
#minimap-label {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 8px;
  font-weight: 500;
  color: #9aa5b4; /* etykieta NA ciemnym canvasie radaru — zostaje jasna (Faza 7.5) */
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: none;
}

/* ===== MUZYKA TŁA (BGM) — przycisk wyciszenia obok radaru ===== */
#bgm-toggle {
  position: absolute;
  top: 10px;
  right: 180px;
  z-index: 20;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(18, 20, 26, 0.95);
  border: 1px solid #2d3748;
  border-radius: 0;
  color: var(--ui-text-muted);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
}

#bgm-toggle:hover {
  background: var(--ui-btn-hover);
  color: #e0e6ed;
}

#bgm-toggle .bgm-icon {
  display: block;
  pointer-events: none;
}

#bgm-toggle .bgm-icon-muted {
  display: none;
}

#bgm-toggle.muted {
  color: #6f7a8a;
}

#bgm-toggle.muted .bgm-icon-unmuted {
  display: none;
}

#bgm-toggle.muted .bgm-icon-muted {
  display: block;
}

/* ==========================================================================
   QUEST WIDGET (CEL) — niezależny, przypięty w lewym górnym rogu ekranu
   ========================================================================== */
#quest-widget {
  position: fixed;
  top: 16px;
  left: 16px;
  right: auto;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 8px 12px;
  z-index: 100;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid #374151;
  border-radius: 4px;
  box-shadow: none;
  pointer-events: none;
  display: none;
}

.quest-header {
  font-size: 9px;
  font-weight: 700;
  color: #d8c27a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  text-shadow: none;
}

.quest-target {
  font-size: 11px;
  color: #e0e0e0;
  margin-bottom: 2px;
  line-height: 1.3;
}

#quest-target-name {
  font-weight: 700;
  color: #c98a4b;
  text-shadow: none;
}

/* Separator dystansu — czytelne oddzielenie nazwy celu od odległości. */
#quest-target-name::after {
  content: ' • ';
  color: #a8b2c0;
  font-weight: 500;
}

.quest-dist {
  font-size: 10px;
  color: #a8b2c0;
  font-weight: 700;
}

.quest-arrow-wrap {
  text-align: center;
  height: 20px;
  overflow: visible;
}

/* Wektorowa strzałka nawigacyjna (SVG) — obraca się wokół własnego środka. */
.quest-arrow {
  display: inline-block;
  vertical-align: middle;
  transform-origin: 50% 50%;
  transition: transform 0.1s linear;
}

/* ==========================================================================
   GŁÓWNY EVENT KRAINY — licznik bossów (Władcy Krainy -> super loch)
   ========================================================================== */
#realm-event-widget {
  position: fixed;
  top: 120px;
  left: 16px;
  z-index: 90;
  width: 176px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid #4c3a8f;
  border-radius: 4px;
  padding: 8px 12px;
  pointer-events: none;
  display: none;
}

.realm-event-title {
  font-size: 9px;
  font-weight: 700;
  color: #c9b6f0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.realm-event-count {
  font-size: 13px;
  font-weight: 900;
  color: #d8c27a;
  margin-bottom: 4px;
}

.realm-event-bar {
  height: 5px;
  background: #15181f;
  border-radius: 2px;
  overflow: hidden;
}

.realm-event-fill {
  height: 100%;
  background: linear-gradient(90deg, #6d28d9, #8b7cf6);
}

/* Pulsująca złota kropka na minimapie dla Mini-Bossa */
@keyframes questDotPulse {
  0%   { opacity: 0.4; transform: scale(0.8); }
  50%  { opacity: 1.0; transform: scale(1.3); }
  100% { opacity: 0.4; transform: scale(0.8); }
}

/* ===== DAWNE BANERY CENTRALNE (.target-eliminated, .realm-event-notification,
   .enrage-warning, .dungeon-cleared) — usunięte. Komunikaty trafiają teraz do
   loga #message-log w lewym dolnym rogu (kolor = kategoria wpisu). ===== */

/* ===== PRZYCISK POWROTU DO MENU (LOGOUT) — obok wyciszenia muzyki ===== */
#logout-btn {
  position: absolute;
  top: 10px;
  right: 218px;
  z-index: 20;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(18, 20, 26, 0.95);
  border: 1px solid #2d3748;
  border-radius: 0;
  color: var(--ui-text-muted);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
}

#logout-btn:hover {
  background: var(--ui-btn-hover);
  color: #e0e6ed;
}

#logout-btn svg {
  display: block;
  pointer-events: none;
}

/* ==========================================================================
   PANEL DRUŻYNY (Party HUD) — po lewej stronie, pod wskaźnikiem bossa
   ========================================================================== */
#party-panel {
  position: absolute;
  top: 96px;
  left: 12px;
  z-index: 55;
  min-width: 168px;
  max-width: 220px;
  background: rgba(18, 20, 26, 0.92);
  border: 1px solid #2d3748;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  padding: 6px 8px;
  pointer-events: auto;
}

#party-panel .party-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--ui-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid #2d3748;
}

#party-panel .party-card {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 3px;
  border-radius: 0;
  cursor: help;
}

#party-panel .party-card:hover {
  background: var(--ui-btn-hover);
}

#party-panel .party-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  background: rgba(255, 255, 255, 0.04);
}

#party-panel .party-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#party-panel .party-name {
  font-size: 10px;
  font-weight: 500;
  color: #e0e6ed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

#party-panel .party-hp-bar {
  height: 5px;
  background: #15181f;
  border: 1px solid #2d3748;
  border-radius: 0;
  overflow: hidden;
}

#party-panel .party-hp-fill {
  height: 100%;
  transition: width 0.12s ease-out;
}

/* ==========================================================================
   ZLECENIA DNIA (Contracts) — widget celów dobrowolnych, lewy górny róg.
   Zgodny z estetyką HUD: ciemne tło, brak scrollbarów, kompaktowy.
   ========================================================================== */
#contracts-widget {
  position: absolute;
  top: 220px;
  left: 12px;
  z-index: 55;
  width: 208px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  background: rgba(18, 20, 26, 0.92);
  border: 1px solid #2d3748;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  padding: 6px 8px;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ui-scroll-thumb) var(--ui-scroll-track);
}

#contracts-widget .party-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--ui-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid #2d3748;
}

#contracts-widget .contract-card {
  padding: 5px 4px;
  border-bottom: 1px solid #232a37;
}

#contracts-widget .contract-card:last-child {
  border-bottom: none;
}

#contracts-widget .contract-name {
  font-size: 11px;
  font-weight: 700;
  color: #e0e6ed;
}

#contracts-widget .contract-desc {
  font-size: 9px;
  color: var(--ui-text-muted);
  margin: 1px 0 4px;
  line-height: 1.25;
}

#contracts-widget .contract-bar {
  height: 5px;
  background: #15181f;
  border: 1px solid #2d3748;
  border-radius: 0;
  overflow: hidden;
}

#contracts-widget .contract-fill {
  height: 100%;
  background: #d8c27a;
  transition: width 0.2s ease-out;
}

#contracts-widget .contract-foot {
  margin-top: 3px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

#contracts-widget .contract-count {
  font-size: 10px;
  color: #a8b2c0;
  font-weight: 700;
}

#contracts-widget .contract-claimed {
  font-size: 9px;
  color: #7fae95;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#contracts-widget .contract-claim {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: #171a22;
  background: #d8c27a;
  border: 1px solid #e7d9a6;
  border-radius: 0;
  padding: 3px 8px;
  cursor: pointer;
}

#contracts-widget .contract-claim:hover {
  background: #e7d9a6;
}

/* ==========================================================================
   MUTACJE LOCHU (Dungeon Modifiers) — widget ryzyko/nagroda w lochu.
   ========================================================================== */
#mutations-widget {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 55;
  width: 208px;
  background: rgba(18, 20, 26, 0.92);
  border: 1px solid #2d3748;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  padding: 6px 8px;
  pointer-events: none;
  display: none;
}

#mutations-widget .party-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--ui-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid #2d3748;
}

#mutations-widget .mutation-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #e0e6ed;
  padding: 2px 0;
}

#mutations-widget .mutation-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

#mutations-widget .mutation-bonus {
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px solid #2d3748;
  font-size: 9px;
  color: #7fae95;
  font-weight: 700;
}

/* Komunikat ukończenia / odbioru zlecenia → wpis success w #message-log. */

/* ==========================================================================
   LEWA KOLUMNA HUD — jeden pionowy stos widgetów (bez nakładania się).
   Kolejność: ZADANIE -> DRUŻYNA -> WŁADCY KRAINY -> ZLECENIA DNIA.
   Widgety mają zmienną wysokość (liczba botów / zleceń), więc flexbox
   dopasowuje pozycje automatycznie — żaden panel nie zasłania drugiego.
   ========================================================================== */
#left-hud-stack {
  position: fixed;
  top: 16px;
  left: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 224px;
  pointer-events: none;
}

/* Widgety w stosie rezygnują z własnego pozycjonowania — układ steruje flex. */
#left-hud-stack > * {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  margin: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box;
  flex: 0 0 auto;
}

/* Panele interaktywne (karty botów, przyciski zleceń) muszą łapać mysz. */
#left-hud-stack #party-panel,
#left-hud-stack #contracts-widget {
  pointer-events: auto;
}

/* ==========================================================================
   LOG KOMUNIKATÓW (#message-log) — lewy dolny róg, zamiast banerów centralnych.
   Wpisy kolorowane kategoriami (event / warn / success / info), max 6 widocznych
   (bez scrollbarów), fade-out po ~8 s. Stos #left-bottom-stack trzyma log NAD
   #controls-panel (widocznym wyłącznie w Bazie) — wzorem #left-hud-stack.
   ========================================================================== */
#left-bottom-stack {
  position: fixed;
  left: 12px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 300px;
  pointer-events: none;
}

/* Dzieci stosu rezygnują z własnego pozycjonowania — układ steruje flex. */
#left-bottom-stack > * {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  margin: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box;
  flex: 0 0 auto;
}

/* Panel sterowania w stosie musi łapać mysz (przyciski dźwięku / resetu). */
#left-bottom-stack #controls-panel {
  pointer-events: auto;
}

#message-log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
}

.log-entry {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  color: #e0e6ed;
  background: rgba(18, 20, 26, 0.82);
  border-left: 3px solid #8fa3bf;
  padding: 4px 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  overflow-wrap: break-word;
  white-space: normal;
  animation: logFadeOut 8s ease-out forwards;
}

/* Kategorie wpisów — kolory dziedziczą dawne banery centralne. */
.log-entry.log-info {
  border-left-color: #8fa3bf;
  color: #e0e6ed;
}

.log-entry.log-warn {
  border-left-color: #d06a6a;
  color: #d06a6a;
}

.log-entry.log-event {
  border-left-color: #d8c27a;
  color: #d8c27a;
}

.log-entry.log-success {
  border-left-color: #7fae95;
  color: #7fae95;
}

/* Licznik deduplikacji (×N) — dyskretny, przy prawej krawędzi wpisu. */
.log-entry .log-count {
  margin-left: 6px;
  color: #9aa5b4;
  font-size: 11px;
  font-weight: 700;
}

@keyframes logFadeOut {
  0%   { opacity: 0; }
  3%   { opacity: 1; }
  87%  { opacity: 1; }
  100% { opacity: 0; }
}
