@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&family=Roboto:wght@400;500;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: #0f1115; color: #d1d5db; font-family: 'Roboto', sans-serif; font-size: 14px; }

/* --- Шапка --- */
header { background: #181b21; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2d323b; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
header b { color: #fff; font-size: 16px; }
header div { font-size: 14px; color: #9ca3af; }

/* --- Кнопки --- */
button, .btn { padding: 10px 18px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; font-family: inherit; transition: all 0.2s; text-decoration: none; display: inline-block; text-align: center; font-size: 14px; }
button:hover, .btn:hover { filter: brightness(1.2); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 4px; }
.w-100 { width: 100%; }
.btn-green { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.btn-red { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-purple { background: linear-gradient(135deg, #6d28d9, #5b21b6); color: #fff; }
.btn-gray { background: #374151; color: #d1d5db; }

/* --- Лендинг --- */
.landing-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; gap: 40px; padding: 20px; flex-wrap: wrap; background: radial-gradient(circle at 50% 50%, #1a1f29 0%, #0f1115 100%); }
.info-panel { max-width: 500px; }
.logo-title { font-size: 56px; color: #10b981; margin-bottom: 20px; text-shadow: 0 0 20px rgba(16, 185, 129, 0.3); font-weight: 700; }
.info-panel p { color: #9ca3af; line-height: 1.6; margin-bottom: 15px; font-size: 16px; }
.discord-btn { display: inline-block; background: #5865F2; color: white; padding: 12px 24px; border-radius: 6px; font-weight: bold; text-decoration: none; margin-top: 10px; transition: 0.2s; }
.discord-btn:hover { background: #4752C4; box-shadow: 0 0 15px rgba(88, 101, 242, 0.4); }
.auth-box { width: 360px; background: #181b21; padding: 30px; border: 1px solid #2d323b; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.auth-box h2 { margin-bottom: 15px; color: #fff; font-size: 20px; text-align: center; }
.auth-box hr { border: none; border-top: 1px solid #2d323b; margin: 20px 0; }

/* --- Поля ввода --- */
input[type="text"], input[type="password"], input[type="number"], select { width: 100%; padding: 12px 15px; margin-bottom: 12px; background: #0f1115; border: 1px solid #374151; color: #fff; border-radius: 6px; font-family: inherit; transition: border-color 0.2s; }
input:focus, select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
input[type="range"] { width: 100%; margin: 10px 0; accent-color: #3b82f6; }

/* --- Панель управления --- */
main { max-width: 1200px; margin: 30px auto; padding: 20px; }
.resources-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; margin-bottom: 25px; }
.res-item { background: #181b21; padding: 15px; border-radius: 8px; border: 1px solid #2d323b; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 500; color: #fff; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

.tabs { display: flex; gap: 5px; margin-bottom: 20px; background: #181b21; padding: 5px; border-radius: 8px; border: 1px solid #2d323b; overflow-x: auto; }
.tabs a { padding: 10px 20px; text-decoration: none; color: #9ca3af; font-weight: 500; border-radius: 6px; transition: 0.2s; white-space: nowrap; }
.tabs a:hover { background: #252a33; color: #fff; }
.tabs a.active { background: #3b82f6; color: #fff; box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4); }

.tab-content { background: #181b21; border: 1px solid #2d323b; border-radius: 8px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.tab-content h2 { color: #fff; margin-bottom: 20px; font-size: 22px; border-bottom: 1px solid #2d323b; padding-bottom: 10px; font-weight: 500; }

.grid-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.panel { background: #1f232b; padding: 20px; border-radius: 8px; border: 1px solid #2d323b; }
.panel h3 { color: #e5e7eb; margin-bottom: 15px; font-size: 18px; font-weight: 500; }
.panel p { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; color: #9ca3af; }
.panel hr { border: none; border-top: 1px solid #374151; margin: 15px 0; }

.market-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #181b21; border: 1px solid #2d323b; border-radius: 6px; margin-bottom: 10px; }
.market-item span { color: #fff; font-weight: 500; }

/* Уведомления */
.error, .success, .info-msg { padding: 12px 20px; border-radius: 6px; margin-bottom: 20px; font-weight: 500; text-align: center; }
.error { background: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; color: #ef4444; }
.success { background: rgba(16, 185, 129, 0.1); border: 1px solid #10b981; color: #10b981; }
.info-msg { background: rgba(59, 130, 246, 0.1); border: 1px solid #3b82f6; color: #3b82f6; }

.war-alert { background: #ef4444; color: white; text-align: center; padding: 10px; font-weight: bold; font-size: 16px; animation: blink 2s infinite; z-index: 200; position: relative; margin-bottom: 20px; border-radius: 6px; }
@keyframes blink { 50% { background: #b91c1c; } }
.event-banner { text-align: center; padding: 12px; font-weight: bold; font-size: 15px; position: relative; z-index: 200; border-bottom: 2px solid #000; color: white; margin-bottom: 20px; border-radius: 6px; }
@keyframes blinkEvent { 50% { filter: brightness(0.7); } }

/* Таблица альянса */
.alliance-table { width: 100%; border-collapse: collapse; }
.alliance-table th { text-align: left; padding: 10px; border-bottom: 1px solid #333; color: #9ca3af; font-size: 12px; text-transform: uppercase; }
.alliance-table td { padding: 10px; border-bottom: 1px solid #222; vertical-align: middle; }

/* --- КАРТА МИРА (Старая карта из game.php) --- */
.map-container { position: relative; width: 100%; height: calc(100vh - 65px); background-color: #0a0c10; background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px); background-size: 50px 50px; overflow: hidden; transition: filter 0.3s ease; }
.map-container.blurred .country-node:not(.selected) { filter: blur(3px); opacity: 0.3; }
.country-node { position: absolute; transform: translate(-50%, -50%); cursor: pointer; z-index: 10; display: flex; flex-direction: column; align-items: center; transition: all 0.2s ease; }
.country-node:hover { z-index: 20; transform: translate(-50%, -50%) scale(1.15); }
.node-name { background: rgba(15, 17, 21, 0.85); padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; color: #fff; border: 1px solid #374151; white-space: nowrap; margin-bottom: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); text-shadow: 1px 1px 2px #000; }
.node-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.8); }
.country-node.free .node-dot { background-color: #10b981; box-shadow: 0 0 15px #10b981; }
.country-node.occupied .node-dot { background-color: #ef4444; box-shadow: 0 0 15px #ef4444; }
.country-node.is-mine .node-dot { background-color: #3b82f6; box-shadow: 0 0 20px #3b82f6; width: 18px; height: 18px; }
.country-node.is-mine .node-name { border-color: #3b82f6; color: #60a5fa; }

.bottom-panel { position: fixed; bottom: -400px; left: 0; width: 100%; height: auto; background: rgba(24, 27, 33, 0.95); backdrop-filter: blur(15px); border-top: 2px solid #3b82f6; transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; padding: 25px 40px; box-shadow: 0 -10px 40px rgba(0,0,0,0.8); }
.bottom-panel.open { bottom: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #374151; padding-bottom: 15px; }
.panel-header h2 { color: #fff; font-size: 24px; margin: 0; font-weight: 700; }
.close-btn { background: #374151; border: none; color: #9ca3af; width: 35px; height: 35px; border-radius: 50%; font-size: 16px; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: 0.2s; }
.close-btn:hover { background: #ef4444; color: #fff; }
.panel-body { display: flex; gap: 40px; align-items: center; flex-wrap: wrap; }
.bp-info { display: flex; gap: 30px; flex-wrap: wrap; }
.bp-info p { margin: 0; color: #9ca3af; font-size: 15px; }
.bp-info b { color: #fff; margin-left: 5px; font-size: 16px; }
.bp-actions { display: flex; gap: 15px; margin-left: auto; min-width: 300px; flex-direction: column; }

/* --- КАРТА МИРА (game.php с Panzoom) --- */
#game-map {
    position: absolute; top: 60px; left: 0; right: 350px; bottom: 0;
    background: #0a0512;
    overflow: hidden;
    cursor: grab;
}
#game-map:active { cursor: grabbing; }
.map-content {
    position: relative;
    width: 1600px;
    height: 900px;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ec/World_map_blank_without_borders.svg');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    filter: invert(1) sepia(1) saturate(3) hue-rotate(220deg) brightness(0.65);
    transform-origin: 0 0;
}

.unit { position: absolute; transform: translate(-50%, -50%); width: 40px; height: 30px; background: #2c1a38; border: 1px solid #a78bfa; display: flex; justify-content: center; align-items: center; cursor: pointer; border-radius: 3px; box-shadow: 0 0 10px rgba(0,0,0,0.8); transition: box-shadow 0.2s; }
.unit:hover { box-shadow: 0 0 15px #a78bfa; z-index: 10; }
.unit.selected { border: 2px solid #fbbf24; box-shadow: 0 0 20px #fbbf24; }
.unit-icon { font-size: 16px; color: #fff; font-weight: bold; }
.unit-strength { position: absolute; bottom: -5px; right: -5px; background: #10b981; color: #000; font-size: 10px; font-weight: bold; padding: 1px 4px; border-radius: 3px; }

#movement-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.path-line { stroke: #fbbf24; stroke-width: 2; stroke-dasharray: 5, 5; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -10; } }

.top-bar { background: #22132b; height: 60px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; border-bottom: 1px solid #4a2c5e; position: relative; z-index: 100; }
.flag-name { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: #fff; }
.tick-timer { font-family: 'Roboto Mono', monospace; background: #120a19; padding: 8px 20px; border: 1px solid #4a2c5e; border-radius: 4px; color: #fff; font-size: 18px; letter-spacing: 2px; box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.2); }
.tick-timer span { color: #a78bfa; }

.sidebar { position: absolute; top: 60px; right: 0; bottom: 0; width: 350px; background: #1e1226; border-left: 1px solid #4a2c5e; z-index: 100; display: flex; flex-direction: column; }
.sidebar-tabs { display: flex; border-bottom: 1px solid #4a2c5e; }
.sidebar-tabs div { flex: 1; text-align: center; padding: 12px 0; font-size: 12px; color: #9ca3af; cursor: pointer; text-transform: uppercase; }
.sidebar-tabs div.active { color: #fff; border-bottom: 2px solid #a78bfa; background: #291735; }
.sidebar-content { flex: 1; overflow-y: auto; padding: 15px; }
.unit-list-item { background: #291735; border: 1px solid #3d2250; padding: 10px; margin-bottom: 8px; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.unit-list-item:hover { border-color: #a78bfa; }
.unit-list-item.selected { border-color: #fbbf24; background: #332040; }
.unit-title { font-size: 14px; font-weight: bold; color: #fff; margin-bottom: 4px; display: flex; justify-content: space-between; }
.unit-sub { font-size: 12px; color: #9ca3af; }

/* =========================================
   WAR ROOM (Военная комната - стиль скриншотов)
   ========================================= */
.war-body {
    background-color: #0d0410;
    background-image: 
        radial-gradient(circle at 50% 50%, #1a0b21 0%, #050206 100%),
        linear-gradient(rgba(167, 139, 250, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(167, 139, 250, 0.05) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    color: #d1d5db;
    font-family: 'Roboto', sans-serif;
}

.war-top-bar {
    height: 60px;
    background: rgba(30, 18, 38, 0.9);
    border-bottom: 1px solid #4a2c5e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.war-time {
    font-family: 'Roboto Mono', monospace;
    font-size: 20px;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

.war-container {
    display: flex;
    height: calc(100vh - 60px);
}

/* Карта в военной комнате */
.war-map-area {
    flex: 1;
    position: relative;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ec/World_map_blank_without_borders.svg');
    background-size: cover;
    background-position: center;
    filter: invert(1) sepia(1) saturate(3) hue-rotate(220deg) brightness(0.4);
    overflow: hidden;
}

.frontline {
    position: absolute;
    top: 0; bottom: 0;
    width: 4px;
    background: #ef4444;
    box-shadow: 0 0 20px #ef4444;
    transform: translateX(-50%);
    transition: left 1s ease-in-out;
    z-index: 10;
}

.map-label {
    position: absolute;
    top: 50%;
    font-size: 40px;
    font-weight: bold;
    color: rgba(255,255,255,0.1);
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 5px;
}
.attacker-label { left: 20%; color: rgba(239, 68, 68, 0.2); }
.defender-label { right: 20%; color: rgba(59, 130, 246, 0.2); }

.unit-marker {
    position: absolute;
    background: rgba(30, 18, 38, 0.9);
    border: 1px solid #a78bfa;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
}

/* Сайдбар статистики в военной комнате */
.war-sidebar {
    width: 380px;
    background: rgba(24, 12, 30, 0.95);
    border-left: 1px solid #4a2c5e;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.coalition-box {
    background: #1e1226;
    border: 1px solid #3d2250;
    border-radius: 6px;
    padding: 15px;
}
.attacker-box { border-left: 4px solid #ef4444; }
.defender-box { border-left: 4px solid #3b82f6; }

.coalition-header {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.country-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.country-info .flag {
    font-size: 32px;
    line-height: 1;
}

.country-info h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}
.country-info span {
    font-size: 12px;
    color: #9ca3af;
}

.progress-bar {
    height: 6px;
    background: #111;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-bar .fill {
    height: 100%;
    background: #a78bfa;
    box-shadow: 0 0 10px #a78bfa;
}
.attacker-box .fill { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.defender-box .fill { background: #3b82f6; box-shadow: 0 0 10px #3b82f6; }

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 5px;
    color: #d1d5db;
}
.stat-row b { color: #fff; }

/* Лог событий войны */
.war-events {
    flex: 1;
    background: #0d0410;
    border: 1px solid #3d2250;
    border-radius: 6px;
    padding: 15px;
    overflow-y: auto;
}
.war-events h4 {
    margin: 0 0 10px 0;
    color: #a78bfa;
    font-size: 12px;
    text-transform: uppercase;
}
.event-item {
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 1px solid #1e1226;
    color: #9ca3af;
}
.event-item:first-child { color: #fff; }

.war-actions {
    margin-top: auto;
}