/* ==========================================================================
   CS2 HUB — генератор конфига
   ========================================================================== */

.cfg__layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.cfg__side { display: grid; gap: 18px; position: sticky; top: calc(var(--header-h) + 18px); }
.cfg__main { display: grid; gap: 16px; min-width: 0; }

/* ------------------------------------------------------- Превью прицела */

.crosshair-preview { display: grid; gap: 10px; }

.crosshair-preview__scene {
    position: relative;
    aspect-ratio: 3 / 2;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background:
        radial-gradient(120% 90% at 50% 20%, #6b5a41 0%, #3d3428 45%, #241f18 100%);
}

.crosshair-preview[data-scene="mirage"] .crosshair-preview__scene {
    background: radial-gradient(120% 90% at 50% 20%, #8a7a5c 0%, #55483a 45%, #2a241d 100%);
}

.crosshair-preview[data-scene="dark"] .crosshair-preview__scene {
    background: radial-gradient(120% 90% at 50% 20%, #2a2f3a 0%, #171b22 50%, #0b0e14 100%);
}

.crosshair-preview__scene::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.16) 0 22px, transparent 22px 46px),
        repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.05) 0 30px, transparent 30px 64px);
    pointer-events: none;
}

.crosshair-preview__scene svg { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }
.crosshair-preview__bgs { display: flex; gap: 6px; flex-wrap: wrap; }
.crosshair-preview__bgs .pill { padding: 5px 11px; font-size: 12px; }

/* -------------------------------------------------------------- Пресеты */

.cfg__presets { display: grid; gap: 8px; }

.preset {
    display: grid;
    gap: 3px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.preset:hover { border-color: rgba(245, 165, 36, 0.45); background: rgba(245, 165, 36, 0.08); }
.preset b { font-size: 13.5px; }
.preset span { font-size: 12px; color: var(--text-mute); }

/* ------------------------------------------------- Конфиги про-игроков */

.cfg__pros { display: grid; gap: 7px; margin-top: 10px; max-height: 340px; overflow-y: auto; padding-right: 4px; }

.pro {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.pro:hover { border-color: rgba(76, 201, 240, 0.45); background: rgba(76, 201, 240, 0.08); }
.pro.is-active { border-color: rgba(245, 165, 36, 0.5); background: rgba(245, 165, 36, 0.1); }
.pro__head { display: flex; align-items: center; gap: 8px; }
.pro__head b { font-size: 13.5px; }
.pro__meta { font-size: 11.5px; color: var(--text-mute); }

.cfg__actions { display: grid; gap: 8px; }
.cfg__save { display: flex; gap: 8px; margin-top: 14px; }
.cfg__save .input { flex: 1; min-width: 0; }

.cfg__saved { display: grid; gap: 6px; margin-top: 12px; }

.cfg__saved li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 13px;
}

.cfg__saved-load { border: 0; background: none; cursor: pointer; text-align: left; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg__saved-meta { font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.cfg__saved .icon-btn { width: 28px; height: 28px; }

/* --------------------------------------------------------------- Вкладки */

.cfg__tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.cfg__tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s var(--ease);
}

.cfg__tab:hover { color: var(--text); border-color: var(--border-strong); }

.cfg__tab.is-active {
    background: rgba(245, 165, 36, 0.12);
    border-color: rgba(245, 165, 36, 0.4);
    color: var(--accent);
}

/* --------------------------------------------------------------- Панели */

.cfg__panel { display: none; padding: 20px; }
.cfg__panel.is-active { display: block; }
.cfg__panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.cfg__panel-head h2 { display: flex; align-items: center; gap: 9px; font-size: 17px; }
.cfg__panel-head .icon { color: var(--accent); }
.cfg__panel-head .hint { margin: 0; }

.cfg__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px 20px; }
.cfg__field { display: grid; gap: 7px; align-content: start; }

.cfg__label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-dim); }
.cfg__label code { font-size: 10.5px; color: var(--text-mute); }

.cfg__range { display: flex; align-items: center; gap: 12px; }
.cfg__range output {
    min-width: 54px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(245, 165, 36, 0.12);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
}

.cfg__range input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 4px;
    appearance: none;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

.cfg__range input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 2px 8px rgba(245, 165, 36, 0.5);
    cursor: pointer;
}

.cfg__range input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* Переключатель */
.switch { display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch__track {
    display: inline-flex;
    align-items: center;
    width: 44px;
    height: 24px;
    padding: 3px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.switch__thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-mute);
    transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.switch input:checked + .switch__track { background: rgba(245, 165, 36, 0.28); border-color: rgba(245, 165, 36, 0.5); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(20px); background: var(--accent); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------------- Бинды */

.cfg__binds { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }

.cfg__bind {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: border-color 0.18s var(--ease);
}

.cfg__bind:hover { border-color: var(--border-strong); }
.cfg__bind:has(input:checked) { border-color: rgba(245, 165, 36, 0.45); background: rgba(245, 165, 36, 0.07); }

.cfg__bind input {
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.cfg__bind input:checked {
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316191f' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 12 5 5L20 6'/%3E%3C/svg%3E") center / 13px no-repeat;
    border-color: var(--accent);
}

.cfg__bind-body { display: grid; gap: 4px; min-width: 0; }
.cfg__bind-body b { font-size: 13.5px; }
.cfg__bind-body code { font-size: 11px; color: var(--text-mute); word-break: break-all; }
.cfg__bind-body .hint { margin: 0; }

.cfg__subtitle { display: flex; align-items: center; gap: 9px; margin: 22px 0 12px; font-size: 15px; }
.cfg__subtitle .icon { color: var(--accent); }

/* ---------------------------------------------------------- Итоговый файл */

.cfg__output { padding: 20px; }

.cfg__code {
    max-height: 420px;
    overflow: auto;
    margin: 0;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 12.5px;
    line-height: 1.65;
    color: #cfd6e4;
    white-space: pre;
}

.cfg__howto { padding: 20px; }
.cfg__steps { display: grid; gap: 12px; counter-reset: step; font-size: 13.5px; color: var(--text-dim); }
.cfg__steps li { display: grid; gap: 5px; padding-left: 34px; position: relative; }

.cfg__steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: rgba(245, 165, 36, 0.14);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.cfg__steps code { display: inline-block; padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); color: var(--accent); font-size: 12px; word-break: break-all; }

@media (max-width: 1080px) {
    .cfg__layout { grid-template-columns: minmax(0, 1fr); }
    .cfg__side { position: static; }
    .cfg__preview-box { max-width: 420px; }
}
