/* --- 1. Негизги Жалпы Стиль --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-image: url("bg.png");
    text-align: center;
    height: 100vh;
    overflow: hidden; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

h1 {
    margin: 20px;
    font-size: 32px;
    color: #333;
}

/* --- 2. Баштоо/Жеңиш Экрандары (Модальдар) --- */
#startScreen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#startModal {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    color: #333;
    width: 80%;
    max-width: 600px;
}
#startModal h2 {
    font-size: 36px;
    margin-bottom: 30px;
    color: #1A237E;
}

.teamSetup {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    justify-content: center;
}
.teamBox {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 10px;
}
.teamBox input {
    width: 90%;
    padding: 10px;
    font-size: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    text-align: center;
    margin-top: 10px;
    font-family: inherit;
}

/* Баштоо баскычы */
#startBtn {
    padding: 15px 50px;
    font-size: 28px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px #27ae60;
    transition: all 0.1s;
}
#startBtn:active {
    transform: translateY(2px);
    box-shadow: 0 2px #27ae60;
}
 
/* Артка саноо */
#countdown {
    font-size: 100px;
    font-weight: bold;
    position: absolute;
    z-index: 99;
    color: white;
    text-shadow: 0 0 10px #e74c3c, 0 0 20px #e74c3c;
    display: none;
    animation: scaleIn 0.5s ease-out;
}
#countdown.go {
    font-size: 50px;
    color: #2ecc71;
    text-shadow: 0 0 5px #27ae60, 0 0 15px #27ae60;
    animation: pulse 0.8s infinite; 
}

/* Анимациялар */
@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0.5; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}


/* --- 3. ТЕСТ ПАНЕЛДЕРИ --- */
.main-game-container {
    display: flex;
    align-items: flex-start;
    gap: 20px; 
}

.panel {
    width: 320px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding-bottom: 15px;
}
.header {
    padding: 15px; border-top-left-radius: 15px; border-top-right-radius: 15px;
    color: white; font-size: 24px; font-weight: bold;
}
#leftPanel .header { background: #1A237E; } /* Көк */
#rightPanel .header { background: #A11C28; } /* Кызыл */

.problem-box {
    height: 100px; /* Суроо көп саптуу болушу мүмкүн */
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: bold; color: white;
    margin: 10px 0;
    padding: 10px;
    text-align: center;
}
#leftProblem { background: #3f51b5; }
#rightProblem { background: #b42444; }

/* ТЕСТ БАСКЫЧТАРЫНЫН СТИЛДЕРИ (keypad'дын ордуна) */
.quiz-keypad {
    display: grid;
    /* 2 катар 3 катарча кылабыз (3x2) - 6 вариант үчүн */
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; 
    padding: 10px 15px;
}

.quiz-btn {
    padding: 12px 5px;
    font-size: 1rem; 
    border: none;
    border-radius: 8px;
    background: #e0f7fa; /* Ачык көк фон */
    box-shadow: 0 3px #b2ebf2;
    cursor: pointer;
    transition: all 0.1s;
    text-align: center;
    font-weight: 700;
}

.quiz-btn:active {
    transform: translateY(3px);
    box-shadow: none;
}


/* --- 4. АРКАН АРЕНАСЫ ЖАНА СҮРӨТТҮ БАШКАРУУ --- */
#arena {
    width: 630px;
    height: 400px;
    position: relative;
    overflow: hidden; 
    margin-top: 50px;
}

#winLine {
    position: absolute; left: 49%; top: 0; bottom: 0;
    border-right: 2px dashed #333;
    z-index: 2; 
}

/* Сүрөттү кармап турган контейнер */
#imageContainer {
    width: 700px; 
    height: 100%;
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%); 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.5, 1); 
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

#tugOfWarImage {
    width: 100%; 
    height: auto;
    display: block;
}

/* --- 5. АРЕНА ИЧИНДЕГИ ЖЕҢИШ ЭКРАНЫ --- */
#arenaWinnerDisplay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10; 
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#winGifContainer {
    width: 100%;
    height:auto; 
    margin-bottom: 10px;
    margin-top: -230px;
    overflow: hidden;
}

.win-gif {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%; 
    height: auto;
    max-height: 100%;
    display: none;
    z-index: -1;
}

.winner-text {
    margin: 5px 0;
    font-size: 32px;
    font-weight: bold;
    color: #009688; 
}
.winner-text-small {
    margin: 5px 0 20px 0;
    font-size: 18px;
    color: #9c27b0; 
}

/* --- КОНФЕТТИ (САЛЮТ) СТИЛДЕРИ (АРЕНА ИЧИНДЕ) --- */
.confetti-arena {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0;
    pointer-events: none;
    z-index: 15; 
    border-radius: 50%;
}

/* --- 6. Анимациялар жана Media Queries --- */

.shake-input { animation: shake-input 0.5s; }
@keyframes shake-input {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* Мобилдик телефондор үчүн (768px чейин) */
@media (max-width: 1050px) {
    .main-game-container { flex-direction: column; align-items: center; }
    .panel { width: 90%; max-width: 400px; margin-bottom: 15px; }
    #arena { width: 90%; height: 300px; margin-top: 15px; }
    
    .problem-box { font-size: 18px; height: 80px; }
    
    .quiz-keypad {
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
    }
    .quiz-btn {
        font-size: 1rem;
        padding: 15px 5px;
    }
}