/* =========================================================================
   ФИРМЕННЫЙ ВЫЛИЗАННЫЙ ДИЗАЙН ИГРЫ «ГАЛАГА 2: ЗАЩИТА НЕБА» (МОРСКАЯ ПВО)
   ========================================================================= */

body {
    margin: 0;
    padding: 10px;
    background-color: #f4f6f8;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    user-select: none;
    box-sizing: border-box;
}

/* Главный контейнер тренажёра (Матрица твоего сайта) */
.game-wrapper {
    background-color: #ffffff;
    border: 3px solid #a3c1ad;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.05);
    max-width: 440px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === ЭКРАН СТАРТОВОЙ ЗАСТАВКИ === */
#startScreen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin: 0 0 4px 0;
    color: #2c3e50;
    font-size: 22px;
    text-align: center;
    text-shadow: 1px 1px 0 #fff;
}

.welcome-text {
    font-size: 11px;
    color: #7f8c8d;
    margin: 0 0 14px 0;
    text-align: center;
    font-weight: bold;
}

.section-title {
    align-self: flex-start;
    font-size: 13px;
    font-weight: bold;
    color: #34495e;
    margin: 0 0 8px 4px;
}

/* Сетка выбора предметов (Чистые 4 пастельные карточки ФГОС) */
.subject-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.subject-card {
    background-color: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.subject-card .emoji { font-size: 20px; }
.subject-card .title { font-size: 12px; font-weight: bold; color: #2c3e50; }

/* Твои ночные фирменные подсветки активных предметов ФГОС */
.subject-card[data-sub="rus"].active { border-color: #2ecc71; background-color: #f2fbf5; }
.subject-card[data-sub="math"].active { border-color: #3498db; background-color: #f2f8fc; }
.subject-card[data-sub="world"].active { border-color: #f1c40f; background-color: #fcfbf2; }
.subject-card[data-sub="multi"].active { border-color: #9b59b6; background-color: #faf2fc; }

/* Линейка выбора 4 водных оборонных кораблей */
.ship-flex {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    margin-bottom: 14px;
}
.ship-card {
    flex: 1;
    background-color: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-size: 10px;
    font-weight: bold;
    color: #7f8c8d;
}
.ship-card .img-preview {
    width: 28px; height: 28px; margin: 0 auto 4px auto;
    background-repeat: no-repeat; background-size: contain; background-position: center;
}
.ship-card.active { border-color: #a3c1ad; background-color: #f4f9f4; color: #2c3e50; }

/* Селектор сложности армады пришельцев */
.speed-toggle {
    display: flex;
    width: 100%;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}
.speed-btn {
    flex: 1; padding: 8px; font-size: 12px; font-weight: bold;
    background-color: #fff; border: none; color: #64748b; cursor: pointer;
}
.speed-btn.active { background-color: #cbd5e1; color: #1e293b; }

/* Главная кнопка «ЗАЩИЩАТЬСЯ!» */
.launch-btn {
    width: 100%; padding: 12px; font-size: 16px; font-weight: bold;
    color: #fff; background-color: #34495e; border: none; border-radius: 10px;
    cursor: pointer; box-shadow: 0 3px 0 #2c3e50; margin-bottom: 12px;
}
.launch-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2c3e50; }

/* Кнопки подвала заставки (Правила, Награды) */
.menu-footer { display: flex; gap: 10px; width: 100%; }
.footer-btn {
    flex: 1; padding: 6px; font-size: 11px; font-weight: bold;
    background-color: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px;
    color: #475569; cursor: pointer; text-align: center;
}

/* === ЭКРАН ИГРОВОГО ПРОЦЕССА === */
#gameScreen { width: 100%; display: none; flex-direction: column; align-items: center; }

.stats-line {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; font-weight: bold; font-size: 13px; color: #2c3e50; padding: 0 4px;
    box-sizing: border-box;
}

/* Пастельное автоматическое масштабирование неба Земли под мобильные экраны */
#gameCanvas {
    width: 100% !important;
    height: auto !important;
    max-width: 400px;
    background-color: #1a252f;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Адаптивные пастельные кнопки ответов под игровым полем */
#mathTaskZone button {
    font-size: 11px !important; 
    padding: 8px 4px !important;
    white-space: normal !important; 
    word-break: break-word;
}

/* === ОКОННЫЕ МОДАЛЬНЫЕ ОВЕРЛЕИ ПРАВИЛ И НАГРАД === */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; padding: 15px; z-index: 100;
}
.modal-box {
    background-color: #fff; border-radius: 14px; width: 90% !important;
    max-width: 360px; max-height: 85vh; overflow-y: auto; padding: 16px; box-sizing: border-box; border: 3px solid #cbd5e1;
}
.modal-box h3 { margin: 0 0 10px 0; color: #2c3e50; text-align: center; font-size: 16px; }
.modal-content { font-size: 12px; color: #475569; line-height: 1.5; margin-bottom: 14px; }
.modal-content ul { margin: 0; padding-left: 18px; }
.modal-content li { margin-bottom: 6px; }
.modal-close {
    width: 100%; padding: 8px; font-size: 12px; font-weight: bold;
    background-color: #64748b; color: white; border: none; border-radius: 6px; cursor: pointer;
}
