/*
=====================================================
 AZƏRBAYCAN FƏTHİ
 STYLE.CSS — HİSSƏ 3 / SON
=====================================================
*/

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #07111f;
    --panel: #0d1b2a;
    --panel-light: #13263a;
    --border: #203b55;

    --red: #ef4444;
    --red-dark: #991b1b;

    --blue: #3b82f6;
    --blue-dark: #1e40af;

    --green: #22c55e;
    --green-dark: #166534;

    --text: #f8fafc;
    --muted: #94a3b8;

    --gold: #facc15;
    --shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

body {
    min-height: 100vh;

    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at top left,
            rgba(30, 64, 175, 0.18),
            transparent 35%
        ),
        radial-gradient(
            circle at bottom right,
            rgba(22, 101, 52, 0.15),
            transparent 35%
        ),
        var(--bg);
}


/*
=====================================================
 ƏSAS KONTEYNER
=====================================================
*/

.game {
    width: 100%;
    max-width: 1500px;

    margin: 0 auto;

    padding: 24px;
}


/*
=====================================================
 YUXARI PANEL
=====================================================
*/

.topbar {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-bottom: 20px;

    padding: 20px 24px;

    border: 1px solid var(--border);

    border-radius: 18px;

    background:
        linear-gradient(
            135deg,
            rgba(19, 38, 58, 0.95),
            rgba(13, 27, 42, 0.95)
        );

    box-shadow: var(--shadow);
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.2;

    margin-bottom: 6px;
}

.topbar p {
    color: var(--muted);
    font-size: 14px;
}


/*
=====================================================
 NÖVBƏ QUTUSU
=====================================================
*/

.turn-box {
    min-width: 170px;

    padding: 12px 16px;

    border-radius: 14px;

    background: rgba(255, 255, 255, 0.05);

    border: 1px solid var(--border);

    text-align: center;
}

.turn-box span {
    display: block;

    margin-bottom: 5px;

    color: var(--muted);

    font-size: 12px;

    text-transform: uppercase;

    letter-spacing: 1px;
}

.turn-box strong {
    font-size: 17px;
}


/*
=====================================================
 ƏSAS LAYOUT
=====================================================
*/

.layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        360px;

    gap: 20px;

    align-items: start;
}


/*
=====================================================
 XƏRİTƏ PANELİ
=====================================================
*/

.map-panel {
    min-width: 0;

    padding: 20px;

    border-radius: 18px;

    border: 1px solid var(--border);

    background:
        linear-gradient(
            145deg,
            rgba(13, 27, 42, 0.98),
            rgba(7, 17, 31, 0.98)
        );

    box-shadow: var(--shadow);
}

.map-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 15px;

    margin-bottom: 18px;
}

.map-header h2 {
    font-size: 20px;
}


/*
=====================================================
 LEJEND
=====================================================
*/

.legend {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;
}

.legend span {
    padding: 7px 10px;

    border-radius: 9px;

    background: rgba(255, 255, 255, 0.05);

    color: #dbeafe;

    font-size: 12px;

    border: 1px solid rgba(255, 255, 255, 0.07);
}


/*
=====================================================
 XƏRİTƏ
=====================================================
*/

.map {
    position: relative;

    min-height: 700px;

    padding: 25px;

    overflow: auto;

    border-radius: 16px;

    border: 1px solid #1d3952;

    background:
        radial-gradient(
            circle at 30% 20%,
            rgba(59, 130, 246, 0.09),
            transparent 30%
        ),
        radial-gradient(
            circle at 70% 70%,
            rgba(34, 197, 94, 0.07),
            transparent 30%
        ),
        #091827;
}


/*
=====================================================
 XƏRİTƏ YÜKLƏNİR
=====================================================
*/

#mapLoading {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    color: var(--muted);

    font-size: 18px;
}


/*
=====================================================
 ƏRAZİ DÜYMƏLƏRİ
=====================================================
*/

.territory {
    position: relative;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 105px;
    min-height: 52px;

    margin: 5px;

    padding: 10px 13px;

    border: 1px solid #31506d;

    border-radius: 12px;

    color: #e2e8f0;

    background:
        linear-gradient(
            145deg,
            #172c40,
            #0f2234
        );

    cursor: pointer;

    font-size: 13px;
    font-weight: 700;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.25);
}

.territory:hover {
    transform: translateY(-3px);

    border-color: #60a5fa;

    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.35);
}

.territory:active {
    transform: scale(0.96);
}


/*
=====================================================
 OYUNÇU RƏNGLƏRİ
=====================================================
*/

.territory.player1 {
    background:
        linear-gradient(
            145deg,
            #dc2626,
            var(--red-dark)
        );

    border-color: #f87171;

    color: white;
}

.territory.player2 {
    background:
        linear-gradient(
            145deg,
            #2563eb,
            var(--blue-dark)
        );

    border-color: #60a5fa;

    color: white;
}

.territory.player3 {
    background:
        linear-gradient(
            145deg,
            #16a34a,
            var(--green-dark)
        );

    border-color: #4ade80;

    color: white;
}


/*
=====================================================
 SEÇİLMİŞ ƏRAZİ
=====================================================
*/

.territory.selected {
    outline: 3px solid var(--gold);

    outline-offset: 3px;

    z-index: 5;

    box-shadow:
        0 0 0 5px rgba(250, 204, 21, 0.15),
        0 0 25px rgba(250, 204, 21, 0.35);

    transform: translateY(-3px);
}


/*
=====================================================
 HƏDƏF ƏRAZİ
=====================================================
*/

.territory.target {
    outline: 3px solid #f97316;

    outline-offset: 3px;

    box-shadow:
        0 0 0 5px rgba(249, 115, 22, 0.14),
        0 0 25px rgba(249, 115, 22, 0.35);

    animation: targetPulse 1.1s infinite;
}

@keyframes targetPulse {

    0%,
    100% {
        box-shadow:
            0 0 0 5px rgba(249, 115, 22, 0.12),
            0 0 18px rgba(249, 115, 22, 0.25);
    }

    50% {
        box-shadow:
            0 0 0 8px rgba(249, 115, 22, 0.08),
            0 0 30px rgba(249, 115, 22, 0.45);
    }
}


/*
=====================================================
 SIDEBAR
=====================================================
*/

.sidebar {
    display: flex;

    flex-direction: column;

    gap: 16px;
}


/*
=====================================================
 SIDEBAR SEKSİYALARI
=====================================================
*/

.sidebar section {
    padding: 18px;

    border-radius: 16px;

    border: 1px solid var(--border);

    background:
        linear-gradient(
            145deg,
            rgba(19, 38, 58, 0.95),
            rgba(13, 27, 42, 0.95)
        );

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.2);
}

.sidebar h2 {
    margin-bottom: 14px;

    font-size: 17px;
}


/*
=====================================================
 OYUNÇU KARTLARI
=====================================================
*/

.players {
    display: flex;

    flex-direction: column;

    gap: 9px;
}

.player-card {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 10px;

    padding: 13px;

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.04);

    border: 1px solid rgba(255, 255, 255, 0.07);

    transition:
        transform 0.18s ease,
        background 0.18s ease;
}

.player-card:hover {
    transform: translateX(3px);

    background: rgba(255, 255, 255, 0.07);
}

.player-card strong {
    display: block;

    font-size: 14px;
}

.player-card small {
    display: block;

    margin-top: 4px;

    color: var(--muted);

    font-size: 12px;
}

.player-card > span {
    white-space: nowrap;

    font-weight: 700;

    font-size: 13px;
}


/*
=====================================================
 OYUNÇU KARTLARININ SOL SƏRHƏDLƏRİ
=====================================================
*/

.player-card.player1 {
    border-left: 4px solid var(--red);
}

.player-card.player2 {
    border-left: 4px solid var(--blue);
}

.player-card.player3 {
    border-left: 4px solid var(--green);
}


/*
=====================================================
 SEÇİLMİŞ ƏRAZİ
=====================================================
*/

#selectedTerritory {
    padding: 12px;

    margin-bottom: 10px;

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.05);

    border: 1px solid rgba(255, 255, 255, 0.07);

    color: #e2e8f0;

    font-weight: 700;
}

#territoryInfo {
    color: var(--muted);

    font-size: 13px;

    line-height: 1.6;
}

.territory-details p {
    margin-bottom: 7px;
}

.territory-details strong {
    color: #e2e8f0;
}


/*
=====================================================
 DÖYÜŞ DÜYMƏSİ
=====================================================
*/

#attackButton {
    width: 100%;

    min-height: 48px;

    padding: 12px 16px;

    border: none;

    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #dc2626,
            #991b1b
        );

    color: white;

    font-size: 15px;

    font-weight: 800;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        opacity 0.18s ease;

    box-shadow:
        0 8px 20px rgba(220, 38, 38, 0.25);
}

#attackButton:hover:not(:disabled) {
    transform: translateY(-2px);

    filter: brightness(1.1);
}

#attackButton:active:not(:disabled) {
    transform: scale(0.98);
}

#attackButton:disabled {
    cursor: not-allowed;

    opacity: 0.4;

    box-shadow: none;
}


/*
=====================================================
 ZƏR ATMA NƏTİCƏSİ
=====================================================
*/

.dice-result {
    margin-top: 12px;

    min-height: 60px;

    display: flex;

    align-items: center;

    padding: 12px;

    border-radius: 10px;

    background: rgba(0, 0, 0, 0.2);

    border: 1px solid rgba(255, 255, 255, 0.06);

    color: #cbd5e1;

    font-size: 13px;

    line-height: 1.5;
}


/*
=====================================================
 HADİSƏLƏR JURNALI
=====================================================
*/

.log {
    max-height: 300px;
}

#gameLog {
    max-height: 220px;

    overflow-y: auto;

    padding-right: 5px;

    color: #cbd5e1;

    font-size: 13px;

    line-height: 1.5;
}

.log-line {
    padding: 9px 0;

    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.06);
}

.log-line:first-child {
    color: #f8fafc;

    font-weight: 600;
}


/*
=====================================================
 SCROLLBAR
=====================================================
*/

#gameLog::-webkit-scrollbar,
.map::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

#gameLog::-webkit-scrollbar-track,
.map::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);

    border-radius: 10px;
}

#gameLog::-webkit-scrollbar-thumb,
.map::-webkit-scrollbar-thumb {
    background: #31506d;

    border-radius: 10px;
}

#gameLog::-webkit-scrollbar-thumb:hover,
.map::-webkit-scrollbar-thumb:hover {
    background: #4b6b88;
}


/*
=====================================================
 QALİB MODALI
=====================================================
*/

.modal {
    position: fixed;

    inset: 0;

    z-index: 9999;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background:
        rgba(2, 6, 23, 0.82);

    backdrop-filter: blur(8px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: min(440px, 100%);

    padding: 40px 30px;

    text-align: center;

    border-radius: 22px;

    border: 1px solid #385570;

    background:
        linear-gradient(
            145deg,
            #13263a,
            #091827
        );

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55);

    animation: modalIn 0.3s ease;
}

@keyframes modalIn {

    from {
        opacity: 0;

        transform:
            scale(0.9)
            translateY(15px);
    }

    to {
        opacity: 1;

        transform:
            scale(1)
            translateY(0);
    }
}

.modal-content h1 {
    margin-bottom: 10px;

    font-size: 64px;
}

.modal-content h2 {
    margin-bottom: 25px;

    font-size: 24px;
}

.modal-content button {
    padding: 13px 22px;

    border: none;

    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #1d4ed8
        );

    color: white;

    font-size: 14px;

    font-weight: 800;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        filter 0.18s ease;
}

.modal-content button:hover {
    transform: translateY(-2px);

    filter: brightness(1.1);
}


/*
=====================================================
 RESPONSIVE — TABLET
=====================================================
*/

@media (max-width: 1050px) {

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .players {
        grid-column: span 2;
    }

    .log {
        grid-column: span 2;
    }

    .map {
        min-height: 550px;
    }
}


/*
=====================================================
 RESPONSIVE — MOBİL
=====================================================
*/

@media (max-width: 700px) {

    .game {
        padding: 10px;
    }

    .topbar {
        flex-direction: column;

        align-items: stretch;

        padding: 16px;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .turn-box {
        width: 100%;
    }

    .map-panel {
        padding: 12px;
    }

    .map-header {
        flex-direction: column;

        align-items: flex-start;
    }

    .legend {
        width: 100%;
    }

    .map {
        min-height: 500px;

        padding: 12px;
    }

    .territory {
        min-width: 90px;

        min-height: 45px;

        padding: 8px;

        font-size: 11px;

        margin: 4px;
    }

    .sidebar {
        display: flex;
    }

    .players,
    .log {
        grid-column: auto;
    }

    .sidebar section {
        padding: 14px;
    }
}


/*
=====================================================
 ÇOX KİÇİK EKRANLAR
=====================================================
*/

@media (max-width: 420px) {

    .topbar h1 {
        font-size: 19px;
    }

    .topbar p {
        font-size: 12px;
    }

    .map-header h2 {
        font-size: 17px;
    }

    .territory {
        min-width: 78px;

        font-size: 10px;
    }

    .legend span {
        font-size: 10px;

        padding: 6px 8px;
    }
}
