/* Базовый сброс и настройки экрана */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1a1a2e;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: none; /* Блокировка масштабирования по двойному тапу */
}

/* Контейнер игры (автоскейлинг, вертикальный вид 9:16) */
#game-container {
    width: 100vw;
    height: 100vh;
    max-width: 56.25vh; /* Ограничивает ширину для сохранения вертикальной пропорции на ПК */
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    container-type: inline-size;
    overflow: hidden;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Стартовый экран */
#start-screen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
}

.title {
    font-size: 11cqw; /* Уменьшено с 16cqw */
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 4px 4px 0 #ff4757;
    line-height: 1.2;
    margin-bottom: 20cqw;
}

/* Верхняя панель */
.top-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4cqw 5cqw;
    background: rgba(255, 255, 255, 0.4);
    font-size: 4cqw;
    font-weight: bold;
    color: #2f3542;
    border-bottom: 1cqw solid rgba(255, 255, 255, 0.6);
}

/* Область вопроса */
.question-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8cqw;
}

#question-text {
    font-size: 6.5cqw;
    color: #2f3542;
    text-align: center;
    font-weight: bold;
    background: #fff;
    padding: 10cqw 6cqw;
    border-radius: 6cqw;
    border: 1.5cqw solid #dfe4ea;
    box-shadow: 0 4cqw 0 #ced6e0, inset 0 0 20px rgba(0,0,0,0.05);
    width: 100%;
}

/* Кнопки и панель управления */
.controls {
    display: flex;
    justify-content: space-around;
    padding: 6cqw;
    margin-bottom: 8cqw;
}

.btn {
    font-family: inherit;
    font-weight: bold;
    font-size: 8cqw;
    border: none;
    border-radius: 5cqw;
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s;
    display: inline-block;
    padding: 5cqw 10cqw;
}

.btn:active {
    transform: translateY(2cqw);
    box-shadow: 0 0 0 transparent !important;
}

.btn-primary {
    background: #ffa502;
    box-shadow: 0 2cqw 0 #ff7f50;
    padding: 6cqw 15cqw;
    font-size: 10cqw;
    text-shadow: 2px 2px 0 #ff4757;
}

.btn-yes {
    background: #2ed573;
    box-shadow: 0 2.5cqw 0 #2bed64;
    width: 40cqw;
    text-shadow: 2px 2px 0 #1e90ff;
}

.btn-no {
    background: #ff4757;
    box-shadow: 0 2.5cqw 0 #ff6b81;
    width: 40cqw;
    text-shadow: 2px 2px 0 #c0392b;
}

/* Окна (Попапы) */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(47, 53, 66, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.popup {
    background: #ffffff;
    padding: 10cqw;
    border-radius: 8cqw;
    text-align: center;
    width: 85%;
    box-shadow: 0 10cqw 30px rgba(0,0,0,0.5);
    border: 2cqw solid #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4cqw;
}

.popup h2 {
    font-size: 8cqw;
    margin: 0 0 4cqw 0;
    white-space: pre-line;
    color: #2f3542;
    width: 100%;
    text-align: center;
}

/* Кнопки в попапах */
#btn-popup {
    font-size: 8cqw !important;
    padding: 4.8cqw 12cqw !important;
    margin: 0 auto;
}

/* Кнопка рекламы */
.btn-reward {
    background: #a29bfe;
    box-shadow: 0 2cqw 0 #6c5ce7;
    font-size: 6cqw !important;
    padding: 3cqw 8cqw !important;
    margin-top: 2cqw;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2cqw;
}

/* Динамические стили для попапов */
.win-style .popup { border-color: #2ed573; }
.win-style #popup-title { color: #2ed573; }
.win-style #btn-popup { background: #2ed573; box-shadow: 0 2cqw 0 #2bed64; text-shadow: 2px 2px 0 #20a055; }

.lose-style .popup { border-color: #ff4757; }
.lose-style #popup-title { color: #ff4757; }
.lose-style #btn-popup { background: #ff4757; box-shadow: 0 2cqw 0 #ff6b81; text-shadow: 2px 2px 0 #c0392b; }