:root {
    /* === ЦВЕТОВАЯ ГАММА: (СИНИЙ + ЗОЛОТО) === */
    --bg-base: #0f172a;       /* Основа: Глубокий синий */
    --footer-bg: #020617;     /* Футер почти черный */
    
    /* Карточки: Синие, стеклянные */
    --card-bg: rgba(30, 58, 138, 0.4); 
    --card-border: rgba(147, 197, 253, 0.1); /* Легкая голубая обводка */
    
    /* АКЦЕНТ: ЗОЛОТО (СЫР) */
    --accent: #ffc107;        
    --accent-glow: rgba(255, 193, 7, 0.6);
    
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
}

/* === СКРОЛЛБАРЫ === */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

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

body {
    margin: 0; padding: 0;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    color: var(--text-main);
    display: flex; flex-direction: column; min-height: 100vh;
    
    /* ===  ФОН: СИНИЙ + ТРЕУГОЛЬНИКИ === */
    background-color: var(--bg-base);
    background-image: 
        /* 1. Золотое свечение сверху (под логотип) */
        radial-gradient(circle at 50% -10%, rgba(255, 193, 7, 0.15) 0%, transparent 50%),

        /* 2. Огромный синий треугольник слева сверху */
        linear-gradient(135deg, rgba(29, 78, 216, 0.3) 0%, transparent 60%),

        /* 3. Темный треугольник справа снизу (контраст) */
        linear-gradient(320deg, rgba(2, 6, 23, 0.9) 0%, transparent 60%),
        
        /* 4. ЧЕТКИЕ ГЕОМЕТРИЧЕСКИЕ ЛИНИИ (ОСКОЛКИ) */
        /* Полоса 1 */
        linear-gradient(115deg, transparent 40%, rgba(59, 130, 246, 0.05) 40%, rgba(59, 130, 246, 0.05) 60%, transparent 60%),
        /* Полоса 2 */
        linear-gradient(200deg, transparent 30%, rgba(255, 255, 255, 0.02) 30%, rgba(255, 255, 255, 0.02) 35%, transparent 35%);

    background-attachment: fixed; /* Фон зафиксирован */
    background-size: cover;
}

/* Header */
.site-header { width: 100%; max-width: 1200px; margin: 0 auto; display: flex; justify-content: center; position: relative; z-index: 2; }
.header-img { width: 100%; height: auto; display: block; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6); }

/* Main Content */
.main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px 60px; flex: 1; display: flex; flex-direction: column; position: relative; z-index: 1; }

.page-title { 
    margin: 50px 0 40px; 
    font-size: clamp(32px, 7vw, 56px); 
    font-weight: 900; 
    color: #fff; 
    text-align: center; 
    text-transform: uppercase; 
    letter-spacing: 4px; 
    /* Тень: смесь синего и золотого */
    text-shadow: 0 0 25px rgba(37, 99, 235, 0.6), 0 0 10px rgba(255, 193, 7, 0.3);
}

/* Cards Grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }

/* Card Style */
.card { 
    position: relative; aspect-ratio: 1 / 1; 
    background: var(--card-bg); 
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border); 
    border-radius: 8px; 
    padding: 15px; display: flex; align-items: center; justify-content: center; 
    cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden; box-shadow: 0 10px 20px rgba(0,0,0,0.3); 
    user-select: none; 
}

.card .title { 
    font-weight: 800; color: #e2e8f0; text-align: center; 
    font-size: 14px; text-transform: uppercase; line-height: 1.4; 
    letter-spacing: 1px; z-index: 10; pointer-events: none; 
    word-wrap: break-word; word-break: break-word;
}

@media (hover: hover) {
    .card:hover { 
        transform: translateY(-8px); 
        border-color: var(--accent); 
        /* При наведении карточка становится темнее, чтобы золото светилось */
        background: rgba(15, 23, 42, 0.9); 
        box-shadow: 0 20px 40px -5px rgba(0,0,0,0.7), 0 0 25px var(--accent-glow); 
    }
    .card:hover .title { color: #fff; }
}
.card:active { transform: scale(0.96); border-color: var(--accent); background: rgba(15, 23, 42, 1); }

/* Золотая полоска снизу */
.card::after { 
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; 
    background: linear-gradient(90deg, transparent, var(--accent), transparent); 
    opacity: 0; transition: opacity 0.3s; 
}
.card:hover::after, .card:active::after { opacity: 1; }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; display: none; justify-content: center; align-items: center; padding: 15px; background: rgba(2, 6, 23, 0.9); backdrop-filter: blur(8px); z-index: 50; }
.modal { width: 100%; max-width: 980px; max-height: 90vh; display: flex; flex-direction: column; background: #0b1120; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; box-shadow: 0 0 50px rgba(0,0,0,0.8); animation: modalPop .3s ease-out; }
@keyframes modalPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header { padding: 15px 24px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; background: linear-gradient(90deg, rgba(30, 58, 138, 0.2), transparent); }
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 1px; }

.modal-close { background: transparent; border: none; color: var(--text-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; transition: all 0.2s; }
.modal-close svg { width: 20px; height: 20px; stroke-width: 2.5; }
.modal-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.modal-scroll-content { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-body { display: flex; gap: 20px; padding: 20px; align-items: center; justify-content: center; }

.chart-area { flex: 1; min-width: 0; height: 400px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.02); border-radius: 8px; position: relative; border: 1px solid rgba(255,255,255,0.03); }
.items-list { flex: 0 0 300px; max-height: 400px; overflow-y: auto; border-radius: 8px; padding: 5px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255,255,255,0.05); }

.items-list .item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); color: #cbd5e1; transition: background 0.2s; border-radius: 6px; }
.items-list .item:hover { background: rgba(59, 130, 246, 0.15); }
.items-list .item:last-child { border-bottom: none; }
.items-list .item .label { font-size: 13px; font-weight: 500; display: flex; align-items: center; flex-grow: 1; }
.items-list .item .percent { font-weight: 700; font-size: 13px; color: #fff; margin-left: 10px; }
.items-list .cheese .label { color: #ffd700; }
.items-list .cheese .percent { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 12px; flex-shrink: 0; box-shadow: 0 0 8px rgba(0,0,0,0.5); }

.modal-footer { padding: 15px 25px; border-top: 1px solid rgba(255, 255, 255, 0.05); display: flex; justify-content: center; flex-shrink: 0; }
.btn-close { background: rgba(30, 58, 138, 0.3); color: #fff; border: 1px solid rgba(59, 130, 246, 0.3); padding: 12px 30px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 1px; min-width: 140px; }
.btn-close:hover { background: var(--accent); border-color: var(--accent); color: #000; box-shadow: 0 0 15px var(--accent-glow); }
.btn-close:active { transform: scale(0.98); }

/* === Bar Chart === */
.bar-chart-container { width: 100%; padding: 10px 15px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; max-height: 400px; }
.bar-row { display: flex; align-items: center; gap: 15px; width: 100%; }
.bar-label { width: 30%; text-align: right; color: #cbd5e1; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex-grow: 1; background: rgba(255, 255, 255, 0.05); height: 8px; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; transition: width 1s ease; border-radius: 4px; }
.bar-value { width: 40px; color: #fff; font-weight: 700; font-size: 12px; text-align: left; }

/* === FOOTER === */
.footer { 
    padding: 25px 0 35px; 
    background: var(--footer-bg); 
    border-top: 2px solid var(--accent); 
    display: flex; justify-content: center; width: 100%; margin-top: auto; 
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}
.footer-wrapper { display: flex; gap: 15px; }

.social-btn { 
    width: 34px; height: 34px; 
    border-radius: 6px; 
    background: #0f172a; 
    border: 1px solid #1e293b;
    display: flex; align-items: center; justify-content: center; 
    transition: all 0.2s ease; color: #64748b; 
}
.social-btn svg { width: 18px; height: 18px; }
.social-btn:hover { background: var(--accent); border-color: var(--accent); color: #000; transform: translateY(-3px); box-shadow: 0 0 15px var(--accent-glow); }

/* === MOBILE ADAPTATION === */
@media (max-width: 900px) {
    .modal-body { 
        flex-direction: column; 
        padding: 15px; 
        align-items: stretch; 
        /* ВОТ ЭТО ЧИНИТ ОТСТУП */
        gap: 30px; 
    }
    
    .chart-area { 
        height: auto; 
        min-height: 250px; 
        aspect-ratio: 1 / 1; 
        margin: 0 auto; 
        width: 100%; 
        max-width: 350px; 
    }
    
    .items-list { 
        flex: none; 
        width: 100%; 
        max-height: none; 
    }
}

@media (max-width: 480px) {
    .cards { gap: 12px; grid-template-columns: repeat(2, 1fr); }
    .card { padding: 10px; border-radius: 6px; }
    .card .title { font-size: 11px; letter-spacing: 0.5px; }
    
    .main { padding: 0 15px 40px; }
    .page-title { margin: 30px 0 30px; }
    .modal-header h2 { font-size: 15px; }
    .btn-close { min-width: 100%; }
    
    /* === FIX ГРАФИКА (Инди года) НА ТЕЛЕФОНЕ === */
    .bar-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .bar-label {
        width: 100%;
        text-align: left;
        white-space: normal;
        font-size: 11px;
        color: #fff;
    }
    
    .bar-track { width: 100%; height: 10px; }
    
    .bar-value {
        align-self: flex-end;
        text-align: right;
        font-size: 11px;
        margin-top: -18px;
        margin-bottom: 5px;
        z-index: 2;
        position: relative;
    }
}