/* Zenly-inspired CSS - Дипломатика стиль */
:root {
    /* Основные цвета Дипломатика */
    --primary: #000000;
    --secondary: #141414;
    --accent: #8CD7FF;
    --accent-light: #B3E5FF;
    --accent-dark: #0069AA;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --text-tertiary: #636366;
    --surface: #1C1C1E;
    --surface-light: #2C2C2E;
    --surface-dark: #0A0A0A;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --info: #5AC8FA;
    
    /* Градиенты Дипломатика */
    --gradient-primary: linear-gradient(135deg, #0069AA 0%, #8CD7FF 100%);
    --gradient-dark: linear-gradient(135deg, #000000 0%, #141414 100%);
    --gradient-surface: linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 100%);
    
    /* Тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
    --shadow-accent: 0 4px 30px rgba(140, 215, 255, 0.25);
    
    /* Радиусы */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    
    /* Анимации */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Roboto', sans-serif;
    background: var(--gradient-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Контейнер */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Типография */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

p {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Карточки */
.card {
    background: var(--gradient-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    transition: left var(--transition-slow);
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(140, 215, 255, 0.2);
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width var(--transition-normal), height var(--transition-normal);
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(140, 215, 255, 0.35);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Аватарки */
.avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-accent);
}

.avatar-sm {
    width: 40px;
    height: 40px;
    border-width: 2px;
}

.avatar-lg {
    width: 120px;
    height: 120px;
    border-width: 4px;
}

/* Статус баджи */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
    border-color: rgba(52, 199, 89, 0.3);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.1);
    color: var(--warning);
    border-color: rgba(255, 149, 0, 0.3);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger);
    border-color: rgba(255, 59, 48, 0.3);
}

.badge-accent {
    background: rgba(140, 215, 255, 0.1);
    color: var(--accent);
    border-color: rgba(140, 215, 255, 0.3);
}

/* Прогресс бар */
.progress-bar {
    height: 4px;
    background: var(--surface-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* Чипы (фишки) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface-light);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.chip:hover {
    background: var(--surface);
    border-color: rgba(140, 215, 255, 0.3);
    transform: translateY(-2px);
}

.chip.selected {
    background: rgba(140, 215, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Формы */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 16px;
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(140, 215, 255, 0.1);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

/* Чекбоксы и радио */
.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-light);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.option-item:hover {
    background: var(--surface);
    border-color: rgba(255, 255, 255, 0.2);
}

.option-item.selected {
    background: rgba(140, 215, 255, 0.1);
    border-color: var(--accent);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    display: none;
}

.option-marker {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.option-item.selected .option-marker {
    border-color: var(--accent);
    background: var(--accent);
}

.option-item.selected .option-marker::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: var(--radius-full);
}

.option-text {
    flex: 1;
    color: var(--text-primary);
}

/* Навигация */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-brand {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-items {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(140, 215, 255, 0.1);
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

.pulse {
    animation: pulse 2s infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* Утилиты */
.text-center {
    text-align: center;
}

.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex {
    display: flex;
}

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

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Специфичные компоненты */
.quiz-question {
    margin-bottom: 32px;
}

.quiz-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.timer {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface);
    padding: 12px 20px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(140, 215, 255, 0.3);
    font-weight: 600;
    color: var(--accent);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.score-display {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin: 20px 0;
}

.leaderboard {
    background: var(--surface-dark);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-light);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 14px;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: var(--gradient-primary);
    color: white;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #8E8E93 0%, #636366 100%);
    color: white;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #FF9500 0%, #FFB700 100%);
    color: white;
}

.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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