:root {
    --system-font: 'Text', 'Display', Roboto, Helvetica, Arial, sans-serif;
    --background-blur: 12px; /* Сила размытия для полупрозрачных элементов */
    --mate-background-blur: 24px; /* Сила размытия для полупрозрачных элементов */
    --full-background-blur: 64px;
    --ui-border-radius: 18px; /* Основной радиус скругления для окон и панелей */
    --app-icon-size: 70px; /* Размер иконки приложения на рабочем столе */
    --app-icon-font-size: 13px; /* Размер шрифта подписи под иконкой */
    --base-font-size: 16px; /* Базовый размер шрифта для всей системы */
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Запрещаем прокрутку всей страницы */
    font-family: var(--system-font);
    background-color: #000;
    -webkit-font-smoothing: antialiased; /* Улучшение рендеринга шрифтов в WebKit */
    -moz-osx-font-smoothing: grayscale;
    font-size: var(--base-font-size); /* Применяем базовый размер шрифта */
}

/* Главный контейнер ОС */
#os-container {
    position: relative;
    width: 100%;
    height: 100%;
    /* Убираем фоновый градиент, так как фон теперь на рабочем столе */
    background-color: antiquewhite;
    display: flex;
    flex-direction: column;
    color: white;
    
}

#os-wallpaper {
    position: absolute;
    width: 110%;
    height: 110%;
    top: -5%;
    left: -5%;
    background-image: url('/assets/bg/bg1.jpg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transition: all 0.4s ease-in-out;
}

/* ==========================================================================
   ОСНОВНАЯ СТРУКТУРА ИНТЕРФЕЙСА (СТАТУС-БАР, КОНТЕНТ, НАВ-БАР)
   ========================================================================== */
#status-bar {
    flex-shrink: 0; /* Запрещаем сжиматься */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    z-index: 999;
    font-size: 0.9em; /* Используем относительные единицы */
    font-weight: 500;
    cursor: pointer; /* Курсор-рука для открытия центра уведомлений */
    /* text-shadow: 0 1px 2px rgba(0,0,0,0.3); */
    mix-blend-mode: difference;
}
#status-bar .right { display: flex; align-items: center; gap: 8px; }
#status-bar .right img { height: 1em; filter: invert(1);}

/* Основная область контента между статус-баром и нав-баром */
#main-content {
    flex-grow: 1; /* Занимает все доступное пространство */
    position: relative;
    overflow: hidden;
    display: flex;
}

/* Нижняя панель навигации */
#nav-bar {
    flex-shrink: 0;
    padding: 8px;
    z-index: 100;
    backdrop-filter: blur(var(--background-blur));
}
#nav-bar-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--ui-border-radius);
    padding: 8px 0;
    transition: all 0.2s ease-in-out;
}

#os-container:has(.app-window.active) #nav-bar {
    backdrop-filter: none; /* Эффект размытия фона */
    -webkit-backdrop-filter: none;
}

#nav-bar button {
    background: none;
    border: none;
    cursor: pointer; 
    padding: 5px 20px;
}

#nav-bar button img {
    height: 1.5em;
    mix-blend-mode: difference;
}

/* ==========================================================================
   РАБОЧИЙ СТОЛ
   ========================================================================== */
#desktop {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: grid; /* Используем грид для адаптивного расположения иконок */
    grid-template-columns: repeat(auto-fill, minmax(var(--app-icon-size), 1fr));
    grid-auto-rows: max-content;
    gap: 25px;
    align-content: flex-start; /* И��онки начинаются сверху */
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    transition: all ease-in-out .2s;
}
.app-icon-img {
    width: var(--app-icon-size);
    height: var(--app-icon-size);
    background: rgba(255, 255, 255, 0.15);
    /* background: #ffffff; */
    /* background: linear-gradient(135deg,rgba(255, 255, 255, .2) 0%, rgba(142, 120, 255, .2) 100%); */
    border-radius: 30%;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
    backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur));
}

.app-icon:hover .app-icon-img {
    transform: scale(1.08); /* Анимация при наведении */
}

.app-icon img {
    width: 100%;
    height: 100%;
}

.app-icon span {
    font-size: var(--app-icon-font-size);
    /* mix-blend-mode: exclusion; */
    color: #000;
    transition: all ease-in-out .2s;
    /* text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); Тень для читаемости */
}

/* ==========================================================================
   ОКНА ПРИЛОЖЕНИЙ
   ========================================================================== */
/* Контейнер для всех окон */
#app-windows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Не перехватывает клики, когда пустой */
    transition: all 0.2s ease-in-out;
}
/* Стилизация отдельного окна приложения */
.app-window {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #f4f4f8; /* Светлый фон для приложений */
    background-color: rgba(255,255,255,0.2);
    /* backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur)); */

    color: #1d1d1f;
    display: flex; flex-direction: column;
    transform: scale(1.2); opacity: 0; /* Начальное состояние для анимации появления */
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s;
    pointer-events: none; /* Неактивно по умолчанию */
    z-index: 10;
    border-radius: var(--ui-border-radius);
    overflow: hidden;

    /* box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.23); */
}

.app-window.active {
    transform: scale(1); opacity: 1; pointer-events: all; /* Активное окно */
}

/* body:has(#lock-screen.overlay.unlocking.hidden) .app-icon {
    opacity: 1;
} */

#os-container:not(:has(#lock-screen.overlay.unlocking.hidden)) .app-icon {
    opacity: 0;
}

/* #os-container:not(:has(#lock-screen.overlay)) .app-icon {
    opacity: 1;
} */

#main-content:has(.app-window.active) .app-icon {
    opacity: 0;
}

#os-container:has(.app-window.active) #os-wallpaper {
    /* -webkit-filter: blur(var(--mate-background-blur)); */
    /* filter: blur(var(--mate-background-blur)) saturate(0.5); */
    filter: blur(var(--full-background-blur)) saturate(0.5); */
    -webkit-backdrop-filter: blur(var(--full-background-blur)); /*        поддержка для iOS */

    /* From https://css.glass */
    /* background: rgba(255, 255, 255, 0.21); */
    /* border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.23); */
}

/* Заголовок окна приложения */
.app-header {
    padding: 0.7em 1em;
    background-color: #e9e9f0;
    flex-shrink: 0;
    border-bottom: 1px solid #dcdce1;
    display: flex;
    align-items: center;
    position: relative;
    height: 1.8em;
}
.app-back-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    width: 1.8em; height: 1.8em;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}
.app-back-btn.hidden { /* Скрытие кнопки "назад" на главном экране */
    opacity: 0;
    pointer-events: none;
}
.app-back-btn img { width: 1.4em; height: 1.4em; }
.app-header-title {
    position: absolute; left: 0; right: 0;
    text-align: center; font-weight: 600; z-index: 1;
}
/* Контентная часть приложения (где переключаются экраны) */
.app-content { flex-grow: 1; position: relative; overflow: hidden; }
.app-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    padding: 1em; box-sizing: border-box;
    /* background-color: #f4f4f8; */
    background-color: transparent;
    transition: transform 0.3s ease-in-out;
}
/* Анимации сдвига экранов внутри приложения */
.app-screen.entering-right { transform: translateX(100%); }
.app-screen.exiting-left { transform: translateX(-100%); }
.app-screen.entering-left { transform: translateX(-100%); }
.app-screen.exiting-right { transform: translateX(100%); }

/* ==========================================================================
   СИСТЕМНЫЕ ОВЕРЛЕИ (экраны поверх всего)
   ========================================================================== */
.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 200;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur));
    transition: opacity 0.3s;
}
.overlay.hidden {
    pointer-events: none;
    opacity: 0;
    z-index: -1; /* Перемещаем за все остальные элементы, чтобы не перехватывал клики */
}

body:has(.overlay.unlocking.hidden) #app-windows {
    opacity: 1;
}

body:has(.overlay) #app-windows {
    opacity: 0;
}

/* --- ЭКРАН БЛОКИРОВКИ --- */
#lock-screen {
    z-index: 300;
    /* Убираем собственный фон, он будет на #os-container */
    transition: transform 0.4s ease-in-out;
}
#lock-screen::before { /* Затемнение для читаемости */
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.4);
}
#lock-screen.unlocking { transform: translateY(-100%); } /* Анимация разблокировки */

.lock-screen-content {
    width: 100%;
    height: 100%; 
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 60px 0;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    gap: 5%;
}

.lock-screen__clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 50%;
}

#lock-screen-time {
    font-size: 5em; 
    font-weight: 300;
}

#lock-screen-date {
    font-size: 1.2em;
    font-weight: 400;
    /* margin-top: -5em; */
}

.lock-screen__unlock-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

#fingerprint-scanner {
    width: 5em;
    height: 5em;
    cursor: pointer;
    display: flex; 
    justify-content: center;
    align-items: center;
}

#fingerprint-scanner img {
    width: 100%;
    filter: invert(1);
    /* mix-blend-mode: difference; */
}

.lock-screen-content > span {
    font-weight: 500;
}

/* body:has(#lock-screen.overlay.unlocking.hidden) .app-icon {
    opacity: 1;
}

body:has(#lock-screen.overlay) .app-icon {
    opacity: 0; 
} */

/* --- ПЕРЕКЛЮЧАТЕЛЬ ПРИЛОЖЕНИЙ --- */
#app-switcher { 
    padding: 50px 20px; 
    box-sizing: border-box; 
    transition: opacity 0.3s, transform 0.3s;
}
#app-switcher.hidden {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none; /* Игнорировать клики, когда скрыто */
}
.app-switcher-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px; height: 100%; overflow-y: auto;
}
.app-preview-card {
    position: relative; cursor: pointer;
    border-radius: var(--ui-border-radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.app-preview-card:hover { transform: translateY(-10px); }
.preview-content {
    height: 250px; background: #f4f4f8; overflow: hidden;
}
/* Масштабирование клона окна для создания превью */
.preview-content > .app-window {
    transform: scale(0.25); transform-origin: top left;
    width: 400% !important; height: 400% !important;
    opacity: 1; border-radius: 0;
}
.app-preview-card span {
    position: absolute; bottom: 0; left: 0; width: 100%;
    padding: 10px; box-sizing: border-box;
    background: rgba(0,0,0,0.4);
    font-weight: 500; text-align: center;
}
.close-preview {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; background: rgba(0,0,0,0.5);
    color: white; border: none; border-radius: 50%;
    cursor: pointer; font-weight: bold; font-size: 16px;
    line-height: 28px; text-align: center; z-index: 1;
}

/* ==========================================================================
   СИСТЕМА УВЕДОМЛЕНИЙ
   ========================================================================== */
/* Всплывающие уведомления */
#popup-notifications {
    position: absolute; top: 15px; left: 50%;
    transform: translateX(-50%); z-index: 1000;
    display: flex; flex-direction: column; gap: 10px;
}
.popup-notification {
    padding: 0.8em 1.2em; background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(var(--background-blur));
    color: white; border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: slideInDown 0.5s forwards, fadeOut 0.5s 4s forwards;
}
@keyframes slideInDown { from { transform: translateY(-150%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* Центр уведомлений (панель) */
#notification-center {
    padding: 20px 20px 0; box-sizing: border-box;
    transform: translateY(-100%);
    transition: transform 0.4s ease-in-out, opacity 0.4s;
    display: flex;
    flex-direction: column;
    opacity: 0; /* Скрыто по умолчанию */
    pointer-events: none; /* Неактивно по умолчанию */
}
#notification-center.visible { 
    transform: translateY(0); 
    opacity: 1;
    pointer-events: all;
    z-index: 200;
}
#nc-time { font-size: 3.5em; font-weight: 300; text-align: center; margin-top: 20px; }
#nc-date { font-size: 1em; font-weight: 400; text-align: center; opacity: 0.8; margin-bottom: 20px; }

#notification-center h2 {
    text-align: center;
    margin-top: 10px;
    color: white;
    flex-shrink: 0;
}

#notification-list { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 0 5px;
}

#lock-screen-notifications {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100% - 100px);
    height: 100%;
    overflow-y: auto;
    width: 90%;
    max-width: 400px;
}
/* Стили отдельного элемента уведомления в списке */
.notification-item {
    position: relative; background: rgba(255, 255, 255, 0.15);
    padding: 12px 15px; border-radius: 12px;
    margin-bottom: 10px;
}
.notification-item .title { font-weight: bold; margin-bottom: 5px; }
.notification-item .message { font-size: 0.9em; opacity: 0.9; }
.notification-close-btn {
    position: absolute; top: 8px; right: 8px; width: 20px; height: 20px;
    background: rgba(0,0,0,0.3); color: white; border: none;
    border-radius: 50%; cursor: pointer; line-height: 20px;
    text-align: center; font-size: 12px;
}
/* "Ручка" для закрытия центра уведомлений */
.notification-center-handle-container {
    flex-shrink: 0;
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.notification-center-handle {
    width: 50px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 2.5px;
}



.glass {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(2px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 2rem;
  box-shadow:
    0 8px 32px rgba(31, 38, 135, 0.2),
    inset 0 4px 20px rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.glass::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.1);
  border-radius: 2rem;
  backdrop-filter: blur(1px);
  box-shadow:
    inset -10px -8px 0px -11px rgba(255,255,255,1),
    inset 0px -9px 0px -8px rgba(255,255,255,1);
  opacity: 0.6;
  z-index: -1;
  filter: blur(1px) drop-shadow(10px 4px 6px black) brightness(115%);
}

/* ==========================================================================
   УНИВЕРСАЛЬНАЯ НАВИГАЦИЯ ВНУТРИ ПРИЛОЖЕНИЙ
   ========================================================================== */
.app-content {
    overflow: hidden; /* Обязательно для корректной работы анимаций */
    position: relative; /* Для позиционирования дочерних .app-page */
}

.app-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1em;
    box-sizing: border-box;
    background-color: inherit; /* Наследуем фон от родительского .app-window */
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    overflow-y: auto;
    pointer-events: none; /* По умолчанию неактивны */
    opacity: 0;
    transform: translateX(100%); /* Все страницы справа по умолчанию */
    z-index: 1; /* Базовый z-index */
}

/* Активная страница */
.app-page.page-active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    z-index: 2; /* Активная стр��ница всегда выше */
}

/* Страница, которая уходит влево (при переходе вперед) */
.app-page.page-exit-left {
    transform: translateX(-30%);
    opacity: 0;
    z-index: 1;
}

/* Страница, которая уходит вправо (при переходе назад) */
.app-page.page-exit-right {
    transform: translateX(100%);
    opacity: 0;
    z-index: 1;
}

/* Страница, которая входит слева (при переходе назад) */
.app-page.page-enter-left {
    transform: translateX(0%); /* Приходит на место */
    opacity: 1;
    z-index: 2;
}

/* Ссылка для навигации */
.nav-link {
    cursor: pointer;
}




/* .liquidGlass-wrapper {
        top: 50%;
        transform: translateY(-50%);
        position: fixed;
        display: flex;
        font-weight: 600;
        overflow: hidden;
        color: white;
        cursor: pointer;
        box-shadow: 0 6px 6px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 0, 0, 0.1);
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 2.2);
        padding: 24px;
        border-radius: 16px;
    }

    .liquidGlass-effect {
        position: absolute;
        z-index: 0;
        inset: 0;
        backdrop-filter: blur(3px);
        filter: url(#glass-distortion);
        overflow: hidden;
        isolation: isolate;
        border-radius: 16px;
    }

    .liquidGlass-tint {
        z-index: 1;
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.20);
        border-radius: 16px;
    }

    .liquidGlass-shine {
        position: absolute;
        inset: 0;
        z-index: 2;
        overflow: hidden;
        box-shadow: inset 2px 2px 1px 0 rgba(255, 255, 255, 0.2), inset -1px -1px 1px 1px rgba(255, 255, 255, 0.1);
        border-radius: 16px;
    }
    .liquidGlass-text {
        z-index: 3;
        font-size: 2rem;
        color: white;
    } */


    .glass {
        background-color: rgba(255, 255, 255, 0.2); /* полупрозрачный цвет фона */
        backdrop-filter: blur(10px);               /* размытие заднего фона */
        -webkit-backdrop-filter: blur(10px);       /* поддержка для iOS */
        border-radius: 10px;                        /* скругление углов */
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);     /* тень для объема */
        overflow: hidden;                           /* обрезка дочерних элементов */
        padding: 20px;
    }