/* ═══════════════════════════════════════════════════════════════
   晚风抖音视频解析 — 企业级设计系统 v2
   动态背景 · 毛玻璃 · 渐变按钮 · 涟漪反馈
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --bg-deep: #06090f;
    --bg-primary: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.6);
    --bg-card-hover: rgba(20, 30, 52, 0.75);
    --bg-card-solid: #111827;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.25);
    --text-primary: #e8edf5;
    --text-secondary: #94a3b8;
    --text-muted: #5b6880;
    --accent-1: #6366f1;
    --accent-2: #8b5cf6;
    --accent-3: #06b6d4;
    --accent-4: #ec4899;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.3), 0 0 60px rgba(99, 102, 241, 0.1);
    --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3), 0 0 60px rgba(6, 182, 212, 0.1);
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Noto Sans SC", sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* ── Dynamic Background ────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 80% at 85% 50%, rgba(139, 92, 246, 0.1), transparent),
        radial-gradient(ellipse 70% 60% at 10% 80%, rgba(6, 182, 212, 0.1), transparent),
        radial-gradient(ellipse 50% 50% at 50% 60%, rgba(236, 72, 153, 0.06), transparent);
    animation: bgShift 20s ease-in-out infinite alternate;
}
@keyframes bgShift {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

/* Floating orbs */
.bg-orbs {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-orbs::before, .bg-orbs::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.3;
}
.bg-orbs::before {
    width: 500px; height: 500px;
    background: var(--accent-1);
    top: 10%; left: -5%;
    animation: float1 18s ease-in-out infinite;
}
.bg-orbs::after {
    width: 400px; height: 400px;
    background: var(--accent-3);
    bottom: 20%; right: -5%;
    animation: float2 22s ease-in-out infinite;
}
@keyframes float1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(8vw, 6vh) scale(1.1); }
    66% { transform: translate(-4vw, 12vh) scale(0.9); }
}
@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-10vw, -8vh) scale(1.15); }
}

/* Grid pattern overlay */
body::after {
    content: '';
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.03;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ── Layout ────────────────────────────────────────────────── */
.app-root {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(11, 17, 32, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
}
.header-inner {
    max-width: 1024px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; gap: 14px;
}
.logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}
.logo-icon {
    width: 40px; height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: var(--glow-primary);
    animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(99,102,241,0.3), 0 0 40px rgba(99,102,241,0.1); }
    50% { box-shadow: 0 0 25px rgba(139,92,246,0.5), 0 0 60px rgba(139,92,246,0.2); }
}
.logo-text {
    font-size: 20px; font-weight: 800; letter-spacing: -0.3px;
    background: var(--gradient-primary);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-badge {
    font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
    padding: 3px 10px; border-radius: 20px;
    background: rgba(99,102,241,0.15); color: #a5b4fc;
}
.header-spacer { flex: 1; }

/* ── Main Content ──────────────────────────────────────────── */
.main {
    flex: 1; max-width: 1024px; width: 100%; margin: 0 auto;
    padding: 28px 24px 60px;
    display: flex; flex-direction: column; gap: 20px;
}

/* ── Glass Card ────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: var(--transition);
    position: relative;
}
.card::before {
    content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg);
    opacity: 0; transition: var(--transition-slow);
    background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(99,102,241,0.06), transparent 40%);
    pointer-events: none; z-index: 0;
}
.card:hover::before { opacity: 1; }
.card:hover {
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}
.card > * { position: relative; z-index: 1; }

.card-highlight {
    border-color: rgba(99,102,241,0.15);
    background: rgba(15, 23, 42, 0.7);
}

/* ── Input ─────────────────────────────────────────────────── */
.input-group {
    display: flex; gap: 12px; align-items: stretch;
}
.input-wrapper {
    flex: 1; position: relative;
}
.input {
    width: 100%;
    background: rgba(11, 17, 32, 0.8);
    border: 2px solid var(--border-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 15px; color: var(--text-primary);
    outline: none; transition: var(--transition);
    font-family: inherit; letter-spacing: 0.2px;
}
.input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.12), var(--glow-primary);
    background: rgba(11, 17, 32, 0.95);
}
.input::placeholder { color: var(--text-muted); }

.textarea {
    resize: vertical; min-height: 80px;
    padding: 12px 16px;
    line-height: 1.5;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; font-size: 15px; font-weight: 600;
    border: none; border-radius: var(--radius);
    cursor: pointer; transition: var(--transition);
    white-space: nowrap; text-decoration: none;
    font-family: inherit; letter-spacing: 0.2px;
    position: relative; overflow: hidden; outline: none;
    -webkit-tap-highlight-color: transparent;
}
/* Ripple */
.btn .ripple {
    position: absolute; border-radius: 50%;
    background: rgba(255,255,255,0.3); transform: scale(0);
    animation: rippleEffect 0.6s ease-out; pointer-events: none;
}
@keyframes rippleEffect {
    to { transform: scale(4); opacity: 0; }
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 16px rgba(99,102,241,0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(99,102,241,0.5);
}
.btn-primary:active { transform: scale(0.96); }
.btn-primary:disabled {
    opacity: 0.45; cursor: not-allowed; transform: none;
    filter: grayscale(30%);
}
.btn-primary:disabled:hover { transform: none; box-shadow: 0 2px 16px rgba(99,102,241,0.35); }

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-card);
    font-weight: 500;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.18);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.btn-secondary:active { transform: scale(0.96); }

.btn-ghost {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    font-weight: 500; padding: 8px 14px; font-size: 13px;
    border-radius: var(--radius-sm);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}

.btn-icon {
    width: 44px; height: 44px; padding: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-color: var(--border-glow);
}

.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: var(--radius); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
    padding: 4px 10px; border-radius: 20px;
}
.badge-primary { background: rgba(99,102,241,0.18); color: #a5b4fc; }
.badge-success { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-info { background: rgba(6,182,212,0.15); color: #22d3ee; }
.badge-warn { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ── Config Panel ──────────────────────────────────────────── */
.config-panel {
    animation: slideDown var(--transition-spring);
    transform-origin: top;
}
@keyframes slideDown {
    from { opacity: 0; transform: scaleY(0.95) translateY(-10px); }
    to { opacity: 1; transform: scaleY(1) translateY(0); }
}
.config-panel .card {
    border-style: dashed;
    background: rgba(15, 23, 42, 0.4);
}
.config-label {
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); margin-bottom: 6px;
}
.config-row {
    display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
}
.config-row .input { flex: 1; }
.config-status {
    font-size: 13px; margin-top: 8px; padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(245,158,11,0.08);
    color: #fbbf24;
    line-height: 1.5;
}

/* ── Hint ──────────────────────────────────────────────────── */
.hint {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted); margin-top: 14px; justify-content: center;
    flex-wrap: wrap;
}
.hint-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted); opacity: 0.5;
}

/* ── Error ─────────────────────────────────────────────────── */
.error-box {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px 20px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius);
    animation: shakeIn 0.4s ease-out;
}
@keyframes shakeIn {
    0% { transform: translateX(-10px); opacity: 0; }
    25% { transform: translateX(6px); }
    50% { transform: translateX(-4px); }
    75% { transform: translateX(2px); }
    100% { transform: translateX(0); opacity: 1; }
}
.error-icon { font-size: 22px; flex-shrink: 0; }
.error-text { font-size: 14px; color: #fca5a5; line-height: 1.5; }
.error-text b { color: #f87171; }

/* ── Result Card ───────────────────────────────────────────── */
.result-card {
    border-color: rgba(99,102,241,0.2);
    animation: fadeSlideUp 0.5s var(--transition-spring);
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-layout {
    display: flex; gap: 28px; align-items: flex-start;
}

/* Cover */
.result-cover {
    flex-shrink: 0; width: 260px;
    border-radius: var(--radius);
    overflow: hidden; position: relative;
    background: #06090f;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.cover-img {
    width: 100%; display: block;
    aspect-ratio: 9 / 16; object-fit: cover;
    transition: transform var(--transition-slow);
}
.result-cover:hover .cover-img { transform: scale(1.03); }

.cover-overlay {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 10px;
    display: flex; gap: 6px;
}

/* Info */
.result-info {
    flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.info-row {
    display: flex; gap: 8px; font-size: 14px; line-height: 1.5; align-items: baseline;
}
.info-label {
    color: var(--text-muted); flex-shrink: 0; min-width: 40px;
    font-weight: 500; font-size: 13px;
}
.info-value {
    color: var(--text-primary); word-break: break-all;
    font-weight: 500;
}
.info-value.mono {
    font-family: "SF Mono", "Fira Code", "JetBrains Mono", "Cascadia Code", monospace;
    font-size: 13px; color: var(--accent-3);
    background: rgba(6,182,212,0.08); padding: 2px 8px;
    border-radius: var(--radius-xs);
}

/* Stats */
.info-stats {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.stat-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; font-size: 13px; font-weight: 500;
    background: rgba(255,255,255,0.04); border-radius: 20px;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-fast);
}
.stat-chip:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
}
.stat-chip b { font-weight: 700; color: var(--text-primary); }

/* Download area */
.download-area {
    margin-top: 4px; padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; gap: 12px;
}
.quality-row {
    display: flex; align-items: center; gap: 12px;
}
.quality-label {
    font-size: 13px; color: var(--text-muted); white-space: nowrap; font-weight: 500;
}
.select {
    background: rgba(11,17,32,0.8);
    border: 2px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 10px 36px 10px 14px;
    font-size: 14px; color: var(--text-primary);
    outline: none; cursor: pointer;
    min-width: 200px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--transition);
    font-family: inherit;
}
.select:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.select option {
    background: var(--bg-card-solid); color: var(--text-primary);
}

.btn-row {
    display: flex; gap: 10px; flex-wrap: wrap;
}

/* ── Skeleton Loading ──────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; gap: 8px;
    align-items: center; pointer-events: none;
}
.toast {
    padding: 12px 24px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: toastIn 0.4s var(--transition-spring), toastOut 0.3s 2.2s ease-in forwards;
    pointer-events: auto; white-space: nowrap;
}
.toast-success {
    background: rgba(34,197,94,0.15); color: #4ade80; border-color: rgba(34,197,94,0.3);
}
.toast-error {
    background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3);
}
.toast-info {
    background: rgba(99,102,241,0.15); color: #a5b4fc; border-color: rgba(99,102,241,0.3);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-12px) scale(0.9); }
}

/* ── Section Visibility ────────────────────────────────────── */
.section-hidden { display: none !important; }

/* ── Particle Canvas ───────────────────────────────────────── */
#particles-canvas {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
    text-align: center; padding: 20px; font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    position: relative; z-index: 1;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .result-layout {
        flex-direction: column; align-items: center;
    }
    .result-cover {
        width: 100%; max-width: 300px;
    }
    .input-group { flex-direction: column; }
    .btn-row { flex-direction: column; }
    .btn-row .btn { width: 100%; justify-content: center; }
    .quality-row { flex-direction: column; align-items: stretch; }
    .select { width: 100%; }
    .header-inner { flex-wrap: wrap; }
    .header-badge { display: none; }
    .main { padding: 16px 16px 40px; }
    .card { padding: 20px; }
    .btn-lg { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .logo-text { font-size: 17px; }
    .logo-icon { width: 34px; height: 34px; font-size: 18px; }
    .info-stats { gap: 4px; }
    .stat-chip { padding: 4px 8px; font-size: 12px; }
}
