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

.hidden { display: none; }

:root {
    --primary-color: #FF6B35;
    --secondary-color: #D45C00;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #4FACFE 0%, #00F2FE 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF4E00 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 主内容 */
.main {
    flex: 1;
    padding: 30px 20px;
}

section {
    margin-bottom: 40px;
}

section h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.url-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.hint {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.hint.error {
    color: var(--error-color);
}

.hint.success {
    color: var(--success-color);
}

/* 按钮 */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF4E00 100%);
    color: white;
    flex: 2;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.25);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, #1DB954 0%, #17a84a 100%);
    color: white;
    border: none;
    flex: 1;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(29, 185, 84, 0.25);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 视频信息 */
.video-info {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.video-info.hidden {
    display: none;
}

.video-info h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
}

.video-thumbnail {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.video-thumbnail.hidden {
    display: none;
}

.video-info-body {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.info-item .value {
    color: var(--text-primary);
    word-break: break-word;
}

/* 格式选择 */
.format-selector {
    margin-top: 16px;
}

.format-selector.hidden {
    display: none;
}

.format-label {
    font-size: 0.8em;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.format-list {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.format-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s;
    user-select: none;
    position: relative;
}

.format-card:last-child {
    border-bottom: none;
}

.format-card:hover {
    background: #fef9f7;
}

.format-card.selected {
    background: rgba(255, 107, 53, 0.06);
    border-left: 3px solid var(--primary-color);
    padding-left: 9px;
}

/* radio dot */
.format-radio {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    transition: border-color 0.12s, background 0.12s;
}

.format-card.selected .format-radio {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: inset 0 0 0 2.5px white;
}

.format-badge-hd {
    font-size: 0.6em;
    font-weight: 900;
    color: white;
    background: #f59e0b;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.format-quality {
    font-weight: 700;
    font-size: 0.9em;
    color: var(--text-primary);
    min-width: 54px;
}

.format-card.selected .format-quality {
    color: var(--primary-color);
}

.format-ext {
    font-size: 0.75em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.format-size {
    margin-left: auto;
    font-size: 0.82em;
    color: var(--text-secondary);
    min-width: 56px;
    text-align: right;
}

.format-card.selected .format-size {
    color: var(--primary-color);
    font-weight: 700;
}

.format-check {
    display: none;
}

/* 进度条 */
.progress-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.progress-section.hidden {
    display: none;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--success-color) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.download-status {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* 文件列表 */
.files-section h2 {
    margin-bottom: 20px;
}

.files-list {
    display: grid;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: 5px;
}

.file-size {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.files-actions {
    display: flex;
    gap: 10px;
}

.files-actions button {
    flex: 1;
}

/* 帮助信息 */
.help-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.help-content {
    display: grid;
    gap: 20px;
}

.help-item h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.help-item ul {
    list-style: none;
    margin-left: 0;
}

.help-item li {
    padding: 5px 0 5px 20px;
    position: relative;
    color: var(--text-secondary);
}

.help-item li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.notice-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.notice-section summary {
    padding: 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notice-section summary::-webkit-details-marker { display: none; }

.notice-section summary::after {
    content: "▼";
    font-size: 12px;
    transition: transform 0.2s;
}

.notice-section[open] summary::after {
    transform: rotate(180deg);
}

.notice-content {
    padding: 0 20px 20px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.notice-content p {
    margin-bottom: 10px;
}

.notice-content p:last-child {
    margin-bottom: 0;
}

.help-item code {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

/* 页脚 */
.footer {
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

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

.footer-links {
    margin-top: 6px;
    font-size: 13px;
}

.footer-links span {
    margin: 0 6px;
    color: var(--border-color);
}

/* 通知框 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification.hidden {
    display: none;
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

.notification.warning {
    background: var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── 头部布局 ─────────────────────────────────────────────── */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

/* 用户状态栏（已登录时显示） */
.user-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    color: white;
}
.user-bar.hidden { display: none; }
.user-email { opacity: 0.9; }
.user-badge {
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 700;
}
.btn-text {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 0.85em;
    text-decoration: underline;
}

/* 试用次数横幅 */
.trial-banner {
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}
.trial-banner.hidden { display: none; }
.trial-banner--low {
    background: rgba(255,255,255,0.2);
    color: white;
}
.trial-banner--warn {
    background: rgba(255, 200, 0, 0.3);
    color: #fff3cd;
}

/* ── 升级弹窗 ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 36px 32px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.modal-box h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.6;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

/* 套餐卡片 */
.plan-cards {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
}

.plan-card {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 14px;
    position: relative;
}

.plan-card--featured {
    border-color: var(--primary-color);
    background: #fff9f7;
}

.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    font-size: 0.72em;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.plan-card h3 {
    font-size: 1em;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.plan-price {
    font-size: 1.4em;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.plan-save {
    font-size: 0.78em;
    color: var(--success-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.btn-upgrade {
    display: block;
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF4E00 100%);
    color: white;
    padding: 10px 0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9em;
    text-decoration: none;
    margin-top: 10px;
    transition: opacity 0.2s;
}
.btn-upgrade:hover { opacity: 0.88; }

.modal-login-hint {
    font-size: 0.85em;
    color: var(--text-secondary);
}
.modal-login-hint a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* ── 语言切换器 ──────────────────────────────────────────── */
.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.user-slot {
    display: flex;
    align-items: center;
}
.lang-picker {
    position: relative;
}
.lang-trigger {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 16px;
    color: white;
    font-size: 0.82em;
    padding: 4px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}
.lang-trigger:hover {
    background: rgba(255,255,255,0.28);
}
.lang-caret {
    font-size: 0.75em;
    opacity: 0.8;
}
.lang-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 200;
    background: rgba(50, 50, 60, 0.97);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    min-width: 460px;
}
.lang-panel.hidden { display: none; }
.lang-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}
.lang-item {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.85);
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    text-align: left;
    white-space: nowrap;
    transition: background 0.15s;
}
.lang-item:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}
.lang-item.active {
    background: rgba(255,255,255,0.22);
    color: white;
    font-weight: 700;
}

/* ── 订阅定价区 ──────────────────────────────────────────── */
.pricing-section {
    background: linear-gradient(135deg, #fff9f7 0%, #fff3ee 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 107, 53, 0.15);
    padding: 32px 24px 24px;
    text-align: center;
}

.pricing-section h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 6px;
    font-size: 1.4em;
}

.pricing-subtitle {
    color: var(--text-secondary);
    font-size: 0.92em;
    margin-bottom: 24px;
}

.pricing-cards {
    display: flex;
    gap: 14px;
    align-items: stretch;
    margin-bottom: 18px;
}

.pricing-card {
    flex: 1;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 22px 14px 18px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.pricing-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.pricing-card--featured {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.15);
}

.pricing-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF4E00 100%);
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.pricing-plan-name {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.pricing-price {
    font-size: 2em;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.pricing-card--featured .pricing-price {
    color: var(--primary-color);
}

.pricing-period {
    font-size: 0.45em;
    font-weight: 600;
    color: var(--text-secondary);
    vertical-align: middle;
}

.pricing-monthly-eq {
    font-size: 0.75em;
    color: var(--success-color);
    font-weight: 600;
    min-height: 1.2em;
    margin-bottom: 14px;
}

.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 18px;
    flex: 1;
}

.pricing-features li {
    font-size: 0.82em;
    color: var(--text-secondary);
    padding: 4px 0 4px 18px;
    position: relative;
}

.pricing-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: 700;
}

.btn-pricing {
    display: block;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 10px 0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88em;
    text-decoration: none;
    transition: all 0.2s;
    margin-top: auto;
}

.btn-pricing:hover {
    background: var(--border-color);
    border-color: var(--text-secondary);
}

.btn-pricing--featured {
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF4E00 100%);
    color: white;
    border-color: transparent;
}

.btn-pricing--featured:hover {
    opacity: 0.9;
    background: linear-gradient(135deg, var(--primary-color) 0%, #FF4E00 100%);
    border-color: transparent;
}

.pricing-note {
    font-size: 0.78em;
    color: var(--text-secondary);
}

/* ── 响应式设计 */
@media (max-width: 600px) {
    .container {
        border-radius: 0;
        min-height: 100vh;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header p {
        font-size: 1em;
    }

    .main {
        padding: 20px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .files-actions {
        flex-direction: column;
    }

    .files-actions button {
        width: 100%;
    }

    .pricing-cards {
        flex-direction: column;
    }

    .pricing-card--featured {
        order: -1;
    }
}
