*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
    --bg: #0a0a12;
    --surface: #111120;
    --surface-2: #16162a;
    --surface-hover: #1c1c38;
    --border: #2a2a45;
    --border-accent: #8b5cf6;
    --text: #e8e8f4;
    --text-dim: #7a7a98;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139,92,246,0.2);
    --success: #22c55e;
    --danger: #ef4444;
    --gradient: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);
    --radius: 14px;
    --radius-sm: 10px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background:
        radial-gradient(ellipse at 25% 15%, rgba(139,92,246,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 80%, rgba(59,130,246,0.05) 0%, transparent 50%);
    animation: bgDrift 25s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes bgDrift {
    0%   { transform: translate(0, 0) rotate(0deg) }
    100% { transform: translate(-3%, 3%) rotate(1deg) }
}

/* === HEADER === */
header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    background: rgba(10,10,18,0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent-light) }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.8rem;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%,100% { transform: scale(1) }
    50% { transform: scale(1.1) }
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.tagline {
    font-size: 0.78rem;
    color: var(--text-dim);
}

/* === MAIN === */
main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* === UPLOAD ZONE === */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(139,92,246,0.04);
}

.upload-content svg {
    color: var(--text-dim);
    margin-bottom: 16px;
}

.upload-zone h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-dim);
    font-size: 0.92rem;
}

.upload-formats {
    font-size: 0.8rem !important;
    color: var(--text-dim);
    opacity: 0.7;
    margin-top: 8px;
}

.upload-progress {
    padding: 16px 0;
}

.progress-bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

/* === FILE INFO === */
.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
}

.file-thumb {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139,92,246,0.12);
    border-radius: 12px;
    flex-shrink: 0;
}

.file-details { flex: 1; min-width: 0 }
.file-details h3 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-details span {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-icon:hover { color: var(--danger); background: rgba(239,68,68,0.1) }

/* === PLAYER === */
.player, .result-player {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
}

.play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.play-btn:hover { transform: scale(1.08); box-shadow: 0 4px 16px var(--accent-glow) }

.time {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
}

.seek-bar {
    flex: 1;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.seek-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
}

/* === EFFECTS GRID === */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.effects-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.effect-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.effect-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.effect-card.active {
    border-color: var(--accent);
    background: rgba(139,92,246,0.08);
    box-shadow: 0 0 20px var(--accent-glow);
}

.effect-icon { font-size: 1.6rem }
.effect-name { font-size: 0.88rem; font-weight: 600 }
.effect-desc { font-size: 0.72rem; color: var(--text-dim); line-height: 1.3 }

/* === SETTINGS PANEL === */
.settings-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
}

.setting-group label {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 8px;
    color: var(--text);
}

.setting-group .val {
    color: var(--accent-light);
    font-weight: 600;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--surface-2);
    border-radius: 3px;
    outline: none;
    margin-bottom: 4px;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--accent-glow);
}

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

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.no-settings {
    color: var(--text-dim);
    font-size: 0.9rem;
    text-align: center;
    padding: 8px 0;
}

/* === ACTION BAR === */
.action-bar {
    display: flex;
    justify-content: center;
}

.btn-process {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-process:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}
.btn-process:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === RESULT === */
.result-section {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px) }
    to { opacity: 1; transform: translateY(0) }
}

.result-actions {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34,197,94,0.3);
}

/* === PROCESSING OVERLAY === */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,18,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg) } }

.overlay p {
    color: var(--text-dim);
    font-size: 1rem;
}

/* === FOOTER === */
footer {
    text-align: center;
    padding: 24px;
    color: var(--text-dim);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
}
footer a { color: var(--accent-light); text-decoration: none }
footer a:hover { text-decoration: underline }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .effects-grid { grid-template-columns: repeat(3, 1fr) }
}

@media (max-width: 600px) {
    .effects-grid { grid-template-columns: repeat(2, 1fr) }
    .upload-zone { padding: 32px 16px }
    .settings-panel { padding: 16px }
    .btn-process { width: 100%; justify-content: center }
    main { padding: 20px 16px 60px }
    .header-inner { flex-direction: column; gap: 8px }
}

@media (max-width: 400px) {
    .effects-grid { grid-template-columns: 1fr 1fr }
    .effect-desc { display: none }
}
