/* ======== ДИЗАЙН-СИСТЕМА UMNELLABOT ======== */

/* Базовый reset и нормализация */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Улучшенная нормализация */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
    height: 100%;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
    display: block;
    max-width: 100%;
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

/* CSS переменные для единообразия */
:root {
    /* Цвета */
    --primary: #9C6CFF;
    --primary-dark: #7C3AED;
    --primary-darker: #6D28D9;
    --primary-light: rgba(156, 108, 255, 0.2);
    --primary-lighter: rgba(156, 108, 255, 0.1);
    
    --success: #22C55E;
    --success-light: rgba(34, 197, 94, 0.2);
    --success-text: #F0FDF4;
    
    --error: #EF4444;
    --error-light: rgba(239, 68, 68, 0.2);
    --error-text: #FEF2F2;
    
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.2);
    
    --white: #FFFFFF;
    --white-10: rgba(255, 255, 255, 0.1);
    --white-20: rgba(255, 255, 255, 0.2);
    --white-30: rgba(255, 255, 255, 0.3);
    --white-70: rgba(255, 255, 255, 0.7);
    --white-80: rgba(255, 255, 255, 0.8);
    
    --bg-primary: rgba(17, 25, 40, 0.75);
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --bg-tertiary: rgba(255, 255, 255, 0.05);
    --bg-overlay: rgba(0, 0, 0, 0.8);
    
    --border: rgba(255, 255, 255, 0.1);
    --border-secondary: rgba(255, 255, 255, 0.2);
    
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.6);
    
    /* Отступы (8px базовая единица) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    
    /* Размеры шрифтов */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 28px;
    --text-4xl: 32px;
    --text-5xl: 48px;
    --text-6xl: 64px;
    
    /* Радиусы скругления */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50px;
    
    /* Тени */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --shadow-primary: 0 12px 30px rgba(156, 108, 255, 0.3);
    --shadow-success: 0 2px 4px rgba(76, 175, 80, 0.2);
    --shadow-energy: 0 2px 4px rgba(255, 152, 0, 0.2);
    
    /* Шрифты */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: 'Courier New', monospace;
}

/* ======== БАЗОВЫЕ СТИЛИ ======== */
body {
    font-family: var(--font-family);
    background: var(--bg-overlay);
    color: var(--text-primary);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-4);
    backdrop-filter: blur(16px) saturate(180%);
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    width: 100%;
    max-width: 100vw;
}

/* ======== ХЕДЕР ======== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.header .game-progress {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--text-primary);
}

.back-btn {
    background: none;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    font-size: var(--text-2xl);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: var(--bg-secondary);
    transform: translateX(-2px);
}

/* ======== ЭНЕРГИЯ ======== */
.energy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.energy-bar {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 600;
    color: var(--primary);
    font-size: var(--text-base);
}

.energy-icon {
    font-size: 1.2em;
}

.energy-count {
    font-size: 1.1em;
}

.energy-max {
    font-size: 0.9em;
    opacity: 0.7;
}

.energy-status {
    font-size: var(--text-xs);
    text-align: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    min-width: 120px;
    transition: all 0.3s ease;
}

.energy-status.full {
    background: linear-gradient(135deg, var(--success), #45a049);
    color: var(--white);
    border-color: var(--success);
    box-shadow: var(--shadow-success);
}

.energy-status.regenerating {
    background: linear-gradient(135deg, var(--warning), #f57c00);
    color: var(--white);
    border-color: var(--warning);
    box-shadow: var(--shadow-energy);
    animation: pulse-energy 2s infinite;
}

@keyframes pulse-energy {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ======== UMНЕЛЛА ПЕРСОНАЖ ======== */
.umnella-container {
    text-align: center;
    margin-bottom: var(--space-6);
}

.umnella-container.small {
    margin-bottom: var(--space-6);
}

.umnella-avatar {
    font-size: var(--text-6xl);
    margin-bottom: var(--space-2);
    user-select: none;
}

.umnella-container.small .umnella-avatar {
    font-size: var(--space-10);
    margin-bottom: var(--space-2);
}

.umnella-speech {
    background: var(--bg-secondary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    line-height: 1.4;
    border: 1px solid var(--border);
}

.umnella-container.small .umnella-speech {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-4);
}

.umnella-final-speech {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
    color: var(--text-secondary);
    font-size: var(--text-base);
    line-height: 1.4;
    border: 1px solid var(--border);
}

/* ======== КНОПКИ ======== */
.btn {
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
    min-width: 120px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border: 1px solid var(--primary);
}

.btn.primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    box-shadow: var(--shadow-primary);
}

.btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: var(--white-20);
    border-color: var(--border-secondary);
}

.btn.success {
    background: linear-gradient(135deg, var(--success), #45a049);
    color: var(--white);
    border: 1px solid var(--success);
}

.btn.danger {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: var(--white);
    border: 1px solid var(--error);
}

.btn.small {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    min-width: 80px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

/* ======== ПОКУПКА ЭНЕРГИИ ======== */
.buy-energy-btn {
    background: linear-gradient(135deg, var(--warning), #f57c00);
    color: var(--white);
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.buy-energy-btn:hover {
    background: linear-gradient(135deg, #f57c00, #e65100);
    transform: translateY(-1px);
    box-shadow: var(--shadow-energy);
}

/* ======== ИГРОВЫЕ РЕЖИМЫ ======== */
.game-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
    width: 100%;
    max-width: 600px;
    margin-bottom: var(--space-8);
    padding: 0;
}

.mode-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
    text-align: center;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    width: 100%;
}

.mode-card:hover {
    background: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-primary);
    border-color: var(--primary);
}

.mode-icon {
    font-size: var(--text-5xl);
    margin-bottom: var(--space-4);
    user-select: none;
}

.mode-card h3 {
    margin: 0 0 var(--space-3) 0;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.mode-card p {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.mode-cost {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--border);
}

/* ======== СТАТИСТИКА ======== */
.stats-section {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
}

.stats-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stats-btn:hover {
    background: var(--white-20);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ======== ЗАГРУЗКА ======== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
    gap: var(--space-4);
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    border: 8px solid var(--white-10);
    border-radius: 50%;
    border-top: 8px solid var(--primary);
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ======== СООБЩЕНИЯ ======== */
.error-message {
    background: var(--error-light);
    border: 2px solid var(--error);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    color: var(--error-text);
    text-align: center;
    margin: var(--space-4) 0;
    animation: fadeIn 0.3s ease;
}

.success-message {
    background: var(--success-light);
    border: 2px solid var(--success);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    color: var(--success-text);
    text-align: center;
    margin: var(--space-4) 0;
    animation: fadeIn 0.3s ease;
}

.energy-warning {
    background: var(--error-light);
    border: 2px solid var(--error);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
    text-align: center;
}

.energy-warning-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-3);
}

.energy-warning-text {
    color: var(--error-text);
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.energy-warning-hint {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

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

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: var(--space-4);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

/* ======== СКРОЛЛБАР ======== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ======== АДАПТИВНОСТЬ ======== */
@media (max-width: 768px) {
    .app-container {
        padding: var(--space-3);
    }
    
    .game-modes {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .mode-card {
        padding: var(--space-5);
        min-height: 160px;
    }
    
    .mode-icon {
        font-size: var(--text-4xl);
        margin-bottom: var(--space-3);
    }
}

@media (max-width: 600px) {
    .umnella-avatar {
        font-size: var(--text-5xl);
    }
    
    .umnella-speech {
        font-size: var(--text-sm);
    }
    
    .header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: stretch;
    }
    
    .energy-container {
        order: -1;
        align-self: center;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: var(--space-2);
    }
    
    .btn {
        font-size: var(--text-sm);
        padding: var(--space-2) var(--space-4);
    }
}




