    @font-face {
      font-family: 'Cinzel';
      src: url('/fonts/cinzel_regular.ttf') format('truetype');
      font-weight: 400;
      font-style: normal;
    }

    @font-face {
      font-family: 'Cinzel';
      src: url('/fonts/cinzel_bold.ttf') format('truetype');
      font-weight: 700;
      font-style: normal;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --nft-common: #808080;
  --nft-rare: #4169E1;
  --nft-epic: #9370DB;
  --nft-legendary: #FFD700;
  --faction-quakors: #2E8B57;
  --faction-jablines: #8B4513;
  --faction-prudoviki: #4682B4;
  --faction-kamyshniki: #228B22;
}
    body {
  font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  background:
    linear-gradient(
      rgba(0, 0, 0, 0.55),
      rgba(0, 0, 0, 0.55)
    ),
    url('/assets/mainfon.jpg') center/cover no-repeat fixed;

  background-color: var(--tg-theme-bg-color, #1a1a2e);

  color: var(--tg-theme-text-color, #eaeaea);

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  position: relative;
}

* {
  -webkit-tap-highlight-color: transparent;
}

.top-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
  }

  .bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
  }

.panel-image {
  width: 100%;
  height: auto;
  display: block;
}

.button-container {
  position: absolute;
  top: -130%;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 0px;
}

.nav-button {
  width: 70px;
  height: 70px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.nav-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-photo-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  z-index: 99;
  pointer-events: none;
  /* Связываем с top-panel через общие свойства */
  overflow: visible;
}

.player-photo-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  pointer-events: none;
}

/* Обеспечиваем, что фото будет внутри области панели */
.top-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  /* Создаем контекст для позиционирования */
  pointer-events: none;
}

.top-panel img {
  pointer-events: none;
}



.player-photo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-left: 10px;
  margin-top: 2px;
  pointer-events: auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.player-photo:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Стили для балансов */
.balance-container {
  position: absolute;
  top: 60%;
  left: 30%;

  transform: translate(-50%, -30%); /* 🔥 X и Y контроль */
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 101;
}

.balance-item {
  display: flex;
  align-items: center;
  gap: 6px;

  padding: 4px 10px;
  border-radius: 20px;

  pointer-events: auto;
}

.balance-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.balance-value {
  font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  min-width: 30px;
  text-align: right;
  white-space: nowrap;
}

.gems-balance .balance-icon {
  filter: drop-shadow(0 0 3px rgba(0, 255, 255, 0.5));
}

.gold-balance .balance-icon {
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.5));
}

.faction-balance .balance-icon {
  filter: drop-shadow(0 0 3px rgba(76, 175, 80, 0.5));
  object-fit: contain;
  max-width: 34px;
  max-height: 34px;
}

.faction-container {
  position: absolute;
  top: 18%;
  left: 63%;

  transform: translate(-50%, -10%); /* 🔥 X и Y контроль */
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 101;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .balance-container {
    left: 25%;
    gap: 4px;
  }
  
  .balance-item {
    padding: 3px 8px;
    gap: 5px;
  }
  
  .balance-icon {
    width: 20px;
    height: 20px;
  }
  
  .faction-balance .balance-icon {
    max-width: 20px;
    max-height: 20px;
  }
  
  .balance-value {
    font-size: 12px;
    min-width: 30px;
  }
}

@media (max-width: 480px) {
  .balance-container {
    left: 60%;
    gap: 3px;
  }
  
  .balance-item {
    padding: 2px 6px;
    gap: 4px;
  }
  
  .balance-icon {
    width: 28px;
    height: 28px;
  }
  
  .faction-balance .balance-icon {
    max-width: 28px;
    max-height: 28px;
  }
  
  .balance-value {
    font-size: 16px;
    min-width: 25px;
  }
}

  /* Стили для экрана загрузки */
    #loading-screen {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, rgba(0, 10, 20, 0.9) 0%, rgba(10, 30, 50, 0.9) 100%);
      z-index: 1000;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      transition: opacity 0.7s ease, transform 0.7s ease;
    }

    .loading-logo {
      width: min(200px, 50vw);
      height: min(200px, 50vw);
      margin-bottom: min(30px, 5vh);
      animation: pulse 1.5s infinite;
    }

    .loading-logo img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .loading-progress {
      width: 80%;
      max-width: min(400px, 80vw);
      height: 8px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 4px;
      overflow: hidden;
      margin-bottom: 20px;
    }

    .loading-progress-bar {
      height: 100%;
      background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
      width: 0%;
      transition: width 0.3s ease;
      border-radius: 4px;
    }

    .loading-text {
      color: white;
      font-size: 16px;
      font-weight: 500;
    }

    @keyframes pulse {
      0% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.05); opacity: 0.9; }
      100% { transform: scale(1); opacity: 1; }
    }

    /* Стили для главного меню */
    #main-menu {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: transparent;
      z-index: 990;
      opacity: 0;
      transform: scale(0.95);
      visibility: hidden;
      transition: opacity 0.8s ease, transform 0.8s ease, visibility 0.8s ease;
    }

    #main-menu.show {
      opacity: 1;
      transform: scale(1);
      visibility: visible;
    }

    .menu-background {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: url('/assets/start-menu.png') center/cover no-repeat;
      opacity: 1;
    }

    .menu-buttons {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 15px;
      padding: 40px;
      padding-top: 40%;
      z-index: 1;
    }

.menu-button {
      width: 300px;
      height: 120px;
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0;
      opacity: 0;
      transform: translateY(20px);
      transition: transform 0.6s ease, opacity 0.6s ease, filter 0.3s ease;
    }

    .menu-button.show {
      opacity: 1;
      transform: translateY(0);
    }

    .menu-button.hide {
  display: none !important;
}

    .menu-button:hover {
      transform: translateY(-5px) scale(1.05);
      filter: drop-shadow(0 5px 15px rgba(79, 172, 254, 0.4));
    }

    .menu-button:hover {
      transform: translateY(-5px) scale(1.05);
      filter: drop-shadow(0 5px 15px rgba(79, 172, 254, 0.4));
    }

    .menu-button img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      transition: transform 0.3s ease;
    }

    /* Responsive styles for menu buttons */
    @media (max-width: 768px) {
      .menu-buttons {
        gap: 15px;
        padding-top: 40%;
        padding-left: 40px;
        padding-right: 40px;
      }
      
      .menu-button {
        width: 280px;
        height: 110px;
      }
    }
    
    @media (max-width: 480px) {
      .menu-buttons {
        gap: 12px;
        padding-top: 40%;
        padding-left: 30px;
        padding-right: 30px;
      }
      
      .menu-button {
        width: 240px;
        height: 95px;
      }
    }

    /* Responsive styles for main screen buttons */
    @media (max-width: 768px) {
      .main-screen-button {
        width: 300px;
        height: 130px;
      }
    }

    @media (max-width: 480px) {
      .main-screen-button {
        width: 280px;
        height: 120px;
      }
    }

    /* Основные панели скрываем до загрузки */
    .top-panel,
    .bottom-panel,
    #player-photo-container {
      display: none;
    }

    .panel-image {
      pointer-events: none;
    }

    .show-ui .top-panel,
    .show-ui .bottom-panel,
    .show-ui #player-photo-container {
      display: block;
    }

    .show-ui #loading-screen,
    .show-ui #main-menu {
      display: none;
    }

    .show-ui #main-menu.show {
      display: block;
    }

    /* Main screen buttons */
    .main-screen-buttons {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
      z-index: 90;
      pointer-events: auto;
      display: none;
    }

    .show-ui .main-screen-buttons {
      display: flex;
    }

    .main-screen-button {
      width: 320px;
      height: 140px;
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0;
      opacity: 1;
      transition: transform 0.3s ease, filter 0.3s ease;
    }

    .main-screen-button:hover {
      transform: translateY(-5px) scale(1.05);
      filter: drop-shadow(0 5px 15px rgba(79, 172, 254, 0.4));
    }

    .main-screen-button img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    /* Стили для системы регистрации */
    .registration-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.85);
      z-index: 1000;
      display: none;
      justify-content: center;
      align-items: center;
      opacity: 0;
      transition: opacity 0.5s ease;
    }

    .registration-overlay.active {
      display: flex;
      opacity: 1;
    }

    .registration-step {
      display: none;
      position: relative;
      width: 100%;
      max-width: 100%;
      opacity: 0;
      transform: scale(0.95);
      transition: opacity 0.4s ease, transform 0.4s ease;
    }

    .registration-step.active {
      display: block;
      opacity: 1;
      transform: scale(1);
    }

    .registration-window {
      position: relative;
      width: 100%;
      border-radius: 20px;
      overflow: hidden;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    }

    .window-background {
      width: 100%;
      height: auto;
    }

    .step-content {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      padding: 40px 30px;
      box-sizing: border-box;
      z-index: 1;
      overflow: visible;
    }



    .language-buttons {
      display: flex;
      flex-direction: column;
      gap: 20px;
      align-items: center;
      margin-bottom: 30px;
      margin-top: 30px;
    }

    .language-button {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0;
      width: 200px;
      height: 80px;
      transition: transform 0.3s ease, filter 0.3s ease;
      opacity: 0;
      transform: translateY(20px);
    }

    .language-button.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .language-button:hover {
      transform: scale(1.05);
      filter: brightness(1.1);
    }

    .language-button img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .next-button-container {
      margin-top: 3px;
      opacity: 0;
      transform: translateY(10px);
      transition: opacity 0.4s ease, transform 0.4s ease;
    }

    .next-button-container.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .next-button {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0;
      width: 180px;
      height: 60px;
      transition: transform 0.3s ease, filter 0.3s ease;
    }

    .next-button:hover {
      transform: scale(1.05);
      filter: brightness(1.1);
    }

    .next-button img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .faction-container {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      margin: 5px 0;
    }

    .arrow-button {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0;
      width: 60px;
      height: 60px;
      opacity: 1;
      transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .arrow-button:hover {
      transform: scale(1.1);
    }

    .arrow-button.hidden {
      opacity: 0;
      pointer-events: none;
    }

    .arrow-button img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .faction-image-container {
      width: 280px;
      height: 340px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .faction-image {
      max-width: 100%;
      max-height: 100%;
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 10px;

    }

    .faction-name {
      font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 28px;
      color: rgb(39, 39, 39);
      text-align: center;
      margin: 5px 0;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
      font-weight: 700;
    }

    .faction-description {
      font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 14px;
      color: rgb(39, 39, 39);
      text-align: center;
      max-width: 320px;
      line-height: 1.4;
      margin: 0 auto 5px;
      padding: 0 15px;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .story-text {
      font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      font-size: 16px;
      color: #202020;
      text-align: center;
      max-width: 340px;
      line-height: 1.5;

      padding: 0 15px;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .continue-button-container {
      margin-top: 5px;
    }

    .continue-button {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0;
      width: 150px;
      height: 70px;
      transition: transform 0.3s ease, filter 0.3s ease;
    }

    .continue-button:hover {
      transform: scale(1.05);
      filter: brightness(1.1);
    }

    .continue-button img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    /* Обычные стили для текста */
    .step-title,
    .faction-name,
    .faction-description,
    .story-text {
      font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      text-align: center;
    }

    .step-title {
      font-size: 24px;
      color: rgb(51, 37, 0);
      font-weight: bold;
      margin-top: 25%;
      margin-bottom: 3px;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }






    /* Анимации для плавных переходов */
    @keyframes fadeInUp {
      from {
        opacity: 0;
        transform: translateY(20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

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

    @keyframes scaleIn {
      from {
        opacity: 0;
        transform: scale(0.9);
      }
      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    @keyframes scaleOut {
      from {
        opacity: 1;
        transform: scale(1);
      }
      to {
        opacity: 0;
        transform: scale(0.9);
      }
    }

    @keyframes slideInLeft {
      from {
        opacity: 0;
        transform: translateX(-50px);
      }
      to {
        opacity: 1;
        transform: translateX(0);
      }
    }

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

    /* Анимации для изменения фракций */
    .faction-image.fade-out {
      animation: fadeOutDown 0.3s ease forwards;
    }

    .faction-image.fade-in {
      animation: fadeInUp 0.3s ease forwards;
    }

    /* Адаптивные стили для мобильных устройств */
    @media (max-width: 768px) {
      .registration-step {
        width: 100%;
        max-width: 540px;
      }

      .language-button {
        width: 180px;
        height: 70px;
      }

      .next-button {
        width: 160px;
        height: 55px;
      }

      .faction-image-container {
        width: 220px;
        height: 300px;
      }

      .faction-name {
        font-size: 24px;
      }

      .faction-description {
        font-size: 13px;
        max-width: 280px;
      }

      .story-text {
        font-size: 15px;
        max-width: 300px;
      }

      .step-title {
        font-size: 22px;
        margin-bottom: 5px;
      }

      .arrow-button {
        width: 50px;
        height: 50px;
      }

      .continue-button {
        width: 110px;
        height: 45px;
      }
    }

    @media (max-width: 480px) {
      .registration-step {
        width: 100%;
        max-width: 400px;
      }

      .language-button {
        width: 160px;
        height: 60px;
      }

      .language-buttons {
        gap: 15px;
      }

      .faction-image-container {
        width: 180px;
        height: 240px;
      }

      .faction-container {
        gap: 5px;
      }

      .faction-name {
        font-size: 22px;
      }

      .faction-description {
        font-size: 12px;
        max-width: 260px;
      }

      .step-content {
        padding: 10px 20px;
      }

      .story-text {
        font-size: 14px;
        max-width: 280px;
      }
    }

    /* Стили для эффекта нажатия */
    .language-button:active,
    .next-button:active,
    .arrow-button:active,
    .continue-button:active {
      transform: scale(0.95) !important;
      transition: transform 0.1s ease !important;
    }

/* RPG/FANTASY MODAL WINDOW SYSTEM */
:root {
  --modal-bg: rgba(0, 0, 0, 0.85);
  --modal-blur: blur(12px);
  --modal-gold-glow: 0 0 20px rgba(255, 215, 0, 0.4);
  --modal-transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --modal-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

/* Модальные оверлеи */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(8px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Основное модальное окно */
.fantasy-modal {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  min-height: 400px;
  background: transparent;
  border-radius: 12px;
  overflow: hidden;
  z-index: 1001;
  box-shadow: 
    var(--modal-shadow),
    0 0 60px rgba(255, 215, 0, 0.3),
    inset 0 0 40px rgba(255, 255, 255, 0.05);
  transition: var(--modal-transition);
  animation: modalAppear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Фоновое изображение */
.modal-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.modal-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8) contrast(1.1);
}



/* Кнопка закрытия */
.modal-close {
  position: absolute;
  top: 30px;
  right: 15px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.modal-close-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.modal-close:hover .modal-close-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9));
}

/* Заголовок модального окна */
.modal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  text-align: center;
  padding: 24px 20px 20px;
  z-index: 2;
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 
    0 0 10px rgba(255, 215, 0, 0.5),
    0 0 20px rgba(255, 215, 0, 0.3),
    2px 2px 4px rgba(0, 0, 0, 0.8);
  margin-bottom: 5px;
  letter-spacing: 1px;
}

.modal-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #d2b48c;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-style: italic;
  opacity: 0.9;
}

/* Контент модального окна */
.modal-content {
  padding: 0 30px 30px;
  position: relative;
  z-index: 2;
  max-height: 95vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-content::-webkit-scrollbar {
  display: none;
}

/* Специальный стиль для контента инвентаря */
.inventory-modal-content {
  display: flex;
  flex-direction: column;
  height: 95vh;
  max-height: 95vh;
  padding-top: 0;
  overflow-y: hidden;
}

/* Скрываем скроллбар в инвентаре */
.inventory-modal-content::-webkit-scrollbar {
  display: none;
}

.inventory-modal-content {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Вкладки инвентаря — фиксированные сверху */
.inventory-tabs {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  margin-top: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

/* Специальный стиль для контента инвентаря — убираем верхний padding чтобы вкладки были выше */
.inventory-modal-content {
  padding-top: 20%
}

/* Стилизация скроллбара для Webkit браузеров */
.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.5);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 215, 0, 0.7);
}

.modal-section {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 20px;
  margin-top: 10px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-placeholder {
  color: #c0c0c0;
  text-align: center;
  font-size: 1.1rem;
  padding: 40px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Анимации */
@keyframes modalAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Внешнее свечение */
.fantasy-modal::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(45deg, 
    rgba(255, 215, 0, 0.1), 
    rgba(184, 134, 11, 0.1), 
    rgba(218, 165, 32, 0.1), 
    rgba(255, 215, 0, 0.1));
  border-radius: 16px;
  z-index: -1;
  filter: blur(15px);
  opacity: 0.7;
  animation: glowPulse 3s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  0% {
    opacity: 0.5;
    filter: blur(15px);
  }
  100% {
    opacity: 0.8;
    filter: blur(20px);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .fantasy-modal {
    width: 95%;
    max-height: 90vh;
    min-height: 90vh;
  }
  
  .modal-title {
    font-size: 1.7rem;
  }
  
  .modal-subtitle {
    font-size: 0.9rem;
  }
  
  .modal-content {
    padding: 0 20px 20px;
    max-height: 90vh;
  }
  
  .inventory-modal-content {
    padding-top: 20%
  }
}

@media (max-width: 480px) {
  .fantasy-modal {
    width: 98%;
    max-height: 95vh;
    min-height: 95vh;
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
  
  .corner-ornament {
    width: 30px;
    height: 30px;
  }
  
  .modal-close {
    width: 28px;
    height: 28px;
  }
  
  .modal-content {
    max-height: 90vh;
  }
  
  .inventory-modal-content {
    padding-top: 20%
  }
}

/* Стили для вкладок инвентаря */
.inventory-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  margin-top: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.inventory-tab {
  flex: 1;
  background: rgba(30, 30, 46, 0.7);
  border: 1px solid rgba(139, 69, 19, 0.5);
  border-radius: 8px;
  padding: 8px 5px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #d2b48c;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.inventory-tab:hover {
  background: rgba(40, 40, 60, 0.8);
  border-color: rgba(184, 134, 11, 0.7);
  transform: translateY(-2px);
}

.inventory-tab.active {
  background: linear-gradient(45deg, rgba(184, 134, 11, 0.3), rgba(218, 165, 32, 0.3));
  border-color: rgba(255, 215, 0, 0.8);
  color: #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.inventory-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.8), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.inventory-tab.active::before {
  opacity: 1;
}

/* Контент вкладок инвентаря */
.inventory-tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.inventory-tab-content::-webkit-scrollbar {
  display: none;
}

.inventory-tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Панель сортировки героев */
.heroes-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
}

.heroes-sort-bar .sort-label {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: #d2b48c;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-right: 4px;
}

.heroes-sort-bar .sort-btn {
  background: rgba(30, 30, 46, 0.7);
  border: 1px solid rgba(139, 69, 19, 0.5);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d2b48c;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
}

.heroes-sort-bar .sort-btn:hover {
  background: rgba(40, 40, 60, 0.8);
  border-color: rgba(184, 134, 11, 0.7);
  transform: translateY(-1px);
}

.heroes-sort-bar .sort-btn.active {
  background: linear-gradient(45deg, rgba(184, 134, 11, 0.3), rgba(218, 165, 32, 0.3));
  border-color: rgba(255, 215, 0, 0.8);
  color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}


.inventory-tab {
  flex: 1;
  background: rgba(30, 30, 46, 0.7);
  border: 1px solid rgba(139, 69, 19, 0.5);
  border-radius: 8px;
  padding: 12px 5px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #d2b48c;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.inventory-tab:hover {
  background: rgba(40, 40, 60, 0.8);
  border-color: rgba(184, 134, 11, 0.7);
  transform: translateY(-2px);
}

.inventory-tab.active {
  background: linear-gradient(45deg, rgba(184, 134, 11, 0.3), rgba(218, 165, 32, 0.3));
  border-color: rgba(255, 215, 0, 0.8);
  color: #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.inventory-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.8), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.inventory-tab.active::before {
  opacity: 1;
}

/* Контент вкладок инвентаря */
.inventory-tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.inventory-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Контейнер сетки инвентаря */
.inventory-grid-container {
  flex: 1;
  min-height: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  padding: 5px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.inventory-grid-container::-webkit-scrollbar {
  display: none;
}

/* Сетка инвентаря - 4х4 */
.inventory-grid {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.inventory-grid:not(.empty) {
  display: grid;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 69, 19, 0.6) rgba(0, 0, 0, 0.2);
  padding-right: 5px;
}

/* Стилизация скроллбара для сетки */
.inventory-grid:not(.empty)::-webkit-scrollbar {
  width: 6px;
}

.inventory-grid:not(.empty)::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.inventory-grid:not(.empty)::-webkit-scrollbar-thumb {
  background: rgba(139, 69, 19, 0.6);
  border-radius: 3px;
}

.inventory-grid:not(.empty)::-webkit-scrollbar-thumb:hover {
  background: rgba(184, 134, 11, 0.8);
}

/* Элементы сетки */
.inventory-item {
  aspect-ratio: 1;
  background: rgba(30, 30, 46, 0.8);
  border: 2px solid rgba(139, 69, 19, 0.6);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  overflow: hidden;
}

.inventory-item:hover {
  transform: scale(1.05);
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.inventory-item-icon {
  width: 60%;
  height: 60%;
  object-fit: contain;
  margin-bottom: 8px;
}

.inventory-item-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffd700;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.inventory-item-count {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.5);
}

/* Сообщение для пустого инвентаря */
.empty-inventory-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 250px;
  width: 100%;
}

.empty-inventory-message p {
  color: #c0c0c0;
  font-size: 1.2rem;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px dashed rgba(255, 215, 0, 0.2);
}

/* Карточки героев в инвентаре */
.inventory-hero-card {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(40, 40, 60, 0.95));
  border: 2px solid;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.inventory-hero-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.inventory-hero-card .hero-card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
}

.inventory-hero-card .hero-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.inventory-hero-card:hover .hero-card-image img {
  transform: scale(1.05);
}

.inventory-hero-card .hero-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inventory-hero-card .hero-card-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inventory-hero-card .hero-card-role {
  font-size: 0.8rem;
  color: #aaa;
  text-align: center;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inventory-hero-card .hero-card-passive {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.inventory-hero-card .hero-card-passive .passive-name {
  color: #ccc;
}

.inventory-hero-card .hero-card-passive .passive-bonus {
  font-weight: 700;
  color: #FFD700;
}

.inventory-hero-card .hero-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.inventory-hero-card .hero-card-stats .hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.inventory-hero-card .hero-card-stats .hero-stat span:first-child {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 2px;
}

.inventory-hero-card .hero-card-stats .hero-stat span:last-child {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.inventory-hero-card .hero-card-power {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
  border-radius: 6px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  margin-top: auto;
}

.inventory-hero-card .hero-card-power span {
  font-size: 0.75rem;
  color: #ccc;
}

.inventory-hero-card .hero-card-power strong {
  font-size: 1rem;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Сетка героев в инвентаре */
#heroes-grid:not(.empty) {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
}

/* Адаптивность карточек героев */
@media (max-width: 768px) {
  #heroes-grid:not(.empty) {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  
  .inventory-hero-card .hero-card-name {
    font-size: 0.9rem;
  }
  
  .inventory-hero-card .hero-card-stats .hero-stat span:last-child {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  #heroes-grid:not(.empty) {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .inventory-hero-card .hero-card-body {
    padding: 8px;
  }
  
  .inventory-hero-card .hero-card-name {
    font-size: 0.85rem;
  }
  
  .inventory-hero-card .hero-card-passive {
    font-size: 0.75rem;
    padding: 4px 6px;
  }
  
  .inventory-hero-card .hero-card-power strong {
    font-size: 0.9rem;
  }
}

/* Элементы категорий */
.hero-item {
  border-color: rgba(255, 69, 0, 0.6);
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.1), rgba(30, 30, 46, 0.8));
}

.hero-item:hover {
  border-color: rgba(255, 69, 0, 0.9);
  box-shadow: 0 0 15px rgba(255, 69, 0, 0.4);
}

.boost-item {
  border-color: rgba(0, 191, 255, 0.6);
  background: linear-gradient(135deg, rgba(0, 191, 255, 0.1), rgba(30, 30, 46, 0.8));
}

.boost-item:hover {
  border-color: rgba(0, 191, 255, 0.9);
  box-shadow: 0 0 15px rgba(0, 191, 255, 0.4);
}

.resource-item {
  border-color: rgba(50, 205, 50, 0.6);
  background: linear-gradient(135deg, rgba(50, 205, 50, 0.1), rgba(30, 30, 46, 0.8));
}

.resource-item:hover {
  border-color: rgba(50, 205, 50, 0.9);
  box-shadow: 0 0 15px rgba(50, 205, 50, 0.4);
}

/* Адаптивность сетки */
@media (max-width: 768px) {
  .inventory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 350px;
  }
  
  .inventory-tab {
    padding: 10px 5px;
    font-size: 0.9rem;
  }
  
  .inventory-item-name {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .inventory-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 300px;
  }
  
  .inventory-tab {
    font-size: 0.85rem;
    padding: 8px 3px;
  }
  
  .inventory-item-name {
    font-size: 0.75rem;
  }
  
  .inventory-grid-container {
    min-height: 200px;
    padding: 15px;
  }
}

/* Модальное окно выбора режима боя */
.battle-mode-modal {
  position: relative;
  width: 98%;
  height: 95vh;
  background: transparent;
  border-radius: 12px;
  overflow: hidden;
  z-index: 1001;
  transition: var(--modal-transition);
  animation: modalAppear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.battle-mode-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.battle-mode-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-mode-buttons {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 80px 40px 60px;
  min-height: 270px;
}

.battle-mode-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.battle-mode-button img {
  width: 100%;
  max-width: 280px;
  height: auto;
  object-fit: contain;
  display: block;
}

.battle-mode-button:hover {
  transform: scale(1.05);
}

.battle-mode-button:active {
  transform: scale(0.95);
}

/* Свечение кнопок */
.battle-mode-glow {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5))
          drop-shadow(0 0 12px rgba(255, 215, 0, 0.3));
  animation: battleButtonGlow 2s ease-in-out infinite alternate;
}

@keyframes battleButtonGlow {
  0% {
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.4))
            drop-shadow(0 0 8px rgba(255, 215, 0, 0.2));
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.7))
            drop-shadow(0 0 20px rgba(255, 215, 0, 0.4));
  }
}

/* Адаптивность модального окна боя */
@media (max-width: 768px) {
  .battle-mode-buttons {
    padding: 70px 30px 50px;
    gap: 20px;
  }

  .battle-mode-button img {
    max-width: 220px;
  }
}

@media (max-width: 480px) {
  .battle-mode-buttons {
    padding: 120px 20px 40px;
    gap: 94px;
  }

  .battle-mode-button img {
    max-width: 150px;
  }
}


