/* ===== ЖАЛПЫ БАПТАУЛАР ===== */
:root{
    --pixel-font:'Press Start 2P', cursive;
    --bg:#11100d;
    --panel:#33281d;
    --panel-deep:#1b1b1b;
    --wood:#5a3928;
    --wood-dark:#2e1c14;
    --wood-light:#7a513c;
    --gold:#ffd54a;
    --gold-dark:#a56b00;
    --red:#d83a2e;
    --red-dark:#7a140d;
    --blue:#1e90ff;
    --blue-dark:#003d99;
    --green:#44ff44;
    --text:#f5f5f5;
    --muted:#d0d0d0;
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    min-height:100vh;
    background:var(--bg);
    color:var(--text);
    font-family:var(--pixel-font);

    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;

    overflow:hidden;
    position:relative;
}

body::before{
    content:'';
    position:fixed;
    inset:0;
    z-index:0;
    pointer-events:none;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.024) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255,255,255,0.024) 1px, transparent 1px),
        repeating-linear-gradient(90deg, rgba(255,213,74,0.09) 0 10px, transparent 10px 20px, rgba(164,107,47,0.09) 20px 30px, transparent 30px 40px);
    background-size:
        32px 32px,
        32px 32px,
        160px 6px;
    background-position:
        0 0,
        0 0,
        0 14px;
}

body::after{
    content:'';
    position:fixed;
    inset:14px;
    z-index:0;
    pointer-events:none;
    opacity:0.18;
    background:
        linear-gradient(var(--gold), var(--gold)) left top / 130px 4px no-repeat,
        linear-gradient(var(--gold), var(--gold)) left top / 4px 130px no-repeat,
        linear-gradient(var(--gold), var(--gold)) right bottom / 130px 4px no-repeat,
        linear-gradient(var(--gold), var(--gold)) right bottom / 4px 130px no-repeat,
        repeating-linear-gradient(90deg, var(--gold) 0 8px, transparent 8px 16px) center top / 220px 4px no-repeat,
        repeating-linear-gradient(90deg, var(--gold) 0 8px, transparent 8px 16px) center bottom / 220px 4px no-repeat;
}

body > *{
    position:relative;
    z-index:1;
}

.language-switch{
    position:fixed;
    top:16px;
    right:16px;
    z-index:30;
    display:flex;
    gap:6px;
    padding:6px;
    background:#241a14;
    border:4px solid #3a2418;
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,0.10),
        inset -2px -2px 0 rgba(0,0,0,0.45),
        3px 3px 0 #000;
}

.language-switch button{
    min-width:44px;
    padding:8px 7px;
    background:#2d2d2d;
    border:3px solid #555;
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,0.10),
        inset -2px -2px 0 rgba(0,0,0,0.45);
    font-size:8px;
    line-height:1;
}

.language-switch button.active{
    color:#1b1b1b;
    background:var(--gold);
    border-color:var(--gold-dark);
    box-shadow:
        inset 2px 2px 0 #fff2a5,
        inset -2px -2px 0 var(--gold-dark);
}

.rotate-phone{
    display:none;
}

/* ===== ТАҚЫРЫП ===== */
h1{
    font-size:64px;
    letter-spacing:0;
    margin:0 0 20px 0;

    text-shadow:
        4px 4px 0 #000,
        0 0 15px rgba(255,255,255,0.15);
}

.status{
    margin-bottom:25px;

    font-size:18px;
    color:#e5e5e5;
}

/* ===== НҰСҚАУЛЫҚ ===== */
.instructions{
    position:fixed;
    top:25px;
    left:25px;

    width:300px;

    padding:20px;

    background:rgba(20,20,20,0.85);

    border:3px solid #555;

    box-shadow:
        inset 0 0 20px rgba(255,255,255,0.03),
        0 0 15px rgba(0,0,0,0.5);

    font-size:10px;
    line-height:1.8;

    color:var(--muted);
}

.instructions h3{
    margin-top:0;
    color:white;
}

/* ===== ҚАЗАН ===== */
.kazan{
    width:450px;

    margin:18px 0;
    padding:16px;

    text-align:center;

    font-size:18px;

    color:var(--text);

    background:var(--panel);

    border:5px solid #a46b2f;

    box-shadow:
        inset 4px 4px 0 #4d3528,
        inset -4px -4px 0 #1d110c;

    position:relative;
    border-radius:0;
}

.kazan::before{
    content:'';

    position:absolute;
    inset:4px;

    border:2px solid rgba(255,255,255,0.12);

    pointer-events:none;
}

.game-board-shell{
    position:relative;
    display:inline-block;
    max-width:100%;
    margin:8px auto 14px;
}

.game-board-shell .board{
    margin:0 auto;
}

body.game-page .game-board-shell .board-with-center-kazans{
    row-gap:200px;
}

.kazan-center-row{
    position:absolute;
    left:50%;
    top:50%;
    z-index:4;

    width:95%;

    display:flex;
    flex-direction:column;
    align-items:stretch;
    justify-content:center;
    gap:8px;

    transform:translate(-50%, -50%);
    pointer-events:none;
}

.game-board-shell .kazan{
    width:100%;
    height:92px;
    margin:0;
    padding:8px 46px 9px 14px;

    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:6px;

    font-size:10px;
    line-height:1.45;
    overflow:hidden;
}

.online-page .game-board-shell .kazan{
    width:100%;
    margin:0;
    padding:8px 46px 9px 14px;
    font-size:10px;
    line-height:1.45;
}

.kazan-label{
    max-width:100%;
    color:#fff2a5;
    text-align:center;
    text-shadow:2px 2px 0 #000;
}

.kazan-total{
    position:absolute;
    top:7px;
    right:8px;

    min-width:24px;
    height:24px;
    padding:0 4px;

    display:grid;
    place-items:center;

    color:#1b1b1b;
    background:var(--gold);
    border:3px solid var(--gold-dark);
    box-shadow:
        inset 2px 2px 0 #fff2a5,
        inset -2px -2px 0 var(--gold-dark),
        2px 2px 0 #000;

    font-size:10px;
    line-height:1;
}

.kazan-balls{
    min-height:27px;

    display:grid;
    grid-template-columns:repeat(41, 16px);
    grid-auto-rows:16px;
    justify-content:center;
    gap:4px;
}



/* ===== ОЙЫН ТАҚТАСЫ ===== */
.board{
    display:grid;
    grid-template-columns:repeat(9,1fr);

    gap:10px;

    padding:24px;

    background:
        linear-gradient(135deg, rgba(255,213,74,0.07) 0 8px, transparent 8px 18px),
        var(--wood);

    border:8px solid var(--wood-dark);

    box-shadow:
        inset 4px 4px 0 var(--wood-light),
        inset -4px -4px 0 #24150f;
    border-radius:0;
    position:relative;
}

/* ===== ОТАУЛАР ===== */
.hole{
    width:88px;
    height:88px;

    position:relative;

    background:var(--panel-deep);

    border:4px solid #3a2418;

    display:grid;
    grid-template-columns:repeat(3,1fr);
    grid-template-rows:repeat(3,1fr);

    gap:4px;

    padding:8px;

    box-sizing:border-box;

    transition:
        transform 0.1s,
        border-color 0.45s,
        box-shadow 0.45s,
        opacity 0.45s;

    image-rendering:pixelated;

    box-shadow:
        inset -4px -4px 0 #111,
        inset 4px 4px 0 #2c2c2c;
    border-radius:0;
}

.hole:hover{
    transform:translateY(-2px) scale(1.03);
    border-color:#ffcc44;
    box-shadow:
        inset -4px -4px 0 #111,
        inset 4px 4px 0 #2c2c2c;
}
.hole.tuzdyk{
    border-color:#b000ff !important;

    box-shadow:
        inset 4px 4px 0 #2d003f,
        inset -4px -4px 0 #120018,
        0 0 14px rgba(176,0,255,0.55);
}

.hole.player-tuzdyk{
    border-color:#ffd84a !important;
}

.hole.bot-tuzdyk{
    border-color:#ff3333 !important;
}

.tuzdyk-mark{
    position:absolute;
    inset:0;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:22px;
    color:#fff;

    text-shadow:
        3px 3px 0 #000,
        0 0 8px rgba(255,255,255,0.4);
}

.tuzdyk-label{
    position:absolute;
    bottom:3px;
    right:4px;

    font-size:7px;
    color:#ffd84a;

    text-shadow:2px 2px 0 #000;
}
.stone{
    width:16px;
    height:16px;

    background:var(--gold);

    border:none;

    image-rendering:pixelated;

    box-shadow:
        2px 2px 0 #a56b00,
        inset -2px -2px 0 #e29f00,
        inset 2px 2px 0 #fff0a8;
}

.kazan-stone{
    animation:kazanStoneAppear 180ms steps(4, end) both;
    animation-delay:var(--stone-delay, 0ms);
}

@keyframes kazanStoneAppear{
    0%{
        opacity:0;
        transform:translateY(-7px);
    }

    70%{
        opacity:1;
        transform:translateY(2px);
    }

    100%{
        opacity:1;
        transform:translateY(0);
    }
}

.hole-count{
    position:absolute;

    top:3px;
    left:5px;

    font-size:12px;
    background:rgba(0,0,0,0.6);
    color:#ffe066;

    pointer-events:none;
}
/* ===== БОТ ЖҮРІСІНІҢ СОҢЫ ===== */
.hole.bot-target{
    transform:scale(1.08);
}

/* Жасыл түс - тас алу жоқ */
.hole.bot-target.safe{
    border-color:#44ff44 !important;

    box-shadow:
        0 0 20px rgba(68,255,68,0.8),
        inset 0 0 12px rgba(68,255,68,0.3);
}

/* Қызыл түс - тас алынды */
.hole.bot-target.capture{
    border-color:#ff4444 !important;

    box-shadow:
        0 0 22px rgba(255,68,68,0.85),
        inset 0 0 14px rgba(255,68,68,0.35);
}


/* ===== ҚАРСЫЛАС ЖАҒЫ ===== */
.hole.enemy{
    border-color:#7a1e1e;
}

/* ===== ОЙЫНШЫ ЖҮРІСІН АЛДЫН АЛА КӨРСЕТУ ===== */
.hole.preview{
    border-color:#00e5ff !important;

    box-shadow:
        0 0 20px rgba(0,229,255,0.9),
        inset 0 0 12px rgba(0,229,255,0.3);

    transform:scale(1.06);
}

/* ===== БОТ ТАҢДАҒАН ОТАУ ===== */
.hole.bot-source{
    border-color:#4da6ff !important;

    box-shadow:
        0 0 20px rgba(77,166,255,0.8),
        inset 0 0 10px rgba(77,166,255,0.35);

    transform:scale(1.05);
}


@keyframes botPulse{
    from{
        transform:scale(1);
    }

    to{
        transform:scale(1.06);
    }
}

/* ===== БАСҚАРУ ЭЛЕМЕНТТЕРІ ===== */
.controls{
    margin-top:30px;

    display:flex;
    gap:20px;
    align-items:center;

    padding:18px 24px;

    background:#2d2d2d;

    border:4px solid #555;

    box-shadow:
        inset 0 0 12px rgba(255,255,255,0.05),
        0 0 15px rgba(0,0,0,0.4);
}

.controls label{
    font-size:14px;
    color:#f1f1f1;
}

.controls select,
button{
    font-family:var(--pixel-font);
}

/* ===== ТАҢДАУ ТІЗІМІ ===== */
select{
    background:var(--blue);

    color:white;

    border:none;

    padding:10px 14px;

    font-size:12px;

    cursor:pointer;
    border-radius:0;
    box-shadow:
        inset 2px 2px 0 #66b2ff,
        inset -2px -2px 0 #003d99,
        3px 3px 0 #000;
}

/* ===== БАТЫРМАЛАР ===== */
button{
    background:var(--red);

    color:white;

    border:none;

    padding:14px 18px;

    font-size:12px;

    cursor:pointer;

    box-shadow:
        inset 2px 2px 0 #ff7b70,
        inset -2px -2px 0 #7a140d,
        3px 3px 0 #000;

    transition:0.05s;
    border-radius:0;
}

button:hover{
    transform:scale(1.05);
}

button:active{
    transform:translate(2px,2px);

    box-shadow:
        inset 2px 2px 0 #7a140d;
}

.hole.move-step{
    border-color:#ffe066 !important;

    box-shadow:
        0 0 18px rgba(255,224,102,0.85),
        inset 0 0 12px rgba(255,224,102,0.22);

    transform:scale(1.06);
}

@media(max-width:900px){
    .language-switch{
        top:10px;
        right:10px;
    }

    .language-switch button{
        min-width:38px;
        padding:7px 5px;
        font-size:7px;
    }
}

@media(max-width:820px) and (orientation:portrait){
    body.game-page{
        overflow:hidden;
    }

    body.game-page > :not(.rotate-phone):not(.language-switch){
        visibility:hidden;
        pointer-events:none;
    }

    body.game-page .rotate-phone{
        position:fixed;
        inset:0;
        z-index:25;
        display:flex;
        align-items:center;
        justify-content:center;
        padding:26px;
        background:
            linear-gradient(rgba(17,16,13,0.86), rgba(17,16,13,0.92)),
            var(--bg);
        text-align:center;
    }

    .rotate-phone-panel{
        width:360px;
        max-width:100%;
        padding:24px 18px;
        background:var(--panel);
        border:7px solid var(--wood-dark);
        box-shadow:
            inset 4px 4px 0 #4d3528,
            inset -4px -4px 0 #1d110c,
            7px 7px 0 #050505;
    }

    .rotate-phone-icon{
        width:76px;
        height:46px;
        margin:0 auto 20px;
        border:5px solid var(--gold);
        box-shadow:
            inset 3px 3px 0 rgba(255,255,255,0.14),
            inset -3px -3px 0 rgba(0,0,0,0.45),
            4px 4px 0 #000;
    }

    .rotate-phone h2{
        margin:0 0 12px;
        color:var(--gold);
        font-size:15px;
        line-height:1.5;
        text-shadow:3px 3px 0 #000;
    }

    .rotate-phone p{
        margin:0 0 12px;
        color:#f2f2f2;
        font-size:9px;
        line-height:1.8;
    }

    .rotate-phone small{
        color:#b8ffb8;
        font-size:7px;
        line-height:1.6;
    }
}

@media(max-width:900px) and (orientation:landscape){
    body.game-page{
        min-height:100vh;
        padding:6px 8px;
        justify-content:flex-start;
        gap:4px;
        overflow:hidden;
    }

    body.game-page h1{
        display:none;
    }

    body.game-page .instructions{
        display:none;
    }

    body.game-page .status{
        min-height:auto;
        margin:0;
        font-size:10px;
        line-height:1.5;
    }

    body.game-page .kazan{
        width:380px;
        max-width:84vw;
        margin:3px 0;
        padding:8px 10px;
        font-size:9px;
        line-height:1.4;
        border-width:4px;
    }

    body.game-page .game-board-shell{
        margin:2px auto 5px;
    }

    body.game-page .kazan-center-row{
        width:100%;
        gap:5px;
    }

    body.game-page .game-board-shell .kazan{
        width:100%;
        height:52px;
        min-height:0;
        margin:0;
        padding:5px 28px 6px 8px;
        font-size:7px;
        line-height:1.35;
        border-width:3px;
        gap:3px;
    }

    body.game-page .kazan-total{
        top:5px;
        right:5px;
        min-width:18px;
        height:18px;
        border-width:2px;
        font-size:7px;
    }

    body.game-page .kazan-balls{
        min-height:15px;
        grid-template-columns:repeat(41, 7px);
        grid-auto-rows:7px;
        gap:1px;
    }

    body.game-page .board{
        gap:4px;
        padding:8px;
        border-width:5px;
    }

    body.game-page .game-board-shell .board-with-center-kazans{
        row-gap:118px;
    }

    body.game-page .hole{
        width:40px;
        height:40px;
        padding:4px;
        gap:2px;
        border-width:3px;
    }

    body.game-page .stone{
        width:7px;
        height:7px;
        box-shadow:
            1px 1px 0 #a56b00,
            inset -1px -1px 0 #e29f00,
            inset 1px 1px 0 #fff0a8;
    }

    body.game-page .hole-count{
        font-size:8px;
    }

    body.game-page .tuzdyk-mark{
        font-size:14px;
    }

    body.game-page .tuzdyk-label{
        display:none;
    }

    body.game-page .controls{
        margin-top:3px;
        gap:8px;
        padding:8px 10px;
        border-width:3px;
    }

    body.game-page .controls label{
        font-size:8px;
        line-height:1.5;
    }

    body.game-page button,
    body.game-page select{
        padding:8px 10px;
        font-size:8px;
    }
}

@media(max-width:916px) and (max-height:413px) and (orientation:landscape){
    body.game-page{
        padding:4px 6px;
        gap:3px;
    }

    body.game-page .status{
        font-size:9px;
        line-height:1.35;
    }

    body.game-page .game-board-shell{
        margin:1px auto 3px;
    }

    body.game-page .game-board-shell .kazan{
        height:46px;
        padding:4px 26px 5px 7px;
        font-size:6px;
        gap:2px;
    }

    body.game-page .kazan-total{
        min-width:16px;
        height:16px;
        font-size:6px;
    }

    body.game-page .kazan-balls{
        min-height:15px;
        grid-template-columns:repeat(41, 7px);
        grid-auto-rows:7px;
        gap:1px;
    }

    body.game-page .board{
        gap:3px;
        padding:6px;
        border-width:4px;
    }

    body.game-page .game-board-shell .board-with-center-kazans{
        row-gap:104px;
    }

    body.game-page .hole{
        width:36px;
        height:36px;
        padding:3px;
        border-width:3px;
    }

    body.game-page .controls{
        padding:6px 8px;
        gap:6px;
    }

    body.game-page button,
    body.game-page select{
        padding:6px 8px;
        font-size:7px;
    }
}
