/* ============================================================
   Short Video Parser v2 — 玻璃态拟物风格
   更有质感、更高级的视觉系统
   ============================================================ */

/* ========== CSS 变量系统 ========== */
:root {
    /* 背景层次 */
    --bg-base: #f7f7f8;
    --bg-soft: #ffffff;
    --bg-elevated: #ffffff;

    /* 玻璃态表面 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: rgba(15, 23, 42, 0.1);

    /* 渐变色系统 */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    --gradient-primary-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #8b5cf6 100%);
    --gradient-accent: linear-gradient(135deg, #ff6b9d 0%, #c084fc 100%);
    --gradient-mesh: radial-gradient(at 20% 30%, rgba(99, 102, 241, 0.065) 0%, transparent 50%),
                     radial-gradient(at 80% 20%, rgba(236, 72, 153, 0.045) 0%, transparent 50%),
                     radial-gradient(at 40% 80%, rgba(139, 92, 246, 0.045) 0%, transparent 50%);

    /* 主色调 */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #8b5cf6;
    --accent-pink: #ff6b9d;
    --accent-cyan: #06b6d4;

    /* 文字颜色 */
    --text: #0f172a;
    --text-soft: #1e293b;
    --text-muted: #64748b;
    --text-lighter: #94a3b8;

    /* 状态颜色 */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* 阴影系统 - 多层次 */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04),
                 0 2px 4px rgba(15, 23, 42, 0.02);
    --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.04),
                 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.06),
                 0 16px 48px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 8px 32px rgba(15, 23, 42, 0.08),
                 0 24px 64px rgba(99, 102, 241, 0.15);
    --shadow-glow: 0 0 32px rgba(99, 102, 241, 0.3),
                   0 0 64px rgba(139, 92, 246, 0.2);

    /* 内阴影和高光 */
    --inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.3);
    --inner-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.05);

    /* 边框 */
    --border-light: rgba(255, 255, 255, 0.5);
    --border-base: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.16);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* 模糊效果 */
    --blur-sm: blur(8px);
    --blur-md: blur(16px);
    --blur-lg: blur(32px);
    --blur-xl: blur(40px);
}

/* ========== 基础重置 ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(180deg, #fafbff 0%, #f5f6fc 50%, #f0f2f8 100%);
    position: relative;
    overflow-x: hidden;
}

/* ========== 动态网格背景 ========== */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: var(--gradient-mesh);
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(100, 110, 125, 0.015) 2px, rgba(100, 110, 125, 0.015) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(100, 110, 125, 0.015) 2px, rgba(100, 110, 125, 0.015) 4px);
    pointer-events: none;
    opacity: 0.2;
}

/* ========== 噪点纹理 ========== */
.noise-texture {
    position: fixed;
    inset: 0;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    opacity: 0.15;
}

/* ========== 浮动光斑动画 ========== */
.floating-blobs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.16;
    animation: float 20s ease-in-out infinite;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.16) 0%, transparent 70%);
    top: 20%;
    right: -50px;
    animation-delay: -7s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
    bottom: 10%;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* ========== 应用容器 ========== */
.app-shell {
    position: relative;
    min-height: 100vh;
}

/* ========== 顶部导航栏 ========== */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 36px;
    min-height: 82px;
    padding: 16px 40px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border-bottom: 1px solid var(--border-base);
    transition: background 0.3s ease;
}

.top-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
}

/* Logo */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.brand img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex: 0 0 auto;
}

/* 导航 */
.top-nav {
    display: flex;
    align-items: center;
    gap: 32px;
    justify-self: start;
    min-width: 0;
}

.top-nav a {
    padding: 10px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.top-nav a::after {
    display: none;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
    color: var(--text);
}

.top-nav a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

#parseForm,
#platforms {
    scroll-margin-top: 110px;
}

.top-nav a:hover::after {
    transform: scaleX(0);
}

/* 状态指示器 */
.top-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    box-shadow: var(--shadow-sm), var(--inner-highlight);
}

.top-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

.top-status.offline::before {
    background: var(--error);
    box-shadow: 0 0 12px var(--error);
    animation: none;
}

.top-status span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.top-status strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

/* ========== 主内容区 ========== */
.main-area {
    position: relative;
    z-index: 2;
    width: min(1200px, calc(100% - 48px));
    margin: 0 auto;
    padding: 60px 0 80px;
}

/* ========== 顶部栏 ========== */
.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 40px;
}

.page-kicker {
    display: inline-block;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 快速统计卡片 */
.quick-stats {
    display: flex;
    gap: 12px;
}

.quick-stats div {
    min-width: 120px;
    padding: 16px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-md);
    box-shadow: var(--shadow-md), var(--inner-highlight);
    text-align: right;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quick-stats div:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.quick-stats strong {
    display: block;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quick-stats span {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

/* ========== 玻璃态卡片基类 ========== */
.glass-card {
    position: relative;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-xl);
    -webkit-backdrop-filter: var(--blur-xl);
    box-shadow: var(--shadow-lg), var(--inner-highlight);
    overflow: hidden;
}

.glass-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.8) 50%,
        transparent 100%);
}

/* ========== 解析表单卡片 ========== */
.parser-card {
    padding: 32px;
    position: relative;
    z-index: 10;
    overflow: visible;
}

.parse-form {
    display: grid;
    gap: 20px;
}

.form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.form-head label {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}

.form-head span {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.form-head span.is-detected {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Textarea 输入框 */
textarea {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    border: 2px solid var(--border-base);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--blur-sm);
    font: inherit;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
    transition: border-color 0.3s ease;
    box-shadow: none;
}

textarea::placeholder {
    color: var(--text-lighter);
}

textarea:hover {
    border-color: var(--border-strong);
}

textarea:focus {
    border-color: var(--primary);
}

/* 批量提示 */
.batch-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(139, 92, 246, 0.05) 100%);
    font-size: 13px;
    line-height: 1.6;
}

.batch-tip strong {
    flex: 0 0 auto;
    color: var(--primary);
    font-weight: 800;
}

.batch-tip span {
    color: var(--text-soft);
}

/* ========== 按钮系统 ========== */
button, .btn {
    border: 0;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 主按钮 */
.primary-btn, .download-btn {
    overflow: hidden;
    color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-md),
                0 0 24px rgba(99, 102, 241, 0.3);
    position: relative;
}

.primary-btn::before, .download-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
    transition: left 0.6s ease;
}

.primary-btn:hover, .download-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl),
                var(--shadow-glow);
}

.primary-btn:hover::before, .download-btn:hover::before {
    left: 100%;
}

.primary-btn:active, .download-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.primary-btn.is-busy {
    opacity: 0.7;
    pointer-events: none;
    animation: buttonPulse 1.5s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: var(--shadow-md), 0 0 24px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: var(--shadow-md), 0 0 32px rgba(99, 102, 241, 0.5);
    }
}

/* 次级按钮 */
.secondary-btn {
    color: var(--text);
    background: var(--glass-bg);
    border: 1px solid var(--border-light);
    backdrop-filter: var(--blur-sm);
    box-shadow: var(--shadow-sm), var(--inner-highlight);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== 涟漪效果 ========== */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========== 结果面板 ========== */
.result-panel {
    margin-top: 24px;
    padding: 32px;
}

.result-panel:not(.hidden) {
    animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ========== Toast 通知升级 ========== */
.toast-stack {
    position: fixed;
    top: 90px;
    left: 50%;
    z-index: 200;
    display: grid;
    gap: 12px;
    justify-items: center;
    pointer-events: none;
    transform: translateX(-50%);
}

.app-toast {
    min-width: 200px;
    max-width: min(400px, calc(100vw - 48px));
    padding: 14px 20px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-xl);
    -webkit-backdrop-filter: var(--blur-xl);
    box-shadow: var(--shadow-xl), var(--inner-highlight);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-toast.success {
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: var(--shadow-xl), 0 0 24px rgba(16, 185, 129, 0.2);
}

.app-toast.error {
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: var(--shadow-xl), 0 0 24px rgba(239, 68, 68, 0.2);
}

.app-toast.leaving {
    animation: toastOut 0.3s ease-out forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

/* ========== 隐藏类 ========== */
.hidden {
    display: none !important;
}

/* ========== 响应式布局 ========== */
@media (max-width: 1040px) {
    .top-status {
        display: none;
    }
}

@media (max-width: 880px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-stats {
        width: 100%;
    }

    .quick-stats div {
        flex: 1;
        text-align: left;
    }
}

@media (max-width: 1100px) {
    .top-header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px 20px;
    }

    .top-header .member-bar {
        grid-column: 2;
        grid-row: 1;
    }

    .top-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
    }

    #parseForm,
    #platforms {
        scroll-margin-top: 170px;
    }
}

@media (max-width: 640px) {
    .top-header {
        padding: 12px 16px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
    }

    .brand {
        font-size: 16px;
        gap: 8px;
    }

    .brand img {
        width: 32px;
        height: 32px;
    }

    .top-header .member-chip {
        padding: 0 8px;
        gap: 8px;
    }

    .top-header .member-name {
        max-width: 72px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-header .member-points {
        display: none;
    }

    .top-nav {
        width: 100%;
        gap: 24px;
    }

    .top-nav a {
        padding: 4px 0;
        font-size: 13px;
    }

    #parseForm,
    #platforms {
        scroll-margin-top: 130px;
    }

    .main-area {
        width: 100%;
        padding: 40px 20px 60px;
    }

    .topbar h1 {
        font-size: 28px;
    }

    .parser-card, .result-panel {
        padding: 24px;
    }

    .blob {
        display: none;
    }
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(99, 102, 241, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* ========== 平台网格样式 ========== */
.platform-panel {
    margin-top: 32px;
    padding: 32px;
}

.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.section-title span {
    display: inline-block;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.section-title h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.section-title p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.platform-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 100px;
    padding: 20px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    box-shadow: var(--shadow-sm), var(--inner-highlight);
    transition: border-color 0.3s ease;
}

.platform-item:hover {
    border-color: var(--primary);
}

.platform-copy {
    flex: 1;
    min-width: 0;
}

.platform-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.platform-item strong {
    display: block;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.platform-item span {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.platform-cost {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    color: #8a6116;
    background: rgba(245, 185, 58, 0.15);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.platform-item em {
    flex: 0 0 auto;
    padding: 5px 12px;
    border-radius: 999px;
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.platform-item.on em {
    color: var(--success);
    background: rgba(16, 185, 129, 0.12);
}

.platform-item.off em {
    color: var(--warning);
    background: rgba(251, 146, 60, 0.12);
}

/* ========== 选中文本样式 ========== */
::selection {
    background: var(--primary);
    color: white;
}

::-moz-selection {
    background: var(--primary);
    color: white;
}
