/* === ГЛОБАЛЬНЫЕ СТИЛИ === */
:root {
    /* Фирменные цвета SFERA AUTO */
    --blue: #2A5BDA;
    --blue-dark: #1A4AB8;
    --blue-light: #4A7BFF;
    --blue-rgb: 42, 91, 218;
    
    --yellow: #FFD700;
    --yellow-dark: #FFB300;
    --yellow-light: #FFF176;
    --yellow-rgb: 255, 215, 0;
    
    /* Фоны и текст */
    --bg: #0A192F;
    --bg-rgb: 10, 25, 47;
    --card-bg: #112240;
    --card-bg-rgb: 17, 34, 64;
    
    --text: #E6F1FF;
    --text-rgb: 230, 241, 255;
    --text-muted: #8892B0;
    --text-muted-rgb: 136, 146, 176;
    
    /* Дополнительные цвета */
    --green: #2ED573;
    --green-rgb: 46, 213, 115;
    --purple: #8774E1;
    --purple-rgb: 135, 116, 225;
    --cyan: #00D2FF;
    --cyan-rgb: 0, 210, 255;
    --red: #FF6B6B;
    --red-rgb: 255, 107, 107;
    
    /* Размеры */
    --app-width: 400px;
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === ЦЕНТРИРОВАНИЕ КОНТЕЙНЕРА === */
body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* === КОНТЕЙНЕР ПРИЛОЖЕНИЯ === */
.app {
    width: 100%;
    max-width: var(--app-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
}

/* Фикс для iOS Safari */
@supports (-webkit-touch-callout: none) {
    .app {
        min-height: -webkit-fill-available;
    }
}

/* === ШАПКА === */
.header {
    text-align: center;
    padding: 20px 0 25px;
    position: relative;
    flex-shrink: 0;
}

.logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    border-radius: 20px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 10px 25px rgba(var(--blue-rgb), 0.4);
    position: relative;
    overflow: hidden;
}

.logo::after {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: var(--yellow);
    border-radius: 50%;
    opacity: 0.3;
}

.title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--text), var(--blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* === ОСНОВНЫЕ КНОПКИ === */
.main-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    scrollbar-width: none;
}

.main-buttons::-webkit-scrollbar {
    display: none;
}

.main-btn {
    background: var(--card-bg);
    border: none;
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.main-btn:active {
    transform: scale(0.98);
    border-color: var(--blue);
    background: rgba(var(--blue-rgb), 0.15);
    box-shadow: 0 6px 15px rgba(var(--blue-rgb), 0.2);
}

/* Иконки кнопок */
.btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* Цвета иконок */
.icon-blue { 
    background: linear-gradient(135deg, var(--blue), var(--blue-light)); 
    box-shadow: 0 4px 12px rgba(var(--blue-rgb), 0.3);
}

.icon-yellow { 
    background: linear-gradient(135deg, var(--yellow), var(--yellow-light)); 
    box-shadow: 0 4px 12px rgba(var(--yellow-rgb), 0.3);
}

.icon-green { 
    background: linear-gradient(135deg, var(--green), #1DD1A1); 
    box-shadow: 0 4px 12px rgba(var(--green-rgb), 0.3);
}

.icon-purple { 
    background: linear-gradient(135deg, var(--purple), #A855F7); 
    box-shadow: 0 4px 12px rgba(var(--purple-rgb), 0.3);
}

.icon-cyan { 
    background: linear-gradient(135deg, var(--cyan), #3A7BD5); 
    box-shadow: 0 4px 12px rgba(var(--cyan-rgb), 0.3);
}

.icon-red { 
    background: linear-gradient(135deg, var(--red), #FF8E53); 
    box-shadow: 0 4px 12px rgba(var(--red-rgb), 0.3);
}

/* Контент кнопок */
.btn-content {
    flex: 1;
    min-width: 0; /* Для правильного переноса текста */
}

.btn-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
    line-height: 1.3;
}

.btn-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === КНОПКА ВЫХОДА === */
.exit-btn {
    background: rgba(var(--text-rgb), 0.05);
    border: 1px solid rgba(var(--text-rgb), 0.1);
    color: var(--text-muted);
    border-radius: 14px;
    padding: 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.exit-btn:active {
    background: rgba(var(--text-rgb), 0.1);
    transform: scale(0.98);
}

/* === АНИМАЦИИ === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Анимация логотипа */
.logo {
    animation: pulse 2s infinite;
}

/* Анимация кнопок при загрузке */
.main-btn {
    animation: fadeInUp 0.4s ease-out backwards;
}

.main-btn:nth-child(1) { animation-delay: 0.1s; }
.main-btn:nth-child(2) { animation-delay: 0.15s; }
.main-btn:nth-child(3) { animation-delay: 0.2s; }
.main-btn:nth-child(4) { animation-delay: 0.25s; }
.main-btn:nth-child(5) { animation-delay: 0.3s; }
.main-btn:nth-child(6) { animation-delay: 0.35s; }

/* === АДАПТИВНОСТЬ === */
/* Для маленьких экранов */
@media (max-width: 420px) {
    .app {
        padding: 12px;
    }
    
    .header {
        padding: 15px 0 20px;
    }
    
    .logo {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    .main-btn {
        padding: 16px;
        gap: 14px;
    }
    
    .btn-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .btn-title {
        font-size: 15px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .app {
        padding: 10px;
    }
    
    .logo {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .title {
        font-size: 20px;
    }
    
    .main-btn {
        padding: 14px;
        gap: 12px;
        border-radius: 16px;
    }
    
    .btn-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }
}

/* Фикс высоты для iOS */
@media (max-height: 700px) {
    .main-buttons {
        gap: 10px;
    }
    
    .main-btn {
        padding: 16px 14px;
    }
    
    .btn-desc {
        -webkit-line-clamp: 1;
        font-size: 12px;
    }
}

/* === УТИЛИТЫ === */
.hidden {
    display: none !important;
}

/* Эффект ripple */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Для скролла в Telegram */
.scrollable {
    -webkit-overflow-scrolling: touch;
}

/* Граница для дебага */
.debug-border {
    border: 1px solid rgba(255, 0, 0, 0.3);
}