/* ============ 全局重置与基础样式 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a73e8;
    --primary-hover: #1967d2;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border-color: #dadce0;
    --hover-bg: #f1f3f4;
    --bg-white: #ffffff;
    --bg-gray: #f8f9fa;
    --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.1), 0 1px 3px rgba(60, 64, 67, 0.08);
    --shadow-md: 0 1px 3px rgba(60, 64, 67, 0.12), 0 4px 8px rgba(60, 64, 67, 0.04);
    --shadow-lg: 0 4px 12px rgba(60, 64, 67, 0.15);
    --google-blue: #4285f4;
    --google-red: #ea4335;
    --google-yellow: #fbbc04;
    --google-green: #34a853;
}

html, body {
    height: 100%;
    font-family: 'Roboto', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: var(--bg-white);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ============ 顶部导航栏 ============ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid transparent;
    transition: box-shadow 0.3s;
}

.topbar.scrolled {
    box-shadow: var(--shadow-sm);
    border-bottom-color: var(--border-color);
}

.logo-text {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--google-blue);
}

.topbar-right {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    font-size: 14px;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s;
    position: relative;
}

.nav-link:hover {
    background: var(--hover-bg);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -19px;
    left: 12px;
    right: 12px;
    height: 3px;
    background: var(--google-blue);
    border-radius: 3px 3px 0 0;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--hover-bg);
}

/* ============ 主页 / Hero 区 ============ */
.page {
    display: none;
    min-height: calc(100vh - 70px);
    padding: 40px 20px;
}

.page.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.hero {
    text-align: center;
    max-width: 720px;
    width: 100%;
    padding: 40px 20px;
}

.brand {
    font-size: 90px;
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -2px;
    user-select: none;
}

.brand span {
    display: inline-block;
    transition: transform 0.2s;
}

.brand:hover span {
    animation: bounce 0.6s ease;
}

.b1 { color: var(--google-blue); }
.b2 { color: var(--google-red); }
.b3 { color: var(--google-yellow); }
.b4 { color: var(--google-blue); }
.b5 { color: var(--google-green); }
.b6 { color: var(--google-red); }
.b1:nth-child(7) { color: var(--google-blue); }

.brand span:nth-child(1) { animation-delay: 0s; }
.brand span:nth-child(2) { animation-delay: 0.05s; }
.brand span:nth-child(3) { animation-delay: 0.1s; }
.brand span:nth-child(4) { animation-delay: 0.15s; }
.brand span:nth-child(5) { animation-delay: 0.2s; }
.brand span:nth-child(6) { animation-delay: 0.25s; }
.brand span:nth-child(7) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.tagline {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

/* ============ 搜索框 ============ */
.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 580px;
    margin: 0 auto 28px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-white);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.search-box:hover,
.search-box:focus-within {
    box-shadow: var(--shadow-md);
    border-color: rgba(223, 225, 229, 0);
}

.search-icon {
    flex-shrink: 0;
    margin-right: 12px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--text-primary);
    background: transparent;
    font-family: inherit;
}

.search-input::placeholder {
    color: #9aa0a6;
}

.clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background 0.2s;
}

.clear-btn:hover {
    background: var(--hover-bg);
}

/* ============ 按钮 ============ */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 36px;
}

.btn {
    padding: 10px 22px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    border-color: #c4c7c5;
}

/* ============ 平台标签 ============ */
.platform-tags {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.platform-tag {
    padding: 6px 14px;
    border-radius: 16px;
    background: var(--bg-gray);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.platform-tag:hover {
    background: #e8f0fe;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.platform-tag.active {
    background: #e8f0fe;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============ 容器（历史/关于页） ============ */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-white);
}

.page-title {
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.empty-tip {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 14px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.history-item:hover {
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.history-thumb {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-gray);
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.history-delete {
    padding: 6px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.2s;
}

.history-delete:hover {
    background: #fce8e6;
    color: var(--google-red);
}

/* ============ 关于页样式 ============ */
.about-content {
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 15px;
}

.about-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 500;
}

.about-content ul {
    padding-left: 24px;
    margin-bottom: 16px;
}

.about-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.about-content strong {
    color: var(--text-primary);
}

.warning {
    background: #fef7e0;
    border-left: 4px solid #fbbc04;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 20px;
    color: var(--text-primary);
}

/* ============ 弹窗 ============ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s;
}

.modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    animation: slideUp 0.3s;
    box-shadow: var(--shadow-lg);
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--hover-bg);
}

.result-video {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #000;
    max-height: 400px;
}

.result-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.result-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.result-url-box {
    background: var(--bg-gray);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
    margin-top: 12px;
    border: 1px solid var(--border-color);
    max-height: 100px;
    overflow-y: auto;
}

.result-error {
    text-align: center;
    padding: 40px 20px;
}

.result-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.result-error-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ============ 加载动画 ============ */
.loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--hover-bg);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============ 底部 ============ */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
}

/* ============ 响应式 ============ */
@media (max-width: 600px) {
    .brand {
        font-size: 56px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-right {
        gap: 8px;
    }

    .nav-link {
        font-size: 13px;
        padding: 6px 8px;
    }

    .nav-link.active::after {
        bottom: -13px;
    }

    .search-input {
        font-size: 14px;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
        margin: 0 auto 28px;
    }

    .btn {
        width: 100%;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-thumb {
        width: 100%;
        height: 160px;
    }
}

/* ============ v2.0 新增样式 ============ */

/* 使用提示 */
.usage-tips {
    margin-top: 24px;
    text-align: center;
}

.usage-tips p {
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--bg-gray);
    padding: 8px 16px;
    border-radius: 16px;
    display: inline-block;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 平台标签网格 */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.platform-item {
    background: var(--bg-gray);
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.platform-item:hover {
    background: #e8f0fe;
    color: var(--primary-color);
}

/* 设置弹窗 */
.settings-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.settings-group {
    margin-bottom: 16px;
}

.settings-group > label {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 500;
}

.settings-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: border-color 0.2s;
    resize: vertical;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.settings-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.settings-checkbox {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}

.settings-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.settings-checkbox span {
    font-size: 14px;
    color: var(--text-primary);
}

/* 结果页面 - 平台标签 */
.result-platform-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

/* 作者信息 */
.author-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.result-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-gray);
    border-radius: 8px;
}

/* 清晰度选择 */
.qualities {
    margin: 16px 0;
}

.qualities-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.qualities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quality-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quality-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quality-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.quality-btn .size {
    font-size: 11px;
    opacity: 0.8;
}

/* 图集展示 */
.result-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
}

.result-images img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.2s;
    cursor: pointer;
}

.result-images img:hover {
    transform: scale(1.02);
}

/* 错误提示 */
.result-error-hint {
    color: var(--text-secondary);
    font-size: 13px;
    background: #fef7e0;
    padding: 10px 14px;
    border-radius: 6px;
    margin: 16px 0;
    text-align: left;
    line-height: 1.5;
}

/* 备注 */
.result-note {
    margin-top: 12px;
    padding: 10px 14px;
    background: #e8f0fe;
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    border-left: 3px solid var(--primary-color);
}
