html, body {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    background: url('/images/login-bg.jpg') no-repeat center center fixed;
    background-size: 100% 100%;
    background-color: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

.screen {
    display: none;
}

#login-screen.active {
    display: block;
}

/* ---------- ЭКРАН ВХОДА / РЕГИСТРАЦИИ ---------- */
.login-box {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    padding: 30px;
    border-radius: 15px;
    color: white;
    text-align: center;
    border: 2px solid #c9a96e;
    width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.tabs {
    display: flex;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    background: rgba(58, 46, 30, 0.8);
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab.active {
    color: #c9a96e;
    border-bottom: 2px solid #c9a96e;
    background: rgba(74, 58, 42, 0.9);
}

.form {
    display: none;
}

.form.active {
    display: block;
}

.form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    box-sizing: border-box;
    background: rgba(42, 31, 14, 0.1);
    border: 1px solid #c9a96e;
    color: #eedba7;
    font-size: 16px;
    border-radius: 5px;
    outline: none;
}

.form input:focus {
    background: rgba(42, 31, 14, 0.5);
    border-color: #c9a96e;
}

.form button {
    width: 100%;
    padding: 12px;
    background: #c9a96e;
    border: none;
    color: black;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.form button:hover {
    background: #dbb87c;
}

.error {
    color: #ff6b6b;
    font-size: 14px;
    margin-top: 10px;
    min-height: 20px;
}

/* ---------- ИГРОВОЙ ЭКРАН ---------- */
#game-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    position: relative;
    background: #1a1a1a;
}

#game-screen.active {
    display: flex;
}

/* ---------- ВЕРХНЯЯ ПАНЕЛЬ UI (НОВАЯ) ---------- */
#ui-top-bar {
    width: 100%;
    height: 100px;               /* увеличена для вертикальных шкал */
    flex-shrink: 0;
    background: rgba(20, 15, 10, 0.85);
    backdrop-filter: blur(5px);
    border-bottom: 2px solid #c9a96e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 50;
    color: #eedba7;
    position: relative;
}

#left-group {
    display: flex;
    align-items: center;
    gap: 15px;                  /* расстояние между аватаркой и статами */
}

/* Только аватарка, имя скрыто */
#player-avatar-section {
    display: flex;
    align-items: center;
    gap: 0;
}

#avatar-frame {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #c9a96e;
    overflow: hidden;
    background: #2a1f0e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

#player-avatar-emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    line-height: 1;
}

#player-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* Вертикальный блок со статами */
#player-stats-vertical {
    display: flex;
    flex-direction: column;
    gap: 3px;                   /* расстояние между строками */
}

#player-level {
    font-size: 14px;
    font-weight: bold;
    color: #ffd966;
    margin-bottom: 2px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-label {
    width: 30px;                /* фиксированная ширина для выравнивания */
    font-size: 11px;
    text-transform: uppercase;
    color: #ccb690;
    text-align: right;
}

.stat-bar-container {
    width: 100px;
    height: 10px;
    background: #2a1f0e;
    border: 1px solid #5c4a2a;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s;
}

.hp-fill { background: linear-gradient(90deg, #c44, #e66); }
.mp-fill { background: linear-gradient(90deg, #48c, #6af); }
.exp-fill { background: linear-gradient(90deg, #c9a96e, #ffd966); }

#exp-bar-container {
    width: 100px;
}

.stat-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px black;
    font-size: 9px;
    pointer-events: none;
}

/* Меню остаётся по центру */
#ui-main-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    justify-content: center;
}

.menu-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
    color: #ccb690;
}
.menu-icon i { font-size: 28px; margin-bottom: 4px; }
.menu-icon span { font-size: 12px; font-weight: bold; text-transform: uppercase; }
.menu-icon:hover { background: rgba(201, 169, 110, 0.2); color: #ffd966; }
.menu-icon-img { width: 36px; height: 36px; object-fit: contain; display: block; margin-bottom: 4px; background: transparent; }

/* ---------- КАРТА ---------- */
#game-main-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    overflow: hidden;
    background: #1a1a1a;
}

#map-container {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 5px solid #5c4a2a;
    border-radius: 0;
    overflow: hidden;
    background: #1a1a1a;
    position: relative;
    width: 100%;
    height: 100%;
}

#map-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a1a1a;
}

#players-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ---------- ЧАТ-ПАНЕЛЬ (ДВЕ КОЛОНКИ) ---------- */
#chat-panel {
    width: 100%;
    height: 150px;
    flex-shrink: 0;
    background: rgba(20, 15, 10, 0.9);
    backdrop-filter: blur(5px);
    border-top: 2px solid #c9a96e;
    display: flex;
    z-index: 60;
    color: #eedba7;
}

.chat-left {
    flex: 3;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #5c4a2a;
}

.chat-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 5px 8px;
    overflow-y: auto;
}

.quick-travel-header {
    font-size: 14px;
    font-weight: bold;
    color: #c9a96e;
    text-align: center;
    padding: 5px 0;
    border-bottom: 1px solid #5c4a2a;
    margin-bottom: 5px;
}

.quick-travel-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-travel-item {
    padding: 8px 10px;
    background: rgba(58, 46, 30, 0.6);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #eedba7;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.quick-travel-item:hover {
    background: rgba(201, 169, 110, 0.25);
    border-color: #c9a96e;
    color: #ffd966;
}

.quick-travel-item i {
    margin-right: 6px;
    color: #c9a96e;
}

.empty-quick-travel {
    color: #888;
    text-align: center;
    padding: 10px;
}

/* Табы чата */
.chat-tabs {
    display: flex;
    gap: 5px;
    padding: 5px 10px 0 10px;
    border-bottom: 1px solid #5c4a2a;
}

.chat-tab {
    padding: 6px 16px;
    background: rgba(58, 46, 30, 0.6);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
    transition: all 0.2s;
}

.chat-tab.active {
    background: #c9a96e;
    color: black;
}

.chat-tab:hover:not(.active) {
    background: rgba(201, 169, 110, 0.3);
    color: #ffd966;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message {
    word-break: break-word;
}

.chat-message .sender {
    color: #c9a96e;
    font-weight: bold;
    margin-right: 6px;
}

.chat-message .text {
    color: #ddd;
}

.chat-message.system {
    color: #aaa;
    font-style: italic;
}

.chat-input-area {
    display: flex;
    padding: 6px 10px;
    gap: 8px;
    border-top: 1px solid #5c4a2a;
}

#chat-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(42, 31, 14, 0.8);
    border: 1px solid #5c4a2a;
    color: #eedba7;
    border-radius: 20px;
    outline: none;
}

#chat-send-btn {
    background: #c9a96e;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: black;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

#chat-send-btn:hover {
    background: #dbb87c;
}

/* ---------- ОКНА (ИНВЕНТАРЬ, АВАТАР, ЛОКАЦИИ, ИГРОКИ, МОНСТРЫ, МОДАЛЬНОЕ) ---------- */
.ui-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    background: rgba(20, 15, 10, 0.95);
    backdrop-filter: blur(8px);
    border: 2px solid #c9a96e;
    border-radius: 10px;
    padding: 15px;
    z-index: 100;
    color: #eedba7;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
    color: #c9a96e;
}

.close-btn {
    background: none;
    border: none;
    color: #eedba7;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

.close-btn:hover {
    color: #ffd966;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.inventory-slot {
    aspect-ratio: 1 / 1;
    background: rgba(42, 31, 14, 0.8);
    border: 1px solid #5c4a2a;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.1s;
    overflow: hidden;
}

.inventory-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.inventory-slot:hover {
    border-color: #c9a96e;
    background: rgba(74, 58, 42, 0.9);
}

.slot-quantity {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 12px;
    color: white;
    text-shadow: 1px 1px 0 black;
    background: rgba(0,0,0,0.5);
    padding: 0 3px;
    border-radius: 4px;
    z-index: 2;
}

.item-info {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    min-height: 50px;
    font-size: 14px;
    border-left: 3px solid #c9a96e;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 10px;
}
.avatar-option {
    aspect-ratio: 1 / 1;
    background: rgba(42, 31, 14, 0.8);
    border: 2px solid #5c4a2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    cursor: pointer;
    transition: all 0.1s;
}
.avatar-option:hover {
    border-color: #c9a96e;
    background: rgba(74, 58, 42, 0.9);
    transform: scale(1.05);
}

/* ---------- ОКНО ПЕРСОНАЖА (СЕТКА СЛОТОВ 2x5 + ПОРТРЕТ) ---------- */
/* ═══════════════════════════════════════════
   ОКНО ПЕРСОНАЖА
═══════════════════════════════════════════ */
#character-window {
    width: 460px;
    height: auto;
}

.character-content {
    display: flex;
    gap: 10px;
}

/* ── Левая колонка: портрет + статы ── */
.character-left {
    flex: 0 0 155px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.character-portrait {
    width: 140px;
    height: 140px;
}

#char-portrait-canvas {
    width: 140px;
    height: 140px;
    border: 2px solid #c9a96e;
    border-radius: 8px;
    background: #2a1f0e;
    box-shadow: 0 0 10px rgba(201,169,110,0.4);
    display: block;
}

.exp-bar-container-char {
    width: 100%;
    height: 5px;
    background: #1a1208;
    border: 1px solid #5c4a2a;
    border-radius: 3px;
    overflow: hidden;
    cursor: help;
}
.exp-bar-fill-char {
    height: 100%;
    background: linear-gradient(90deg, #c9a96e, #ffd966);
    width: 0%;
    transition: width 0.3s;
}

/* ── Таблица статов: 2 колонки ── */
.character-stats {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 5px 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 0;
    font-size: 12px;
    line-height: 1.4;
}
.stat-label {
    color: #b8a070;
}
.stat-row span:last-child {
    color: #ffd966;
    font-weight: bold;
}
/* Основные характеристики чуть ярче */
.stat-row.stat-primary .stat-label {
    color: #ddc898;
}
.stat-row.stat-primary span:last-child {
    color: #fff;
}

/* ── Правая колонка: слоты + бонусы ── */
/* ---------- СЕТКА СЛОТОВ 2×5 ---------- */
.equipment-grid-simple {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 6px;
}

.slot-cell {
    background: rgba(42,31,14,0.8);
    border: 1px solid #5c4a2a;
    border-radius: 6px;
    padding: 3px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 46px;
}
.slot-cell:hover {
    border-color: #c9a96e;
    background: rgba(74,58,30,0.9);
}

.slot-icon {
    font-size: 18px;
    line-height: 1;
    margin-bottom: 1px;
}
.slot-item {
    font-size: 9px;
    font-weight: bold;
    color: #ffd966;
    text-align: center;
    max-width: 92%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- БОНУСЫ ЭКИПИРОВКИ ---------- */
.equipment-bonuses {
    background: rgba(0,0,0,0.35);
    border: 1px solid #5c4a2a;
    border-radius: 5px;
    padding: 4px 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px;
}
.bonus-row {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #eedba7;
    flex: 0 0 48%;
}
.bonus-label { font-weight: bold; }
#bonus-attack, #bonus-defense, #bonus-hp, #bonus-mp {
    color: #ffd966;
    font-weight: bold;
}

/* Разделитель между группами стат */
.stat-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #5c4a2a, transparent);
    margin: 3px 0;
}

/* Скрываем старые классы */
.equipment-list { display: none !important; }

/* Списки локаций, игроков, монстров */
.locations-list-window, .players-list-window, .monsters-list-window {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location-entry, .player-entry, .monster-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.5);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.location-entry:hover, .player-entry:hover, .monster-entry:hover {
    background: rgba(201,169,110,0.2);
}

.location-entry .name {
    font-weight: bold;
    color: #eedba7;
}
.location-entry .action {
    color: #c9a96e;
    font-size: 12px;
}
.player-entry .name {
    color: #ffd966;
}
.player-entry .level {
    color: #aaa;
    font-size: 12px;
}
.monster-info {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.monster-icon {
    font-size: 24px;
}
.monster-name {
    flex: 1;
    font-weight: bold;
    color: #ffaa66;
}
.monster-hp {
    font-size: 14px;
    color: #ffd966;
}

/* Модальное окно действия с монстром */
.monster-action-content {
    text-align: center;
    padding: 15px;
    font-size: 18px;
    color: #eedba7;
    border-bottom: 1px solid #5c4a2a;
    margin-bottom: 15px;
}
.monster-action-buttons {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}
.modal-action-btn {
    flex: 1;
    padding: 10px 0;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-action-btn.attack-btn {
    background: #4a2808;
    color: #ffd966;
    border: 1px solid #c9a96e;
}
.modal-action-btn.attack-btn:hover {
    background: #6a3810;
    color: #fff;
}
.modal-action-btn.info-btn {
    background: #2a1f0e;
    color: #eedba7;
    border: 1px solid #c9a96e;
}
.modal-action-btn.info-btn:hover {
    background: #3a2e1e;
    color: #ffd966;
}

/* Предметы на карте */
.ground-item {
    position: absolute;
    font-size: 28px;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    z-index: 25;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s;
}
.ground-item:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

/* Монстры на карте */
.map-monster {
    position: absolute !important;
    width: 48px !important;
    height: 48px !important;
    background: #2a1f0e !important;
    border: 2px solid #c9a96e !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: translate(-50%, -50%) !important;
    pointer-events: auto !important;
    z-index: 30 !important;
    overflow: hidden !important;
    box-shadow: 0 0 0 1px #3a2e1e, 0 4px 8px black !important;
    font-size: 32px !important;
    line-height: 1 !important;
    color: #ffd966 !important;
}
.map-monster img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}
#map-container {
    overflow: visible !important;
}

/* ---------- БОЕВОЕ ОКНО ---------- */
.battle-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 200;
    display: flex;
    align-items: center; justify-content: center;
    background: transparent;
}
.battle-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/maps/forest.jpg');
    background-size: cover;
    background-position: center;
    filter: blur(10px) brightness(0.4);
    z-index: 0;
    display: block !important;
}
.battle-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}
.battle-timer-center {
    position: absolute;
    top: 16px;
    right: 24px;
    left: auto;
    transform: none;
    z-index: 10;
}
.timer-circle {
    position: relative;
    width: 70px; height: 70px;
}
.timer-circle svg {
    width: 70px; height: 70px;
}
.timer-circle span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #ffd966;
}
.battle-main-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    width: 100%;
    margin: 15px 0 10px;
}
.battle-column {
    flex: 1;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 30px;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.battle-center-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100px;
}
.skill-btn-main {
    background: linear-gradient(to bottom, #4a2808, #2a1205);
    border: 3px solid #c9a96e;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    cursor: pointer;
    box-shadow: 0 5px 0 #1a120a;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.skill-btn-main i {
    font-size: 40px;
    color: #f0d060;
}
.skill-btn-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0 #1a120a;
}
.unit-avatar {
    width: 160px;
    height: 160px;
    border-radius: 15px;
    border: 5px solid #c9a96e;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
    padding: 0;
}
.unit-avatar span {
    font-size: 160px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent;
}
.unit-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-width: 100%;
    min-height: 100%;
}
.unit-name {
    font-size: 13px;
    font-weight: bold;
    color: #c9a96e;
    margin: 4px 0;
    text-align: center;
    opacity: 0.7;  /* Приглушённо — главная инфа в панели пати */
}
.unit-bars {
    width: 100%;
    margin: 5px 0;
}
.hp-bar-container, .mp-bar-container {
    height: 24px;
    background: #1a120a;
    border-radius: 12px;
    border: 1px solid #5c4a2a;
    margin-bottom: 8px;
    position: relative;
}
.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c44, #e66);
    border-radius: 12px;
    transition: width 0.3s;
}
.mp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #48c, #6af);
    border-radius: 12px;
    transition: width 0.3s;
}
.hp-text, .mp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px black;
    font-size: 13px;
}
.battle-log-panel {
    width: 90%;
    max-width: 860px;
    background: rgba(10, 6, 2, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid #7a5c2a;
    border-top: 2px solid #c9a96e;
    border-radius: 10px;
    margin-top: 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(201,169,110,0.1);
}
.battle-log-header {
    background: linear-gradient(90deg, #2a1f0e, #1a1208);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: bold;
    color: #c9a96e;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid #3a2808;
}
.battle-log-messages {
    height: 120px;
    overflow-y: auto;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    scrollbar-width: thin;
    scrollbar-color: #3a2808 transparent;
}
.battle-log-messages::-webkit-scrollbar { width: 4px; }
.battle-log-messages::-webkit-scrollbar-thumb { background: #3a2808; border-radius: 2px; }

.battle-log-entry {
    color: #ddd0b0;
    word-break: break-word;
    line-height: 1.4;
    padding: 1px 0;
}
/* Полоска слева по типу сообщения */
.battle-log-entry.player-action {
    color: #7ddd7d;
    border-left: 2px solid #4a8a4a;
    padding-left: 7px;
}
.battle-log-entry.monster-action {
    color: #e88;
    border-left: 2px solid #8a3a3a;
    padding-left: 7px;
}
.battle-log-entry.system {
    color: #8a8070;
    font-style: italic;
}
.radial-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 300;
}
.radial-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.radial-menu {
    position: relative;
    width: 300px;
    height: 300px;
}
.radial-center-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #2a1508;
    border: 3px solid #c9a96e;
    color: #f0d060;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.radial-buttons {
    position: relative;
    width: 100%;
    height: 100%;
}
.radial-btn {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a2808, #2a1205);
    border: 3px solid #c9a96e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%);
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Android Emoji", "EmojiOne Color", "Twemoji Mozilla", sans-serif;
}
.radial-btn .sk-icon {
    font-size: 32px;
    line-height: 1;
    font-family: inherit;
}
.radial-btn .sk-name {
    font-size: 10px;
    font-weight: bold;
    margin-top: 4px;
    color: #eedba7;
}
.radial-btn .sk-cost {
    font-size: 9px;
    color: #6af;
}

/* ===== БОЕВЫЕ КНОПКИ ===== */
.battle-actions-panel {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    padding: 10px 0 6px;
    width: 100%;
    flex-wrap: wrap;
}
.battle-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    border: 3px solid #c9a96e;
    background: linear-gradient(160deg, #3a2208 0%, #1e1005 100%);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
    box-shadow: 0 4px 0 #0d0804;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.battle-action-btn:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 8px 0 #0d0804;
    border-color: #ffd966;
}
.battle-action-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 0 #0d0804;
}
.battle-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.battle-action-btn .ba-icon {
    font-size: 28px;
    line-height: 1;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.battle-action-btn .ba-label {
    font-size: 11px;
    font-weight: bold;
    color: #eedba7;
    margin-top: 4px;
    letter-spacing: 0.3px;
}
.attack-btn  { border-color: #e07030; }
.attack-btn:hover:not(:disabled) { border-color: #ff9050; background: linear-gradient(160deg, #5a3010 0%, #2a1805 100%); }
.defend-btn  { border-color: #3090c0; }
.defend-btn:hover:not(:disabled) { border-color: #50c0f0; background: linear-gradient(160deg, #10304a 0%, #081828 100%); }
.skills-btn  { border-color: #9060d0; }
.skills-btn:hover:not(:disabled) { border-color: #c090ff; background: linear-gradient(160deg, #301850 0%, #180828 100%); }
.flee-btn    { border-color: #608040; }
.flee-btn:hover:not(:disabled) { border-color: #90c060; background: linear-gradient(160deg, #203010 0%, #101808 100%); }

/* Кнопки задизаблены во время хода монстра */
.battle-actions-panel.disabled .battle-action-btn {
    opacity: 0.35;
    pointer-events: none;
}

/* ===== VS КОЛОНКА ===== */
.battle-vs-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 70px;
}
.battle-vs-label {
    font-size: 28px;
    font-weight: 900;
    color: #c9a96e;
    text-shadow: 0 0 12px rgba(201,169,110,0.6);
    letter-spacing: 2px;
}
.turn-indicator {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s;
}
.turn-indicator.player-turn {
    background: rgba(80,200,80,0.2);
    border: 1px solid #4c4;
    color: #6f6;
    animation: pulse-green 1.5s infinite alternate;
}
.turn-indicator.monster-turn {
    background: rgba(200,80,80,0.2);
    border: 1px solid #c44;
    color: #f66;
    animation: pulse-red 1.5s infinite alternate;
}
@keyframes pulse-green {
    from { box-shadow: 0 0 4px rgba(80,200,80,0.3); }
    to   { box-shadow: 0 0 12px rgba(80,200,80,0.7); }
}
@keyframes pulse-red {
    from { box-shadow: 0 0 4px rgba(200,80,80,0.3); }
    to   { box-shadow: 0 0 12px rgba(200,80,80,0.7); }
}

/* ===== ПАНЕЛЬ ЭФФЕКТОВ ===== */
.battle-effects-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    margin-top: 8px;
    min-height: 26px;
}
.effect-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid;
    white-space: nowrap;
    cursor: default;
}
.effect-badge.bleed {
    background: rgba(160,30,30,0.85);
    border-color: #e74c3c;
    color: #fff;
    animation: bleed-pulse 1s infinite alternate;
}
@keyframes bleed-pulse {
    from { box-shadow: 0 0 4px rgba(231,76,60,0.4); }
    to   { box-shadow: 0 0 10px rgba(231,76,60,0.9); }
}

/* ===== ЛОГ БОЯ ===== */

/* Урон-попап */
@keyframes dmg-float {
    0%   { transform: translateY(0);   opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}
.dmg-popup {
    position: absolute;
    font-size: 22px;
    font-weight: 900;
    pointer-events: none;
    animation: dmg-float 0.9s ease-out forwards;
    text-shadow: 1px 1px 3px #000;
    z-index: 500;
}
.dmg-popup.player  { color: #ff5; }
.dmg-popup.monster { color: #f44; }
.dmg-popup.bleed   { color: #e74c3c; font-size: 18px; }

.battle-action-log,
.battle-middle,
.vs-badge,
.damage-log,
.last-action {
    display: none;
}

/* Плавающие иконки */
#floating-icons {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 150;
}
.float-icon {
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.7);
    border: 2px solid #c9a96e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #eedba7;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    backdrop-filter: blur(4px);
}
.float-icon:hover {
    transform: scale(1.1);
    background: rgba(201,169,110,0.3);
    color: #ffd966;
}

/* Игровой режим */
body.in-game {
    background: #1a1a1a !important;
    background-size: auto;
}
body.in-game::before {
    display: none;
}
body.in-game #stars-canvas {
    display: none;
}

/* ---------- ОКНО ОБУЧЕНИЯ НАВЫКАМ ---------- */
#training-window {
    width: 500px;
    max-height: 500px;
    overflow-y: auto;
}

.training-info {
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skill-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.4);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #5c4a2a;
}

.skill-icon {
    font-size: 32px;
    width: 50px;
    text-align: center;
}

.skill-info {
    flex: 1;
}

.skill-name {
    font-weight: bold;
    color: #ffd966;
}

.skill-desc {
    font-size: 12px;
    color: #ccb690;
}

.skill-cost {
    font-size: 12px;
    color: #6af;
}

.skill-action {
    min-width: 120px;
    text-align: right;
}

.learn-btn {
    background: #4a2808;
    border: 1px solid #c9a96e;
    color: #ffd966;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.learn-btn:hover {
    background: #6a3810;
    color: white;
}

.learn-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.learned {
    color: #6f6;
    font-weight: bold;
}

.training-note {
    margin-top: 15px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
    font-style: italic;
}

/* ---------- НОВОЕ ОКНО ЛОКАЦИЙ С КАТЕГОРИЯМИ ---------- */
#locations-window {
    width: 350px;
    max-height: 500px;
    overflow-y: auto;
}

.locations-categories {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.location-category {
    border: 1px solid #5c4a2a;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(201, 169, 110, 0.1);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.category-header:hover {
    background: rgba(201, 169, 110, 0.25);
}

.category-icon {
    font-size: 20px;
}

.category-name {
    flex: 1;
    font-size: 16px;
    font-weight: bold;
    color: #ffd966;
}

.category-arrow {
    font-size: 14px;
    color: #c9a96e;
    transition: transform 0.2s;
}

.location-category.collapsed .category-arrow {
    transform: rotate(-90deg);
}

.category-content {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.location-category.collapsed .category-content {
    max-height: 0;
    overflow: hidden;
}

.location-map-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px 10px 30px;
    cursor: pointer;
    border-bottom: 1px solid #3a2e1e;
    transition: background 0.2s;
}

.location-map-item:hover {
    background: rgba(201, 169, 110, 0.2);
}

.location-map-item.current {
    background: rgba(201, 169, 110, 0.15);
    border-left: 3px solid #c9a96e;
}

.location-map-name {
    color: #eedba7;
    font-size: 14px;
}

.location-map-status {
    font-size: 12px;
    color: #aaa;
}

.location-map-item.current .location-map-status {
    color: #c9a96e;
    font-weight: bold;
}

.empty-category-message {
    padding: 15px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* ---------- МАГАЗИН ---------- */
#shop-window {
    width: 450px;
    max-height: 500px;
    overflow-y: auto;
}

.shop-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid #5c4a2a;
    padding-bottom: 5px;
}

.shop-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    background: rgba(58, 46, 30, 0.6);
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    color: #aaa;
    transition: all 0.2s;
}

.shop-tab.active {
    background: #c9a96e;
    color: black;
}

.shop-tab:hover:not(.active) {
    background: rgba(201, 169, 110, 0.3);
    color: #ffd966;
}

.shop-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #5c4a2a;
}

.shop-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-item-icon {
    font-size: 28px;
    width: 40px;
    text-align: center;
}

.shop-item-name {
    font-weight: bold;
    color: #ffd966;
}

.shop-item-price {
    color: #6f6;
    font-size: 14px;
}

.shop-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-quantity-input {
    width: 50px;
    padding: 5px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #5c4a2a;
    color: #eedba7;
    border-radius: 4px;
    text-align: center;
}

.shop-btn {
    padding: 6px 12px;
    background: #4a2808;
    border: 1px solid #c9a96e;
    color: #ffd966;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.shop-btn:hover {
    background: #6a3810;
    color: white;
}

.shop-btn.sell {
    background: #2a4a08;
}

.shop-btn.sell:hover {
    background: #3a6a10;
}

.sort-btn {
    margin-left: auto;
    margin-right: 8px;
    padding: 4px 10px;
    background: #2a1f0e;
    border: 1px solid #c9a96e;
    color: #ffd966;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s;
}
.sort-btn:hover {
    background: #4a2808;
    color: white;
}



/* ═══════════════════════════════════════════
   ОКНО НАВЫКОВ (Дом мастеров)
═══════════════════════════════════════════ */
#training-window {
    width: 420px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.training-info {
    font-size: 13px;
    color: #c9a96e;
    padding: 4px 0 8px;
    border-bottom: 1px solid #5c4a2a;
    margin-bottom: 6px;
}
.skills-list {
    overflow-y: auto;
    flex: 1;
}

/* Секция физические / магические */
.skill-section { margin-bottom: 6px; }

.skill-section-header {
    background: rgba(92,74,42,0.5);
    border: 1px solid #5c4a2a;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: bold;
    color: #ffd966;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.skill-section-header::after {
    content: '▾';
    font-size: 12px;
    transition: transform 0.2s;
}
.skill-section.collapsed .skill-section-header::after { transform: rotate(-90deg); }
.skill-section.collapsed .skill-section-body { display: none; }

.skill-section-body { padding: 4px 0; }

/* Карточка навыка */
.skill-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(0,0,0,0.25);
    border: 1px solid #3a2a10;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 4px;
    transition: border-color 0.15s;
}
.skill-entry:hover { border-color: #7a6040; }
.skill-entry.learned-skill { opacity: 0.7; }

.skill-info { flex: 1; }
.skill-name {
    font-size: 13px;
    font-weight: bold;
    color: #ffd966;
}
.skill-lvl {
    font-size: 11px;
    font-weight: normal;
    color: #9a8060;
    margin-left: 4px;
}
.skill-desc {
    font-size: 11px;
    color: #b8a070;
    margin-top: 2px;
}
.skill-meta {
    font-size: 11px;
    color: #7ab0ff;
    margin-top: 2px;
}
.skill-learned {
    font-size: 12px;
    color: #6bcc6b;
    font-weight: bold;
}
.learn-btn {
    padding: 4px 10px;
    background: #3a2808;
    border: 1px solid #c9a96e;
    color: #ffd966;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.learn-btn:hover:not(:disabled) { background: #5a4020; }
.learn-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══════════════════════════════════════════
   КНОПКИ В БЫСТРОМ ПЕРЕХОДЕ
═══════════════════════════════════════════ */
.quick-travel-item.qt-action {
    background: rgba(74,40,8,0.8);
    border-color: #c9a96e;
    color: #ffd966;
    font-weight: bold;
}
.quick-travel-item.qt-rest {
    background: rgba(20,60,30,0.7);
    border-color: #4a9a4a;
    color: #8ddd8d;
    font-size: 12px;
    animation: rest-pulse 2s infinite alternate;
}
@keyframes rest-pulse {
    from { box-shadow: none; }
    to   { box-shadow: 0 0 8px rgba(77,200,77,0.4); }
}

/* ═══════════════════════════════════════════
   ОКНО РЕЗУЛЬТАТА БОЯ (победа / смерть)
═══════════════════════════════════════════ */
.battle-result-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    background: rgba(0,0,0,0.55);
    animation: fade-in 0.3s ease;
}
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }

.result-box {
    background: linear-gradient(160deg, #1a1208, #2a1f0e);
    border-radius: 14px;
    padding: 24px 32px;
    min-width: 280px;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}
.victory-box { border: 2px solid #c9a96e; }
.death-box   { border: 2px solid #8b2020; }

.result-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 14px;
}
.victory-box .result-title { color: #ffd966; }
.death-box   .result-title { color: #e74c3c; }

.result-rewards { margin-bottom: 12px; }
.result-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #eedba7;
    padding: 3px 0;
    border-bottom: 1px solid rgba(92,74,42,0.3);
}
.result-row span:last-child { color: #ffd966; font-weight: bold; }
.result-row.loss span:last-child { color: #e74c3c; }

.result-drops-title {
    font-size: 12px;
    color: #9a8060;
    text-align: left;
    margin-bottom: 4px;
}
.result-drops {
    text-align: left;
    margin-bottom: 14px;
}
.result-drop-item {
    font-size: 13px;
    color: #eedba7;
    padding: 2px 0;
}
.result-drop-empty { font-size: 12px; color: #6a5a40; }

.result-note { font-size: 12px; color: #9a8060; margin-top: 10px; }

.result-close-btn {
    margin-top: 4px;
    padding: 7px 24px;
    background: #3a2808;
    border: 1px solid #c9a96e;
    color: #ffd966;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.result-close-btn:hover { background: #5a4020; }

/* Эффект регена (Покой) */
@keyframes regen-pulse {
    from { box-shadow: 0 0 3px rgba(39,174,96,0.3); }
    to   { box-shadow: 0 0 10px rgba(39,174,96,0.8); }
}
.battle-log-entry.regen { color: #2ecc71; }
.battle-log-entry.dodge { color: #3498db; }

/* Базовая атака в радиальном меню — всегда доступна */
.radial-btn.radial-basic {
    border-color: #c9a96e;
    background: rgba(60, 40, 10, 0.95);
}

/* ═══════════════════════════════════════════
   ОКНО КРАФТА
═══════════════════════════════════════════ */
#craft-window {
    width: 400px;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
}

/* ── Табы: Рецепты / Ингредиенты ── */
.craft-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.craft-tab-btn {
    flex: 1;
    padding: 6px 0;
    background: rgba(42,31,14,0.6);
    border: 1px solid #5c4a2a;
    border-radius: 6px;
    color: #c9a96e;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.craft-tab-btn.active,
.craft-tab-btn:hover {
    background: rgba(92,74,42,0.8);
    color: #ffd966;
    border-color: #c9a96e;
}

/* ── Тело: скролл ── */
.craft-body {
    overflow-y: auto;
    overflow-x: visible;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
    /* Нужен для того чтобы тултипы не обрезались */
    isolation: isolate;
}

/* ── Фильтр категорий ── */
.craft-cat-bar {
    display: flex;
    gap: 5px;
    margin-bottom: 6px;
}
.craft-cat-btn {
    flex: 1;
    padding: 4px 0;
    background: rgba(30,20,8,0.7);
    border: 1px solid #3a2a10;
    border-radius: 5px;
    color: #9a8060;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.craft-cat-btn.active,
.craft-cat-btn:hover {
    background: rgba(70,50,15,0.85);
    border-color: #c9a96e;
    color: #ffd966;
}

/* ── Карточка рецепта ── */
.craft-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid #3a2a10;
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color 0.15s;
}
.craft-card.can-craft { border-color: #7a9a40; }
.craft-card.ingr-card { border-color: #4a6a8a; }

.craft-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.craft-result-icon { font-size: 20px; }
.craft-result-name {
    font-size: 14px;
    font-weight: bold;
    color: #ffd966;
    flex: 1;
}
.craft-ready {
    font-size: 11px;
    color: #7acc44;
    font-weight: bold;
    background: rgba(50,100,10,0.4);
    border: 1px solid #5a8820;
    border-radius: 4px;
    padding: 1px 6px;
}

/* ── Список ингредиентов (раскрывающийся) ── */
.craft-ingr-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 400px;
    opacity: 1;
}
.craft-ingr-list.craft-ingr-collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin-bottom: 0;
}

/* Кнопка скрафтить — скрыта когда свёрнуто */
.craft-btn-collapsed {
    display: none !important;
}

/* Шеврон */
.craft-chevron {
    margin-left: auto;
    margin-right: 6px;
    font-size: 13px;
    color: #9a8060;
    transition: transform 0.2s;
}

.craft-card-header.craft-collapsible {
    cursor: pointer;
    user-select: none;
}
.craft-card-header.craft-collapsible:hover { background: rgba(255,255,255,0.03); }

.craft-ingr-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #c9a96e;
    padding: 3px 4px;
    border-radius: 4px;
    position: relative;
}
.craft-ingr-row.missing { color: #c07070; }
.ingr-icon { font-size: 14px; width: 18px; text-align: center; }
.ingr-name { flex: 1; }
.ingr-qty { font-weight: bold; font-size: 12px; }
.ingr-qty.ok  { color: #7acc44; }
.ingr-qty.bad { color: #e74c3c; }

/* ── Компактная строка ингредиента (вкладка Ингредиенты) ── */
.craft-ingr-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid #3a2a10;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #ffd966;
    font-weight: bold;
    position: relative;
    cursor: help;
    transition: border-color 0.15s;
}
.craft-ingr-compact:hover { border-color: #c9a96e; }

/* ── Тултип (общий для recipe и ingredient) ── */
.has-tooltip { position: relative; } /* position:relative для fallback */
.craft-tooltip {
    display: none;
    position: fixed;       /* fixed — выходит за любой overflow */
    background: rgba(12,8,2,0.99);
    border: 1px solid #c9a96e;
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 12px;
    color: #eedba7;
    white-space: nowrap;
    z-index: 99999;        /* поверх всего */
    pointer-events: none;
    box-shadow: 0 6px 24px rgba(0,0,0,0.9);
    line-height: 1.8;
    font-weight: normal;
    min-width: 120px;
}
/* Позиция задаётся JS через data-атрибуты или через transform */
.has-tooltip:hover .craft-tooltip { display: block; }

/* ── Кнопка крафта ── */
.craft-btn {
    width: 100%;
    padding: 7px 0;
    background: linear-gradient(135deg, #3a2808, #5a4010);
    border: 1px solid #c9a96e;
    border-radius: 6px;
    color: #ffd966;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}
.craft-btn:hover:not(.disabled):not(:disabled) {
    background: linear-gradient(135deg, #5a4010, #7a5820);
}
.craft-btn.disabled,
.craft-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Пустое состояние */
.craft-empty {
    text-align: center;
    color: #6a5a40;
    font-size: 13px;
    padding: 20px 0;
}

/* Количество результата в заголовке ингредиентного рецепта */
.craft-result-qty {
    font-size: 12px;
    color: #9a8060;
    margin-left: 2px;
}

/* ═══════════════════════════════════════════
   КАРТОЧКИ МОНСТРОВ (multi-monster battle)
═══════════════════════════════════════════ */
#monster-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    min-width: 200px;
    max-width: 240px;
}

/* Карточка — вертикальная компоновка: иконка сверху, инфо снизу */
.monster-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(20,10,5,0.85);
    border: 1px solid #3a2808;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}
.monster-card:hover { border-color: #7a5820; }
.monster-card-target {
    border-color: #c9a96e !important;
    box-shadow: 0 0 14px rgba(201,169,110,0.5);
}

/* Иконка — крупная */
.monster-card-avatar { flex-shrink: 0; }
.monster-card-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #5c4a2a;
    display: block;
}
.monster-card-emoji {
    font-size: 72px;
    line-height: 100px;
    display: block;
    text-align: center;
    width: 100px;
}

/* Инфо под иконкой — на всю ширину */
.monster-card-info {
    width: 100%;
    min-width: 0;
}
.monster-card-name {
    font-size: 13px;
    font-weight: bold;
    color: #ffd966;
    text-align: center;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.monster-card-lvl {
    font-size: 11px;
    color: #9a8060;
    font-weight: normal;
}

/* Шкалы — заметнее */
.monster-bar-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}
.monster-mini-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
}
.monster-mini-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.monster-mini-text {
    font-size: 10px;
    color: #9a8060;
    white-space: nowrap;
    min-width: 36px;
    text-align: right;
}

/* Стрелка цели */
.monster-target-arrow {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #c9a96e;
    font-size: 14px;
}

/* ── Цвета лога боя ── */
.battle-log-entry.bleed   { color: #e87878; border-left: 2px solid #8a3a3a; padding-left: 7px; }
.battle-log-entry.regen   { color: #7acc7a; border-left: 2px solid #3a7a3a; padding-left: 7px; }
.battle-log-entry.dodge   { color: #7ab0e8; border-left: 2px solid #3a5a8a; padding-left: 7px; }
.battle-log-entry.victory { color: #ffd966; font-weight: bold; text-align: center; }
.battle-log-entry.defeat  { color: #e74c3c; font-weight: bold; text-align: center; }

/* ═══════════════════════════════════════════
   СИСТЕМА ПАТИ
═══════════════════════════════════════════ */
#party-panel {
    position: fixed;
    top: 80px;
    left: 10px;
    width: 210px;
    background: rgba(12,8,2,0.95);
    border: 1px solid #5c4a2a;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 400;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}
.party-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
    color: #ffd966;
    border-bottom: 1px solid #3a2808;
    padding-bottom: 6px;
}
.party-panel-header button {
    background: none;
    border: none;
    color: #7a6040;
    cursor: pointer;
    font-size: 14px;
}
.party-panel-header button:hover { color: #c9a96e; }

.party-empty { font-size: 12px; color: #6a5a40; text-align: center; padding: 6px 0; }

.party-create-btn {
    width: 100%;
    padding: 7px;
    background: rgba(42,31,14,0.8);
    border: 1px solid #c9a96e;
    border-radius: 6px;
    color: #ffd966;
    font-size: 12px;
    cursor: pointer;
}
.party-create-btn:hover { background: rgba(70,50,15,0.9); }

/* Участник пати */
.party-member-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    position: relative;
}
.party-member-row.party-leader { background: rgba(201,169,110,0.07); }
.party-member-avatar { font-size: 18px; flex-shrink: 0; }
.party-member-info { flex: 1; min-width: 0; }
.party-member-name {
    font-size: 11px;
    font-weight: bold;
    color: #ffd966;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.party-member-lvl { font-size: 10px; color: #7a6040; font-weight: normal; }
.party-bar-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.party-mini-bar {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}
.party-mini-fill.hp { background: #c0392b; height: 100%; border-radius: 3px; transition: width 0.3s; }
.party-mini-fill.mp { background: #2980b9; height: 100%; border-radius: 3px; transition: width 0.3s; }
.party-bar-text { font-size: 9px; color: #7a6040; min-width: 28px; text-align: right; }
.party-kick-btn {
    background: none;
    border: none;
    color: #5a3a2a;
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
}
.party-kick-btn:hover { color: #e74c3c; }

/* Форма приглашения */
#party-invite-form {
    display: flex;
    gap: 4px;
}
#party-invite-input {
    flex: 1;
    padding: 5px 7px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2808;
    border-radius: 5px;
    color: #eedba7;
    font-size: 11px;
}
#party-invite-btn {
    padding: 5px 8px;
    background: #2a4010;
    border: 1px solid #4a7a20;
    border-radius: 5px;
    color: #8ddd8d;
    font-size: 11px;
    cursor: pointer;
}
#party-invite-btn:hover { background: #3a5a18; }

/* Попап приглашения */
#party-invite-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(160deg, #1a1208, #2a1f0e);
    border: 2px solid #c9a96e;
    border-radius: 12px;
    padding: 20px 28px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
    min-width: 240px;
}
.party-invite-from { font-size: 16px; font-weight: bold; color: #ffd966; }
.party-invite-text { font-size: 13px; color: #c9a96e; }
.party-invite-btns { display: flex; gap: 10px; }
#party-accept-btn {
    padding: 8px 20px;
    background: #1a4010;
    border: 1px solid #4a8a20;
    border-radius: 7px;
    color: #8ddd8d;
    font-size: 13px;
    cursor: pointer;
}
#party-accept-btn:hover { background: #2a5a18; }
#party-decline-btn {
    padding: 8px 20px;
    background: #3a1010;
    border: 1px solid #7a2020;
    border-radius: 7px;
    color: #e88;
    font-size: 13px;
    cursor: pointer;
}

/* Участники в бою пати */
#party-battle-members {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 6px 0;
    flex-wrap: wrap;
}
.party-battle-member {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #3a2808;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: #c9a96e;
    position: relative;
}
.party-battle-member.active-turn {
    border-color: #ffd966;
    color: #ffd966;
    background: rgba(201,169,110,0.1);
}
.party-battle-member.dead { opacity: 0.4; text-decoration: line-through; }
.pbm-bar {
    width: 50px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.pbm-fill.hp { background: #c0392b; height: 100%; transition: width 0.3s; }
.pbm-hp { font-size: 9px; color: #7a6040; }
.pbm-arrow { font-size: 10px; color: #ffd966; margin-left: 2px; }

.pbm-avatar { font-size: 14px; }
.pbm-name   { font-size: 11px; font-weight: bold; min-width: 40px; }
.party-battle-member.is-me { border-color: #5a9a5a; }

/* ═══════════════════════════════════════════
   ГИЛЬДИИ
═══════════════════════════════════════════ */
#guild-window {
    width: 420px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

/* Табы */
.guild-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    border-bottom: 1px solid #3a2808;
    padding-bottom: 6px;
}
.guild-tab {
    flex: 1;
    padding: 5px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #7a6040;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.guild-tab:hover { color: #c9a96e; }
.guild-tab.active {
    background: rgba(92,74,42,0.4);
    border-color: #5c4a2a;
    color: #ffd966;
    font-weight: bold;
}

/* Контент таба */
.guild-tab-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Информация о гильдии */
.guild-info-block {
    background: rgba(0,0,0,0.3);
    border: 1px solid #3a2808;
    border-radius: 8px;
    padding: 12px 14px;
}
.guild-info-tag {
    font-size: 22px;
    font-weight: bold;
    color: #c9a96e;
    letter-spacing: 1px;
}
.guild-info-name {
    font-size: 18px;
    font-weight: bold;
    color: #ffd966;
    margin: 4px 0 6px;
}
.guild-info-desc {
    font-size: 12px;
    color: #9a8060;
    margin-bottom: 10px;
    font-style: italic;
}
.guild-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(92,74,42,0.2);
    color: #c9a96e;
}
.guild-info-row span:last-child { color: #ffd966; font-weight: bold; }

/* Действия */
.guild-actions { display: flex; flex-direction: column; gap: 6px; }
.guild-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2808;
    border-radius: 6px;
    color: #eedba7;
    font-size: 12px;
}
.guild-input:focus { outline: none; border-color: #7a5820; }

.guild-action-btn {
    padding: 8px 14px;
    background: rgba(42,31,14,0.8);
    border: 1px solid #c9a96e;
    border-radius: 6px;
    color: #ffd966;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}
.guild-action-btn:hover { background: rgba(70,50,15,0.9); }
.guild-action-btn.danger {
    background: rgba(60,15,15,0.8);
    border-color: #8a2020;
    color: #e88;
}

/* Участники */
.guild-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    background: rgba(0,0,0,0.2);
    border: 1px solid #2a1a08;
    border-radius: 6px;
}
.guild-member-avatar { font-size: 20px; flex-shrink: 0; }
.guild-member-info { flex: 1; min-width: 0; }
.guild-member-name {
    font-size: 12px;
    font-weight: bold;
    color: #ffd966;
}
.guild-member-rank {
    font-size: 10px;
    color: #7a6040;
    margin-top: 1px;
}
.rank-leader  { color: #ffd966 !important; }
.rank-officer { color: #c9a96e !important; }
.rank-member  { color: #7a6040 !important; }

.guild-member-actions { display: flex; gap: 4px; }
.guild-sm-btn {
    padding: 3px 7px;
    background: rgba(42,31,14,0.8);
    border: 1px solid #5c4a2a;
    border-radius: 4px;
    color: #c9a96e;
    font-size: 11px;
    cursor: pointer;
}
.guild-sm-btn:hover { border-color: #c9a96e; }
.guild-sm-btn.danger { color: #e88; border-color: #5a2020; }

/* Журнал */
.guild-log-entry {
    display: flex;
    gap: 8px;
    font-size: 11px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(92,74,42,0.15);
}
.guild-log-time { color: #5a4a30; white-space: nowrap; }
.guild-log-text { color: #b0a080; }

/* Поиск */
.guild-search-row {
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid #2a1a08;
    border-radius: 6px;
}
.guild-empty, .guild-loading, .guild-no-guild {
    text-align: center;
    color: #6a5a40;
    font-size: 13px;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Форма создания */
.guild-create-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
}

/* Тег гильдии в чате */
.chat-message .guild-tag {
    color: #c9a96e;
    font-weight: bold;
    margin-right: 4px;
}

/* Попап приглашения в гильдию */
#guild-invite-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(160deg, #1a1208, #2a1f0e);
    border: 2px solid #c9a96e;
    border-radius: 12px;
    padding: 20px 28px;
    z-index: 9001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
    min-width: 240px;
}

/* ═══════════════════════════════════════════
   АВАТАР — ЗАГРУЗКА
═══════════════════════════════════════════ */
#avatar-window { width: 320px; }

.avatar-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
}

#avatar-preview-wrap {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 3px solid #5c4a2a;
    overflow: hidden;
    background: #1a1208;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
#avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 50%;
}
#avatar-preview-placeholder {
    color: #5a4a30;
    font-size: 13px;
}

.avatar-upload-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.avatar-upload-label {
    display: block;
    text-align: center;
    padding: 9px 0;
    background: rgba(42,31,14,0.8);
    border: 1px solid #c9a96e;
    border-radius: 7px;
    color: #ffd966;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.avatar-upload-label:hover { background: rgba(70,50,15,0.9); }

.avatar-save-btn {
    padding: 9px 0;
    background: #1a4010;
    border: 1px solid #4a8a20;
    border-radius: 7px;
    color: #8ddd8d;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
}
.avatar-save-btn:hover { background: #2a5a18; }
.avatar-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.avatar-remove-btn {
    padding: 7px 0;
    background: transparent;
    border: 1px solid #3a1010;
    border-radius: 7px;
    color: #7a4040;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
}
.avatar-remove-btn:hover { border-color: #7a2020; color: #e88; }

/* Аватар в верхней панели */
#avatar-frame {
    position: relative;
    overflow: hidden;
    border-radius: 50%;
}
#player-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ═══════════════════════════════════════════
   ОКНО ИНФОРМАЦИИ О МОНСТРЕ
═══════════════════════════════════════════ */
.minfo-box {
    background: linear-gradient(160deg, #1a1208, #2a1f0e);
    border: 1px solid #7a5c2a;
    border-top: 2px solid #c9a96e;
    border-radius: 14px;
    padding: 20px 24px;
    min-width: 260px;
    max-width: 320px;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}
.minfo-close {
    position: absolute;
    top: 10px; right: 12px;
    background: none; border: none;
    color: #7a6040; font-size: 16px;
    cursor: pointer; line-height: 1;
}
.minfo-close:hover { color: #c9a96e; }

.minfo-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}
.minfo-name {
    font-size: 18px;
    font-weight: bold;
    color: #ffd966;
    text-align: center;
}
.minfo-level { font-size: 12px; color: #9a8060; }

.minfo-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    padding: 10px 12px;
}
.minfo-stat {
    font-size: 12px;
    color: #c9a96e;
    display: flex;
    justify-content: space-between;
    gap: 6px;
}
.minfo-stat span { color: #ffd966; font-weight: bold; }

.minfo-drops-title {
    font-size: 12px;
    font-weight: bold;
    color: #9a8060;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.minfo-drops { display: flex; flex-direction: column; gap: 4px; }
.minfo-drop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #c9a96e;
    padding: 4px 6px;
    background: rgba(0,0,0,0.2);
    border-radius: 5px;
}
.minfo-drop-icon { font-size: 14px; }
.minfo-drop-name { flex: 1; }
.minfo-drop-qty  { color: #ffd966; font-weight: bold; }
.minfo-empty { font-size: 12px; color: #5a4a30; text-align: center; padding: 8px 0; }

/* Статусы монстров в списке */
.mstatus {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}
.mstatus.alive    { background: rgba(30,100,30,0.4); color: #7acc7a; border: 1px solid #4a7a4a; }
.mstatus.dead     { background: rgba(60,20,20,0.4);  color: #e88;    border: 1px solid #7a2020; }
.mstatus.in-battle{ background: rgba(100,60,10,0.4); color: #ffd966; border: 1px solid #8a6020; }
