/*
  panels.css — Стили для центральных панелей: инвентарь и крафт.
  Панели появляются по центру экрана поверх игры с затемнением фона.
  Кнопки-рецепты крафта с цветовой индикацией доступности.
*/

/* === Затемнение фона при открытой панели === */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: 49;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.panel-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* === Общий стиль центральной панели === */
.side-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  background: rgba(18, 18, 35, 0.98);
  border: 2px solid rgba(100, 150, 255, 0.25);
  border-radius: 14px;
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(80, 120, 255, 0.08);
}

/* Когда панель открыта — появляется по центру */
.side-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* === Заголовок панели === */
.panel-title {
  padding: 14px 18px;
  font-size: 16px;
  font-weight: bold;
  color: #8ab4f8;
  border-bottom: 1px solid rgba(100, 150, 255, 0.15);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === Кнопка закрытия (крестик) === */
.panel-close-btn {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.panel-close-btn:hover {
  background: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.4);
  color: #f44336;
}

/* === Скроллируемое содержимое === */
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

/* Скроллбар */
.panel-content::-webkit-scrollbar { width: 6px; }
.panel-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.panel-content::-webkit-scrollbar-thumb { background: rgba(100, 150, 255, 0.2); border-radius: 3px; }

/* ==========================================
   ИНВЕНТАРЬ
   ========================================== */

#inventory-panel.side-panel {
  width: min(1040px, 96vw);
  max-width: 96vw;
}

#inventory-panel .panel-content {
  overflow-x: hidden;
}

#inventory-panel .upgrade-card-name {
  font-size: 15px;
  color: #e8f0ff;
}

#inventory-panel .upgrade-card-level {
  font-size: 12px;
  color: #9aa8b8;
}

.inv-three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 780px) {
  .inv-three-col {
    grid-template-columns: 1fr;
  }
}

.inv-column {
  min-width: 0;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  padding: 10px 10px 12px;
  border: 1px solid rgba(100, 150, 255, 0.1);
}

.inv-col-title {
  font-size: 12px;
  font-weight: bold;
  color: #8ab4f8;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inv-col-head {
  font-size: 15px;
  font-weight: bold;
  color: #b8cffc;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.inv-subtitle--strong {
  font-size: 12px;
  font-weight: bold;
  color: #9dbbf0;
  letter-spacing: 0.04em;
}

.inv-stats-panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(100, 150, 255, 0.14);
}

.inv-bag-details {
  margin-top: 8px;
  font-size: 11px;
}

.inv-bag-summary {
  cursor: pointer;
  color: #7a9dd4;
  user-select: none;
}

.inv-bag-summary:hover {
  color: #a8c7ff;
}

.inv-bag-zero-list .inv-item.empty {
  opacity: 0.42;
}

.inv-bag-hint {
  font-size: 10px;
  color: #5a5a70;
  margin: 2px 0 8px;
  line-height: 1.4;
}

.inv-armor-meta {
  font-size: 10px;
  color: #6a7a8e;
  margin-top: 2px;
  line-height: 1.25;
}

.inv-slot-text {
  flex: 1;
  min-width: 0;
}

.inv-slot-lv {
  color: #ffd54f;
  font-weight: bold;
  flex-shrink: 0;
  font-size: 12px;
}

.inv-tool-name {
  font-weight: 600;
  color: #e0e0e0;
}

.inv-name-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.inv-gear-hint {
  font-size: 10px;
  color: #7a8a9e;
  line-height: 1.35;
  font-weight: normal;
}

.inv-char-hint {
  font-size: 10px;
  color: #5a5a70;
  margin-bottom: 6px;
}

.inv-slot-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.inv-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 12px;
}

.inv-slot-label {
  color: #888;
}

.inv-slot-empty {
  color: #555;
  font-style: italic;
}

.inv-subtitle {
  font-size: 10px;
  font-weight: bold;
  color: #6b8cc9;
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inv-tool-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 5px;
}

.inv-tool-head {
  font-size: 13px;
  color: #ddd;
  margin-bottom: 3px;
}

.inv-tool-lv {
  color: #ffd54f;
  font-weight: bold;
}

.inv-tool-meta {
  font-size: 10px;
  color: #777;
  line-height: 1.4;
}

.inv-active-tool {
  font-size: 12px;
  color: #aaa;
  margin-top: 6px;
  padding: 8px;
  background: rgba(79, 195, 247, 0.07);
  border-radius: 6px;
  border: 1px solid rgba(79, 195, 247, 0.18);
}

.inv-list-compact .inv-item {
  margin-bottom: 3px;
  padding: 6px 8px;
}

.inv-col-desc {
  font-size: 11px;
  color: #666;
  margin: -2px 0 8px;
  line-height: 1.35;
}

/* Один предмет в инвентаре */
.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  transition: background 0.2s;
}

.inv-item:hover {
  background: rgba(255,255,255,0.08);
}

/* Предмет с нулевым количеством — затемнён */
.inv-item.empty {
  opacity: 0.35;
}

.inv-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.inv-name {
  flex: 1;
  font-size: 13px;
  color: #ccc;
}

.inv-amount {
  font-size: 15px;
  font-weight: bold;
  color: #90EE90;
  min-width: 30px;
  text-align: right;
}

/* Разделитель */
.inv-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 12px 0;
}

/* Статистика в инвентаре */
.inv-stat {
  font-size: 12px;
  color: #888;
  padding: 2px 0;
}

.inv-stat b {
  color: #aaa;
}

/* ==========================================
   КРАФТ
   ========================================== */

#craft-panel.side-panel {
  width: min(1240px, 98vw);
  max-height: 92vh;
  /* Легче, чем у общей .side-panel: меньше подлагиваний поверх движущегося canvas на слабых ПК */
  backdrop-filter: blur(8px);
}

#build-panel.side-panel {
  width: min(1180px, 98vw);
  max-height: 92vh;
  backdrop-filter: blur(8px);
}

.build-panel-hint {
  font-size: 11px;
  color: #7a8a9e;
  line-height: 1.45;
  margin: 0 0 12px;
}

.build-delta-hint {
  color: #6a7a8e;
  font-weight: normal;
  font-size: 10px;
}

.build-three-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.build-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.build-col-head {
  font-size: 14px;
  font-weight: 700;
  color: #eceff4;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

.build-col-hint {
  margin-bottom: 10px !important;
  font-size: 10px !important;
  line-height: 1.4 !important;
}

.build-col-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.build-col-card.upgrade-card {
  margin-bottom: 0;
}

.build-craft-slot {
  width: 100%;
  min-width: 0;
}

.build-craft-slot .craft-recipe {
  max-width: 100%;
  box-sizing: border-box;
}

.build-place-card {
  margin-top: 10px;
}

.build-panel-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  margin-top: 4px;
}

.build-placed-row {
  font-size: 12px;
  color: #b0bec5;
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.build-castle-stats {
  background: rgba(30, 40, 55, 0.55);
  border: 1px solid rgba(129, 199, 132, 0.2);
  border-radius: 8px;
  padding: 8px 10px 10px;
  margin-bottom: 10px;
  font-size: 11px;
  line-height: 1.45;
  color: #c5d0dc;
}

.build-castle-stats-title {
  font-weight: 700;
  color: #e8f5e9;
  margin-bottom: 6px;
  font-size: 12px;
}

.build-castle-stats-block {
  font-weight: 600;
  color: #aed581;
  margin: 8px 0 4px;
  font-size: 11px;
}

.build-castle-stats-block:first-of-type {
  margin-top: 2px;
}

.build-castle-stats-list {
  margin: 0 0 0 16px;
  padding: 0;
  list-style: disc;
}

.build-castle-stats-list li {
  margin: 2px 0;
}

.craft-recipe-cost {
  margin-bottom: 8px;
}

.craft-result {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.craft-result-line {
  font-size: 11px;
  color: #aed581;
  white-space: nowrap;
}

.craft-result-name {
  color: #c5e1a5;
}

.craft-skill-panel {
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(129, 199, 132, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.craft-skill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.craft-skill-title {
  font-size: 13px;
  font-weight: bold;
  color: #a5d6a7;
}

.craft-skill-xp {
  font-size: 11px;
  color: #888;
}

.craft-skill-bar-outer {
  height: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.craft-skill-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #43a047, #66bb6a);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.craft-skill-hint {
  font-size: 10px;
  color: #6a8a6e;
  line-height: 1.4;
  margin: 0;
}

.craft-scale-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #81c784;
  background: rgba(129, 199, 132, 0.12);
  border: 1px solid rgba(129, 199, 132, 0.25);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 4px;
}

.craft-owned-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #90caf9;
  background: rgba(100, 181, 246, 0.12);
  border: 1px solid rgba(100, 181, 246, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 4px;
}

.craft-three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 920px) {
  .craft-three-col {
    grid-template-columns: 1fr;
  }
}

.craft-four-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: start;
}

@media (max-width: 1200px) {
  .craft-four-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .craft-four-col {
    grid-template-columns: 1fr;
  }
}

.craft-five-col {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  align-items: start;
}

@media (max-width: 1280px) {
  .craft-five-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .craft-five-col {
    grid-template-columns: 1fr;
  }
}

.craft-col-empty {
  font-size: 11px;
  color: #6a6a80;
  padding: 8px 4px;
  line-height: 1.35;
}

.craft-col {
  min-width: 0;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  padding: 10px 8px;
  border: 1px solid rgba(100, 150, 255, 0.1);
}

.craft-col-title {
  font-size: 12px;
  font-weight: bold;
  color: #8ab4f8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.craft-col-sub {
  font-size: 10px;
  color: #5c5c70;
  line-height: 1.35;
  margin: 0 0 10px;
}

.craft-col-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(58vh, 560px);
  overflow-y: auto;
  padding-right: 4px;
}

.craft-col-list::-webkit-scrollbar {
  width: 5px;
}

.craft-col-list::-webkit-scrollbar-thumb {
  background: rgba(100, 150, 255, 0.2);
  border-radius: 3px;
}

.craft-recipe-owned {
  opacity: 0.72;
}

.craft-recipe-owned:not(.locked) {
  border-style: dashed;
  border-color: rgba(100, 181, 246, 0.25);
}

/* Одна карточка рецепта */
.craft-recipe {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

/* Доступный рецепт — подсветка */
.craft-recipe.available {
  border-color: rgba(76, 175, 80, 0.35);
  background: rgba(76, 175, 80, 0.06);
}

.craft-recipe.available:hover {
  background: rgba(76, 175, 80, 0.12);
}

/* Заблокированный рецепт */
.craft-recipe.locked {
  opacity: 0.4;
  pointer-events: none;
}

/* Заголовок рецепта */
.craft-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.craft-icon {
  font-size: 22px;
}

.craft-name {
  font-size: 14px;
  font-weight: bold;
  color: #ddd;
  flex: 1;
}

.craft-lock {
  font-size: 11px;
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Описание рецепта */
.craft-desc {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Ингредиенты рецепта */
.craft-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.craft-ing {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
}

/* Ресурсов хватает */
.craft-ing.ok {
  color: #81C784;
  border: 1px solid rgba(129, 199, 132, 0.25);
}

/* Ресурсов не хватает */
.craft-ing.missing {
  color: #e57373;
  border: 1px solid rgba(229, 115, 115, 0.25);
}

/* Нижняя часть карточки: результат + кнопка (кнопка всегда справа в одной строке) */
.craft-footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.craft-footer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.craft-footer .craft-do-btn {
  flex-shrink: 0;
}

.craft-result {
  font-size: 12px;
  color: #90EE90;
  flex: 1;
  min-width: 0;
}

.craft-xp {
  font-size: 11px;
  color: #8ab4f8;
}

/* Кнопка «Крафт» */
.craft-do-btn {
  padding: 5px 12px;
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  border: none;
  border-radius: 5px;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.craft-do-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #66BB6A, #4CAF50);
  transform: scale(1.05);
}

.craft-do-btn:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

/* Прогресс-бар крафта: фиксированная высота снизу панели — без скачков центра модалки */
#craft-panel .craft-progress {
  flex-shrink: 0;
  box-sizing: border-box;
  height: 52px;
  padding: 8px 14px 10px;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.14);
  border-top: 1px solid rgba(100, 150, 255, 0.12);
  border-radius: 0 0 12px 12px;
}

#craft-panel .craft-progress.craft-progress--active {
  background: rgba(0, 0, 0, 0.32);
  border-top-color: rgba(255, 143, 0, 0.25);
}

.craft-progress-bar {
  height: 8px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

#craft-panel .craft-progress:not(.craft-progress--active) .craft-progress-bar {
  opacity: 0.35;
}

.craft-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff8f00, #FFD54F);
  border-radius: 4px;
  transition: width 0.1s linear;
  width: 0%;
}

.craft-progress-text {
  font-size: 11px;
  color: #888;
  line-height: 1.2;
  min-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#craft-panel .craft-progress.craft-progress--active .craft-progress-text {
  color: #bbb;
}

/* ==========================================
   ПАНЕЛЬ ПРОКАЧКИ (UPGRADES)
   ========================================== */

.upgrade-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.upgrade-card:hover {
  background: rgba(255,255,255,0.06);
}

.upgrade-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.upgrade-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.upgrade-card-icon.axe { background: rgba(255, 143, 0, 0.15); border: 1px solid rgba(255, 143, 0, 0.3); }
.upgrade-card-icon.pickaxe { background: rgba(100, 181, 246, 0.15); border: 1px solid rgba(100, 181, 246, 0.3); }
.upgrade-card-icon.sword { background: rgba(244, 67, 54, 0.15); border: 1px solid rgba(244, 67, 54, 0.3); }
.upgrade-card-icon.harvest { background: rgba(76, 175, 80, 0.15); border: 1px solid rgba(76, 175, 80, 0.3); }

.upgrade-card-info {
  flex: 1;
  min-width: 0;
}

.upgrade-card-name {
  font-size: 14px;
  font-weight: bold;
  color: #ddd;
}

.upgrade-card-level {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.upgrade-card-level span {
  color: #FFD700;
  font-weight: bold;
}

.upgrade-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.upgrade-stat {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: #aaa;
}

.upgrade-stat b {
  color: #ddd;
}

.upgrade-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upgrade-do-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.upgrade-do-btn:hover:not(:disabled) {
  transform: scale(1.04);
  filter: brightness(1.15);
}

.upgrade-do-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.upgrade-do-btn.axe { background: linear-gradient(135deg, #ff8f00, #ff6d00); }
.upgrade-do-btn.pickaxe { background: linear-gradient(135deg, #42A5F5, #1E88E5); }
.upgrade-do-btn.sword { background: linear-gradient(135deg, #ef5350, #c62828); }

.upgrade-cost-text {
  font-size: 10px;
  color: #999;
}

.upgrade-req-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.upgrade-req-badge.locked {
  color: #f44336;
  background: rgba(244, 67, 54, 0.12);
}

.upgrade-req-badge.affordable {
  color: #FFD54F;
  background: rgba(255, 213, 79, 0.08);
}

.upgrade-req-badge.ready {
  color: #81C784;
  background: rgba(129, 199, 132, 0.08);
}

.upgrade-req-badge.max {
  color: #CE93D8;
  background: rgba(206, 147, 216, 0.08);
}

.upgrade-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  padding: 6px 0 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 10px;
}

/* Торговец: две колонки (ширина ~два прежних столбца) */
#trader-panel.side-panel {
  width: min(880px, 96vw);
  max-width: 96vw;
}

#trader-panel .trader-two-col {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

#trader-panel .trader-col {
  flex: 1;
  min-width: 0;
}

#trader-panel .trader-col--buy {
  padding-right: 6px;
  border-right: 1px solid rgba(100, 150, 255, 0.12);
}

@media (max-width: 640px) {
  #trader-panel .trader-two-col {
    flex-direction: column;
    gap: 20px;
  }
  #trader-panel .trader-col--buy {
    padding-right: 0;
    border-right: none;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.12);
  }
}

.trader-col-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}

.trader-col-title--buy {
  color: #69f0ae;
  text-shadow: 0 0 18px rgba(105, 240, 174, 0.25);
}

.trader-col-title--sell {
  color: #ffcc80;
  text-shadow: 0 0 18px rgba(255, 204, 128, 0.2);
}

/* Подзаголовки внутри колонки — отступ снизу, чтобы не прилипали к карточкам */
.trader-block-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8a9aaf;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.trader-group-heading {
  font-size: 12px;
  font-weight: 600;
  color: #b0bec5;
  margin: 14px 0 10px;
}

.trader-group-heading:first-of-type {
  margin-top: 0;
}

.trader-scrap-hint {
  font-size: 11px;
  color: #7a8a9e;
  line-height: 1.4;
  margin: -4px 0 16px;
}

.upgrade-mastery-bar {
  width: 100%;
  height: 4px;
  background: #1a1a2a;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.upgrade-mastery-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.upgrade-mastery-fill.axe { background: linear-gradient(90deg, #ff8f00, #FFD54F); }
.upgrade-mastery-fill.pickaxe { background: linear-gradient(90deg, #42A5F5, #80DEEA); }
.upgrade-mastery-fill.sword { background: linear-gradient(90deg, #ef5350, #FF8A65); }
.upgrade-mastery-fill.bow { background: linear-gradient(90deg, #5d4037, #8d6e63); }

/* ==========================================
   ПРОКАЧКА: ДВУХКОЛОНОЧНАЯ РАСКЛАДКА
   ========================================== */

#upgrades-panel {
  width: min(1180px, 98vw);
  max-width: 98vw;
}

.upg-four-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) {
  .upg-four-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .upg-four-columns {
    grid-template-columns: 1fr;
  }
}

.upg-two-columns {
  display: flex;
  gap: 14px;
}

.upg-column {
  flex: 1;
  min-width: 0;
}

.upg-col-title {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8ab4f8;
  padding: 8px 0 10px;
  border-bottom: 2px solid rgba(100, 150, 255, 0.15);
  margin-bottom: 10px;
}

.upg-col-sub {
  font-size: 10px;
  line-height: 1.4;
  color: #7a8a9e;
  margin: -4px 0 10px;
}

.upg-col-hint {
  font-size: 10px;
  line-height: 1.45;
  color: #8a9aaf;
  margin: -2px 0 10px;
}

.upgrade-card-note {
  font-size: 9px;
  color: #6d7a8c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.upgrade-card-stats--row {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  gap: 4px;
}

.upgrade-card-stats--row .upgrade-stat {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 4px 7px;
  white-space: nowrap;
}

.upgrade-tier-hint {
  font-size: 10px;
  line-height: 1.35;
  color: #9ccc65;
  background: rgba(156, 204, 101, 0.08);
  border: 1px solid rgba(156, 204, 101, 0.2);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.upgrade-cost-block {
  margin-bottom: 8px;
}

.upgrade-cost-caption {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #789;
  margin-bottom: 4px;
}

.upgrade-cost-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.upgrade-cost-line.is-ok {
  border-color: rgba(129, 199, 132, 0.35);
}

.upgrade-cost-line.is-short {
  border-color: rgba(239, 83, 80, 0.35);
}

.upgrade-cost-line .ui-svg-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.upgrade-cost-label {
  flex: 1;
  min-width: 0;
  color: #c5cae9;
  font-weight: 600;
}

.upgrade-cost-qty {
  font-variant-numeric: tabular-nums;
  color: #eee;
}

.upgrade-card-footer--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.upgrade-card-next {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.upgrade-card-icon.helmet,
.upgrade-card-icon.torso,
.upgrade-card-icon.legs,
.upgrade-card-icon.gloves,
.upgrade-card-icon.boots {
  background: rgba(100, 150, 255, 0.12);
  border: 1px solid rgba(100, 150, 255, 0.28);
}

.upgrade-do-btn.bow {
  background: linear-gradient(135deg, #8d6e63, #5d4037);
}

/* Броня и усиления снаряжения: явный фон, чтобы активная кнопка не сливалась с белым текстом */
.upgrade-do-btn.harvest,
.upgrade-do-btn.helmet,
.upgrade-do-btn.torso,
.upgrade-do-btn.legs,
.upgrade-do-btn.gloves,
.upgrade-do-btn.boots {
  background: linear-gradient(135deg, #00897b, #00695c);
}
