/* Styles Travian avec perspective isométrique basée sur l'image de référence */

/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: url('/static/images/travian-village-bg.jpg'); /* Photo de background */
    background-size: cover; /* Couvre toute la page */
    background-position: center center; /* Centré */
    background-repeat: no-repeat;
    background-attachment: fixed; /* Fixe lors du scroll */
    backdrop-filter: blur(10px); /* Flou pour effet de style */
    min-height: 100vh;
    color: #333;
    overflow-x: auto;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1); /* Fond semi-transparent pour laisser voir l'image */
    border-radius: 15px;
    /* Pas de flou sur le container principal */
}

.village-container {
    position: relative;
    width: 100%;
}

.village-map {
    width: 100%;
    min-width: 0;
}






/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.2); /* Plus transparent pour laisser voir l'image */
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* Pas de flou sur le header */
}

header h1 {
    font-size: 2.5em;
    color: #2c5530;
    margin-bottom: 10px;
}

.back-link {
    display: inline-block;
    margin-top: 10px;
    color: #2c5530;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 16px;
    background: #98FB98;
    border-radius: 8px;
    transition: background 0.3s;
}

.back-link:hover {
    background: #90EE90;
}

/* Conteneur principal */
.village-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Contrôles du village */
.village-controls {
    display: block; /* Menu réactivé */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #8B4513;
    width: 300px;
    flex-shrink: 0;
    max-height: 80vh;
    overflow-y: auto;
}

.village-info {
    margin-bottom: 20px;
}

.village-info input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 2px solid #98FB98;
    border-radius: 8px;
    font-size: 16px;
}

.village-info button {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #2c5530;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.village-info button:hover {
    background: #1e3a21;
}

/* Placed Buildings Container - Independent */
.placed-buildings-container {
    position: absolute;
    top: 250px;
    width: 300px;
    z-index: 1000;
    max-height: 450px; /* More restrictive to prevent overflow */
    overflow-y: auto;
}

/* Buildings Legend - moved to left sidebar */
.buildings-legend {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #8B4513;
    backdrop-filter: blur(10px);
}

.buildings-legend h3 {
    color: #8B4513;
    font-size: 1.1em;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px solid #8B4513;
    padding-bottom: 5px;
}

.buildings-list {
    max-height: calc(100vh - 450px); /* Very restrictive to ensure scroll appears early */
    overflow-y: auto;
    padding: 5px;
}

.buildings-list .building-item {
    display: flex;
    align-items: center;
    padding: 6px; /* Reduced padding */
    margin: 3px 0; /* Reduced margin */
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    border: 1px solid #ddd;
}

.buildings-list .building-number {
    background: #8B4513;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px;
    margin-right: 8px;
    flex-shrink: 0;
}

.buildings-list .building-item img {
    width: 25px; /* Reduced from 30px */
    height: 25px; /* Reduced from 30px */
    margin-right: 8px; /* Reduced margin */
    border-radius: 4px;
    object-fit: cover;
}

.buildings-list .building-info {
    flex: 1;
}

.buildings-list .building-name {
    font-weight: bold;
    color: #333;
    font-size: 0.9em;
    margin-bottom: 2px;
}

.buildings-list .building-level {
    font-size: 0.8em;
    color: #666;
}

/* Bouton d'export spécial */
#exportVillage {
    background: #2E8B57 !important;
    font-weight: bold;
    border: 2px solid #228B22;
}

#exportVillage:hover {
    background: #3CB371 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Carte du village - Perspective isométrique basée sur l'image */
.village-map {
    flex: 1;
    position: relative;
    background: url('/static/images/travian-village-bg.jpg'); /* Image de fond sur la div village-map */
    background-size: 300%; /* Zoom de 200% - vous pouvez ajuster cette valeur */
    background-position: center 10%; /* Centré horizontalement, décalé vers le bas */
    background-repeat: no-repeat;
    background-attachment: scroll; /* Scroll normal */
    z-index: 1;
    border-radius: 15px;
    padding: 0; /* Pas de padding pour que l'image remplisse */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 700px; /* Hauteur augmentée pour accommoder l'image plus grande */
    overflow: hidden;
    /* Pas de flou sur la carte du village */
}

.village-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; /* Transparent car l'image est maintenant sur village-map */
    border-radius: 15px;
    overflow: hidden;
    /* Image à plat - pas de perspective */
}

/* Village principal */
.village2 {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Île centrale avec forme authentique Travian */
.village-island {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 737px;
    height: 529px;
    background: rgba(139, 115, 85, 0.2); /* Couleur terre très transparente pour s'harmoniser avec l'image */
    border-radius: 50%;
    border: 2px solid rgba(101, 89, 65, 0.4);
    z-index: 10;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.1),
        0 0 30px rgba(0, 0, 0, 0.2);
}

/* Slots de bâtiments */
.building-slot {
    position: absolute;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 15;
}

.building-slot:hover {
    transform: scale(1.05);
}

/* Forme des slots adaptée à l'image */
.building-slot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120"><defs><filter id="shadow"><feDropShadow dx="2" dy="2" stdDeviation="3" flood-color="rgba(0,0,0,0.5)"/></filter></defs><path d="M49.4 70.4c-7.8 1.8-13.5 4.7-16.8 8.6-3.5 4.3-4.1 7.2-2.1 11.3 3.3 7.1 13.9 11.7 28.5 12.4 19.8 1.1 35-6.5 35-17.5 0-4.9-5.8-10.2-14.2-13.1-8.1-2.8-22-3.6-30.4-1.7z" fill="%23c4a484" stroke="%23a0956b" stroke-width="2" filter="url(%23shadow)"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    /* Effet de relief */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.building-slot.occupied::before {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120"><defs><filter id="shadow"><feDropShadow dx="2" dy="2" stdDeviation="3" flood-color="rgba(0,0,0,0.5)"/></filter></defs><path d="M49.4 70.4c-7.8 1.8-13.5 4.7-16.8 8.6-3.5 4.3-4.1 7.2-2.1 11.3 3.3 7.1 13.9 11.7 28.5 12.4 19.8 1.1 35-6.5 35-17.5 0-4.9-5.8-10.2-14.2-13.1-8.1-2.8-22-3.6-30.4-1.7z" fill="%23b8956b" stroke="%2396855a" stroke-width="2" filter="url(%23shadow)"/></svg>');
}

/* Positions des slots selon la disposition Travian authentique - en pourcentages pour la responsivité */
.building-slot[data-slot="1"] { 
    top: 32%; 
    left: 26%; 
    background: #666 !important; /* Grisé pour indiquer qu'il n'est pas utilisable */
    opacity: 0.5;
    cursor: not-allowed;
}
.building-slot[data-slot="2"] { top: 47%; left: 28%; }
.building-slot[data-slot="3"] { top: 23%; left: 15%; }
.building-slot[data-slot="4"] { top: 37%; left: 6%; }
.building-slot[data-slot="5"] { top: 50%; left: 8%; }
.building-slot[data-slot="6"] { top: 63%; left: 11%; }

.building-slot[data-slot="7"] { top: 62%; left: 40%; }
.building-slot[data-slot="8"] { top: 74%; left: 26%; }
.building-slot[data-slot="9"] { top: 77%; left: 41%; }

.building-slot[data-slot="10"] { top: 60%; left: 57%; }
.building-slot[data-slot="11"] { top: 76%; left: 58%; }
.building-slot[data-slot="12"] { top: 68%; left: 71%; }

.building-slot[data-slot="13"] { 
    top: 41%; 
    left: 64%; 
    background: #666 !important; /* Grisé pour indiquer qu'il n'est pas utilisable */
    opacity: 0.5;
    cursor: not-allowed;
}
.building-slot[data-slot="14"] { top: 49%; left: 83%; }
.building-slot[data-slot="15"] { top: 33%; left: 84%; }
.building-slot[data-slot="16"] { top: 24%; left: 74%; }

.building-slot[data-slot="17"] { top: 32%; left: 47%; }
.building-slot[data-slot="18"] { top: 21%; left: 56%; }
.building-slot[data-slot="19"] { top: 10%; left: 65%; }
.building-slot[data-slot="20"] { top: 8%; left: 46%; }
.building-slot[data-slot="21"] { top: 11%; left: 33%; }

/* Bâtiments placés */
.building-placed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    z-index: 20;
    /* Effet de relief pour les bâtiments */
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.8));
    pointer-events: auto;
    overflow: visible;
}

.building-placed .building-sprite {
    width: 50px;
    height: 50px;
    margin-bottom: 2px;
}

.building-placed .building-sprite svg {
    width: 100%;
    height: 100%;
    /* Effet de profondeur léger */
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.6));
}


.building-placed .building-name {
    font-size: 8px;
    margin-top: 2px;
    background: rgba(0, 0, 0, 0.8);
    padding: 1px 4px;
    border-radius: 2px;
    border: 1px solid #fff;
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

/* Styles pour les images de bâtiments */
.building-placed img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #654321;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Numéro sur les bâtiments */
.building-placed .building-number {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #ff6b35;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 25;
}

/* Bouton de suppression */
.building-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    /* Ensure it's always clickable */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.building-remove-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.building-remove-btn:active {
    transform: scale(0.95);
}


/* Plus d'overlay nécessaire car l'image est maintenant sur tout le body */

/* Menu déroulant pour sélectionner les bâtiments */
.building-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 500px;
    max-height: 70vh;
    overflow: hidden;
    border: 2px solid #8B4513;
}

.dropdown-header {
    background: #8B4513;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #654321;
}

.dropdown-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

    .dropdown-content {
        max-height: 80vh; /* Increased from 70vh */
        overflow-y: auto;
        padding: 10px;
        /* Prevent scroll events from bubbling */
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        /* Better mobile scrolling */
        overscroll-behavior: contain;
    }

.building-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.building-item:hover {
    background: rgba(139, 69, 19, 0.1);
    border-color: #8B4513;
    transform: translateX(5px);
}

.building-item img {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 5px;
    object-fit: cover;
}

.building-info {
    flex: 1;
}

.building-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.building-description {
    font-size: 0.85em;
    color: #666;
    line-height: 1.3;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

.building-config {
    margin-top: 20px;
}

.building-config label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

.building-config input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid #98FB98;
    border-radius: 8px;
}

.building-config button {
    padding: 10px 20px;
    margin-right: 10px;
    background: #2c5530;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.building-config button:hover {
    background: #1e3a21;
}

.share-content, .image-content {
    text-align: center;
}

.share-content img {
    max-width: 200px;
    margin: 20px 0;
}

.image-content img {
    max-width: 100%;
    margin: 20px 0;
    border-radius: 10px;
}

/* Informations du village (pour la vue partagée) */
.village-info {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.village-info h3 {
    color: #2c5530;
    margin-bottom: 15px;
}

.village-info h4 {
    color: #2c5530;
    margin: 20px 0 10px 0;
}

.building-list {
    list-style: none;
}

.building-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
}

.building-list li:last-child {
    border-bottom: none;
}

.building-list .building-icon {
    margin-right: 10px;
    font-size: 18px;
}

/* Responsive */
@media (max-width: 1200px) {
    .village-container {
        flex-direction: column;
    }
    
    .village-controls {
        width: 100%;
    }
    
    .container {
        max-width: 100%;
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .village-controls {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .village-info input {
        font-size: 18px; /* Prevent zoom on iOS */
        padding: 12px;
    }
    
    .village-info button {
        font-size: 18px;
        padding: 12px;
    }
    
    .village-map {
        padding: 5px;
        min-height: 450px;
        max-width: 100vw;
        overflow: hidden;
        /* Enhanced background zoom for mobile */
        background-size: 500%; /* Increased zoom for mobile */
        background-position: center 15%; /* Better positioning for mobile */
    }
    
    .village-background {
        height: 450px;
    }
    
    .village-island {
        width: 380px;
        height: 300px;
        /* Move village island higher on mobile */
        top: 40%; /* Moved up from 50% */
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .building-slot {
        width: 42px;
        height: 42px;
    }
    
    .building-slot:hover {
        transform: scale(1.1); /* Slightly larger for touch */
    }
    
    .building-placed img {
        width: 42px;
        height: 42px;
    }
    
    .building-placed .building-number {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    .building-remove-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    /* Mobile-friendly dropdown */
    .building-dropdown {
        max-width: 95vw;
        max-height: 95vh; /* Increased from 90vh */
        top: 2%; /* Moved up from 5% */
        left: 50%;
        transform: translateX(-50%);
    }
    
    .dropdown-content {
        max-height: 85vh; /* Increased from 75vh */
    }
    
    .building-item {
        padding: 10px; /* Reduced from 15px */
    }
    
    .building-item img {
        width: 45px; /* Reduced from 50px */
        height: 45px; /* Reduced from 50px */
    }
    
    .building-name {
        font-size: 1em; /* Reduced from 1.1em */
    }
    
    .building-description {
        font-size: 0.85em; /* Reduced from 0.9em */
    }
    
    /* Mobile styles for placed buildings container */
    .placed-buildings-container {
        position: absolute;
        left: 10px;
        top: 0;
        width: 280px;
        max-height: calc(100vh - 250px); /* More restrictive on mobile */
    }
    
    .buildings-legend {
        padding: 12px;
    }
    
    .buildings-legend h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .buildings-list {
        max-height: 50vh;
    }
    
    .buildings-list .building-item {
        padding: 6px;
        margin: 3px 0;
    }
    
    .buildings-list .building-number {
        width: 18px;
        height: 18px;
        font-size: 9px;
        margin-right: 6px;
    }
    
    .buildings-list .building-item img {
        width: 25px;
        height: 25px;
        margin-right: 8px;
    }
    
    .buildings-list .building-name {
        font-size: 0.85em;
    }
    
    .buildings-list .building-level {
        font-size: 0.7em;
    }
    
    
    /* Mobile modals */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
    }
    
    .building-config input {
        font-size: 18px;
        padding: 12px;
    }
    
    .building-config button {
        font-size: 18px;
        padding: 12px 20px;
        margin: 5px;
    }
    
    /* Mobile layout: Move share controls to bottom */
    .village-container {
        flex-direction: column;
    }
    
    .village-controls {
        order: 2; /* Move to bottom */
        margin-top: 20px;
        margin-bottom: 0;
        padding: 10px;
        background: rgba(255, 255, 255, 0.95);
    }
    
    .village-info {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
    }
    
    .village-info input {
        width: 100%;
        max-width: 300px;
        margin-bottom: 0;
        font-size: 18px;
        padding: 12px;
        text-align: center;
    }
    
    .village-info button {
        width: 200px;
        margin-bottom: 0;
        font-size: 18px;
        padding: 12px 20px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .village-controls {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .village-map {
        min-height: 380px;
        max-width: 100vw;
        overflow: hidden;
        /* Enhanced background zoom for mobile */
        background-size: 600%; /* Even more zoom for smaller mobile */
        background-position: center 20%; /* Better positioning for small mobile */
    }
    
    .village-background {
        height: 380px;
    }
    
    .village-island {
        width: 320px;
        height: 250px;
        /* Move village island higher on mobile */
        top: 35%; /* Moved up from 50% */
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .building-slot {
        width: 38px;
        height: 38px;
    }
    
    .building-placed img {
        width: 38px;
        height: 38px;
    }
    
    .building-placed .building-number {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .building-remove-btn {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
    
    .building-dropdown {
        max-width: 98vw;
        max-height: 95vh; /* Increased height */
        top: 2%; /* Moved up from 5% */
    }
    
    .building-item {
        padding: 12px;
    }
    
    .building-item img {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 3px;
    }
    
    header {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.6em;
    }
    
    .village-map {
        min-height: 320px;
        /* Maximum background zoom for very small mobile */
        background-size: 700%; /* Maximum zoom for tiny screens */
        background-position: center 25%; /* Optimized positioning for very small mobile */
    }
    
    .village-background {
        height: 320px;
    }
    
    .village-island {
        width: 280px;
        height: 220px;
        /* Move village island higher on very small mobile */
        top: 30%; /* Moved up from 50% */
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .building-slot {
        width: 35px;
        height: 35px;
    }
    
    .building-placed img {
        width: 35px;
        height: 35px;
    }
    
    .building-placed .building-number {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
    
    .building-remove-btn {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .village-info {
        flex-direction: column;
        gap: 12px;
    }
    
    .village-info input {
        font-size: 18px;
        padding: 12px;
        max-width: 280px;
    }
    
    .village-info button {
        font-size: 18px;
        padding: 12px 20px;
        width: 180px;
    }
    
    /* Mobile styles for placed buildings container */
    .placed-buildings-container {
        position: absolute;
        left: 5px;
        top: 0;
        width: 260px;
        max-height: calc(100vh - 200px); /* More restrictive on small mobile */
    }
    
    .buildings-legend {
        padding: 10px;
    }
    
    .buildings-legend h3 {
        font-size: 0.95em;
        margin-bottom: 8px;
    }
    
    .buildings-list {
        max-height: 45vh;
    }
    
    .buildings-list .building-item {
        padding: 5px;
        margin: 2px 0;
    }
    
    .buildings-list .building-number {
        width: 16px;
        height: 16px;
        font-size: 8px;
        margin-right: 5px;
    }
    
    .buildings-list .building-item img {
        width: 22px;
        height: 22px;
        margin-right: 6px;
    }
    
    .buildings-list .building-name {
        font-size: 0.8em;
    }
    
    .buildings-list .building-level {
        font-size: 0.65em;
    }
    
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .building-slot:hover {
        transform: none;
    }
    
    .building-item:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.8);
    }
    
    .building-legend-item:hover {
        transform: none;
    }
    
    .village-info button:hover {
        background: #2c5530;
    }
    
    .building-config button:hover {
        background: #2c5530;
    }
    
    .close-btn:hover {
        background-color: transparent;
    }
    
    .building-remove-btn:hover {
        background: #dc2626;
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .building-slot:active {
        transform: scale(0.95);
    }
    
    .building-item:active {
        transform: scale(0.98);
        background: rgba(139, 69, 19, 0.2);
    }
    
    .village-info button:active {
        background: #1e3a21;
        transform: scale(0.98);
    }
    
    .building-config button:active {
        background: #1e3a21;
        transform: scale(0.98);
    }
    
    .building-remove-btn:active {
        background: #b91c1c;
        transform: scale(0.9);
    }
}
