:root {
    --bg-primary: #f0f4ff;
    --bg-container: rgba(255, 255, 255, 0.95);
    --text-primary: #1a1a2e;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --card-bg: #f8f9fa;
    --shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --btn-text: #fff;
}

[data-theme="dark"] {
    --bg-primary: #0f0c29;
    --bg-container: rgba(255, 255, 255, 0.06);
    --text-primary: #fff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.08);
    --shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --btn-text: #fff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    transition: background 0.3s ease;
}

.container {
    background: var(--bg-container);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 32px 24px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
}

.theme-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.theme-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 48px;
    margin-bottom: 8px;
}

h1 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.subtitle {
    color: var(--text-muted);
    font-size: 16px;
    margin-top: -4px;
    transition: color 0.3s ease;
}

.info-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

#status {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 12px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

#status.loading {
    color: #667eea;
    font-weight: 600;
}

#status.error {
    color: #dc3545;
}

#status.success {
    color: #28a745;
}

#recordBtn {
    width: 100%;
    padding: 18px 0;
    background: var(--gradient);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

#recordBtn .btn-icon {
    font-size: 24px;
}

#recordBtn .btn-text {
    color: var(--btn-text);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#recordBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5);
}

#recordBtn:active {
    transform: scale(0.97);
}

#recordBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

#recordBtn.recording {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

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

#result {
    margin-top: 20px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    display: none;
    transition: all 0.3s ease;
}

#result.visible {
    display: block;
}

#result .user-text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

#result .ai-answer {
    color: var(--text-primary);
}

.speak-btn {
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--gradient);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.speak-btn:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.speak-btn.hidden {
    display: none;
}

.footer {
    text-align: center;
    margin-top: 24px;
}

.footer p {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.5px;
    opacity: 0.6;
}

.hidden {
    display: none !important;
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        padding: 24px 16px;
        border-radius: 24px;
    }
    h1 {
        font-size: 24px;
    }
    .subtitle {
        font-size: 14px;
    }
    #recordBtn .btn-text {
        font-size: 16px;
    }
    #recordBtn {
        padding: 16px 0;
    }
    .logo {
        font-size: 40px;
    }
    .info-card p {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 16px 12px;
        border-radius: 20px;
    }
    h1 {
        font-size: 20px;
    }
    #recordBtn .btn-text {
        font-size: 14px;
    }
    .theme-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Для экранов с высоким разрешением */
@media (min-width: 768px) {
    .container {
        padding: 40px 32px;
        max-width: 560px;
    }
    h1 {
        font-size: 32px;
    }
    #recordBtn .btn-text {
        font-size: 20px;
    }
}
