/* ============================================
   TON/Telegram Design System
   Минималистичный, премиальный дизайн
   ============================================ */

:root {
    /* Цветовая палитра TON/Telegram */
    --ton-blue-dark: #0088cc;
    --ton-blue: #3390ec;
    --ton-blue-light: #5eb3f5;
    --ton-cyan: #00d4ff;
    --ton-teal: #00c9b7;
    
    /* Нейтральные цвета */
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-surface: #1a1a1a;
    --bg-surface-hover: #222222;
    
    /* Текст */
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --text-tertiary: #636366;
    
    /* Акценты */
    --accent-primary: var(--ton-blue);
    --accent-success: #00cc88;
    --accent-warning: #ffaa00;
    --accent-danger: #ff4757;
    
    /* Тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(51, 144, 236, 0.3);
    
    /* Радиусы */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Отступы */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Анимации */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ============================================
   Базовые стили
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Типографика
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

p {
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   Компоненты
   ============================================ */

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--ton-blue);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--ton-blue-light);
    box-shadow: var(--shadow-glow);
}

.btn-success {
    background: var(--accent-success);
    color: var(--text-primary);
}

.btn-success:hover {
    background: #00b377;
    box-shadow: 0 0 20px rgba(0, 204, 136, 0.3);
}

.btn-danger {
    background: var(--accent-danger);
    color: var(--text-primary);
}

.btn-danger:hover {
    background: #ff3347;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-ghost:hover {
    background: var(--bg-surface);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* Карточки */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:active {
    transform: scale(0.98);
}

/* Инпуты */
.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: all var(--transition-base);
}

.input:focus {
    border-color: var(--ton-blue);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.1);
}

.input::placeholder {
    color: var(--text-tertiary);
}

/* Баланс */
.balance-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--ton-blue), var(--ton-cyan));
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Иконки */
.icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.icon-sm {
    width: 20px;
    height: 20px;
    font-size: 16px;
}

.icon-lg {
    width: 32px;
    height: 32px;
    font-size: 28px;
}

/* ============================================
   Layout
   ============================================ */

.container {
    width: 100%;
    max-width: 100%;
    padding: var(--spacing-md);
    margin: 0 auto;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: var(--spacing-sm) 0;
    display: flex;
    justify-content: space-around;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    color: var(--text-tertiary);
    text-decoration: none;
    transition: all var(--transition-base);
    border-radius: var(--radius-md);
    min-width: 60px;
}

.footer-item.active {
    color: var(--ton-blue);
}

.footer-item .icon {
    font-size: 24px;
}

.footer-item .label {
    font-size: 11px;
    font-weight: 500;
}

/* ============================================
   Игры
   ============================================ */

.game-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-card:active {
    transform: scale(0.98);
}

.game-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--ton-blue), var(--ton-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    overflow: hidden;
}

.game-card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.game-card-content {
    padding: var(--spacing-md);
}

.game-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.game-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   Модальные окна
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn var(--transition-slow);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.modal-close:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* ============================================
   Утилиты
   ============================================ */

.text-center {
    text-align: center;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   Анимации
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn var(--transition-base);
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   Скроллбар
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-hover);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ============================================
   Адаптивность
   ============================================ */

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-sm);
    }
    
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    
    .btn {
        padding: 10px 20px;
        font-size: 15px;
    }
}

