/* БАЗОВЫЕ НАСТРОЙКИ ЭКРАНА (ТЕМНАЯ ТЕМА ПО УМОЛЧАНИЮ) */
body {
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: background-color 0.3s;
}

#calculator {
    background-color: #000000;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    max-height: 850px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    transition: background-color 0.3s;
}

/* ВЕРХНЯЯ ПАНЕЛЬ С КНОПКОЙ ТЕМЫ */
.top-bar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}

#theme-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    width: 45px;
    height: 45px;
}

/* ОГРОМНЫЙ ЭКРАН КАЛЬКУЛЯТОРА */
#display {
    width: 100%;
    height: 150px;
    font-size: 70px;
    font-weight: 300;
    text-align: right;
    border: none;
    background-color: #000000;
    color: #ffffff;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 20px;
    outline: none;
    transition: background-color 0.3s, color 0.3s;
}

/* СЕТКА КНОПОК НА 5 КОЛОНОК */
#buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    align-items: center;
    justify-items: center;
    width: 100%;
}

/* ОБЩИЙ СТИЛЬ ДЛЯ ВСЕХ КНОПОК */
button {
    width: 65px;
    height: 65px;
    font-size: 24px;
    font-weight: 400;
    border: none;
    border-radius: 50%;
    background-color: transparent;
    color: #8e8e93; /* Цвет для инженерных кнопок по умолчанию */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s, color 0.3s;
}

/* ЭФФЕКТ НАЖАТИЯ ДЛЯ ТЕМНОЙ ТЕМЫ */
button:active {
    background-color: #222222 !important;
}

/* БЕЛЫЕ КНОПКИ ДЛЯ ЦИФР */
.btn-white {
    color: #ffffff !important;
    font-size: 28px;
}

/* СВЕТЛО-СЕРЫЕ КНОПКИ ДЛЯ СКОБОК */
.btn-gray {
    color: #aeaea7 !important;
}

/* ОРАНЖЕВЫЙ ТЕКСТ ДЛЯ МАТЕМАТИЧЕСКИХ ЗНАКОВ */
.btn-orange-text {
    color: #ff851b !important;
    font-size: 28px;
}

/* МЕЛКИЙ ШРИФТ ДЛЯ ТРИГОНОМЕТРИИ */
.font-small {
    font-size: 16px !important;
}

/* КРУГЛАЯ ОРАНЖЕВАЯ КНОПКА РАВНО */
.btn-equal {
    background-color: #f75c2f !important;
    color: #ffffff !important;
    font-size: 32px;
}

.btn-equal:active {
    background-color: #d44b24 !important;
}

/* ПУСТЫЕ МЕСТА ДЛЯ ВЫРАВНИВАНИЯ КНОПКИ "=" ВНИЗУ */
.empty-space {
    width: 65px;
    height: 65px;
}

/* ======================================================= */
/* МАГИЯ СВЕТЛОЙ ТЕМЫ XIAOMI                  */
/* ======================================================= */

body.light-theme, 
body.light-theme #calculator {
    background-color: #f9f9f9 !important; /* Белый фон */
}

body.light-theme #display {
    background-color: #f9f9f9 !important;
    color: #000000 !important; /* Черные цифры на экране */
}

body.light-theme .btn-white {
    color: #000000 !important; /* Черные цифры на кнопках */
}

body.light-theme button {
    color: #666666; /* Инженерные кнопки становятся темнее */
}

body.light-theme button:active {
    background-color: #e5e5e5 !important; /* Серый круг при нажатии днем */
}