/* --- Глобальные переменные и базовые стили --- */
@font-face {
    font-family: 'Manrope';
    src: url('../fonts/Manrope-Regular.woff2') format('woff2');
    font-weight: 400; /* Regular */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Manrope';
    src: url('../fonts/Manrope-Medium.woff2') format('woff2');
    font-weight: 500; /* Medium */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Manrope';
    src: url('../fonts/Manrope-SemiBold.woff2') format('woff2');
    font-weight: 600; /* SemiBold */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Manrope';
    src: url('../fonts/Manrope-Bold.woff2') format('woff2');
    font-weight: 700; /* Bold */
    font-style: normal;
    font-display: swap;
}
:root {
    --bg-color: #1a1c1e;
    --surface-color: #2a2c2e;
    --block-bg-color: #1c1c1e;
    --border-color: #3b3b3b;
    --primary-color: #ffab60;
    --primary-hover-color: #ffc28a;
    --text-color: #ffffff;
    --text-muted-color: #8e8e93;
    --danger-color: #c94a4a;
    --success-color: #4CAF50;
    --common-rarity-color: #b0b0b0;
    --rare-rarity-color: #9eff91;
    --epic-rarity-color: #c787ff;
    --legendary-rarity-color: #ff7676;

    --font-size-base: clamp(14px, 2.5vw, 16px);
    --font-size-lg: clamp(18px, 4vw, 24px);
    --font-size-sm: clamp(12px, 2vw, 14px);
    --font-size-xs: clamp(10px, 1.8vw, 12px);
}

* {
    -webkit-tap-highlight-color: transparent; /* Убирает выделение на iOS и Android */
    -webkit-touch-callout: none; /* Запрещает вызов меню (копировать/вставить) при долгом нажатии */
    -webkit-user-select: none;   /* Запрещает выделение текста */
    -khtml-user-select: none;    /* Konqueror HTML */
    -moz-user-select: none;      /* Firefox */
    -ms-user-select: none;       /* Internet Explorer/Edge */
    user-select: none;           /* Стандартное свойство */
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 75px 15px 85px 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain; /* Предотвращает "оттягивание" страницы на мобильных */
}
button,
input,
select,
textarea {
  font-family: inherit; /* <<-- Вот ключевое правило! */
  font-size: 100%; /* Также полезно для консистентности размеров */
  margin: 0;
}
.container {
    max-width: 600px;
    margin: 0 auto;
}

.top-app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(26, 28, 30, 0.85); /* Полупрозрачный фон */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 900;
}

.player-stats-bar {
    display: flex;
    gap: 10px;
    background-color: var(--block-bg-color);
    padding: 5px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.stat-item-bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-item-bar i, .stat-item-bar .stat-icon-text {
    color: var(--primary-color);
    font-size: 16px;
}

.stat-item-bar b {
    font-size: var(--font-size-base);
    font-weight: 600;
}

.app-bar-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}
.app-bar-actions .header-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
}
.bottom-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 5px 0;
    z-index: 900;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.nav-button {
    background: none;
    border: none;
    color: var(--text-muted-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-button i {
    font-size: 22px;
    margin-bottom: 4px;
}

.nav-button span {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.nav-button:hover {
    color: var(--text-color);
}

.nav-button.active {
    color: var(--primary-color);
}
/* --- Типография --- */
h1, h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
}
h1 { font-size: var(--font-size-lg); margin-bottom: 20px; width: 100%;}
h3 { font-size: 18px; margin-right: auto; }
.frens-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--block-bg-color);
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.frens-counter i {
    color: var(--primary-color);
    font-size: var(--font-size-sm);
}

.frens-counter b {
    font-size: var(--font-size-sm);
    font-weight: 700;
}

.frens-counter span {
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
    font-weight: 500;
}
h1 span {
    flex-grow: 1;
    margin-right: auto; /* Заставляет кнопки прижаться к правому краю */
}
.header .back-btn {
    margin-right: 10px;
    margin-left: -5px; /* Небольшой отрицательный отступ для выравнивания */
}
.current-user-rank-in-list {
    /* position: sticky; УБИРАЕМ */
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 15px;
    margin: 10px 15px 10px 15px; /* Отступы внутри блока */
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-base);
    font-weight: 600;
    z-index: 1; /* Чтобы была над списком, если нужно */
}

.current-user-rank-in-list span b {
    color: #fff;
}

/* Сделаем так, чтобы плашка не показывалась, если в ней нет контента */
.current-user-rank-in-list:empty {
    display: none;
}
/* --- Основные блоки --- */
.block {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}
.content-section > .block:first-child {
    margin-top: 0;
}

/*
   Для всех остальных .block (включая тот, что в #leaderboard-section)
   мы сбрасываем стили анимации, чтобы они были видимы по умолчанию.
*/
#leaderboard-section .block {
    opacity: 1;
    transform: none;
}

.header {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* --- Статус игрока --- */
.player-stats span { color: var(--text-muted-color); }
.player-stats b { color: var(--text-color); font-weight: 600; }

/* --- Магазин --- */
.crates-container {
    display: flex;
    gap: 15px;
    padding: 15px;
    overflow: auto;
    flex-direction: row;
    flex-wrap: nowrap;

}
.crate-card {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 150px;
}
.crate-card i { font-size: 3rem; color: var(--primary-color); }
.crate-card h4 { margin: 10px 0 5px 0; font-size: var(--font-size-base); }
.crate-card p { margin: 0; font-weight: bold; color: var(--text-muted-color); font-size: var(--font-size-sm); }

/* --- Кнопки --- */
.buy-button, .claim-button {
    background-color: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
    transition: background-color 0.2s, transform 0.1s;
    font-size: var(--font-size-base);
}
.buy-button:hover, .claim-button:hover { background-color: var(--primary-hover-color); }
.buy-button:active, .claim-button:active { transform: scale(0.98); }
.buy-button:disabled, .claim-button:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

/* --- Мастерская --- */
.workshop-list {
    list-style: none;
    padding: 15px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}
.workshop-slot {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    min-height: 60px;
    flex-direction: column;
}
.open-all-container button { margin-top: 0; }
.workshop-slot button { margin-top: 0; }
.workshop-slot.empty { justify-content: center; color: var(--text-muted-color); font-style: italic; border-style: dashed; font-size: var(--font-size-sm); text-align: center; }
.workshop-slot.locked { justify-content: space-between; background-color: #222; border-style: dashed; }
.workshop-slot.locked .slot-info { display: flex; align-items: center; gap: 10px; color: var(--text-muted-color); font-size: var(--font-size-sm); }
.workshop-slot.locked i { font-size: var(--font-size-sm); }
.workshop-slot .item-info { display: flex; align-items: center; gap: 5px; flex-direction: column; }
.workshop-slot .item-info i { font-size: 24px; }
.workshop-slot .item-info span { color: var(--text-muted-color); font-size: var(--font-size-sm); text-align: center; }
.workshop-slot .item-info span b { color: var(--text-color); }
.workshop-slot .buy-button { margin-top: 0; white-space: nowrap; }

/* --- Инвентарь (Табы и Сетка) --- */
.inventory-tabs { display: flex; border-bottom: 1px solid var(--border-color); }
.tab-button {
    flex: 1;
    padding: 12px 5px;
    background: none;
    border: none;
    color: var(--text-muted-color);
    font-size: var(--font-size-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
    font-size: var(--font-size-sm);
}
.tab-button.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.inventory-content { display: none; padding: 15px; }
.inventory-content.active { display: block; }
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.inventory-item {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    position: relative;
    text-align: center;
    cursor: pointer;

    /* ИЗМЕНЕНИЕ: Убираем aspect-ratio и задаем минимальную высоту */
    min-height: 100px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* Распределяем пространство */
    border-left: 4px solid transparent;
    transition: background-color 0.2s;
}
.inventory-item:hover { background-color: #333; }
.inventory-item i {
    font-size: 2.5rem; /* Немного уменьшим иконку, чтобы было больше места */
    flex-shrink: 0;
    margin-bottom: 5px; /* Добавим отступ снизу */
}
.inventory-item .item-name {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;

    /* ИЗМЕНЕНИЕ: Убираем position: absolute, если оно там было */
    position: static;
    margin-bottom: 5px; /* Добавляем отступ для XP */
}
.inventory-item .quantity {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary-color);
    color: #000;
    font-weight: bold;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-color);
}
.open-all-container { padding: 15px 0 0 0; border-top: 1px solid var(--border-color); margin-top: 15px; }

/* Стили редкости */
.rarity-Common { color: var(--common-rarity-color); }
.rarity-Rare { color: var(--rare-rarity-color); }
.rarity-Epic { color: var(--epic-rarity-color); }
.rarity-Legendary { color: var(--legendary-rarity-color); }
.inventory-item[data-rarity="Common"] { border-left-color: var(--common-rarity-color); }
.inventory-item[data-rarity="Rare"] { border-left-color: var(--rare-rarity-color); }
.inventory-item[data-rarity="Epic"] { border-left-color: var(--epic-rarity-color); }
.inventory-item[data-rarity="Legendary"] { border-left-color: var(--legendary-rarity-color); }

/* --- Общие элементы --- */
.empty-text { color: var(--text-muted-color); text-align: center; width: 100%; padding: 20px 0; margin: 0; }
#loading-indicator { text-align: center; padding: 50px; color: var(--text-muted-color); font-size: var(--font-size-base); }

/* --- Модальные окна --- */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.modal {
    background-color: var(--surface-color);
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 650px;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin: 10px;
}
.modal h3 { margin-top: 0; margin-bottom: 10px; font-size: 18px; }
.modal p { color: var(--text-muted-color); margin: 10px 0; font-size: var(--font-size-sm); }
#buy-autofarm-btn {
    font-size: var(--font-size-sm);
    margin: 0;
    padding: 8px 6px;
}

.modal-actions { display: flex; gap: 10px; margin-top: 25px; }
.action-btn { flex: 1; padding: 12px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; font-size: var(--font-size-base); transition: opacity 0.2s; }
.action-btn:hover { opacity: 0.8; }
.action-btn.cancel { background-color: #555; color: white; }
.action-btn.confirm, .action-btn.build { background-color: var(--primary-color); color: #000; }
.action-btn.sell-quick { background-color: var(--danger-color); color: white; }
.close-btn {
    position: absolute;
    top: 10px; right: 10px;
    background: none; border: none;
    color: var(--text-muted-color);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.tournament-banner {
    background: linear-gradient(135deg, #2a2c2e 0%, #3a3c3e 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 15px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: 10px;
}
#tournament-number {
    color: var(--text-muted-color);
}
#tournament-prize {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 5px;
}
.banner-timer {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
}
.banner-timer b {
    display: block;
    font-size: 28px;
    color: var(--text-color);
    font-family: monospace;
    letter-spacing: 2px;
    margin-top: 5px;
}
.close-btn:hover { color: var(--text-color); }
#loot-grid { padding-top: 15px; }

/* --- Уведомления (Toasts) --- */
#toast-container {
    position: fixed;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 90%;
    max-width: 400px;
}
.toast {
    background-color: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background-color: var(--danger-color); }

/* --- Переключатель Авто-фарма --- */
.autofarm-toggle-container { display: flex; align-items: center; gap: 8px; font-size: var(--font-size-sm); color: var(--text-muted-color); }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch label { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #3e3e3e; transition: .4s; border-radius: 22px; }
.toggle-switch label:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + label { background-color: var(--primary-color); }
input:checked + label:before { transform: translateX(18px); }
input:disabled + label { background-color: #555; cursor: not-allowed; }
.slot-requirements {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
    text-align: center;
}
.requirement {
    display: block; /* Каждый на новой строке */
}
.requirement.met {
    color: var(--success-color);
    text-decoration: line-through;
}
.requirement.unmet {
    color: var(--danger-color);
}
.bulk-buy-container {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    align-items: center;
}

.bulk-buy-container input {
    width: 100%; /* Фиксированная ширина для поля ввода */
    padding: 6px;
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    /* Убираем стрелочки в Chrome/Safari/Edge/Opera */
    -webkit-appearance: none;
    margin: 0;
}
/* Убираем стрелочки в Firefox */
.bulk-buy-container input[type=number] {
    -moz-appearance: textfield;
}

.bulk-buy-container .buy-button {
    flex-grow: 1; /* Кнопка занимает оставшееся место */
    margin-top: 0;
    padding: 8px 4px; /* Уменьшаем padding для компактности */
}
.inventory-item .xp-info {
    position: static; /* ИЗМЕНЕНИЕ: Убираем абсолютное позиционирование */
    transform: none;
    left: auto;
    bottom: auto;

    background-color: rgba(0, 0, 0, 0.6);
    color: var(--primary-color);
    font-size: var(--font-size-xs);
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.modal .item-stats {
    margin-top: 15px;
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
    text-align: left;
}
.modal .item-stats div {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Добавляем для лучшего выравнивания */
    margin-bottom: 5px; /* Добавляем отступ между строками */
}
.modal .item-stats b {
    color: var(--text-color);
}
.header-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.header-btn:hover {
    color: var(--text-color);
    border-color: var(--primary-color);
}
.header-btn.loading i {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loot-animation-grid {
    display: grid;
    /* Адаптивные колонки: каждая от 80px до 1fr, будут переноситься */
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 40vh; /* Ограничиваем высоту, чтобы не занимало весь экран */
    overflow: hidden;
    padding: 10px 0;
}

.loot-animation-container-wrapper {
    display: flex;
    flex-wrap: wrap; /* Разрешаем перенос на новые строки */
    justify-content: center; /* Центрируем ленты */
    gap: 5px; /* Уменьшаем расстояние между лентами */
    max-height: 50vh; /* Увеличим максимальную высоту */
    overflow-y: auto; /* Добавляем скролл, если все равно не влезет */
    padding: 10px 0;
    align-items: flex-start;
}

/* Стили для анимации открытия */
.loot-animation-container {
    height: 100px; /* Уменьшаем высоту каждой ленты */
    overflow: hidden;
    position: relative;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, var(--block-bg-color) 25%, var(--block-bg-color) 75%, rgba(0,0,0,0) 100%);
    border-radius: 8px;

    /* ИЗМЕНЕНИЕ: Ширина будет управляться через JS */
    flex-grow: 1;
    flex-shrink: 1;
}
.loot-reel {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    /* Скорость анимации зависит от количества элементов */
    transition: top ease-out;
}
.loot-reel .inventory-item {
    width: 50px;
    height: 50px;
    padding: 5px;
    margin-bottom: 10px;
}
.loot-reel .inventory-item i {
    font-size: 1.2rem;
}
.loot-reel .inventory-item .item-name {
    display: none; /* Скрываем название в анимации */
}
.loot-reel .inventory-item .quantity {
    display: none; /* Скрываем количество в ленте */
}
.loot-animation-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 0 10px var(--primary-color);
}
.loot-modal-content {
    max-width: 500px;
    width: 95%;
}
.processing-large-batch {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    color: var(--text-muted-color);
    text-align: center;
}

.processing-large-batch i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    animation: spin 2s linear infinite; /* Добавляем анимацию вращения */
}
.leaderboard-list {
    list-style: none;
    padding: 0 15px; /* Добавляем отступы */
    margin: 0;
}
.leaderboard-item {
    display: grid; /* Используем грид для лучшего контроля */
    grid-template-columns: 30px 1fr auto; /* Ранг | Инфо | XP и Приз */
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.leaderboard-item:last-child {
    border-bottom: none;
}
.user-info .user-balance { /* Новый стиль для баланса */
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
    margin-top: 4px;
}
.rank-details { /* Новый контейнер для XP и приза */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}
.xp-total { /* Переименовано из .xp-total */
    font-size: var(--font-size-base);
    color: var(--primary-color);
    font-weight: bold;
    padding-left: 0;
}
.prize-amount { /* Новый стиль для приза */
    font-size: var(--font-size-sm);
    color: var(--rare-rarity-color);
    font-weight: 600;
    margin-top: 4px;
}
.rank-circle {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--block-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: auto 10px auto 0;
    align-content: center;
}
.user-info {
    flex-grow: 1;
    min-width: 0; /* Важно для правильного переноса текста */
}
.user-info .name {
    font-weight: 600;
    font-size: var(--font-size-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Обрезаем слишком длинные имена */
}
.xp-total {
    flex-shrink: 0;
    text-align: right;
    font-size: var(--font-size-sm);
    color: var(--primary-color);
    font-weight: bold;
    padding-left: 10px;
}
.component-preview {
    display: flex;
    flex-wrap: wrap; /* Разрешаем перенос иконок */
    gap: 5px;
    margin-top: 5px;
}
.component-preview i {
    font-size: 18px; /* Немного увеличим иконки */
}

/* Стили для плашки с рангом текущего пользователя */
.current-user-rank {
    position: sticky; /* Прилипает к низу при скролле */
    bottom: 15px;
    left: 15px;
    right: 15px;
    width: auto; /* Ширина по контенту */
    margin: 0; /* Убираем margin, так как sticky позиционирование */
    transform: none; /* Убираем центрирование */

    background-color: var(--primary-color);
    color: #000;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-base);
    font-weight: 600;
    z-index: 900;
    transition: transform 0.3s ease;
}
/* Анимация появления/скрытия */
.current-user-rank:not(.visible) {
    transform: translateY(150%);
}
.current-user-rank.visible {
    transform: translateY(0);
}
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-container {
    text-align: center;
}

.loader-icon {
    font-size: 48px;
    color: var(--primary-color);
    animation: pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.loading-text {
    margin-top: 15px;
    font-size: var(--font-size-base);
    color: var(--text-muted-color);
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}
.container.visible {
    opacity: 1 !important;
    transition: opacity 0.5s ease;
}
.help-modal-content {
    padding-top: 15px;
}
.help-modal-content h3 {
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
}
.help-modal-content .buy-button {
    margin-top: 20px;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 60vh; /* Ограничиваем высоту и добавляем скролл */
    overflow-y: auto;
    padding: 15px 5px 15px 0; /* Небольшой отступ для скроллбара */
}

.help-step, .help-tip {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    background-color: var(--block-bg-color);
    padding: 15px;
    border-radius: 10px;
}

.help-tip {
    background-color: #2f3b25; /* Зеленоватый фон для совета */
    border: 1px solid #4a5c3c;
}

.help-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.help-tip .help-icon {
    color: #a3e063;
}

.help-text strong {
    display: block;
    font-size: var(--font-size-base);
    margin-bottom: 5px;
}
.help-text p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
    line-height: 1.5;
}
.info-modal-content {
    max-width: 650px; /* Делаем его немного шире */
}
.info-modal-content #info-modal-body {
    text-align: left;
}
.crate-info-block {
    margin-bottom: 20px;
}
.crate-info-header {
    background-color: var(--block-bg-color);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}
.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}
.info-table th, .info-table td {
    padding: 8px 5px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.info-table th {
    color: var(--text-muted-color);
    font-weight: normal;
}
.info-table td {
    font-weight: 500;
}
/* Выравнивание колонок */
.info-table .col-item { width: 40%; }
.info-table .col-chance { width: 15%; text-align: right; }
.info-table .col-price { width: 15%; text-align: right; }
.info-table .col-time { width: 15%; text-align: right; }
.info-table .col-xp { width: 15%; text-align: right; }

.info-table .item-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}
.info-table .item-cell i {
    font-size: 18px;
}
.fullscreen-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 80vh;
    padding: 20px;
}
.fullscreen-screen i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
}
.fullscreen-screen h2 {
    font-size: 22px;
    margin-bottom: 10px;
}
.fullscreen-screen p {
    color: var(--text-muted-color);
    max-width: 300px;
    line-height: 1.5;
    margin-bottom: 30px;
}
.large-button {
    padding: 15px 30px;
    font-size: 18px;
}
.wallet-modal-content {
    max-width: 500px;
}

#wallet-modal-body .loading-text {
    text-align: center;
    color: var(--text-muted-color);
    padding: 30px 0;
}

.wallet-balances {
    display: grid;
    /*grid-template-columns: 1fr 1fr;*/
    gap: 15px;
    margin-bottom: 25px;
}

.balance-card {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.balance-card .label {
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
    margin-bottom: 5px;
}

.balance-card .amount {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}
.balance-card .amount small {
    font-size: 0.8rem;
    color: var(--text-color);
}


.wallet-history h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.wallet-widget {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wallet-icon {
    width: 36px;
    height: 36px;
}

.address-details {
    display: flex;
    flex-direction: column;
}

.wallet-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
}

.address-string {
    font-size: var(--font-size-base);
    font-weight: 500;
    font-family: monospace;
}

.wallet-actions {
    display: flex;
    gap: 8px;
}

.wallet-action-btn {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.wallet-action-btn:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}

.wallet-action-btn.disconnect:hover {
    background-color: var(--danger-color);
    color: white;
}
.wallet-history h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.wallet-history-item {
    background-color: var(--block-bg-color);
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.history-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.history-icon.deposit {
    color: var(--rare-rarity-color); /* Зеленый */
}
.history-icon.withdrawal {
    color: var(--legendary-rarity-color); /* Красный */
}

.history-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.history-title {
    font-weight: 500;
    font-size: var(--font-size-base);
}

.history-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
}

.history-amount {
    font-weight: 600;
    font-size: var(--font-size-base);
}

.history-amount.deposit {
    color: var(--rare-rarity-color); /* Зеленый */
}
.history-amount.withdrawal {
    color: var(--legendary-rarity-color); /* Красный */
}
.history-amount small {
    font-weight: normal;
}

.deposit-modal-content { max-width: 400px; }
.deposit-modal-content h3 { text-align: center; width: 100%; }
.deposit-modal-content p { text-align: center; color: var(--text-muted-color); font-size: var(--font-size-sm); }
.deposit-tabs { display: flex; gap: 10px; margin: 20px 0; }
.deposit-tabs .tab-button {
    border: 1px solid var(--border-color);
    background-color: var(--block-bg-color);
    color: var(--text-muted-color);
    border-radius: 10px;
}
.deposit-tabs .tab-button.active {
    background-color: var(--surface-color);
    color: var(--text-color);
    border-color: var(--primary-color);
}
.deposit-icon { text-align: center; margin: 15px 0; }
.deposit-icon img { width: 80px; height: 80px; }
.wallet-onchain-balance { text-align: center; color: var(--text-muted-color); margin-bottom: 20px; }
.wallet-onchain-balance span { color: var(--text-color); font-weight: 600; }

.deposit-input-group {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 15px;
    position: relative;
}
.deposit-input-group .input-label {
    position: absolute;
    top: -10px;
    left: 10px;
    background: var(--surface-color);
    padding: 0 5px;
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
}
.deposit-input-group input {
    width: 100%;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    font-weight: 500;
    outline: none;
    text-align: center;
}
.deposit-quick-buttons { display: flex; gap: 10px; margin: 15px 0; }
.deposit-quick-buttons button {
    flex: 1;
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted-color);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}
.deposit-quick-buttons button:hover { background-color: var(--surface-color); }
.referral-container {
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    align-content: center;
    justify-content: center;
}
.referral-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted-color);
    line-height: 1.5;
    margin: 0;
    width: 100%;
    text-align: justify;
}
.referral-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 100%;
    flex-direction: column-reverse;
    margin-top: 10px;
}
.spin-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.spin-button, .share-button {
    border: none;
    border-radius: 8px;
    padding: 10px 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.spin-button {
    background-color: var(--primary-color);
    color: #000;
    font-size: var(--font-size-sm);
    width: 100%;
}
.spin-button:hover {
    background-color: var(--primary-hover-color);
}
.spin-button:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
}
.spin-cost {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
    margin-top: 5px;
}
.share-button {
    background-color: #0088cc; /* Telegram blue */
    color: white;
    font-size: var(--font-size-sm);
    width: 100%;
}
.share-button:hover {
    background-color: #33a9e0;
}
.share-button:disabled .bi-hourglass-split {
    animation: spin 1s linear infinite;
}
.player-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Адаптивная сетка */
    gap: 5px;
    flex-basis: 100%; /* Занимает всю ширину, если переносится на новую строку */
}

.stat-item {
    background-color: var(--block-bg-color);
    border-radius: 10px;
    padding: 7px 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border-color);
}

.stat-item i, .stat-item .stat-icon-text {
    font-size: var(--font-size-lg);
    color: var(--primary-color);
    flex-shrink: 0;
}

.stat-icon-text {
    font-weight: bold;
    line-height: 1;
}

.stat-item div {
    line-height: 0.8;
    overflow: hidden;
}

.stat-item b {
    font-size: var(--font-size-base);
    font-weight: 600;
    display: block;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-item small {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
}
.withdrawal-modal-content { max-width: 400px; }
.withdrawal-body { margin-top: 20px; }
.min-amount-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
    text-align: center;
    margin-top: 8px;
}
.withdrawal-summary {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-base);
}
.summary-item span {
    color: var(--text-muted-color);
}
.summary-item b {
    color: var(--text-color);
}
.withdrawal-summary hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 10px 0;
}
.history-details {
    align-items: flex-start; /* Выравниваем по левому краю */
}
.history-commission {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
    margin-top: 2px;
}
.lp-staking-container {
    padding: 15px;
    text-align: center;
}
.lp-staking-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted-color);
    line-height: 1.5;
    margin: 0 0 10px 0;
    text-align: justify;
}
.lp-staking-rate {
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    font-size: var(--font-size-xs);
    font-weight: bold;
    color: var(--primary-color);
    flex: 1;
}
.lp-button {
    background-color: #007bff;
    color: white;
    text-decoration: none;
    font-size: var(--font-size-sm);
    margin: 0;
    flex: 1;
    border: 1px solid #007bff;
    padding: 10px;
}
.lp-button:hover {
    background-color: #0056b3;
}
.trade-button {
    padding: 10px;
    color: white;
    text-decoration: none;
    font-size: var(--font-size-sm);
    margin: 0;
    flex: 1;
    gap: 3px;
    background-color: #4CAF50;
    border: 1px solid #4CAF50;
    text-align: center;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}
.trade-button:hover {
    background-color: #317134;
}
.user-lp-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}
.user-lp-stats .stat {
    flex: 1;
    background-color: var(--block-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    text-align: center;
}
.user-lp-stats .stat span {
    color: var(--text-muted-color);
    display: block;
    font-size: var(--font-size-xs);
}
.user-lp-stats .stat b {
    font-size: var(--font-size-xs);
    color: var(--text-color);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}
.freemium-banner {
    background: linear-gradient(90deg, #ff9191, #ff9191);
    color: #000;
    padding: 10px 15px;
    text-align: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.freemium-banner button {
    background-color: rgba(255, 255, 255, 0.9);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

.item-icon-image {
    width: 24px;
    height: 24px;
    object-fit: contain; /* Сохраняет пропорции, вписывая в контейнер */
    display: block;
    border-radius: 100%;
    border: 1px solid var(--border-color);
}

/* Стиль для больших иконок в магазине (как вы и просили) */
.crate-card .item-icon-image {
    width: 100px;
    height: 100px;
    margin: 0 auto; /* Центрирование */
    border-radius: 100%;
    border: 1px solid var(--border-color);
}

/* Стиль для иконок в сетке инвентаря */
.inventory-item .item-icon-image {
    width: 50px; /* Устанавливаем фиксированную ширину */
    height: 50px; /* и высоту */
    flex-shrink: 0;
    margin-bottom: 5px;
    border-radius: 100%;
    border: 1px solid var(--border-color);
}

/* Стиль для иконок в слотах мастерской */
.workshop-slot .item-info .item-icon-image {
    width: 40px;
    height: 40px;
    border-radius: 100%;
    border: 1px solid var(--border-color);
}

/* Стиль для маленьких иконок в таблице с шансами дропа */
.info-table .item-cell .item-icon-image {
    width: 24px;
    height: 24px;
    border-radius: 100%;
    border: 1px solid var(--border-color);
}
.minimal-banner {
    background: linear-gradient(90deg, #007bff, #00c6ff);
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.banner-buttons {
    position: relative;
    display: inline-block;
}

#vote-us-btn-minimal {
    background-color: rgba(255, 255, 255, 0.9);
    color: #007bff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

.notification-dot {
    width: 8px; height: 8px;
    background-color: #ff3f3f;
    border-radius: 50%;
    position: absolute;
    top: -3px; right: -3px;
    border: 1.5px solid white;
    box-shadow: 0 0 3px rgba(0,0,0,0.4);
}

/* --- Стили для модального окна голосования --- */
.tac-modal {
    max-width: 380px;
    text-align: center;
}

.tac-modal .header h3 {
    margin-right: auto;
}

.tac-modal-body {
    padding: 15px 10px;
}

.tac-icon {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.tac-modal-body p {
    font-size: var(--font-size-base);
    color: var(--text-color);
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.tac-subtext {
    font-size: var(--font-size-xs) !important;
    color: var(--text-muted-color) !important;
    margin-top: 15px !important;
}
#tac-timer-container .buy-button {
    cursor: not-allowed;
    background-color: #555; /* Серый фон для неактивной кнопки */
    display: flex;
    flex-direction: column;
}

#tac-timer-container .buy-button span {
    margin-right: 5px;
}

#tac-timer {
    font-weight: bold;
    letter-spacing: 1px;
}
.vote-token-banner {
    /* Яркий красно-розовый градиент */
    background: linear-gradient(135deg, #FF512F 0%, #DD2476 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 12px; /* Чуть более скругленные углы */
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 20px rgba(221, 36, 118, 0.4); /* Цветная тень */
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Декоративный блик */
.vote-token-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
    pointer-events: none;
}

.vote-text-content {
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.vote-title {
    font-size: var(--font-size-base); /* Крупный текст */
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.vote-subtitle {
    font-size: var(--font-size-xs);
    opacity: 0.9;
    font-weight: 500;
}

.vote-token-btn {
    background-color: white;
    color: #DD2476; /* Цвет текста под цвет градиента */
    border: none;
    border-radius: 8px; /* Овальная кнопка */
    padding: 6px 20px;
    font-weight: 700;
    font-size: var(--font-size-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 2px;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1;
    margin-top: 0; /* Сброс глобальных стилей */
    width: auto;   /* Сброс глобальных стилей */
}

.vote-token-btn:active {
    transform: scale(0.95);
}

.vote-token-btn i {
    font-size: 18px;
    line-height: 0;
}