* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(rgba(102, 126, 234, 0.85), rgba(118, 75, 162, 0.85)), 
                url('/games/ferma/static/images/background.jpeg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    padding: 20px;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
    position: relative;
}

/* Дополнительный оверлей для лучшей читаемости */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(3px);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    transform: translateZ(0);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(238, 238, 238, 0.8);
}

h1 {
    color: #2d5016;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(45deg, #2d5016, #4a7c1f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.resources {
    display: flex;
    gap: 20px;
    font-size: 1.1em;
}

.resource {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    padding: 12px 18px;
    border-radius: 25px;
    font-weight: bold;
    color: #8b6914;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    will-change: transform;
    border: 2px solid rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.resource:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.resource.population {
    background: linear-gradient(45deg, #81c784, #a5d6a7);
    border-color: #4caf50;
}

.building-selector {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, rgba(227, 242, 253, 0.9), rgba(187, 222, 251, 0.9));
    border-radius: 15px;
    border: 2px solid rgba(144, 202, 249, 0.8);
    backdrop-filter: blur(5px);
}

.building-selector h3 {
    margin-bottom: 15px;
    color: #1565c0;
    text-align: center;
    font-size: 1.4em;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.building-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.building-option {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    will-change: transform;
    transform: translateZ(0);
    backdrop-filter: blur(5px);
}

.building-option:hover {
    transform: translateY(-8px) translateZ(0);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 1);
}

.building-option.selected {
    border-color: #4caf50;
    background: rgba(232, 245, 232, 0.95);
    transform: translateY(-5px);
}

.building-icon {
    font-size: 2.8em;
    margin-bottom: 10px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.2));
}

.building-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.building-cost {
    font-size: 0.95em;
    color: #666;
    font-weight: 600;
}

.building-income {
    font-size: 0.85em;
    color: #4caf50;
    font-weight: 600;
    margin-top: 5px;
}

.building-pop {
    font-size: 0.8em;
    color: #1976d2;
    font-weight: 600;
    margin-top: 3px;
}

.selected-building {
    text-align: center;
    padding: 20px;
    background: rgba(232, 245, 232, 0.9);
    border-radius: 12px;
    margin: 25px 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #2d5016;
    border: 2px solid rgba(76, 175, 80, 0.5);
    backdrop-filter: blur(5px);
}

/* Поднятое игровое поле */
.game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    background: url(/games/ferma/icon/grass) no-repeat center center;
    background-size: cover;
    transform: translateZ(0);
    will-change: transform;
    position: relative;
}

/* Поднятая изометрическая сетка */
.plots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin: 5px 0;
    transform: perspective(1000px) rotateX(60deg) rotateY(0deg) rotateZ(45deg) translateZ(50px);
    transform-style: preserve-3d;
    transform-origin: center center;
    will-change: transform;
    backface-visibility: hidden;

    /* ДОРОГИ: фон сетки просвечивает в промежутках (gap) между участками */
    background-color: #b9a06a;
    background-image:
        /* мелкая гравийная крошка */
        radial-gradient(rgba(255,250,235, 0.22) 1.1px, transparent 1.7px),
        radial-gradient(rgba(74, 56, 28, 0.30) 1.1px, transparent 1.7px),
        /* лёгкая фактура укатанного грунта */
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 7px),
        linear-gradient(135deg, #c6ac74 0%, #b3965d 55%, #a5884f 100%);
    background-size: 9px 9px, 12px 12px, 100% 100%, 100% 100%;
    background-position: 0 0, 4px 6px, 0 0, 0 0;
    border-radius: 4px;
    box-shadow: 0 0 0 3px rgba(120, 100, 60, 0.35);
}

/* Кнопка 🚧: убрать ТОЛЬКО пунктирную разметку (дороги остаются) */
body.roads-off .plot,
body.roads-off .plot.completed {
    outline: none !important;
}

/* ===== ПЕШЕХОДЫ — гуляют по дорогам между участками (изометрия) ===== */
.plots-grid {
    position: relative;
}

.pedestrian {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
    pointer-events: none;
    will-change: transform;
    transform-style: preserve-3d;
}

.pedestrian .ped {
    position: absolute;
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(-45deg) rotateX(-60deg);
    line-height: 0;
    transform-style: preserve-3d;
}

/* Спрайт: лист 4 кадра x 4 направления (32x44 -> показ 26x36) */
.pedestrian .ped .bob {
    display: block;
    width: 26px;
    height: 36px;
    background-repeat: no-repeat;
    background-size: 104px 144px;
    image-rendering: pixelated;
    filter: drop-shadow(1px 3px 2px rgba(0, 0, 0, 0.35));
    animation: ped-walk 0.6s steps(4) infinite, ped-bob 0.55s ease-in-out infinite;
}

@keyframes ped-walk {
    from { background-position-x: 0px; }
    to   { background-position-x: -104px; }
}

@keyframes ped-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2.5px); }
}

/* Базовое состояние участка - плоское */
.plot {
    width: 150px;
    height: 150px;
    border: 3px solid #8bc34a;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(197, 225, 165, 0.9), rgba(139, 195, 74, 0.9));
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: visible;
    box-shadow: 
        2px 2px 8px rgba(0, 0, 0, 0.2),
        inset 2px 2px 4px rgba(255, 255, 255, 0.3);
    transform: translateZ(0);
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    
    /* Гарантируем одинаковый размер */
    min-width: 150px;
    min-height: 150px;
    max-width: 150px;
    max-height: 150px;

    /* РАЗМЕТКА ДОРОГИ: пунктир по центру промежутка (в gap) */
    outline: 2px dashed rgba(255, 246, 210, 0.6);
    outline-offset: 9px;
}

/* Тень дорожной разметки чуть темнее на hover свечении не мешает */
.plot.completed {
    outline-color: rgba(255, 246, 210, 0.5);
}

/* Участок при наведении - легкое поднятие */
.plot:hover {
    transform: translateZ(10px) scale(1.02);
    box-shadow: 
        4px 4px 12px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.4);
}

/* УЧАСТОК В ПРОЦЕССЕ СТРОИТЕЛЬСТВА - ПОДНЯТЫЙ */
.plot.building {
    background: linear-gradient(135deg, rgba(255, 249, 196, 0.9), rgba(255, 235, 59, 0.9));
    border-color: #ff9800;
    transform: translateZ(25px) scale(1.05);
    box-shadow: 
        8px 8px 20px rgba(255, 152, 0, 0.5),
        inset 3px 3px 6px rgba(255, 255, 255, 0.4);
}

/* ЗАВЕРШЕННОЕ СТРОЕНИЕ - ВОЗВРАЩАЕТСЯ В ПЛОСКОЕ СОСТОЯНИЕ */
.plot.completed {
    background: linear-gradient(135deg, rgba(200, 230, 201, 0.9), rgba(76, 175, 80, 0.9));
    border-color: #2e7d32;
    transform: translateZ(0) scale(1);
    box-shadow: 
        3px 3px 10px rgba(76, 175, 80, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.3);
}

/* Улучшенная анимация пульсации только для строительства */
@keyframes building-pulse {
    0% { 
        transform: translateZ(25px) scale(1.05);
        box-shadow: 8px 8px 20px rgba(255, 152, 0, 0.5);
    }
    50% { 
        transform: translateZ(30px) scale(1.07);
        box-shadow: 12px 12px 25px rgba(255, 152, 0, 0.6);
    }
    100% { 
        transform: translateZ(25px) scale(1.05);
        box-shadow: 8px 8px 20px rgba(255, 152, 0, 0.5);
    }
}

.plot.building {
    animation: building-pulse 2s ease-in-out infinite;
    backface-visibility: hidden;
}

/* Легкая анимация для завершенных зданий */
@keyframes completed-glow {
    0% { 
        box-shadow: 3px 3px 10px rgba(76, 175, 80, 0.3);
    }
    50% { 
        box-shadow: 4px 4px 15px rgba(76, 175, 80, 0.4);
    }
    100% { 
        box-shadow: 3px 3px 10px rgba(76, 175, 80, 0.3);
    }
}

.plot.completed {
    animation: completed-glow 3s ease-in-out infinite;
}

/* КОНТЕНТ УЧАСТКОВ - ОБРАТНЫЙ ПОВОРОТ для выравнивания текста */
.plot-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* ОБРАТНЫЙ ПОВОРОТ для компенсации изометрии */
    transform: rotate(-45deg) rotateX(-60deg);
    transform-style: preserve-3d;
}

/* Номера участков - расположены в углу (скрываем для завершенных строений) */
.plot-number {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.8em;
    color: #666;
    background: rgba(223, 222, 158, 0.95);
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    /* Компенсируем поворот для номера */
    transform: rotate(-25deg) rotateX(60deg) rotate(-5deg);
}

/* Скрываем номера для завершенных строений */
.plot.completed .plot-number {
    display: none;
}

/* ИНДИКАТОРЫ СТРОИТЕЛЬСТВА - СИЛЬНО УМЕНЬШЕННЫЙ РАЗМЕР */
.building-progress {
    text-align: center;
    padding: 5px 4px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    /* БЕЗ ДОПОЛНИТЕЛЬНОГО ПОВОРОТА - уже компенсирован в .plot-content */
    transform: none;
     /* Изменяем порядок элементов */
    order: 1;
    /* ПОДНИМАЕМ ВЫШЕ - добавляем отрицательный margin-top */
    margin-top: -40px;
}

.progress-bar {
    width: 50%;
    height: 4px;
    background: rgba(224, 224, 224, 0.8);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: 2px;
     /* Перемещаем прогресс-бар вниз */
    order: 3;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    transition: width 0.5s ease;
    transform: translateZ(0);
}

/* Горизонтальное расположение текстовых индикаторов - СИЛЬНО УМЕНЬШЕННЫЙ */
.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 50%;
    gap: 4px; 
    /* Перемещаем текст и таймер НАД прогресс-баром */
    order: 2;
    margin-bottom: 4px;  
}

.building-text {
    font-size: 0.5em;
    font-weight: bold;
    color: #e65100;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.timer {
    font-size: 0.5em;
    font-weight: bold;
    color: #d32f2f;
    white-space: nowrap;
}

.building-level {
    font-size: 0.5em;
    color: #666;
    font-weight: bold;
    margin-top: 10px;
    /* Уровень размещаем над всем */
    order: 1;
    width: 100%;
    text-align: center;
    margin-bottom: 2px;
}

/* ЗАВЕРШЕННЫЕ СТРОЕНИЯ - УМЕНЬШЕННЫЙ РАЗМЕР */
.completed-building {
    text-align: center;
    padding: 4px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    /* БЕЗ ДОПОЛНИТЕЛЬНОГО ПОВОРОТА - уже компенсирован в .plot-content */
    transform: none;
}

.building-emoji {
    font-size: 1.6em;
    margin-bottom: 1px;
    display: block;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
}

.building-name-completed {
    font-size: 0.6em;
    font-weight: bold;
    color: #2d5016;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

.building-level-completed {
    font-size: 0.5em;
    color: #666;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.8);
    padding: 1px 3px;
    border-radius: 3px;
}

/* ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ ИЗОБРАЖЕНИЙ ЗДАНИЙ С УДАЛЕНИЕМ БЕЛОГО ФОНА */
.farm-character,
.castle-character,
.house-character,
.mine-character,
.lake-character {
    /* Фильтры для удаления белого фона и улучшения контура */
    filter: 
        brightness(1.1) 
        contrast(1.2)
        drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3))
        drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.2));
    
    /* Дополнительные фильтры для удаления белого фона */
    mix-blend-mode: multiply;
}

/* Стили для изображения фермы - СИЛЬНО УМЕНЬШЕННЫЙ РАЗМЕР */
.farm-character {
    width: 85%;
    height: 85%;
    object-fit: contain;
    transform: translateX(-50%) translateZ(10px) scale(1.05);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    z-index: 8;
    /* Центрируем и поднимаем выше */
    top: -23%;
    left: 50%;
}

.farm-building-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transform: none;
    perspective: 1200px;
    overflow: visible;
}

/* Подложка для фермы чтобы отделить от фона участка */
.farm-building-container::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    right: 25%;
    bottom: 25%;
    background: 
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.6) 0%, transparent 60%),
        radial-gradient(circle at 30% 70%, rgba(139, 195, 74, 0.3) 0%, transparent 50%);
    border-radius: 15px;
    filter: blur(10px);
    transform: translateZ(-8px);
    z-index: 5;
    opacity: 0.7;
    pointer-events: none;
}

/* Стили для изображения замка - СИЛЬНО УМЕНЬШЕННЫЙ РАЗМЕР */
.castle-character {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transform: translateX(-50%) translateZ(15px) scale(1.1);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    z-index: 8;
    top: -39%;
    left: 50%;
}

.castle-building-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transform: none;
    perspective: 1500px;
    overflow: visible;
}

/* Подложка для замка */
.castle-building-container::before {
    content: '';
    position: absolute;
    top: 30%;
    left: 30%;
    right: 30%;
    bottom: 30%;
    background: 
        radial-gradient(circle at 30% 70%, rgba(255, 215, 0, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(139, 195, 74, 0.3) 0%, transparent 50%);
    border-radius: 10px;
    filter: blur(12px);
    transform: translateZ(-10px);
    z-index: 5;
    opacity: 0.8;
    pointer-events: none;
}

/* Стили для изображения дома */
.house-character {
    width: 85%;
    height: 85%;
    object-fit: contain;
    transform: translateX(-50%) translateZ(12px) scale(1.1);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    z-index: 8;
    top: -33%;
    left: 50%;
}

/* Ур.1 — 3D-домик (белые стены, красная крыша, рыжий котик) */
.house-character.house-lvl1 {
    width: 65%;
    height: 65%;
    top: -12%;
    transform: translateX(-50%) translateZ(12px) scale(1.02);
    /* 3D-рендер уже с прозрачным фоном — multiply не нужен (затемняет тени) */
    mix-blend-mode: normal;
    filter:
        brightness(1.02)
        contrast(1.05)
        saturate(1.08)
        drop-shadow(4px 6px 10px rgba(0, 0, 0, 0.35));
}

/* Ур.2+ — каменный 1-й этаж + деревянный 2-й (3D, выше) */
.house-character.house-lvl2 {
    width: 65%;
    height: 65%;
    top: -18%;
    transform: translateX(-50%) translateZ(12px) scale(1.05);
    /* 3D-рендер с прозрачным фоном — multiply не нужен */
    mix-blend-mode: normal;
    filter:
        brightness(1.02)
        contrast(1.05)
        saturate(1.08)
        drop-shadow(4px 6px 10px rgba(0, 0, 0, 0.35));
}

.house-building-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transform: none;
    perspective: 1200px;
    overflow: visible;
}

/* Подложка для дома */
.house-building-container::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    right: 20%;
    bottom: 20%;
    background: 
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.6) 0%, transparent 60%),
        radial-gradient(circle at 30% 70%, rgba(255, 193, 7, 0.3) 0%, transparent 50%);
    border-radius: 12px;
    filter: blur(10px);
    transform: translateZ(-8px);
    z-index: 5;
    opacity: 0.7;
    pointer-events: none;
}

/* Стили для изображения шахты */
.mine-character {
    width: 80%;
    height: 80%;
    object-fit: contain;
    transform: translateX(-50%) translateZ(14px) scale(1.08);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    z-index: 8;
    top: -27%;
    left: 50%;
}

.mine-building-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transform: none;
    perspective: 1300px;
    overflow: visible;
}

/* Подложка для шахты */
.mine-building-container::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    right: 25%;
    bottom: 25%;
    background: 
        radial-gradient(circle at 30% 70%, rgba(121, 85, 72, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(158, 158, 158, 0.3) 0%, transparent 50%);
    border-radius: 15px;
    filter: blur(12px);
    transform: translateZ(-10px);
    z-index: 5;
    opacity: 0.8;
    pointer-events: none;
}

/* Стили для изображения озера — 3D-спрайт (изометрия, как дом) */
.lake-character,
.lake-building-container .lake-character {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transform: translateX(-50%) translateZ(12px) scale(1.0);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    z-index: 8;
    top: -34%;
    left: 50%;
    /* 3D-рендер уже с прозрачным фоном — multiply не нужен (затемняет воду) */
    filter:
        brightness(1.02)
        contrast(1.05)
        saturate(1.08)
        drop-shadow(4px 6px 10px rgba(0, 0, 0, 0.35));
    mix-blend-mode: normal;
}

/* Озеро в клетке: специфичнее, чем `.lake-building-container img` (там multiply) */
.lake-building-container .lake-character {
    mix-blend-mode: normal;
}

/* Мягкий подъём озера при наведении (как у 3D-домиков), без высокого прыжка */
.plot.completed:hover .lake-building-container .lake-character {
    transform: translateX(-50%) translateZ(16px) scale(1.05);
    filter:
        brightness(1.04)
        contrast(1.06)
        saturate(1.1)
        drop-shadow(6px 8px 14px rgba(0, 0, 0, 0.4));
}

.lake-building-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transform: none;
    perspective: 1200px;
    overflow: visible;
}

/* Подложка для озера */
.lake-building-container::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    right: 20%;
    bottom: 20%;
    background: 
        radial-gradient(circle at 50% 30%, rgba(100, 181, 246, 0.4) 0%, transparent 60%),
        radial-gradient(circle at 30% 70%, rgba(76, 175, 80, 0.3) 0%, transparent 50%);
    border-radius: 50%;
    filter: blur(12px);
    transform: translateZ(-8px);
    z-index: 5;
    opacity: 0.7;
    pointer-events: none;
}

/* Эффект при наведении на участок с озером */
.plot.completed:hover .lake-character {
    transform: translateX(-50%) translateZ(20px) scale(1.12);
    filter: drop-shadow(8px 8px 15px rgba(0, 0, 0, 0.4));
}

/* Эффект при наведении на участок с фермой */
.plot.completed:hover .farm-character {
    transform: translateX(-50%) translateZ(20px) scale(1.1);
    filter: 
        brightness(1.3)
        contrast(1.5)
        drop-shadow(6px 6px 12px rgba(0, 0, 0, 0.5))
        drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.3))
        saturate(1.4);
    top: -28%;
}

/* Эффект при наведении на участок с замком */
.plot.completed:hover .castle-character {
    transform: translateX(-50%) translateZ(25px) scale(1.15);
    filter: 
        brightness(1.3)
        contrast(1.5)
        drop-shadow(8px 8px 16px rgba(0, 0, 0, 0.6))
        drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.3))
        saturate(1.4);
    top: -44%;
}

/* Эффект при наведении на участок с домом (общий fallback) */
.plot.completed:hover .house-character {
    transform: translateX(-50%) translateZ(22px) scale(1.15);
    filter: 
        brightness(1.3)
        contrast(1.5)
        drop-shadow(6px 6px 12px rgba(0, 0, 0, 0.5))
        drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.3))
        saturate(1.4);
    top: -38%;
}

/* 3D-дома (Ур.1/Ур.2) при наведении — мягкий подъём, без резкого прыжка */
.plot.completed:hover .house-character.house-lvl1 {
    top: -12%;
    transform: translateX(-50%) translateZ(14px) scale(1.04);
    filter:
        brightness(1.1)
        contrast(1.08)
        saturate(1.1)
        drop-shadow(5px 7px 12px rgba(0, 0, 0, 0.45));
}

.plot.completed:hover .house-character.house-lvl2 {
    top: -18%;
    transform: translateX(-50%) translateZ(14px) scale(1.06);
    filter:
        brightness(1.1)
        contrast(1.08)
        saturate(1.1)
        drop-shadow(5px 7px 12px rgba(0, 0, 0, 0.45));
}

/* Эффект при наведении на участок с шахтой */
.plot.completed:hover .mine-character {
    transform: translateX(-50%) translateZ(24px) scale(1.12);
    filter: 
        brightness(1.3)
        contrast(1.5)
        drop-shadow(7px 7px 14px rgba(0, 0, 0, 0.6))
        drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.3))
        saturate(1.4);
    top: -32%;
}

/* Усиленное свечение участка при наведении */
.plot.completed:hover::after {
    content: '';
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background: radial-gradient(circle at center, 
        rgba(255, 215, 0, 0.3) 0%, 
        rgba(139, 195, 74, 0.2) 40%, 
        transparent 70%);
    border-radius: 12px;
    z-index: 6;
    pointer-events: none;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.7; }
}

/* Анимация появления фермы - ДВИЖЕНИЕ СВЕРХУ ВНИЗ */
@keyframes farm-3d-appear {
    0% {
        transform: translateX(10%) translateZ(70px) scale(1.65);
        opacity: 0;
        filter: brightness(0.9) saturate(0.8);
        top: -40%;
    }
    100% {
        transform: translateX(10%) translateZ(70px) scale(1.15);
        opacity: 1;
        filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.2));
        top: -20%;
    }
}

.farm-building-container.animate-once {
    animation: farm-3d-appear 0.9s ease-out forwards;
}

/* Анимация появления замка с 3D эффектом */
@keyframes castle-3d-appear {
    0% {
        transform: translateX(10%) translateZ(70px) scale(1.65);
        opacity: 0;
        filter: brightness(0.9) saturate(0.8);
        top: -40%;
    }
    100% {
        transform: translateX(10%) translateZ(70px) scale(1.15);
        opacity: 1;
        filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.2));
        top: -20%;
    }
}

.castle-building-container.animate-once {
    animation: castle-3d-appear 0.9s ease-out forwards;
}

/* Анимация появления дома - ДВИЖЕНИЕ СВЕРХУ ВНИЗ */
@keyframes house-3d-appear {
    0% {
        transform: translateX(10%) translateZ(70px) scale(1.65);
        opacity: 0;
        filter: brightness(0.9) saturate(0.8);
        top: -43%;
    }
    100% {
        transform: translateX(10%) translateZ(70px) scale(1.15);
        opacity: 1;
        filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.2));
        top: -33%;
    }
}

.house-building-container.animate-once {
    animation: house-3d-appear 0.9s ease-out forwards;
}

/* Анимация появления шахты - ДВИЖЕНИЕ СВЕРХУ ВНИЗ */
@keyframes mine-3d-appear {
    0% {
        transform: translateX(10%) translateZ(70px) scale(1.65);
        opacity: 0;
        filter: brightness(0.9) saturate(0.8);
        top: -40%;
    }
    100% {
        transform: translateX(10%) translateZ(70px) scale(1.15);
        opacity: 1;
        filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.2));
        top: -22%;
    }
}

.mine-building-container.animate-once {
    animation: mine-3d-appear 0.9s ease-out forwards;
}

/* ПУСТЫЕ УЧАСТКИ - только номер */
.plot:not(.building):not(.completed) .plot-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Тень под поднятым полем - теперь только для строительства */
.game-area::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, transparent 70%);
    filter: blur(15px);
    transform: rotateX(90deg) translateZ(-80px);
    z-index: -1;
    bottom: -40px;
    opacity: 0.7;
}

.game-info {
    text-align: center;
    padding: 20px;
    background: rgba(227, 242, 253, 0.9);
    border-radius: 12px;
    margin-top: 30px;
    border: 2px solid rgba(144, 202, 249, 0.6);
    backdrop-filter: blur(5px);
}

.game-info p {
    margin: 0;
    color: #1565c0;
    font-weight: 600;
}

/* АЛЬТЕРНАТИВНЫЕ ВАРИАНТЫ ДЛЯ УДАЛЕНИЯ БЕЛОГО ФОНА */
/* Вариант 1 - более агрессивное удаление белого */
.farm-character.no-bg,
.castle-character.no-bg,
.house-character.no-bg,
.mine-character.no-bg,
.lake-character.no-bg {
    filter: 
        brightness(0) 
        invert(1)
        drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3))
        drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.2));
}

/* Вариант 2 - через blend modes */
.farm-character.blend-mode,
.castle-character.blend-mode,
.house-character.blend-mode,
.mine-character.blend-mode,
.lake-character.blend-mode {
    mix-blend-mode: darken;
    filter: 
        brightness(1.1)
        contrast(1.3)
        drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.4))
        drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.3));
}

/* Вариант 3 - временное решение с box-shadow */
.farm-character.temp-fix,
.castle-character.temp-fix,
.house-character.temp-fix,
.mine-character.temp-fix,
.lake-character.temp-fix {
    filter: 
        brightness(1.1)
        contrast(1.3)
        drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.4))
        drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.3))
        saturate(1.2);
    
    /* Попытка скрыть белые края */
    box-shadow: 0 0 0 1px rgba(139, 195, 74, 0.3) inset;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    body {
        background: linear-gradient(rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9)), 
                    url('/games/ferma/static/images/background.jpeg') no-repeat center center fixed;
        background-size: cover;
        padding: 10px;
    }
    
    .plots-grid {
        transform: perspective(800px) rotateX(60deg) rotateY(0deg) rotateZ(45deg) translateZ(30px) scale(0.9);
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .plot {
        outline-offset: 7px;
    }
    
    .plot {
        width: 130px;
        height: 130px;
        min-width: 130px;
        min-height: 130px;
        max-width: 130px;
        max-height: 130px;
    }
    
    .plot.building {
        transform: translateZ(20px) scale(1.03);
    }
    
    @keyframes building-pulse-mobile {
        0% { transform: translateZ(20px) scale(1.03); }
        50% { transform: translateZ(25px) scale(1.05); }
        100% { transform: translateZ(20px) scale(1.03); }
    }
    
    .plot.building {
        animation: building-pulse-mobile 2s ease-in-out infinite;
    }
    
    .plot-content {
        transform: rotate(-45deg) rotateX(-60deg) scale(0.9);
    }
    
    .plot-number {
        transform: rotate(45deg) rotateX(60deg) rotate(-5deg) scale(1.1);
    }
    
    .game-area {
        padding: 50px 0;
        margin: 30px 0;
    }
    
    .building-emoji {
        font-size: 1.4em;
    }
    
    .farm-character {
        width: 60%;
        height: 60%;
        transform: translateX(-50%) translateZ(8px) scale(1.03);
        top: -15%;
    }
    
    .castle-character {
        width: 55%;
        height: 55%;
        transform: translateX(-50%) translateZ(10px) scale(1.05);
        top: -10%;
    }
    
    .house-character {
        width: 55%;
        height: 55%;
        transform: translateX(-50%) translateZ(9px) scale(1.05);
        top: -23%;
    }
    
    .mine-character,
    .lake-character {
        width: 60%;
        height: 60%;
        transform: translateX(-50%) translateZ(10px) scale(1.04);
        top: -18%;
    }
    
    .plot.completed:hover .farm-character {
        transform: translateX(-50%) translateZ(15px) scale(1.05);
        top: -25%;
    }
    
    .plot.completed:hover .castle-character {
        transform: translateX(-50%) translateZ(18px) scale(1.08);
        top: -20%;
    }
    
    .plot.completed:hover .house-character {
        transform: translateX(-50%) translateZ(16px) scale(1.08);
        top: -25%;
    }
    
    .plot.completed:hover .mine-character {
        transform: translateX(-50%) translateZ(17px) scale(1.06);
        top: -23%;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .resources {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .building-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Уменьшенные индикаторы для мобильных */
    .building-progress {
        padding: 4px 3px;
        gap: 2px;
        margin-top: -30px;
    }
    
    .progress-bar {
        width: 75%;
        height: 5px;
    }
    
    .building-text,
    .timer {
        font-size: 0.45em;
    }
    
    .building-emoji {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    body {
        background: linear-gradient(rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95)), 
                    url('/games/ferma/static/images/background.jpeg') no-repeat center center fixed;
        background-size: cover;
    }
    
    .plots-grid {
        transform: perspective(600px) rotateX(60deg) rotateY(0deg) rotateZ(45deg) translateZ(20px) scale(0.8);
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .plot {
        outline-offset: 5px;
    }
    
    .plot {
        width: 110px;
        height: 110px;
        min-width: 110px;
        min-height: 110px;
        max-width: 110px;
        max-height: 110px;
    }
    
    .plot.building {
        transform: translateZ(15px) scale(1.02);
    }
    
    @keyframes building-pulse-small {
        0% { transform: translateZ(15px) scale(1.02); }
        50% { transform: translateZ(20px) scale(1.04); }
        100% { transform: translateZ(15px) scale(1.02); }
    }
    
    .plot.building {
        animation: building-pulse-small 2s ease-in-out infinite;
    }
    
    .plot-content {
        transform: rotate(-45deg) rotateX(-60deg) scale(0.8);
    }
    
    .plot-number {
        transform: rotate(45deg) rotateX(60deg) rotate(-5deg) scale(1.2);
    }
    
    .game-area {
        padding: 40px 0;
        margin: 20px 0;
    }
    
    .building-emoji {
        font-size: 1em;
    }
    
    .farm-character {
        width: 50%;
        height: 50%;
        transform: translateX(-50%) translateZ(6px) scale(1.02);
        top: -10%;
    }
    
    .castle-character {
        width: 45%;
        height: 45%;
        transform: translateX(-50%) translateZ(8px) scale(1.03);
        top: -5%;
    }
    
    .house-character {
        width: 50%;
        height: 50%;
        transform: translateX(-50%) translateZ(7px) scale(1.03);
        top: -15%;
    }
    
    .mine-character {
        width: 55%;
        height: 55%;
        transform: translateX(-50%) translateZ(8px) scale(1.02);
        top: -13%;
    }
    
    .plot.completed:hover .farm-character {
        transform: translateX(-50%) translateZ(10px) scale(1.03);
        top: -20%;
    }
    
    .plot.completed:hover .castle-character {
        transform: translateX(-50%) translateZ(12px) scale(1.05);
        top: -15%;
    }
    
    .plot.completed:hover .house-character {
        transform: translateX(-50%) translateZ(11px) scale(1.05);
        top: -20%;
    }
    
    .plot.completed:hover .mine-character {
        transform: translateX(-50%) translateZ(12px) scale(1.04);
        top: -18%;
    }
    
    .building-options {
        grid-template-columns: 1fr;
    }
    
    .progress-info {
        flex-direction: column;
        gap: 1px;
    }
    
    .building-text,
    .timer {
        font-size: 0.4em;
    }
    
    /* Еще более уменьшенные индикаторы для маленьких экранов */
    .building-progress {
        padding: 3px 2px;
        gap: 1px;
        margin-top: -20px;
    }
    
    .progress-bar {
        width: 70%;
        height: 4px;
    }
    
    .building-emoji {
        font-size: 0.9em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plot.building {
        animation: none;
    }
    
    .building-option,
    .plot {
        transition: none;
    }
    
    .progress-fill {
        transition: none;
    }
    
    .farm-building-container.animate-once,
    .castle-building-container.animate-once,
    .house-building-container.animate-once,
    .mine-building-container.animate-once {
        animation: none;
    }
    
    .farm-character,
    .castle-character,
    .house-character,
    .mine-character {
        transition: none;
    }
    
    .plot.completed:hover .farm-character,
    .plot.completed:hover .castle-character,
    .plot.completed:hover .house-character,
    .plot.completed:hover .mine-character {
        transform: none;
        filter: none;
    }
}

/* Запасной фон если изображение не загрузится */
@media (max-width: 768px) {
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
}

/* Дополнительные классы для анимаций */
.building-click {
    animation: click-effect 0.5s ease-out;
}

@keyframes click-effect {
    0% { transform: translateZ(25px) scale(1.1); }
    100% { transform: translateZ(25px) scale(1.05); }
}

.building-start {
    animation: building-start 0.5s ease-out;
}

@keyframes building-start {
    0% { 
        transform: translateZ(0) scale(1);
        background: linear-gradient(135deg, rgba(197, 225, 165, 0.9), rgba(139, 195, 74, 0.9));
    }
    100% { 
        transform: translateZ(25px) scale(1.05);
        background: linear-gradient(135deg, rgba(255, 249, 196, 0.9), rgba(255, 235, 59, 0.9));
    }
}

.completed-new {
    animation: completed-new 1s ease-out;
}

@keyframes completed-new {
    0% { 
        transform: translateZ(25px) scale(1.05);
        box-shadow: 8px 8px 20px rgba(255, 152, 0, 0.5);
    }
    50% { 
        transform: translateZ(15px) scale(1.1);
        box-shadow: 0 0 30px rgba(76, 175, 80, 0.8);
    }
    100% { 
        transform: translateZ(0) scale(1);
        box-shadow: 3px 3px 10px rgba(76, 175, 80, 0.3);
    }
}

/* Уведомление о доходе */
.income-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(129, 199, 132, 0.95));
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    transform: translateX(400px);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.income-notification.show {
    transform: translateX(0);
}

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

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

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.98));
    border-radius: 20px;
    padding: 30px;
    min-width: 350px;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: linear-gradient(135deg, #ff5252, #ff1744);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(255, 23, 68, 0.3);
}

.modal-close:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 15px rgba(255, 23, 68, 0.5);
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(76, 175, 80, 0.3);
}

.modal-building-icon {
    font-size: 4em;
    margin-bottom: 10px;
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));
}

/* Картинка-иконка здания в шапке модалки (вместо эмодзи) */
.modal-building-icon img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    vertical-align: middle;
}

/* Мелкие inline-иконки (рыба, жители, хищник/гном — в таблице и заголовках) */
.mid-icon {
    width: 17px;
    height: 17px;
    object-fit: contain;
    vertical-align: -3px;
    margin-right: 3px;
}

/* Иконки ресурсов в верхней панели и в ценах/доходах */
.res-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: -4px;
    margin-right: 4px;
}
.cost-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: -3px;
    margin: 0 3px 0 1px;
}

.modal-building-name {
    font-size: 1.8em;
    color: #2d5016;
    background: linear-gradient(45deg, #2d5016, #4a7c1f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.modal-body {
    margin-bottom: 25px;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.modal-stat {
    background: linear-gradient(135deg, rgba(227, 242, 253, 0.9), rgba(187, 222, 251, 0.9));
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(144, 202, 249, 0.5);
}

.stat-label {
    display: block;
    font-size: 0.8em;
    color: #1565c0;
    font-weight: 600;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: #2d5016;
}

.modal-income {
    background: linear-gradient(135deg, rgba(232, 245, 232, 0.9), rgba(200, 230, 201, 0.9));
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(76, 175, 80, 0.5);
}

.modal-income h3 {
    font-size: 1.1em;
    color: #2e7d32;
    margin: 0 0 15px 0;
    text-align: center;
}

.income-items {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.income-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.income-icon {
    font-size: 1.3em;
}

/* Картинка-иконка ресурса в строке дохода (вместо эмодзи) */
.income-icon img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    vertical-align: middle;
}

.income-amount {
    font-weight: bold;
    font-size: 1.1em;
    color: #2e7d32;
}

.modal-progress-section {
    margin-top: 20px;
    background: linear-gradient(135deg, rgba(255, 243, 205, 0.9), rgba(255, 241, 118, 0.9));
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 152, 0, 0.5);
}

.modal-progress-section h3 {
    font-size: 1.1em;
    color: #e65100;
    margin: 0 0 15px 0;
    text-align: center;
}

.modal-progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.modal-progress-text {
    font-weight: bold;
    color: #e65100;
}

.modal-progress-time {
    font-weight: bold;
    color: #d32f2f;
}

.modal-progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(224, 224, 224, 0.8);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.modal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.modal-footer {
    text-align: center;
}

.modal-upgrade-btn {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    width: 100%;
}

.modal-upgrade-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.6);
    background: linear-gradient(135deg, #43a047, #4caf50);
}

.modal-upgrade-btn:active {
    transform: translateY(0);
}

/* Адаптивность модального окна */
@media (max-width: 480px) {
    .modal-content {
        min-width: 90%;
        padding: 20px;
    }
    
    .modal-stats {
        grid-template-columns: 1fr;
    }
    
    .modal-building-icon {
        font-size: 3em;
    }
    
    .modal-building-icon img {
        width: 64px;
        height: 64px;
    }
    
    .modal-building-name {
        font-size: 1.4em;
    }
}

/* Нижнее меню */
.bottom-menu {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.menu-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.menu-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.menu-tooltip {
    display: none;
    position: absolute;
    bottom: 55px;
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    z-index: 1001;
    text-align: left;
}

.menu-tooltip p {
    margin: 0;
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.menu-icon:hover .menu-tooltip {
    display: block;
}

/* Barscoin */
.barscoin-icon {
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
}

/* Иконка здания на участке - увеличенная */
.farm-building-container img,
.castle-building-container img,
.house-building-container img,
.mine-building-container img,
.lake-building-container img {
    filter: brightness(1.1) contrast(1.2)
        drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3));
    mix-blend-mode: multiply;
}

/* Увеличенные иконки и расстояние */
.building-option {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 8px;
}

/* Кот Маркиз — теперь на нижнем баннере Bars Village, реплики НАД котом */
.alps-banner {
    position: relative;
}

.marquis-section {
    position: absolute;
    right: 24px;
    bottom: 10px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    max-width: 360px;
    pointer-events: none;
}

.marquis-speech {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    pointer-events: auto;
}

.marquis-icon {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ffd700;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.3s ease;
    pointer-events: auto;
    background: #fff;
}

.marquis-icon:hover {
    transform: scale(1.1) rotate(-5deg);
}

.marquis-bubble {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 260px;
    border: 2px solid #ffd700;
    position: relative;
}

.marquis-bubble::after {
    content: '';
    position: absolute;
    right: 40px;
    bottom: -10px;
    width: 0;
    height: 0;
    border-top: 12px solid #ffd700;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
}

#marquis-quote {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    font-style: italic;
}

.marquis-author {
    font-size: 12px;
    color: #b8860b;
    text-align: right;
    margin-top: 6px;
    font-weight: 600;
}

.marquis-refresh {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ffd700;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 4px;
}

.marquis-refresh:hover {
    background: #ffd700;
    transform: rotate(180deg);
}

.marquis-speech.fade-in .marquis-bubble {
    animation: speech-fade 0.5s ease-out;
}

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

/* Баннер на всю ширину */
.header-banner {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}

.header-banner img {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Ресурсы под баннером */
header .resources {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 8px 0;
    margin-top: 0;
}

.resource {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
