* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* 移动端菜单/滚动更顺滑 */
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
}

.container {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

input[type="text"] {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    /* ≥16px 防止 iOS Safari 聚焦自动放大 */
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    min-width: 0;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

button[type="submit"], .btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    /* 移动端触控目标 ≥48px */
    min-height: 48px;
    line-height: 1.2;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-accent {
    background: #ed8936;
    color: white;
}

.btn-accent:hover {
    background: #dd6b20;
    transform: translateY(-2px);
}

button[type="submit"] {
    background: #667eea;
    color: white;
}

button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hint {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.result-card, .error-card {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
}

.video-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cover {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
}

.meta {
    flex: 1;
}

.meta h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.author, .duration, .source {
    font-size: 0.95rem;
    color: #666;
    margin-top: 0.3rem;
}

.download-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.error-card {
    text-align: center;
}

.error-card h2 {
    color: #e53e3e;
    margin-bottom: 1rem;
}

/* ---- 品牌与标题 ---- */

.brand {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.brand:hover {
    color: #fff;
}

header h1 {
    font-size: 2.1rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.hero-sub {
    font-size: 1.05rem;
    opacity: 0.92;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---- 平台卡片网格（内链）---- */

.platform-grid {
    margin-top: 2rem;
}

.platform-grid h2 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: #333;
}

.cards {
    display: grid;
    /* min() 保证极窄屏下轨道不会超过容器宽度（否则 minmax(200px,1fr) 会撑破布局） */
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 0.75rem;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #ececec;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.card-title {
    font-weight: 700;
    color: #5568d3;
}

.card-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.45;
}

/* ---- 平台页 / 静态页 ---- */

.crumbs {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

.crumbs a {
    color: #5568d3;
    text-decoration: none;
}

.crumbs a:hover {
    text-decoration: underline;
}

main > h1 {
    font-size: 1.6rem;
    line-height: 1.25;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.lede {
    color: #555;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.format-list {
    margin: 0 0 0.5rem;
}

.format-list dt {
    font-weight: 600;
    color: #333;
    margin-top: 0.85rem;
}

.format-list dd {
    color: #555;
    font-size: 0.92rem;
    line-height: 1.65;
    margin: 0.2rem 0 0;
}

.note-list {
    padding-inline-start: 1.5rem;
    color: #555;
    line-height: 1.7;
    font-size: 0.95rem;
}

.note-list li {
    margin-bottom: 0.4rem;
}

/* 静态页正文（HTML 片段由 content.rs 提供，结构受控） */
.static-page h1 {
    font-size: 1.7rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.static-page h2 {
    font-size: 1.15rem;
    margin: 1.75rem 0 0.6rem;
    color: #333;
}

.static-page p,
.static-page li {
    color: #444;
    line-height: 1.7;
    font-size: 0.95rem;
}

.static-page p {
    margin-bottom: 0.75rem;
}

.static-page ul {
    padding-inline-start: 1.5rem;
    margin-bottom: 0.75rem;
}

.static-page li {
    margin-bottom: 0.35rem;
}

.static-page a {
    color: #5568d3;
}

.page-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 1.25rem;
}

.notfound h1 {
    font-size: 1.5rem;
    color: #e53e3e;
    margin-bottom: 0.75rem;
}

.notfound .hint {
    margin-bottom: 1.25rem;
}

/* ---- 页脚导航 ---- */

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 1rem;
    margin-bottom: 0.75rem;
}

.footer-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
}

.footer-nav a:hover {
    color: #fff;
    text-decoration: underline;
}

.hint-sm {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #999;
}

footer {
    background: rgba(0,0,0,0.1);
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.85rem;
    line-height: 1.6;
}

footer p {
    margin: 0.3rem 0;
}

/* ---- 移动端适配 ---- */

@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem;
    }

    main {
        padding: 1.25rem;
        border-radius: 12px;
    }

    header {
        margin-bottom: 1.5rem;
    }

    header h1 {
        font-size: 2.2rem;
    }

    header p {
        font-size: 1rem;
    }

    /* 输入框 + 按钮：竖排、占满宽度，触控目标大 */
    .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .input-group input,
    .input-group button {
        width: 100%;
    }

    .hint {
        font-size: 0.85rem;
    }

    /* 结果卡片：竖排布局 */
    .video-info {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .cover {
        width: 160px;
        height: 160px;
        margin: 0 auto;
    }

    .meta h2 {
        font-size: 1.1rem;
    }

    /* 下载按钮：单列全宽 */
    .download-buttons {
        grid-template-columns: 1fr;
    }

    /* 页脚与语言切换 */
    footer {
        padding: 1.25rem 1rem;
    }

    footer p {
        font-size: 0.8rem;
    }

    /* 合成进度遮罩 */
    .merge-card {
        padding: 1.5rem 1.25rem;
        min-width: 260px;
        margin: 0 1rem;
    }

    .merge-hint {
        font-size: 0.8rem;
    }
}

/* 超窄屏（<360px） */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.8rem;
    }

    .cover {
        width: 128px;
        height: 128px;
    }
}

/* ---- 合成下载进度遮罩 ---- */

.merge-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.merge-card {
    background: white;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    text-align: center;
    min-width: 300px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.merge-card h3 {
    margin-bottom: 0.5rem;
}

.merge-label {
    font-weight: 600;
    color: #5568d3;
    margin-bottom: 0.75rem;
}

.merge-hint {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.merge-spinner {
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    animation: merge-spin 1s linear infinite;
}

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

.merge-progress {
    display: none;
    background: #eee;
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.merge-progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    width: 0;
    transition: width 0.2s;
}

.merge-status {
    font-size: 0.85rem;
    color: #666;
}

/* ---- GEO 内容区（HowTo + FAQ，可被 AI 引擎引用）---- */

.geo-section {
    margin-top: 2rem;
    text-align: left;
}

.geo-section h2 {
    font-size: 1.15rem;
    margin: 1.5rem 0 0.75rem;
    color: #333;
}

.howto-steps {
    padding-inline-start: 1.5rem;
    color: #555;
    line-height: 1.7;
}

.howto-steps li {
    margin-bottom: 0.35rem;
}

.faq-list details {
    background: #f9fafb;
    border: 1px solid #ececec;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.faq-list summary {
    padding: 0.85rem 1rem;
    font-weight: 600;
    cursor: pointer;
    list-style-position: inside;
    color: #333;
}

.faq-list summary:hover {
    background: #f1f2f7;
}

.faq-list details[open] summary {
    border-bottom: 1px solid #ececec;
}

.faq-list details p {
    padding: 0.75rem 1rem;
    color: #555;
    font-size: 0.92rem;
    line-height: 1.7;
}

.geo-updated {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #999;
}

/* ---- 语言切换器 ---- */

.lang-switch {
    margin-top: 0.75rem;
}

.lang-switch a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 600;
}

.lang-switch a:hover {
    color: #fff;
    text-decoration: underline;
}

.lang-switch a.active {
    color: #fff;
    text-decoration: underline;
}

/* 直连下载进行中：按钮显示进度，暂不可重复点击 */
.btn.is-downloading { opacity: .85; cursor: progress; font-variant-numeric: tabular-nums; }
