* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #000;
    color: #fff;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
}

.status-bar-left {
    flex: 1;
}

.status-bar-center {
    flex: 2;
    display: flex;
    justify-content: center;
}

.status-bar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.time {
    font-weight: 600;
    font-size: 16px;
}

.status-icon {
    width: 18px;
    height: 18px;
}

.dynamic-island {
    width: 120px;
    height: 32px;
    background: #000;
    border-radius: 16px;
}

.app-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    z-index: 1000;
    display: none;
}

.app-container.open {
    display: block;
}

.page {
    display: none;
    height: calc(100vh - 140px);
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
}

.page.active {
    display: block;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px;
    margin-bottom: auto;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 10px;
}

.app-icon:active {
    transform: scale(0.9);
}

.app-icon img {
    width: 60px;
    height: 60px;
    border-radius: 15px;
}

.app-icon span {
    font-size: 12px;
    color: #fff;
    text-align: center;
}

.dock {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 20px);
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-around;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    z-index: 100;
}

.dock .app-icon {
    padding: 0;
    margin: 0 10px;
}

.dock .app-icon img {
    width: 50px;
    height: 50px;
}

.page-indicator {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 20px) + 100px);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    z-index: 90;
}

.dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.dot.active {
    background: rgba(255, 255, 255, 0.8);
}

/* Fullscreen app styles */
.app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 100;
    display: none;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.app.active {
    display: flex;
}

.app-content {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Swipe handle */
.swipe-handle {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2.5px;
    z-index: 1000;
}

/* Remove all back buttons */
.back-button {
    display: none;
}

/* Hide app header */
.app-header {
    display: none;
}

@media (max-width: 390px) {
    .app-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .app-icon img {
        width: 50px;
        height: 50px;
    }
}

@media (min-width: 768px) {
    .app-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .app-icon img {
        width: 70px;
        height: 70px;
    }
}

:root {
    --app-icon-size: 60px;
    --app-spacing: 16px;
    --dock-height: 90px;
    --status-bar-height: 44px;
    --page-indicator-height: 20px;
    --safe-area-top: env(safe-area-inset-top, 0);
}

.ios-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-image: url('../images/wallpaper.svg');
    background-size: cover;
    background-position: center;
}

/* Специальный класс для скрытия в PWA режиме */
.browser-only {
    display: flex;
}

@media all and (display-mode: standalone) {
    .browser-only {
        display: none;
    }
}

.battery, .wifi, .signal {
    width: 20px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
}

.battery {
    position: relative;
    border: 1px solid #fff;
    border-radius: 2px;
    width: 22px;
    height: 12px;
}

.battery::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 6px;
    background-color: #fff;
    border-radius: 1px;
}

.battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 3px;
    width: 2px;
    height: 4px;
    background-color: #fff;
    border-radius: 0 2px 2px 0;
}

.wifi {
    position: relative;
    width: 15px;
    height: 12px;
}

.wifi::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 15px;
    height: 15px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    border-radius: 0 0 9px 0;
    transform: rotate(45deg) skew(10deg, 10deg);
}

.signal {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 12px;
}

.signal::before, .signal::after {
    content: '';
    width: 3px;
    background-color: #fff;
    border-radius: 1px;
}

.signal::before {
    height: 6px;
}

.signal::after {
    height: 10px;
}

/* Контейнер для springboard */
.springboard-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: calc(var(--status-bar-height) + var(--safe-area-top));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* В браузерном режиме (не PWA) */
@media not all and (display-mode: standalone) {
    .springboard-container {
        top: var(--status-bar-height);
        padding-top: 0;
    }
}

/* Контейнер для страниц */
.pages-container {
    flex: 1;
    display: flex;
    overflow-x: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.pages-container:active {
    cursor: grabbing;
}

/* Индикаторы страниц */
.page-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    height: var(--page-indicator-height);
    margin-bottom: 10px;
    gap: 5px;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
    cursor: pointer;
}

.indicator:hover {
    transform: scale(1.2);
}

.indicator.active {
    background-color: #fff;
    width: 20px;
    border-radius: 4px;
}

/* Стили для большой иконки в открытом приложении */
.app-large-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.app-large-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.fadeIn {
    animation: fadeIn 0.3s forwards;
}

.slideUp {
    animation: slideUp 0.3s forwards;
}

/* Медиа запросы для адаптивности */
@media screen and (max-width: 414px) {
    :root {
        --app-icon-size: 50px;
        --app-spacing: 10px;
    }
    
    .app-grid {
        grid-gap: 12px;
    }
}

@media screen and (max-width: 320px) {
    :root {
        --app-icon-size: 45px;
        --app-spacing: 8px;
    }
    
    .app-grid {
        grid-gap: 10px;
    }
}

.swipe-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    border-radius: 12px 12px 0 0;
    z-index: 1000;
}

/* Скрываем тулбар в режиме печати */
@media print {
    #toolbar {
        display: none !important;
    }
}

/* Скрываем тулбар на экране */
@media screen {
    #toolbar {
        display: none !important;
    }
} 