/* ============ 字体 ============ */
@font-face {
    font-family: 'ayfont';
    src: url('/fonts/iconfont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

:root, [data-theme="dark"] {
    --bg: #0a0a0f;
    --bg-2: #12121a;
    --card: #17171f;
    --border: #26262f;
    --text: #f0f0f5;
    --muted: #8a8a99;
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --success: #10b981;
    --nav-bg: rgba(10, 10, 15, 0.75);
    --glow-1: rgba(99, 102, 241, 0.15);
    --glow-2: rgba(139, 92, 246, 0.08);
}

[data-theme="light"] {
    --bg: #f8f9fc;
    --bg-2: #ffffff;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --success: #059669;
    --nav-bg: rgba(248, 249, 252, 0.8);
    --glow-1: rgba(79, 70, 229, 0.08);
    --glow-2: rgba(124, 58, 237, 0.05);
}

body {
    font-family: 'ayfont', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, var(--glow-1), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, var(--glow-2), transparent);
    background-attachment: fixed;
}

/* ============ 顶栏 ============ */
.topbar {
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s, border-color 0.3s;
}

.topbar-inner {
    max-width: 900px; margin: 0 auto;
    padding: 0 20px; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}

.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }

.brand-logo {
    height: 38px; width: auto; max-width: 130px;
    object-fit: contain; display: block;
}

.topnav { display: flex; gap: 4px; flex: 1; justify-content: center; }

.topnav a {
    color: var(--muted); text-decoration: none;
    font-size: 13.5px; padding: 7px 13px;
    border-radius: 8px; transition: all 0.18s;
}

.topnav a:hover { color: var(--text); background: var(--card); }
.topnav a.on { color: var(--primary); background: rgba(99, 102, 241, 0.12); }

.topbar-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.theme-btn {
    width: 34px; height: 34px; border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s;
}

.theme-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .icon-moon { display: none; }
.theme-btn .icon-sun { display: block; }
[data-theme="light"] .theme-btn .icon-moon { display: block; }
[data-theme="light"] .theme-btn .icon-sun { display: none; }

/* ============ 移动端菜单 ============ */
.menu-toggle {
    display: none;
    width: 36px; height: 36px; border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text);
    cursor: pointer;
    align-items: center; justify-content: center;
    transition: all 0.18s;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.menu-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s;
}

.menu-overlay.show { display: block; opacity: 1; }

.menu-drawer {
    position: fixed; top: 0; left: -300px;
    width: 280px; max-width: 85vw;
    height: 100%;
    background: var(--card);
    border-right: 1px solid var(--border);
    z-index: 201;
    transition: left 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
    display: flex; flex-direction: column;
}

.menu-drawer.show { left: 0; }

.menu-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.menu-brand { display: flex; align-items: center; }

.menu-brand img {
    height: 32px; width: auto; max-width: 110px;
    object-fit: contain; display: block;
}

.menu-close {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s;
}

.menu-close:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.menu-links {
    flex: 1; padding: 12px;
    display: flex; flex-direction: column;
    gap: 4px; overflow-y: auto;
}

.menu-link {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--muted);
    font-size: 14.5px; font-weight: 500;
    transition: all 0.18s;
}

.menu-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.menu-link:hover { background: var(--bg); color: var(--text); }
.menu-link.on { background: rgba(99, 102, 241, 0.12); color: var(--primary); }

/* ============ 通用主体 ============ */
.wrap {
    max-width: 900px; margin: 0 auto;
    padding: 48px 20px 80px;
}

.intro { text-align: center; margin-bottom: 36px; }

.intro h1 {
    font-size: 32px; font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text) 30%, var(--muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.intro p { color: var(--muted); font-size: 14.5px; }

.intro.home { margin-bottom: 44px; }
.intro.home h1 { font-size: 40px; margin-bottom: 12px; }
.intro.home p { font-size: 15px; max-width: 520px; margin: 0 auto; }

.intro-tag {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 14px; border-radius: 100px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    font-size: 12.5px; color: var(--primary);
    margin-bottom: 18px;
}

.pulse {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.8s infinite;
}

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

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 18px;
    transition: background 0.3s, border-color 0.3s;
}

.input-row { display: flex; gap: 8px; }

.input-main {
    flex: 1;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px 15px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-main:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-main::placeholder { color: var(--muted); }

.btn-primary {
    padding: 0 22px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex; align-items: center; gap: 6px;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============ 首页接口卡片 ============ */
.api-list { display: flex; flex-direction: column; gap: 14px; }

.api-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    transition: border-color 0.2s, transform 0.2s, background 0.3s;
    position: relative;
    overflow: hidden;
}

.api-item::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--primary-2));
    opacity: 0;
    transition: opacity 0.2s;
}

.api-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.api-item:hover::before { opacity: 1; }

.api-head {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.api-name {
    font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

.api-tag {
    font-size: 11px; font-weight: 600;
    padding: 3px 9px; border-radius: 100px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.api-row { display: flex; gap: 8px; }

.api-url {
    flex: 1;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 13px;
    color: var(--muted);
    font-size: 12.5px;
    font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
    outline: none;
    cursor: text;
    transition: border-color 0.2s, background 0.3s, color 0.3s;
}

.api-url:focus {
    border-color: var(--primary);
    color: var(--text);
}

.copy-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 0 16px; border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--muted);
    font-size: 13px; font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.copy-btn.done {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* ============ 页脚 ============ */
.foot {
    margin-top: 48px; padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.foot-links {
    display: flex; justify-content: center;
    gap: 22px; margin-bottom: 10px;
}

.foot-links a {
    color: var(--muted); text-decoration: none;
    transition: color 0.18s;
}

.foot-links a:hover { color: var(--primary); }

/* ============ Toast ============ */
.toast {
    position: fixed;
    bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 22px;
    font-size: 13.5px;
    color: var(--text);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-width: 90vw;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .topnav { display: none !important; }
    .menu-toggle { display: flex; }
    .wrap { padding: 28px 14px 60px; }
    .intro h1 { font-size: 24px; }
    .intro.home h1 { font-size: 28px; }
    .input-row { flex-direction: column; }
    .btn-primary { justify-content: center; padding: 12px; }
    .api-row { flex-direction: column; }
    .copy-btn { justify-content: center; padding: 10px; }
}