/* Cat Fighting — Кузница: планшет и VK Mini App на ПК.
   Только catfight-tablet-layout. 1cqw = 1% центрального #content.
   Алхимия, руны, расчёты и обработчики не меняются. */
@media (min-width: 601px) and (min-height: 600px) {
  body.catfight-tablet-layout #content .forge-container:not(.alchemy-page) {
    box-sizing: border-box; min-width: 0; min-height: 0;
    padding: clamp(5px, 1.25cqw, 10px);
    border-radius: clamp(12px, 3cqw, 24px);
  }
  /* Баннер: 6 ресурсов слева и 4 кнопки справа должны помещаться. */
  body.catfight-tablet-layout #content .forge-container:not(.alchemy-page) .forge-banner-wrapper {
    height: clamp(160px, 40cqw, 250px) !important;
    min-width: 0; border-radius: clamp(12px, 3cqw, 24px) !important;
    margin-bottom: clamp(8px, 2cqw, 16px);
  }
  body.catfight-tablet-layout #content #forgeResources {
    top: clamp(5px, 1.25cqw, 10px); left: clamp(5px, 1.25cqw, 10px);
    bottom: clamp(5px, 1.25cqw, 10px);
    padding: clamp(5px, 1.25cqw, 10px) clamp(8px, 2cqw, 16px);
    border-radius: clamp(8px, 2cqw, 16px);
  }
  body.catfight-tablet-layout #content #forgeResources .resource-row {
    gap: clamp(6px, 1.5cqw, 12px);
    font-size: clamp(14px, 3.5cqw, 25px);
  }
  body.catfight-tablet-layout #content #forgeResources .resource-row img {
    width: clamp(20px, 5cqw, 38px) !important;
    height: clamp(20px, 5cqw, 38px) !important;
    flex-shrink: 0;
  }
  body.catfight-tablet-layout #content #forgeNavButtons {
    right: clamp(8px, 2cqw, 16px) !important;
    top: clamp(3px, .75cqw, 6px) !important;
    gap: clamp(3px, .75cqw, 6px) !important;
  }
  body.catfight-tablet-layout #content #forgeNavButtons .forge-nav-btn {
    height: clamp(34px, 8.5cqw, 52px);
    width: auto; max-width: 100%; object-fit: contain;
  }
  /* Заголовок текущего раздела и значок справки. */
  body.catfight-tablet-layout #content #forgeSectionTitle {
    min-width: 0; flex-shrink: 0;
  }
  body.catfight-tablet-layout #content .forge-section-title-inner {
    min-width: 0; gap: clamp(12px, 3cqw, 24px);
    margin: clamp(10px, 2.5cqw, 20px) 0 clamp(6px, 1.5cqw, 12px);
    padding: 0 clamp(36px, 9cqw, 70px) 0 clamp(8px, 2cqw, 16px);
  }
  body.catfight-tablet-layout #content .forge-title-text {
    font-size: clamp(16px, 4cqw, 30px);
    letter-spacing: clamp(1px, .25cqw, 2px);
  }
  body.catfight-tablet-layout #content .forge-title-deco-left,
  body.catfight-tablet-layout #content .forge-title-deco-right {
    height: clamp(2px, .5cqw, 4px);
  }
  body.catfight-tablet-layout #content #forgeHelpBtn {
    font-size: clamp(20px, 5cqw, 38px) !important;
    width: clamp(40px, 10cqw, 76px);
    right: clamp(6px, 1.5cqw, 12px) !important;
  }
  /* Ковка: свиток+3 предмета. Плавка: 5 предметов.
     Размеры заданы inline в JS, поэтому здесь !important. */
  body.catfight-tablet-layout #content #forgeMainContent {
    min-width: 0; min-height: 0;
  }
  body.catfight-tablet-layout #content #forgeSlots {
    min-width: 0; max-width: 100%;
    gap: clamp(8px, 2cqw, 16px) !important;
    margin: clamp(10px, 2.5cqw, 20px) 0;
    justify-content: center; flex-shrink: 0;
  }
  body.catfight-tablet-layout #content #forgeSlots > .forge-slot {
    box-sizing: border-box;
    width: clamp(60px, 15cqw, 110px) !important;
    height: clamp(60px, 15cqw, 110px) !important;
    flex: 0 0 clamp(60px, 15cqw, 110px);
    border-radius: clamp(8px, 2cqw, 16px) !important;
    font-size: clamp(11px, 2.75cqw, 20px) !important;
  }
  body.catfight-tablet-layout #content #forgeSlots > .forge-slot > span {
    font-size: clamp(11px, 2.75cqw, 20px) !important;
    overflow-wrap: anywhere;
  }
  body.catfight-tablet-layout #content #forgeSlots > .scroll-slot img {
    width: clamp(28px, 7cqw, 51px) !important;
    height: clamp(28px, 7cqw, 51px) !important;
    margin-bottom: clamp(2px, .5cqw, 4px) !important;
  }
  body.catfight-tablet-layout #content #forgeSlots > .scroll-slot span {
    font-size: clamp(9px, 2.25cqw, 16px) !important;
    line-height: 1.2;
  }
  /* Стоимость и кнопка действия могут переноситься на следующую строку. */
  body.catfight-tablet-layout #content #forgeActionRow {
    box-sizing: border-box; min-width: 0;
    min-height: clamp(52px, 13cqw, 95px) !important;
    padding: clamp(10px, 2.5cqw, 20px) !important;
    gap: clamp(8px, 2cqw, 16px) !important;
    font-size: clamp(13px, 3.25cqw, 24px);
    flex-wrap: wrap;
  }
  body.catfight-tablet-layout #content #forgeActionRow > span {
    font-size: clamp(12px, 3cqw, 23px) !important;
    line-height: 1.35;
  }
  body.catfight-tablet-layout #content #forgeActionRow > div {
    min-width: 0; font-size: clamp(13px, 3.25cqw, 24px) !important;
  }
  body.catfight-tablet-layout #content #forgeActionRow > div[style*="min-width: 160px"] {
    min-width: 0 !important;
    flex: 1 1 clamp(140px, 35cqw, 260px);
    margin-left: 0 !important;
  }
  body.catfight-tablet-layout #content #forgeActionRow img {
    width: clamp(20px, 5cqw, 38px) !important;
    height: clamp(20px, 5cqw, 38px) !important;
    flex-shrink: 0;
  }
  body.catfight-tablet-layout #content #forgeActionBtn {
    box-sizing: border-box; min-width: 0 !important;
    width: 100%; max-width: 100%;
    padding: clamp(10px, 2.5cqw, 19px) clamp(12px, 3cqw, 23px) !important;
    font-size: clamp(14px, 3.5cqw, 26px) !important;
    white-space: normal !important;
    border-radius: clamp(20px, 5cqw, 38px);
  }
  /* Инвентарь: независимая прокрутка, строки, предметы и «Добавить». */
  body.catfight-tablet-layout #content .forge-inventory-header {
    min-width: 0;
    gap: clamp(12px, 3cqw, 24px);
    padding: clamp(10px, 2.5cqw, 20px) 0;
    font-size: clamp(18px, 4.5cqw, 34px);
  }
  body.catfight-tablet-layout #content .forge-inventory-header::before,
  body.catfight-tablet-layout #content .forge-inventory-header::after {
    height: clamp(2px, .5cqw, 4px);
  }
  body.catfight-tablet-layout #content #forgeInventory {
    min-width: 0; min-height: 0;
    overflow-x: hidden; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.catfight-tablet-layout #content #forgeInventory .inventory-item {
    min-width: 0; flex-shrink: 0;
    gap: clamp(12px, 3cqw, 23px);
    padding: clamp(6px, 1.5cqw, 12px) clamp(12px, 3cqw, 23px);
  }
  body.catfight-tablet-layout #content #forgeInventory .item-slot {
    box-sizing: border-box;
    width: clamp(52px, 13cqw, 98px);
    height: clamp(52px, 13cqw, 98px);
    flex: 0 0 clamp(52px, 13cqw, 98px);
    min-width: 0; border-radius: clamp(8px, 2cqw, 15px);
  }
  body.catfight-tablet-layout #content #forgeInventory .item-slot img {
    width: 100%; height: 100%; max-width: 100%; max-height: 100%;
    object-fit: contain;
  }
  body.catfight-tablet-layout #content #forgeInventory .item-content {
    min-width: 0; flex: 1 1 0;
  }
  body.catfight-tablet-layout #content #forgeInventory .item-name {
    font-size: clamp(13px, 3.25cqw, 24px);
    line-height: 1.3; overflow-wrap: anywhere;
    margin-bottom: clamp(2px, .5cqw, 4px);
  }
  body.catfight-tablet-layout #content #forgeInventory .rarity-badge {
    font-size: clamp(11px, 2.75cqw, 20px);
  }
  body.catfight-tablet-layout #content #forgeInventory .item-stats {
    font-size: clamp(12px, 3cqw, 22px) !important;
    line-height: 1.35;
  }
  body.catfight-tablet-layout #content #forgeInventory .inv-action-btn {
    box-sizing: border-box; flex: 0 0 clamp(70px, 17.5cqw, 132px);
    width: clamp(70px, 17.5cqw, 132px);
    height: clamp(52px, 13cqw, 98px);
    padding: clamp(4px, 1cqw, 8px);
    font-size: clamp(12px, 3cqw, 22px);
    border-radius: clamp(8px, 2cqw, 15px);
    white-space: normal; overflow-wrap: anywhere;
  }
  body.catfight-tablet-layout #content #forgeDevMessage {
    padding: clamp(24px, 6cqw, 45px) clamp(16px, 4cqw, 30px) !important;
    font-size: clamp(20px, 5cqw, 38px) !important;
  }
  /* Окно выбора свитков. Общая ширина окна уже в modal-tablet.css. */
  body.catfight-tablet-layout #roleModal .scroll-packs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch !important;
    gap: clamp(6px, 1.5vw, 12px) !important;
    min-width: 0;
  }
  body.catfight-tablet-layout #roleModal .scroll-packs .scroll-card {
    min-width: 0 !important; box-sizing: border-box;
    padding: clamp(6px, 1.2vw, 12px);
    overflow-wrap: anywhere;
  }
  body.catfight-tablet-layout #roleModal .scroll-packs .scroll-card img {
    width: clamp(46px, 8vw, 76px) !important;
    height: clamp(46px, 8vw, 76px) !important;
    max-width: 100%; object-fit: contain;
  }
  body.catfight-tablet-layout #roleModal .scroll-packs .scroll-card [style*="font-size: 14px"],
  body.catfight-tablet-layout #roleModal .scroll-packs .scroll-card [style*="font-size: 13px"] {
    font-size: clamp(13px, 2.5vw, 18px) !important;
  }
  body.catfight-tablet-layout #roleModal .scroll-packs .scroll-card [style*="font-size: 12px"] {
    font-size: clamp(11px, 2.2vw, 16px) !important;
  }
}
