/* --- 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;
}
 
/* Жеңиш экраны */
#winnerScreen { 
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #A11C28, #1A237E); /* Көк жана Кызыл градиент */ 
    color: white; 
    display: none; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    z-index: 100;
    text-shadow: 2px 2px #000;
}
#winnerScreen h2 { font-size: 40px; }

/* Артка саноо */
#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: 60px; display: flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: bold; color: white;
    margin: 10px 0;
}
#leftProblem { background: #3f51b5; }
#rightProblem { background: #b42444; }

.input-display {
    width: 80%;
    padding: 10px;
    margin: 10px auto;
    display: block;
    font-size: 24px;
    text-align: center;
    border: 2px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
}

/* Клавиатура */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 20px;
}
.btn {
    padding: 15px 5px;
    font-size: 20px;
    border: none;
    border-radius: 8px;
    background: #eee;
    box-shadow: 0 3px #ccc;
    cursor: pointer;
    transition: all 0.1s;
}
.btn:active {
    transform: translateY(3px);
    box-shadow: none;
}
.btn-clear { background: #e74c3c; color: white; box-shadow: 0 3px #c0392b; }
.btn-zero { grid-column: span 1; }
.btn-go { background: #3498db; color: white; box-shadow: 0 3px #2980b9; }

/* --- 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. Анимациялар --- */
.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); }
}

/* КОНФЕТТИ ҮЧҮН СТИЛЬ */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    pointer-events: none;
    z-index: 101;
    border-radius: 50%;
}
/* --- style.css файлына кошуңуз --- */

#winnerScreen { 
    /* ... (Башка стилдер калат) ... */
    /* Сүрөттөр жана текст туура жайгашуусу үчүн: */
    justify-content: center;
    align-items: center;
}

#winnerAnimation {
    height: 250px; /* Анимацияга орун берүү */
    margin-bottom: 20px;
}



/* Конфеттинин дизайнын жогорудагы сүрөт менен айкалыштыруу үчүн,
   конфеттини winnerAnimation div'инин үстүнө коюу керек. */
   /* Эски #winnerScreen стилдерин алып салыңыз */

/* --- АРЕНА ИЧИНДЕГИ ЖЕҢИШ ЭКРАНЫ --- */
#arena {
    /* Бийиктигин сүрөткө ылайыкташтыруу, position: relative калсын */
    /* ... (башка стилдер калат) ... */
    position: relative;
    overflow: hidden; 
}

#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; /* GIF үчүн кичине орун */
    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%;
}