:root {
    --bg-color:         #050505;
    --accent-primary:   #fbbf24;
    --accent-secondary: #f97316;
    --text-main:        #ffffff;
    --text-dim:         #a0a0a0;
    --card-bg:          rgba(255,255,255,0.03);
    --card-border:      rgba(255,255,255,0.07);
    --error:            #ff4d6d;
    --accent-glow:      rgba(251,191,36,0.06);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Фоновое свечение ---- */
.bg-glow {
    position: fixed;
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    pointer-events: none; z-index: 0;
}

/* ---- Layout ---- */
.page {
    position: relative; z-index: 1;
    max-width: 960px; margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* ---- Topbar ---- */
.topbar {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap; gap: 0.75rem;
}
.back-link {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-dim); text-decoration: none;
    font-size: 0.85rem; font-weight: 600;
    transition: color 0.2s, transform 0.2s;
}
.back-link:hover { color: var(--accent-primary); transform: translateX(-3px); }
.page-label {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2.5px;
    color: var(--accent-primary);
}

/* ---- Заголовок ---- */
.page-title {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    font-weight: 800; line-height: 1.1; margin-bottom: 0.5rem;
    animation: fadeInLeft 0.6s forwards;
}
.page-title span {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.page-sub {
    color: var(--text-dim); font-size: 0.95rem;
    margin-bottom: 1.5rem;
    animation: fadeInLeft 0.6s 0.1s both;
}

/* ---- Основная сетка ---- */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem; align-items: start;
}
.left-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

/* ---- Drop zone ---- */
.drop-zone {
    border: 1.5px dashed var(--card-border);
    border-radius: 14px; background: var(--card-bg);
    width: 100%; min-height: 180px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.75rem; cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative; overflow: hidden;
    padding: 1.5rem; text-align: center; max-width: 100%; box-sizing: border-box;
}
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(251,191,36,0.04);
}
.drop-zone.has-file { cursor: default; min-height: auto; }
.drop-zone input[type=file] { display: none; }
.drop-icon { opacity: 0.35; }
.drop-label { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; }
.drop-label strong { color: var(--accent-primary); }
.drop-hint { font-size: 0.72rem; color: rgba(255,255,255,0.2); }

/* Состояние «файл выбран» */
.file-loaded {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.1rem; width: 100%; min-width: 0; overflow: hidden; max-width: 100%;
}
.file-loaded-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent-primary);
}
.file-loaded-info { flex: 1; min-width: 0; text-align: left; }
.file-loaded-name {
    font-size: 0.85rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.file-loaded-size { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

/* ---- Пресеты ---- */
.presets-label {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2.5px;
    color: var(--text-dim);
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--card-border);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.preset-btn {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    font-family: 'Inter', sans-serif;
    color: var(--text-dim);
    text-align: center;
}
.preset-btn:hover {
    border-color: rgba(251,191,36,0.35);
    color: var(--text-main);
    transform: translateY(-2px);
}
.preset-btn.active {
    border-color: var(--accent-primary);
    background: rgba(251,191,36,0.07);
    color: var(--accent-primary);
}
.preset-btn-icon { font-size: 1.3rem; line-height: 1; }
.preset-btn-name {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    line-height: 1.2;
}
.preset-btn-desc {
    font-size: 0.63rem; color: var(--text-dim);
    line-height: 1.3;
}
.preset-btn.active .preset-btn-desc { color: rgba(251,191,36,0.6); }

/* ---- Панель параметров пресета ---- */
.preset-params {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    display: none; flex-direction: column; gap: 1rem;
    animation: fadeIn 0.3s forwards;
}
.preset-params.visible { display: flex; }

.params-title {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2px;
    color: var(--accent-primary);
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--card-border);
    display: flex; align-items: center; gap: 0.5rem;
}

/* ---- Слайдеры ---- */
.slider-row { display: flex; flex-direction: column; gap: 0.35rem; }
.slider-row-head { display: flex; justify-content: space-between; align-items: center; }
.slider-name { font-size: 0.78rem; color: var(--text-dim); }
.slider-val {
    font-size: 0.78rem; font-weight: 700;
    color: var(--accent-primary); min-width: 3ch; text-align: right;
}
input[type=range] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px;
    background: rgba(255,255,255,0.1); border-radius: 2px;
    outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px;
    border-radius: 50%; background: var(--accent-primary);
    cursor: pointer; transition: box-shadow 0.2s;
}
input[type=range]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px rgba(251,191,36,0.2);
}
input[type=range]::-moz-range-thumb {
    width: 14px; height: 14px; border: none;
    border-radius: 50%; background: var(--accent-primary); cursor: pointer;
}

/* Hint-подсказка (details/summary) */
.param-tip { margin-top: 0.15rem; }
.param-tip summary {
    font-size: 0.7rem; color: rgba(255,255,255,0.25);
    cursor: pointer; list-style: none;
    display: inline-flex; align-items: center; gap: 4px;
    user-select: none; transition: color 0.2s;
}
.param-tip summary::-webkit-details-marker { display: none; }
.param-tip summary::before {
    content: '';
    display: inline-block; width: 10px; height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4.2' stroke='%23606060' stroke-width='1.2'/%3E%3Cpath d='M5 4.2v3M5 3h.01' stroke='%23606060' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
    flex-shrink: 0;
}
.param-tip[open] summary { color: rgba(255,255,255,0.45); }
.param-tip[open] summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4.2' stroke='%23fbbf24' stroke-width='1.2'/%3E%3Cpath d='M5 4.2v3M5 3h.01' stroke='%23fbbf24' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.param-tip-body {
    margin-top: 0.5rem; padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border-left: 2px solid rgba(251,191,36,0.2);
    border-radius: 0 6px 6px 0;
    font-size: 0.72rem; color: rgba(255,255,255,0.35);
    line-height: 1.55; display: flex; flex-direction: column; gap: 0.25rem;
}
.param-tip-body b { color: rgba(255,255,255,0.55); font-weight: 600; }
.param-tip-body .tip-row {
    display: grid; grid-template-columns: auto 1fr;
    gap: 0.15rem 0.5rem; align-items: baseline;
}
.param-tip-body .tip-key {
    color: var(--accent-primary); font-weight: 700;
    font-size: 0.67rem; white-space: nowrap;
}

/* ---- Toggle ---- */
.toggle-row {
    display: flex; align-items: center;
    justify-content: space-between; gap: 0.75rem;
}
.toggle-label {
    font-size: 0.82rem; color: var(--text-main);
    display: flex; flex-direction: column; gap: 2px;
}
.toggle-label .hint {
    font-size: 0.68rem; color: rgba(255,255,255,0.25);
    font-weight: 400; line-height: 1.3;
}
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.1); border-radius: 20px;
    cursor: pointer; transition: background 0.2s;
}
.toggle-track::after {
    content: ''; position: absolute;
    width: 14px; height: 14px; background: #fff;
    border-radius: 50%; top: 3px; left: 3px; transition: transform 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent-primary); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }

/* ---- Прогресс и статус ---- */
.progress-wrap {
    height: 3px; background: rgba(255,255,255,0.06);
    border-radius: 2px; overflow: hidden; display: none;
}
.progress-wrap.visible { display: block; }
.progress-bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px; transition: width 0.3s ease;
}
.status-bar {
    min-height: 1.4em; font-size: 0.85rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.status-bar.loading { color: var(--accent-primary); }
.status-bar.success { color: #4ade80; }
.status-bar.error   { color: var(--error); }
.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(251,191,36,0.25);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ---- Кнопки ---- */
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 12px 22px; border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; border: none;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    text-decoration: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--accent-primary); color: #000; }
.btn-primary:hover:not(:disabled) {
    background: #fff; transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251,191,36,0.25);
}
.btn-outline {
    background: transparent; color: var(--text-main);
    border: 1px solid var(--card-border);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-primary); color: var(--accent-primary);
    transform: translateY(-2px);
}
.btn-ghost {
    background: transparent; color: var(--text-dim);
    border: 1px solid transparent;
}
.btn-ghost:hover:not(:disabled) { color: var(--error); }

/* ---- Правая колонка: инфо-панель ---- */
.info-panel {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: 14px; padding: 1.25rem;
    display: flex; flex-direction: column; gap: 1.1rem;
    position: sticky; top: 1.5rem; min-width: 0; overflow: hidden;
}
.info-panel-title {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2.5px; color: var(--text-dim);
}

/* Карточки мета-инфо файла */
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.meta-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px; padding: 0.65rem 0.75rem;
    min-width: 0; overflow: hidden;
}
.meta-card-label {
    font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-dim); margin-bottom: 0.2rem;
}
.meta-card-value {
    font-size: 0.9rem; font-weight: 700; color: var(--text-main);
}
.meta-card-value.dim { color: var(--text-dim); font-weight: 400; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Активный пресет в инфо-панели */
.active-preset-badge {
    display: none;
    align-items: center; gap: 0.5rem;
    background: rgba(251,191,36,0.07);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: 8px; padding: 0.65rem 0.85rem;
    font-size: 0.8rem; font-weight: 600;
    color: var(--accent-primary);
}
.active-preset-badge.visible { display: flex; }
.active-preset-badge-icon { font-size: 1.1rem; }

/* Разделитель */
.divider {
    height: 1px; background: var(--card-border); margin: 0.1rem 0;
}

/* Hint-текст в панели */
.hint-text {
    font-size: 0.72rem; color: rgba(255,255,255,0.2); line-height: 1.5;
}

/* ---- Анимации ---- */
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Адаптив ---- */
@media (max-width: 768px) {
    .main-grid { grid-template-columns: 1fr; }
    .info-panel { position: static; order: -1; }
    .presets-grid { grid-template-columns: repeat(2, 1fr); }
    .meta-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .presets-grid { grid-template-columns: repeat(2, 1fr); }
    .actions { flex-direction: column; }
    .btn { justify-content: center; }
}
