/* ===== RESET & BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0c0c1d; 
    color: #e0e0e0; 
    overflow: hidden;
    line-height: 1.5;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #16213e 100%);
    position: relative;
}
.login-page::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e94560' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.login-box {
    background: rgba(20, 20, 40, 0.85);
    padding: 50px;
    border-radius: 20px;
    border: 1px solid rgba(233, 69, 96, 0.3);
    backdrop-filter: blur(20px);
    max-width: 520px;
    width: 92%;
    position: relative;
    z-index: 1;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5), 0 0 100px rgba(233, 69, 96, 0.1);
}

.login-box h1 { 
    color: #e94560; 
    margin-bottom: 8px; 
    text-align: center;
    font-size: 32px;
    text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
    letter-spacing: 1px;
}
.login-box h2 { 
    color: #8b92b4; 
    font-size: 15px; 
    margin-bottom: 35px; 
    text-align: center;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.forms { display: flex; gap: 25px; flex-wrap: wrap; }
.forms form { flex: 1; min-width: 200px; }
.forms form h3 { 
    color: #fff; 
    margin-bottom: 18px; 
    font-size: 18px;
    border-bottom: 2px solid rgba(233, 69, 96, 0.3);
    padding-bottom: 8px;
}

input {
    width: 100%;
    padding: 13px 15px;
    margin-bottom: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 14px;
    transition: all 0.3s;
}
input:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}
input::placeholder { color: #555; }

button {
    width: 100%;
    padding: 13px;
    margin-bottom: 10px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #e94560, #c73e54);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}
button:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.4);
}
button:active { transform: translateY(0); }

/* ===== GAME UI ===== */
#game-ui { 
    display: flex; 
    flex-direction: column; 
    height: 100vh;
    background: #0a0a1a;
}

/* Top Bar */
#top-bar {
    display: flex;
    gap: 12px;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(15,15,35,0.95), rgba(10,10,25,0.98));
    border-bottom: 2px solid #e94560;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 10;
}

.res-box {
    background: rgba(255,255,255,0.04);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s;
}
.res-box:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(233, 69, 96, 0.3);
}
.res-box b { color: #e94560; }
.res-box a { text-decoration: none; font-weight: bold; transition: all 0.2s; }
.res-box a:hover { color: #ff8a9b; text-shadow: 0 0 10px rgba(255,107,107,0.5); }

/* Main Area */
#main-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Map Container */



#world-map:active { cursor: grabbing; }

#map-controls {
    position: absolute;
    bottom: 25px;
    left: 25px;
    display: flex;
    gap: 6px;
    background: rgba(0,0,0,0.6);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
}

#map-controls button {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 18px;
    margin: 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
}
#map-controls button:hover { background: #e94560; }

#minimap {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    border: 2px solid rgba(233, 69, 96, 0.5);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Side Panel */
#side-panel {
    width: 400px;
    background: linear-gradient(180deg, rgba(15,15,35,0.98), rgba(10,10,25,0.99));
    border-left: 2px solid rgba(233, 69, 96, 0.3);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}

.panel-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-bottom: 2px solid rgba(233, 69, 96, 0.3);
}

.tab-btn {
    flex: 1;
    padding: 16px 5px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0;
    border-radius: 0;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}
.tab-btn:hover { color: #aaa; background: rgba(255,255,255,0.03); }
.tab-btn.active {
    color: #e94560;
    border-bottom-color: #e94560;
    background: rgba(233, 69, 96, 0.08);
}

.tab-content {
    display: none;
    padding: 22px;
    overflow-y: auto;
    flex: 1;
}
.tab-content.active { display: block; }
.tab-content h3 {
    color: #e94560;
    margin-bottom: 18px;
    font-size: 20px;
    border-bottom: 1px solid rgba(233, 69, 96, 0.2);
    padding-bottom: 10px;
}
.tab-content h4 { color: #fff; margin: 18px 0 10px; font-size: 16px; }

/* Village Grid */
#village-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.building-slot {
    aspect-ratio: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.building-slot::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.02));
    pointer-events: none;
}
.building-slot:hover { 
    border-color: #e94560; 
    transform: scale(1.08);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.2);
    z-index: 2;
}

.building {
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.building span { font-size: 24px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.building small { display: block; font-size: 10px; color: #888; margin-top: 2px; font-weight: 600; }

.empty-slot {
    color: #444;
    font-size: 28px;
    font-weight: 300;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.empty-slot:hover { color: #e94560; }

/* Build List */
.build-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.build-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.build-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #e94560;
    opacity: 0;
    transition: opacity 0.25s;
}
.build-item:hover {
    background: rgba(233, 69, 96, 0.06);
    border-color: rgba(233, 69, 96, 0.3);
    transform: translateX(8px);
}
.build-item:hover::before { opacity: 1; }
.build-item b { color: #fff; font-size: 15px; }
.build-item small { color: #888; font-size: 12px; line-height: 1.6; display: block; margin-top: 4px; }

/* Queue */
.queue-item {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.15), rgba(233, 69, 96, 0.05));
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(233, 69, 96, 0.3);
    color: #fff;
    font-size: 14px;
}
.queue-item b { color: #e94560; }

/* Army */
.unit-row {
    padding: 12px 15px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.unit-row b { color: #e94560; text-transform: capitalize; }

/* Reports */
.report-item {
    padding: 15px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #e94560;
    transition: all 0.2s;
}
.report-item:hover { background: rgba(255,255,255,0.06); }
.report-item b { font-size: 14px; display: block; margin-bottom: 6px; }
.report-item small { color: #888; font-size: 12px; }

/* Modal */
#battle-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-box {
    background: linear-gradient(180deg, #1a1a3e, #12122a);
    padding: 45px;
    border-radius: 20px;
    border: 2px solid rgba(233, 69, 96, 0.4);
    max-width: 520px;
    width: 92%;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 100px rgba(233, 69, 96, 0.1);
    animation: modalIn 0.4s ease;
}
@keyframes modalIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-box h2 { color: #e94560; margin-bottom: 25px; font-size: 26px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(233, 69, 96, 0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(233, 69, 96, 0.7); }

/* Responsive */
@media (max-width: 1000px) {
    #main-area { flex-direction: column; }
    #side-panel { width: 100%; height: 45vh; border-left: none; border-top: 2px solid rgba(233, 69, 96, 0.3); }
    #village-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 600px) {
    .login-box { padding: 30px 20px; }
    .forms { flex-direction: column; }
    #top-bar { font-size: 12px; padding: 8px 10px; }
    .res-box { padding: 6px 10px; }
    #village-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== MAP FULL FRAME FIX ===== */
#map-container {
    flex: 1;
    position: relative;
    background: #0a0f1a;
    overflow: hidden;
    min-height: 400px;
    min-width: 0;
}



/* ===== BUILD LIST - 2 KOLUMNY ===== */
#tab-build .build-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
#tab-build .build-item {
    margin-bottom: 0;
    padding: 14px;
}
#tab-build .build-item b {
    font-size: 13px;
}
#tab-build .build-item small {
    font-size: 11px;
}

/* ===== ARMY RECRUIT INPUTS ===== */
.recruit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    margin-bottom: 8px;
}
.recruit-row .recruit-info {
    flex: 1;
}
.recruit-row .recruit-info b {
    font-size: 14px;
    color: #fff;
}
.recruit-row .recruit-info small {
    font-size: 11px;
    color: #888;
    display: block;
    margin-top: 3px;
}
.recruit-row input[type="number"] {
    width: 60px;
    padding: 8px;
    text-align: center;
    margin: 0;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}
.recruit-row button {
    width: auto;
    padding: 8px 16px;
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 1200px) {
    #tab-build .build-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #village-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== BUILD ITEM SMALL FIX ===== */
#tab-build .build-item small {
    display: block;
    margin-top: 4px;
    line-height: 1.4;
}

/* ===== ADVANCED BUILDINGS & LOCKED STATE ===== */
.advanced-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.build-item.advanced {
    border-left: 3px solid #e94560;
    background: rgba(233, 69, 96, 0.04);
}
.build-item.advanced:hover {
    background: rgba(233, 69, 96, 0.1);
    border-color: #e94560;
}
.build-item.locked {
    opacity: 0.35;
    filter: grayscale(0.8);
    cursor: not-allowed;
    border-left-color: #555 !important;
}
.build-item.locked:hover {
    transform: none;
    background: rgba(255,255,255,0.03);
}
.build-item .req-text {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
    display: block;
    font-style: italic;
}

/* Cavalry row disabled state */
#recruit-cavalry-row.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ===== CANCEL BUILD BUTTON ===== */
.queue-item button {
    background: rgba(192, 57, 43, 0.8) !important;
    border-radius: 6px;
    font-size: 11px;
    padding: 4px 10px;
    width: auto !important;
    margin: 0 !important;
    flex-shrink: 0;
    transition: all 0.2s;
}
.queue-item button:hover {
    background: #e74c3c !important;
    transform: scale(1.1);
}

/* ===== MODERN GLASSMORPHISM UI ===== */

/* Top bar - glass effect */
#top-bar {
    background: rgba(15, 15, 35, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(233, 69, 96, 0.4);
    box-shadow: 0 4px 30px rgba(0,0,0,0.4);
}

.res-box {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.25s ease;
}
.res-box:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(233, 69, 96, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.15);
}

/* Side panel - glass */
#side-panel {
    background: rgba(12, 12, 30, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(233, 69, 96, 0.25);
    box-shadow: -10px 0 40px rgba(0,0,0,0.4);
}

/* Panel tabs */
.panel-tabs {
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(8px);
}

.tab-btn {
    position: relative;
    overflow: hidden;
}
.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #e94560;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}
.tab-btn:hover::after {
    width: 60%;
}
.tab-btn.active::after {
    width: 100%;
}

/* Building slots - 3D effect */
.building-slot {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.building-slot:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 8px 25px rgba(233, 69, 96, 0.2);
    border-color: rgba(233, 69, 96, 0.4);
    z-index: 5;
}

.building {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

/* Build items - glow effect */
.build-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.build-item:hover {
    background: rgba(233, 69, 96, 0.08);
    border-color: rgba(233, 69, 96, 0.4);
    transform: translateX(6px) translateY(-2px);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.15);
}
.build-item.advanced {
    border-left: 3px solid #e94560;
    background: rgba(233, 69, 96, 0.04);
}
.build-item.advanced:hover {
    background: rgba(233, 69, 96, 0.1);
}

/* Queue items */
.queue-item {
    background: rgba(233, 69, 96, 0.08);
    border: 1px solid rgba(233, 69, 96, 0.2);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Modal - glass */
#battle-modal {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
}
.modal-box {
    background: rgba(20, 20, 45, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(233, 69, 96, 0.3);
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 100px rgba(233, 69, 96, 0.1);
}

/* Map controls - floating glass */
#map-controls {
    background: rgba(10, 10, 25, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#map-controls button {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s;
}
#map-controls button:hover {
    background: #e94560;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

/* Minimap */
#minimap {
    background: rgba(10, 10, 25, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(233, 69, 96, 0.3);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

/* Buttons - gradient glow */
button {
    background: linear-gradient(135deg, #e94560, #c73e54);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.4);
    filter: brightness(1.1);
}
button:active {
    transform: translateY(0) scale(0.98);
}

/* Inputs - glow on focus */
input:focus {
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15), 0 0 20px rgba(233, 69, 96, 0.1);
}

/* Unit rows */
.unit-row {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.unit-row:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(4px);
}

/* Report items */
.report-item {
    background: rgba(255,255,255,0.04);
    border-left: 4px solid #e94560;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.report-item:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Toast animation */
@keyframes slideIn {
    from { transform: translateX(100px) scale(0.9); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

/* Wall section glow */
#tab-village > div:last-child {
    background: rgba(142, 68, 173, 0.08) !important;
    border: 1px solid rgba(142, 68, 173, 0.3) !important;
    box-shadow: 0 4px 20px rgba(142, 68, 173, 0.1);
}
#btn-wall {
    background: linear-gradient(135deg, #8e44ad, #6c3483) !important;
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}
#btn-wall:hover {
    box-shadow: 0 8px 25px rgba(142, 68, 173, 0.5);
}

/* Login page enhancements */
.login-box {
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(233, 69, 96, 0.2);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5), 0 0 100px rgba(233, 69, 96, 0.08);
}

/* ===== RANKING ===== */
.ranking-row {
    transition: all 0.2s;
}
.ranking-row:hover {
    transform: translateX(6px);
    background: rgba(255,255,255,0.06) !important;
}
.ranking-row.me:hover {
    background: rgba(46,204,113,0.1) !important;
}

/* Top bar resource max */
.res-box small {
    color: #666;
    font-size: 10px;
    margin-left: 2px;
    font-variant-numeric: tabular-nums;
}
.res-box small span {
    color: #555;
}

/* ===== DOM MAP - Tribal Wars style ===== */
#world-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    background: #0a0f1a;
}
#world-map:active {
    cursor: grabbing;
}

#map-tiles {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

#map-villages {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none;
}
#map-villages .village-marker {
    pointer-events: auto;
}

/* Tile base */
.tile {
    position: absolute;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
}

/* Tereny - prawdziwe grafiki PNG */
.terrain-0 { background: url('tiles/grass.png') center/cover no-repeat; }
.terrain-1 { background: url('tiles/forest.png') center/cover no-repeat; }
.terrain-2 { background: url('tiles/mountain.png') center/cover no-repeat; }
.terrain-3 { background: url('tiles/water.png') center/cover no-repeat; }
.terrain-4 { background: url('tiles/hill.png') center/cover no-repeat; }

/* Siatka przy dużym zoomie */
.tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 1px solid rgba(0,0,0,0.15);
    pointer-events: none;
}

/* Village markers
   UWAGA: wczesniej JS generowal znaczniki z klasa ".village-overlay", a te
   regoly CSS byly napisane pod ".village-marker" - klasy nigdy sie nie
   spotykaly, wiec wioski nie reagowaly na klik i nie mialy widocznej nazwy.
   To byla glowna przyczyna "niewidocznych" wiosek graczy na mapie. */
.village-marker {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
    z-index: 10;
    pointer-events: auto;
}
.village-marker:hover {
    z-index: 100;
    transform: scale(1.18);
}
.village-marker.selected {
    z-index: 100;
}
.village-marker.selected .village-icon {
    filter: drop-shadow(0 0 6px #f1c40f) drop-shadow(0 0 14px rgba(241, 196, 15, 0.6));
}

.village-icon {
    width: 92%;
    height: 92%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.15s ease;
}
.village-icon img { pointer-events: none; }

/* Delikatne rozroznienie kolorystyczne wg typu (obrazki juz sa
   zroznicowane graficznie, to tylko dodatkowy akcent/glow) */
.village-own .village-icon { filter: drop-shadow(0 0 5px rgba(241, 196, 15, 0.45)); }
.village-player .village-icon { filter: drop-shadow(0 0 4px rgba(66, 150, 230, 0.35)); }
.village-enemy .village-icon { filter: drop-shadow(0 0 4px rgba(210, 40, 44, 0.35)); }
.village-ruins .village-icon { opacity: 0.92; }

/* Nazwa wioski - widoczna od razu (jak w Plemionach), nie tylko na hover */
.village-name {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.8);
    pointer-events: none;
    opacity: 0.92;
    transition: opacity 0.15s, transform 0.15s;
    padding: 2px 7px;
    background: rgba(10, 12, 20, 0.72);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    margin-bottom: 5px;
}
.village-own .village-name {
    border-color: rgba(241, 196, 15, 0.5);
    color: #ffe9a8;
}
.village-marker:hover .village-name,
.village-marker.selected .village-name {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
}

/* Badge muru */
.wall-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #000;
    font-size: 9px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.3);
}

/* Hover effects */
.village-marker:hover .village-icon {
    transform: scale(1.2);
    filter: brightness(1.2);
}

/* Animacja pojawiania się wiosek */
@keyframes villagePop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.village-marker {
    animation: villagePop 0.3s ease;
}
