:root {
    --bg-dark: #090d16;
    --bg-card: rgba(18, 26, 43, 0.85);
    --border-color: rgba(255, 255, 255, 0.12);
    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-gold: #fbbf24;
    --accent-green: #34d399;
    --accent-red: #f87171;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Верхняя панель ресурсов */
.top-bar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 40;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.nation-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
}

.resource-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    font-size: 12px;
}
.resource-list::-webkit-scrollbar { display: none; }

.res-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.turn-badge {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Контейнер интерактивной карты */
.map-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

#caucasus-map {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 800px;
    transition: transform 0.2s ease-out;
}

/* Стили SVG элементов */
.sea-area {
    fill: #0c1a30;
    stroke: #1e3a5f;
    stroke-width: 1.5;
}

.mountain-area {
    fill: #1c2333;
    stroke: #334155;
    stroke-dasharray: 4,4;
}

.province-path {
    transition: all 0.25s ease;
    cursor: pointer;
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 1.8;
}

.province-path:hover, .province-path:active {
    stroke: #ffffff;
    stroke-width: 3;
    filter: brightness(1.25);
}

.province-path.selected {
    stroke: var(--accent-gold);
    stroke-width: 3.5;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.6));
}

.province-label {
    font-size: 11px;
    font-weight: 700;
    fill: #ffffff;
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

.province-badge {
    pointer-events: none;
}

/* Нижняя панель навигации */
.bottom-nav {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn.active, .nav-btn:hover {
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.1);
}

.nav-btn .icon {
    font-size: 18px;
}

.end-turn-btn {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}
.end-turn-btn:hover {
    background: linear-gradient(135deg, #047857, #059669);
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 50;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.open {
    display: flex;
}

.modal-sheet {
    background: #0f172a;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Сетка карточек */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.action-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-card:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.action-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.action-card-title {
    font-size: 13px;
    font-weight: 600;
}

.action-card-cost {
    font-size: 11px;
    color: var(--accent-gold);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.action-card-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Кнопки действий */
.btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: white;
}
.btn-danger {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
    color: white;
}
.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
}

/* Дипломатические отношения */
.diplomacy-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diplomacy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.relation-bar {
    height: 6px;
    background: #334155;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.relation-progress {
    height: 100%;
    transition: width 0.3s;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.floating-alert {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent-blue);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 60;
    animation: fadeIn 0.2s ease-out;
}
