/* ==========================================================================
   6. Terminal Szczegółowy / Modal (Wykres & Minecraft Tooltip)
   ========================================================================== */

.market-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background-color: rgba(4, 5, 8, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.15s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.market-modal-backdrop[hidden] {
  display: none;
  opacity: 0;
}

.market-modal-panel {
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  background-color: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-item-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-item-icon-box {
  width: 56px;
  height: 56px;
  background-color: var(--bg-base);
  border: 2px solid #1f2533;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8);
}

.modal-item-icon-box img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}

.modal-rarity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.modal-rarity-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.05em;
}

.btn-copy-ah {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: var(--bg-sky-10);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-xs);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
  transition-property: var(--tr-props);
}

.btn-copy-ah:hover {
  background: var(--bg-sky-22);
  border-color: var(--cyan);
  transform: translateY(-1px);
  box-shadow: none;
}

.modal-item-name {
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

/* STR-14: nazwa + ikona kopiowania obok (styl jak .btn-copy-nick w Graczach; players.css ladowany leniwie) */
#modalItemTitle { display: flex; align-items: center; gap: 8px; min-width: 0; }
#modalItemTitle .modal-item-name-text { min-width: 0; overflow-wrap: anywhere; }
#modalItemTitle .btn-copy-nick { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: none; color: var(--text-dim); cursor: pointer; transition: color .15s, background .15s; }
#modalItemTitle .btn-copy-nick svg { width: 16px; height: 16px; }
#modalItemTitle .btn-copy-nick:hover { color: var(--text-bright); background: var(--panel-hover); }
#modalItemTitle .btn-copy-nick:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
#modalItemTitle.sk-pending .btn-copy-nick { visibility: hidden; }

.modal-item-key {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--text-dim);
}

.modal-top-pricing {
  display: flex;
  align-items: center;
  gap: 20px;
}

.modal-liquid-display {
  text-align: right;
}

.modal-price-label {
  display: block;
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.modal-price-val {
  font-family: var(--font-mono);
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--green);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: var(--fs-4xl);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

/* Modal Body: Split-Screen */
.modal-grid-body {
  display: grid;
  grid-template-columns: 1fr 390px;
  flex: 1;
  overflow-y: auto;
}

.modal-left-chart-col {
  padding: 20px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.chart-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-timeframe-group {
  display: flex;
  background-color: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.btn-timeframe {
  padding: 3px 8px;
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-dim);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: 0.12s ease;
  transition-property: var(--tr-props);
  white-space: nowrap;
}

.btn-timeframe:hover {
  color: var(--text-main);
}

.btn-timeframe.active {
  background-color: var(--surface-chip);
  color: var(--cyan);
}

.btn-tf-max {
  color: var(--accent-gold);
  font-weight: 700;
}

.btn-tf-max:hover {
  color: var(--color-amber-400);
}

.btn-tf-max.active {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.chart-legend-pills {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.legend-pill-range {
  color: var(--silver);
  background: var(--bg-white-05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-pill-liquid {
  color: var(--green);
  font-weight: 700;
}

.chart-canvas-wrapper {
  height: 290px;
  position: relative;
  margin-bottom: 16px;
}

/* 6 Metryk Giełdowych w Modalu */
/* P10 E4: statystyki jako wiersze z cienka linia zamiast 6 kafelkow w ramkach */
.modal-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 24px;
  margin-top: auto;
}

.modal-metrics-grid .metric-card {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 10px 0;
  min-width: 0;
  box-shadow: none;
  cursor: help;
}

.modal-metrics-grid .metric-card:hover {
  border-color: var(--border-subtle);
  transform: none;
  box-shadow: none;
}

/* Audyt 02.11 G: 3 glowne wartosci w 1. rzedzie, spread/wolumen/probki jako przyciszone szczegoly */
.modal-metrics-grid .metric-card:nth-child(n+4) {
  padding: 6px 0;
  /* Audyt 18.11 W26: bez stalego przygaszenia - wyszarzany jest tylko kafel bez danych (.is-empty) */
}

.modal-metrics-grid .metric-card:nth-child(n+4) strong {
  font-size: 0.85em;
}

.modal-metrics-grid .metric-card small {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 2px;
}

.modal-metrics-grid .metric-card strong {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--text-main);
}

.metric-card.metric-low strong {
  color: var(--text-main);
}

.metric-card.metric-trend strong {
  color: var(--slate-400);
  transition: color 0.2s ease;
}

.metric-card.metric-trend.trend-up strong {
  color: var(--green);
}

.metric-card.metric-trend.trend-down strong {
  color: var(--red);
}

.metric-card.metric-trend.trend-neutral strong {
  color: var(--slate-400);
}

.metric-card.metric-liquid-period strong,
.metric-card.metric-spread strong,
.metric-card.metric-vol strong {
  color: var(--text-main);
}

.metric-card.metric-samples strong {
  color: var(--text-muted);
}

/* Prawa Kolumna Modalu: Wyłącznie Lista Ofert Graczy o Pełnej Wysokości */
.modal-right-sellers-col {
  padding: 18px 20px;
  background-color: var(--bg-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.recent-sellers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 12px;
}

.recent-sellers-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  min-width: 0;
  flex: 1;
}

.recent-sellers-header-left .period-badge {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  background: var(--bg-sky-12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  margin-left: 2px;
  white-space: nowrap;
}

.recent-sellers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  height: 100%;
  min-height: 400px;
  max-height: 440px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.25) transparent;
  contain: content;
  padding-right: 6px;
}

/* Wiersz Sprzedawcy: Aksamitny, Smooth Hover Bez Szarpnięć i Bez Bugów */
.seller-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(14, 17, 24, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  transition: background-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  cursor: pointer;
  min-height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
}

.seller-row:hover {
  background: rgba(22, 28, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 10px rgba(56, 189, 248, 0.12);
}

.seller-row.is-selected {
  border-color: var(--cyan);
  background: var(--bg-sky-14);
  box-shadow: none;
}

/* Osobne Okienko Lore po prawej stronie Modalu */
/* Osobne Okienko Lore po prawej stronie Modalu */
.modal-lore-popout {
  width: 320px;
  min-width: 280px;
  max-width: 340px;
  max-height: 90vh;
  height: fit-content;
  align-self: center;
  background-color: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  box-sizing: border-box;
  gap: 10px;
  transform: translateZ(0);
  animation: lorePopoutFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lore-popout[hidden] {
  display: none !important;
}

/* Jedyny breakpoint ukladu modal + popout lore (duplikat z mobile.css usuniety) */
@media (max-width: 1340px) {
  .market-modal-backdrop {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px;
    overflow-y: auto;
  }
  .modal-lore-popout {
    width: 100%;
    max-width: 980px;
    align-self: center;
  }
}

@keyframes lorePopoutFade {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.lore-popout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  padding-bottom: 2px;
}

.lore-popout-icon,
.sellers-header-icon {
  flex-shrink: 0;
  color: var(--cyan);
  vertical-align: middle;
}

/* 1:1 Minecraft Tooltip Box wewnątrz Popoutu (Dopasowany naturalnie do treści) */
.mc-tooltip-box {
  background-color: #100010;
  border: 2px solid #280070;
  box-shadow: inset 0 0 0 1px #5000ff, 0 8px 20px rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-family: 'Inter', var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.45;
  height: auto;
  min-height: auto;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin-bottom: 0;
  contain: content;
}

.mc-tooltip-header {
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(80, 0, 255, 0.25);
  flex-shrink: 0;
}

.mc-tooltip-lines {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 0, 255, 0.4) transparent;
  padding-right: 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mc-tooltip-lines div {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

/* Kolory Minecrafta dla Lore */
.mc-c-0 { color: #000000; }
.mc-c-1 { color: #0000aa; }
.mc-c-2 { color: #00aa00; }
.mc-c-3 { color: #00aaaa; }
.mc-c-4 { color: #aa0000; }
.mc-c-5 { color: #aa00aa; }
.mc-c-6 { color: #ffaa00; font-weight: 600; }
.mc-c-7 { color: #aaaaaa; }
.mc-c-8 { color: #555555; }
.mc-c-9 { color: #5555ff; }
.mc-c-a { color: #55ff55; font-weight: 600; }
.mc-c-b { color: #55ffff; font-weight: 600; }
.mc-c-c { color: #ff5555; font-weight: 600; }
.mc-c-d { color: #ff55ff; font-weight: 600; }
.mc-c-e { color: #ffff55; font-weight: 600; }
.mc-c-f { color: var(--color-white); }

.lore-popout-footer {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  background: var(--bg-white-02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  box-sizing: border-box;
}

.lore-popout-footer .lore-footer-icon {
  flex-shrink: 0;
  color: var(--text-dim);
}

.seller-row-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.seller-row-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-xs);
  image-rendering: pixelated;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.seller-row-name {
  color: var(--cyan);
  font-weight: 600;
}

.seller-row-count {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--text-dim);
  background-color: var(--surface-chip);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

.seller-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seller-deal-badge {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--green-light);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.seller-row-price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--green);
}

.seller-row-time {
  font-size: var(--fs-2xs);
  color: var(--text-dim);
}

/* Toast Powiadomienia (np. Kopiowanie /ah) */
.market-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface-raised);
  border: 1px solid var(--green);
  border-radius: var(--radius-md);
  color: var(--slate-50);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 16px rgba(16, 185, 129, 0.3);
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.market-toast[hidden] {
  display: none !important;
}

.market-toast.is-error {
  border-color: var(--red);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 16px rgba(239, 68, 68, 0.3);
}

.market-toast.is-error .toast-icon {
  background-color: var(--red);
  color: var(--color-white);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--green);
  color: #05070a;
  font-weight: 900;
  font-size: var(--fs-xs);
}

@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   7. Stopka
   ========================================================================== */

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-base);
  padding: 14px 20px;
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

.footer-inner {
  max-width: var(--site-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-brand {
  font-weight: 700;
  color: var(--text-muted);
}

/* ==========================================================================
   8. Pływający Przycisk Przewijania do Góry (Scroll To Top)
   ========================================================================== */

.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: var(--z-fab);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(18, 22, 33, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 14px rgba(56, 189, 248, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition-property: var(--tr-props);
  -webkit-tap-highlight-color: transparent;
}

.scroll-top-btn:hover {
  background: var(--surface-chip);
  border-color: var(--cyan);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.75), 0 0 20px rgba(56, 189, 248, 0.45);
}

.scroll-top-btn:active {
  transform: scale(0.92);
}

.scroll-top-btn[hidden] {
  display: none !important;
}

/* Etykiety enchantow miecza przy ofercie (K/W/O/S) */
.seller-ench-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  margin-left: 3px;
  padding: 0 3px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 800;
  line-height: 1;
}
.seller-ench-tag.ench-k { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.45); }
.seller-ench-tag.ench-w { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.45); }
.seller-ench-tag.ench-o { background: rgba(34, 197, 94, 0.15); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }
.seller-ench-tag.ench-s { background: var(--bg-sky-15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }
/* Wiersz oferty: bez przepelnienia przy etykietach K/W/O/S i % */
.seller-row { gap: 6px; min-width: 0; padding: 7px 9px; }
.seller-row-left { min-width: 0; flex: 1 1 auto; gap: 4px; overflow: hidden; }
.seller-row-name { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seller-row-avatar,
.seller-row-count,
.seller-ench-tag { flex-shrink: 0; }
.seller-ench-tag { margin-left: 0; }
.seller-row-right { flex: 0 0 auto; gap: 5px; }
.seller-row-price,
.seller-row-time,
.seller-deal-badge { white-space: nowrap; }
#modalRecentSellersList { overflow-x: hidden; }
/* Przycisk powrotu do wszystkich ofert (zamiast domyslnego szarego przycisku) */
.btn-clear-bucket-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-sky-12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-clear-bucket-filter:hover {
  background: var(--bg-sky-22);
  border-color: rgba(56, 189, 248, 0.6);
}

/* Naglowek "Oferty z okresu" w jednej linii */
#modalRecentSellersTitle {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.recent-sellers-header-left .period-badge { white-space: nowrap; }
/* ===== Pelny redesign (29.10): okno przedmiotu w systemie kolorow strony ===== */
.modal-rarity-tag { color: var(--accent, var(--accent)); }
.modal-item-name { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
.modal-price-val { color: var(--accent); font-size: var(--fs-4xl); }
.modal-price-label { color: var(--text-muted); }
.btn-copy-ah { background: transparent; border-color: rgba(60, 200, 223, 0.35); color: var(--accent, var(--accent)); }
.modal-metrics-grid .metric-card strong { font-weight: 600; }
.modal-metrics-grid .metric-card strong.trend-up, .modal-metrics-grid .metric-card .trend-up { color: var(--green-light); }
.modal-metrics-grid .metric-card strong.trend-down, .modal-metrics-grid .metric-card .trend-down { color: var(--color-red-400); }
/* Kafelek bez danych (trend przy < 2 probkach, spread przy jednej cenie) - wyszarzony, nie przyciaga uwagi */
.modal-metrics-grid .metric-card.is-empty { opacity: 0.45; }
.modal-metrics-grid .metric-card.is-empty strong { color: var(--slate-500); font-weight: 500; }
.seller-row { border-radius: var(--radius-md); }
.seller-row.is-selected { background: rgba(60, 200, 223, 0.08); border-color: rgba(60, 200, 223, 0.35); }
.seller-row-name { color: var(--accent, var(--accent)); }
.seller-row-price { color: var(--accent); font-weight: 700; }

/* ===== Pelny redesign (29.10): okno przedmiotu bez ramek w ramkach ===== */
.modal-item-key, .modal-rarity-tag, .chart-legend-pills, .sellers-header-icon, .lore-popout-icon, .lore-footer-icon { display: none; }
.modal-price-label { text-transform: none; letter-spacing: 0; font-weight: 500; }
.recent-sellers-header { font-size: var(--fs-xs); letter-spacing: 0.02em; }
.seller-row-count { background: none; border: 0; color: var(--text-dim); padding: 0; }
.modal-right-sellers-col .modal-lore-popout { width: auto; min-width: 0; max-width: none; max-height: none; margin-top: 16px;
  background: none; border: 0; border-top: 1px solid var(--border-subtle); border-radius: 0; box-shadow: none; padding: 14px 0 0; align-self: stretch; }
/* Ramka lore (10.11): ciemne tlo, cienka fioletowa ramka, bez grubego lewego paska */
.modal-right-sellers-col .mc-tooltip-box { background: var(--bg-base); border: 1px solid rgba(168, 85, 247, 0.2); border-radius: var(--radius-md); box-shadow: none; padding: 10px 12px; }
.modal-right-sellers-col .lore-popout-footer { background: none; border: 0; padding: 8px 0 0; }
/* wykres wypelnia wysokosc kolumny (opis po prawej wydluza panel) */
.modal-left-chart-col .chart-canvas-wrapper { flex: 1 1 auto; height: auto; min-height: 290px; }

/* ===== Poprawka 29.10: okno o stalej wysokosci, oferty i opis dziela prawa kolumne ===== */
.market-modal-panel { height: min(88vh, 720px); }
.modal-grid-body { min-height: 0; overflow: hidden; }
.modal-left-chart-col { min-height: 0; overflow: hidden; }
.modal-left-chart-col .chart-canvas-wrapper { flex: 1 1 auto; height: auto; min-height: 0; }
.modal-right-sellers-col { min-height: 0; }
.modal-right-sellers-col .recent-sellers-list { flex: 1 1 auto; min-height: 120px; max-height: none; height: auto; }
.modal-right-sellers-col .modal-lore-popout { flex: 0 1 auto; max-height: 45%; overflow-y: auto; margin-top: 12px; }
@media (max-width: 768px) {
  .market-modal-panel { height: auto; max-height: 92vh; }
  .modal-grid-body { overflow-y: auto; }
  .modal-left-chart-col .chart-canvas-wrapper { min-height: 240px; }
  .modal-right-sellers-col .modal-lore-popout { max-height: none; }
  /* STR-65: okno przewija sie w calosci, wiec lista z flex 1 1 0 kurczyla sie do 120 px (2-3 wiersze) */
  #chartModal .modal-right-sellers-col .recent-sellers-list { flex: 0 0 auto; height: auto; max-height: min(50vh, 400px); }
}
/* podzial prawej kolumny: opis ile potrzebuje (max 50%), lista ofert reszta z wlasnym przewijaniem */
.modal-right-sellers-col .recent-sellers-list { flex: 1 1 0; min-height: 120px; }
.modal-right-sellers-col .modal-lore-popout { flex: 0 0 auto; max-height: 50%; }
/* Audyt #9: sygnal przewijania lore - dol zanika zamiast wygladac na uciety */
.modal-right-sellers-col .modal-lore-popout {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  padding-bottom: 24px;
}
/* Audyt #5: glowki z mc-heads (128x136) bez sciskania */
.player-head-avatar { object-fit: contain; }

/* ===== Audyt GUI 08.11 E3: panel przedmiotu ===== */
.market-modal-panel { width: min(1180px, 94vw); max-width: none; border-radius: var(--radius-panel); }
.modal-rarity-tag, .modal-price-label, .modal-metrics-grid .metric-card small, #modalRecentSellersTitle, .lore-popout-title {
  text-transform: none; letter-spacing: 0; font-family: var(--font-sans); color: var(--text-dim); }
.modal-price-val { color: var(--text-bright); }
/* Przycisk zamkniecia (10.11): jak w modalu kalkulatora - jedna koncowa regula, bez cyanowej ramki na :focus */
.modal-close-btn, .modal-close-btn:hover, .modal-close-btn:focus { border-radius: var(--radius-md); border: 1px solid rgba(255, 255, 255, 0.08); background: transparent; box-shadow: none; outline: 0; }
/* Audyt 14.11 (niskie): obrys fokusu z klawiatury wyrazny (krycie 0.7 zamiast 0.25) */
.modal-close-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 2px; }
.btn-timeframe { color: var(--text-muted); }
.btn-timeframe.active { color: var(--accent); background: var(--accent-dim); }
.modal-grid-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.modal-metrics-grid { grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; margin-top: 14px; }
.modal-metrics-grid .metric-card { background: var(--panel-active); padding: 10px 12px; border: 0; min-height: 0; opacity: 1; }
.modal-metrics-grid .metric-card:nth-child(n+4) strong, .modal-metrics-grid .metric-card strong { color: var(--text-bright); font-size: var(--fs-md); }
.modal-right-sellers-col { border-left: 1px solid var(--border-subtle); }
.recent-sellers-list { display: block; }
/* Wiersze ofert (10.11): ramka zawsze 1px (przezroczysta), zeby zaznaczenie nie przesuwalo ukladu; bez paska inset */
.seller-row, .seller-row:hover, .seller-row:focus-visible { border: 1px solid transparent; background: none; border-radius: var(--radius-sm); box-shadow: none; padding: 8px 4px; }
.seller-row:hover { background: rgba(255, 255, 255, 0.03); }
.seller-row.is-selected, .seller-row.is-selected:hover { border: 1px solid rgba(255, 255, 255, 0.14); background: var(--panel-hover); box-shadow: none; }
.seller-row-price { color: var(--text-bright); }
.seller-row-name { color: var(--text-main); }
@media (max-width: 768px) {
  .market-modal-panel { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
  .modal-topbar { position: sticky; top: 0; z-index: var(--z-over); background: var(--panel-bg); }
  /* STR-65: dluga nazwa sciskala cene do 46 px - nazwa na cala szerokosc, cena pod nia, zamkniecie w rogu */
  .modal-topbar { flex-wrap: wrap; row-gap: 8px; }
  .modal-topbar .modal-item-identity { flex: 1 1 100%; padding-right: 44px; }
  .modal-topbar .modal-top-pricing { width: 100%; justify-content: flex-start; }
  .modal-topbar .modal-liquid-display { text-align: left; }
  .modal-topbar .modal-close-btn { position: absolute; top: 12px; right: 12px; }
  .modal-grid-body { grid-template-columns: 1fr; }
  .modal-right-sellers-col { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .modal-metrics-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Audyt 11.11 S21b: wiersz sprzedawcy jako <button> - reset domyslnego stylu przycisku, wyglad bez zmian */
.seller-row { font-family: inherit; font-weight: inherit; line-height: inherit; color: inherit; text-align: inherit; letter-spacing: inherit; text-transform: inherit; margin: 0; width: 100%; box-sizing: border-box; }

/* D12 (audyt UI 12.11): czas oferty w jednej linii */
.seller-row-time { white-space: nowrap; flex-shrink: 0; }

/* STR-15: bez zakladek - domyslnie pelna lista ofert; klik w oferte = tryb "split":
   lista zmniejszona (przewijana) u gory, opis tej oferty wysuwany od dolu; ponowny klik zamyka */
.modal-right-sellers-col[data-tab="offers"] .modal-lore-popout,
.modal-right-sellers-col:not([data-tab]) .modal-lore-popout { display: none; }
.modal-right-sellers-col[data-tab="split"] { display: flex; flex-direction: column; min-height: 0; }
.modal-right-sellers-col[data-tab="split"] .recent-sellers-list { flex: 0 1 45%; min-height: 120px; overflow-y: auto; }
.modal-right-sellers-col[data-tab="split"] .modal-lore-popout {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle);
  animation: lore-slide-up .18s ease-out;
}
@keyframes lore-slide-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal-right-sellers-col[data-tab="split"] .modal-lore-popout { animation: none; } }

/* STR-18: dni do wygasniecia peta/kostiumu przy cenie oferty */
.seller-row-expiry { flex-shrink: 0; padding: 1px 6px; border: 1px solid var(--border-subtle); border-radius: var(--radius-xs); color: var(--text-muted); font: 600 var(--fs-2xs) var(--font-mono); white-space: nowrap; }
.seller-row-expiry.is-soon { color: var(--red); border-color: currentColor; }

/* STR-65: nick sprzedawcy nie kurczy sie kosztem plakietek zaklec (Excalibur: 47 z 83 px) - plakietki przechodza do drugiej linii */
button.seller-row .seller-row-left { flex-wrap: wrap; row-gap: 2px; }
button.seller-row .seller-row-name { flex-shrink: 0; max-width: 100%; }

/* STR-52: okno czasowe przy naglowku Aktualna cena */
.modal-price-window { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: var(--radius-sm, 4px); background: rgba(255,255,255,.08); color: var(--text-bright, #fff); font-size: .85em; text-transform: none; letter-spacing: 0; }

/* STR-56: plakietki wariantu obok nazwy w oknie */
.modal-variant-badges { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.modal-variant-badges:empty { display: none; }
