:root {
    --bg: #0b1024;
    --bg-2: #0f152e;
    --panel: #161f3a;
    --panel-2: #1c2748;
    --text: #e6ecff;
    --muted: #98a2c0;
    --accent: #6366f1;
    --accent-2: #22d3ee;
    --accent-3: #8b5cf6;
    --danger: #ef4444;
    --warn: #f59e0b;
    --ok: #10b981;
    --border: #2a3556;
    --radius: 16px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,0.18) 0%, transparent 60%),
        radial-gradient(1000px 500px at -10% 110%, rgba(34,211,238,0.14) 0%, transparent 60%),
        radial-gradient(700px 400px at 50% 40%, rgba(139,92,246,0.08) 0%, transparent 70%),
        var(--bg);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 56px 20px 80px;
}

/* ---------- Logo ---------- */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    margin: 0 auto 22px;
    width: fit-content;
    transition: transform .15s ease, opacity .15s;
}
.logo:hover { transform: translateY(-1px); opacity: 0.95; }
.logo-mark {
    display: inline-flex;
    border-radius: 12px;
    box-shadow: 0 10px 24px -10px rgba(99,102,241,0.7), 0 0 0 1px rgba(255,255,255,0.06) inset;
    line-height: 0;
}
.logo-word {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.logo-accent {
    background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Nav ---------- */
.nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 0 auto 30px;
    padding: 5px;
    width: fit-content;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.nav-link {
    padding: 8px 16px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
    box-shadow: 0 6px 16px -8px rgba(99,102,241,0.7);
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 32px; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.35);
    color: #c7cdff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 18px;
}
.badge svg { color: var(--accent-2); }
.hero h1 {
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.1;
    margin: 0 0 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.hero h1 .grad {
    background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.subtitle {
    color: var(--muted);
    margin: 0 auto;
    max-width: 640px;
    font-size: 16px;
}
.hero-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
}
.hero-tags span {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

/* ---------- Card ---------- */
.card {
    position: relative;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 30px 70px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.02) inset;
}
.card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius) + 1px);
    padding: 1px;
    background: linear-gradient(135deg, rgba(99,102,241,0.55), rgba(34,211,238,0.35), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0.7;
}

/* ---------- Dropzone ---------- */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    color: var(--muted);
    background:
        radial-gradient(400px 200px at 50% 0%, rgba(99,102,241,0.07), transparent 70%);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background:
        radial-gradient(400px 200px at 50% 0%, rgba(99,102,241,0.18), transparent 70%);
    color: var(--text);
}
.dz-inner svg {
    color: var(--accent-2);
    margin-bottom: 10px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}
.dz-inner p { margin: 4px 0; }
.dz-title { font-size: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.warn { color: var(--warn); font-size: 13px; margin-top: 8px; }

/* ---------- Preview ---------- */
.preview {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.preview-media {
    width: 100%;
    background: #0a1024;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 380px;
    border: 1px solid var(--border);
}
.preview-media img,
.preview-media video {
    max-width: 100%;
    max-height: 380px;
    display: block;
}

/* ---------- Crop UI (unchanged) ---------- */
.crop-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.crop-stage img { display: block; pointer-events: none; }
.crop-rect {
    position: absolute;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(0,0,0,0.4);
    cursor: move;
}
.crop-rect::before, .crop-rect::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.crop-rect::before {
    background:
        linear-gradient(to right, transparent calc(33.333% - 1px), rgba(255,255,255,0.4) calc(33.333% - 1px) 33.333%, transparent 33.333%),
        linear-gradient(to right, transparent calc(66.666% - 1px), rgba(255,255,255,0.4) calc(66.666% - 1px) 66.666%, transparent 66.666%),
        linear-gradient(to bottom, transparent calc(33.333% - 1px), rgba(255,255,255,0.4) calc(33.333% - 1px) 33.333%, transparent 33.333%),
        linear-gradient(to bottom, transparent calc(66.666% - 1px), rgba(255,255,255,0.4) calc(66.666% - 1px) 66.666%, transparent 66.666%);
}
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-2);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.h-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.h-n  { top: -7px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.h-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.h-e  { top: 50%; right: -7px; transform: translateY(-50%); cursor: ew-resize; }
.h-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.h-s  { bottom: -7px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.h-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.h-w  { top: 50%; left: -7px; transform: translateY(-50%); cursor: ew-resize; }

#cropInfo { align-self: center; font-variant-numeric: tabular-nums; }

/* ---------- Meta ---------- */
.meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    font-size: 14px;
    padding: 14px 16px;
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* ---------- Controls ---------- */
.controls { margin-top: 24px; }
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    align-items: end;
}
.row > label {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
}
.row > label.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
input[type="number"], select {
    background: #0e1530;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input[type="number"]:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
output {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-weight: 600;
    background: rgba(99,102,241,0.15);
    padding: 2px 8px;
    border-radius: 6px;
    align-self: flex-start;
    font-size: 13px;
}

/* ---------- File list (converter) ---------- */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 14px 0 6px;
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
}
.file-list:empty { display: none; }
.file-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color .15s, background .15s;
}
.file-row.done   { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.06); }
.file-row.failed { border-color: rgba(239,68,68,0.4);  background: rgba(239,68,68,0.06); }
.fr-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.fr-size { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.fr-status { font-size: 12.5px; font-weight: 600; }
.fr-status.ok  { color: #6ee7b7; }
.fr-status.err { color: #fca5a5; }
.fr-remove {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    font-size: 16px;
    transition: color .15s, border-color .15s, background .15s;
}
.fr-remove:hover {
    color: #fecaca;
    border-color: rgba(239,68,68,0.5);
    background: rgba(239,68,68,0.08);
}
.fr-dl {
    color: #fff;
    text-decoration: none;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
}
.fr-dl:hover { opacity: 0.9; }

.hint {
    margin: 4px 0 14px;
    padding: 10px 12px;
    background: rgba(34,211,238,0.06);
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--muted);
}

/* ---------- Buttons ---------- */
.actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .05s, opacity .15s, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
    background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
    background-size: 200% 100%;
    color: #fff;
    box-shadow: 0 8px 24px -8px rgba(99,102,241,0.6);
}
.btn.primary:hover { background-position: 100% 0; }
.btn.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn.ghost:hover { background: rgba(255,255,255,0.04); border-color: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.mini { padding: 7px 12px; font-size: 13px; align-self: end; }
#trimInfo { align-self: center; font-variant-numeric: tabular-nums; }

/* ---------- Progress / Result / Error ---------- */
.progress { margin-top: 22px; }
.bar {
    width: 100%; height: 10px;
    background: #0e1530;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.bar-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
    background-size: 200% 100%;
    transition: width .15s ease;
    animation: shimmer 2s linear infinite;
}
@keyframes shimmer {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}
#progressText { color: var(--muted); margin: 8px 0 0; font-size: 14px; }

.result {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid rgba(16,185,129,0.4);
    border-radius: var(--radius);
    background: rgba(16,185,129,0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.result p { margin: 0; flex: 1 1 100%; }

.error {
    margin-top: 18px;
    padding: 12px 14px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: var(--radius-sm);
    color: #fecaca;
    font-size: 14px;
}

/* ---------- How it works ---------- */
.how, .features, .faq {
    margin-top: 56px;
}
.how h2, .features h2, .faq h2 {
    text-align: center;
    font-size: clamp(22px, 3vw, 28px);
    margin: 0 0 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    counter-reset: step;
}
.steps li {
    position: relative;
    padding: 24px;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    color: #fff;
    font-weight: 700;
    margin-bottom: 10px;
    box-shadow: 0 6px 16px -6px rgba(99,102,241,0.7);
}
.steps h3 { margin: 0 0 6px; font-size: 16px; }
.steps p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Features ---------- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.feature {
    padding: 22px;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform .15s ease, border-color .15s, box-shadow .15s;
}
.feature:hover {
    transform: translateY(-3px);
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 14px 30px -16px rgba(99,102,241,0.5);
}
.feature-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(99,102,241,0.14);
    color: var(--accent-2);
    margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- FAQ ---------- */
.faq details {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 10px;
    transition: border-color .15s;
}
.faq details[open] { border-color: rgba(99,102,241,0.5); }
.faq summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    font-size: 22px;
    line-height: 1;
    color: var(--accent-2);
    transition: transform .2s;
}
.faq details[open] summary::after { content: "−"; }
.faq details p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
}
.faq code {
    background: rgba(0,0,0,0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12.5px;
}

/* ---------- Footer ---------- */
.foot { text-align: center; margin-top: 40px; }

.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
    .steps, .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 540px) {
    .container { padding: 32px 14px 60px; }
    .hero h1 { font-size: 28px; }
    .card { padding: 20px; }
    .meta { grid-template-columns: 1fr; }
    .actions { flex-direction: column-reverse; }
    .actions .btn { width: 100%; }
    .steps, .feature-grid { grid-template-columns: 1fr; }
}
