:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;
    --bg: #ffffff;
    --bg-soft: #f8fafc;
    --bg-card: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-light: #1e3a5f;
    --primary-dark: #2563eb;
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-hover: 0 10px 25px rgba(0,0,0,0.4), 0 4px 10px rgba(0,0,0,0.3);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}
.header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.logo .dot {
    width: 36px; height: 36px; background: var(--gradient); border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.logo-icon {
    width: 36px; height: 36px; border-radius: 10px; object-fit: contain;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

/* 汉堡菜单按钮 */
.menu-toggle-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--bg-card); cursor: pointer; display: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    transition: var(--transition);
}
.menu-toggle-btn:hover { background: var(--bg-soft); }
.menu-toggle-btn .menu-bar {
    display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px;
    transition: var(--transition);
}
.menu-toggle-btn.active .menu-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle-btn.active .menu-bar:nth-child(2) { opacity: 0; }
.menu-toggle-btn.active .menu-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 功能菜单面板 */
.menu-panel {
    display: none; position: fixed; top: 64px; right: 12px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-hover); width: 280px; max-width: calc(100vw - 24px);
    z-index: 200; padding: 8px; opacity: 0; transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-height: calc(100vh - 80px); overflow-y: auto;
}
.menu-panel.show { display: block; opacity: 1; transform: translateY(0); }
.menu-panel-inner { display: flex; flex-direction: column; gap: 2px; }
.menu-panel-item {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
    cursor: pointer; transition: var(--transition);
}
.menu-panel-item:hover { background: var(--bg-soft); }
.menu-panel-item .mp-icon { font-size: 22px; width: 28px; text-align: center; flex-shrink: 0; }
.menu-panel-item .mp-info { flex: 1; min-width: 0; }
.menu-panel-item .mp-info strong { display: block; font-size: 14px; font-weight: 600; }
.menu-panel-item .mp-info small { display: block; font-size: 12px; color: var(--text-light); margin-top: 2px; }
.menu-panel-item .mp-badge {
    background: var(--primary); color: #fff; font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px; min-width: 20px; text-align: center;
}
.menu-panel-divider { height: 1px; background: var(--border); margin: 4px 0; }

.nav { display: flex; gap: 4px; }
.nav a {
    padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    color: var(--text-secondary); text-decoration: none; transition: var(--transition);
}
.nav a:hover { color: var(--primary); background: var(--bg-soft); }
.nav a.active { color: var(--primary); background: var(--primary-light); }
.nav .admin-link { color: var(--primary); border: 1px solid var(--primary); padding: 6px 14px; }
.nav .admin-link:hover { background: var(--primary); color: #fff; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--bg-card); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); position: relative; overflow: hidden;
}
.theme-toggle:hover { background: var(--bg-soft); transform: scale(1.05); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon {
    position: absolute; font-size: 18px; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-toggle .icon-sun { transform: rotate(0deg) scale(1); opacity: 1; }
.theme-toggle .icon-moon { transform: rotate(-180deg) scale(0); opacity: 0; }
[data-theme="dark"] .theme-toggle .icon-sun { transform: rotate(180deg) scale(0); opacity: 0; }
[data-theme="dark"] .theme-toggle .icon-moon { transform: rotate(0deg) scale(1); opacity: 1; }

/* Hero */
.hero { padding: 80px 0 60px; background: var(--bg-soft); transition: var(--transition); }
.hero .container { text-align: center; }

.hero-badge {
    display: inline-block; padding: 6px 16px; background: var(--primary-light);
    color: var(--primary); border-radius: 20px; font-size: 13px; font-weight: 500; margin-bottom: 24px;
}

.hero h1 { font-size: 48px; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero h1 span { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.hero p { font-size: 17px; color: var(--text-secondary); max-width: 600px; margin: 0 auto 40px; }

.stats { display: flex; align-items: center; justify-content: center; gap: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 48px; max-width: 600px; margin: 0 auto 32px; box-shadow: var(--shadow); transition: var(--transition); }

.stat-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
.stat-num { font-size: 32px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

.quick-bar { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.quick-btn {
    display: inline-flex; align-items: center; padding: 10px 24px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    text-decoration: none; cursor: pointer; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text); transition: var(--transition);
}
.quick-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.quick-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.quick-btn.primary:hover { background: var(--primary-dark); color: #fff; }

/* Section */
.section { padding: 60px 0; }

.section-header { text-align: center; margin-bottom: 36px; }
.section-title { font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; }
.section-title .bar { width: 4px; height: 24px; background: var(--gradient); border-radius: 2px; }
.section-desc { color: var(--text-secondary); font-size: 14px; margin-top: 8px; }

/* Search */
.search-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.search-input {
    flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text); font-size: 14px; outline: none; transition: var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-btn {
    width: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-card); cursor: pointer; font-size: 16px; transition: var(--transition);
}
.search-btn:hover { border-color: var(--primary); background: var(--primary-light); }

.filter-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

.category-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.category-tab {
    padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer;
    background: var(--bg-soft); color: var(--text-secondary); border: none; transition: var(--transition);
}
.category-tab:hover { color: var(--primary); }
.category-tab.active { background: var(--primary); color: #fff; }

.view-toggle { display: flex; gap: 4px; }
.view-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--bg-card); cursor: pointer; font-size: 14px; color: var(--text-secondary);
    transition: var(--transition);
}
.view-btn:hover { color: var(--primary); border-color: var(--primary); }
.view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* API List */
.api-list { display: grid; gap: 16px; }
.api-list.grid-view { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.api-list.list-view { grid-template-columns: 1fr; }

.api-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; cursor: pointer; transition: var(--transition); position: relative; overflow: hidden;
}
.api-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient); transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease;
}
.api-card:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.api-card:hover::before { transform: scaleX(1); }

.api-card-header { display: flex; align-items: start; justify-content: space-between; margin-bottom: 10px; }
.api-card-name { font-size: 16px; font-weight: 600; color: var(--text); }
.api-card-fav {
    background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px;
    color: var(--text-light); transition: var(--transition);
}
.api-card-fav:hover { color: var(--warning); transform: scale(1.2); }
.api-card-fav.active { color: var(--warning); }

.api-card-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }

.api-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.api-tag {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.api-tag.get { background: #dcfce7; color: #166534; }
.api-tag.post { background: #fef3c7; color: #92400e; }
.api-tag.category { background: var(--bg-soft); color: var(--text-secondary); }
.api-tag.pinned { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; border: 1px solid #fcd34d; }
.api-tag.status-warn { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.api-tag.status-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.api-tag.status-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.api-card.card-pinned { border-color: #fcd34d; background: linear-gradient(135deg, var(--bg-card) 0%, #fffbeb 100%); }
.api-card.card-pinned::before { background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%); transform: scaleX(1); }
[data-theme="dark"] .api-card.card-pinned { background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245,158,11,0.08) 100%); }
[data-theme="dark"] .api-tag.pinned { background: rgba(245,158,11,0.2); color: #fbbf24; border-color: rgba(245,158,11,0.3); }

.api-card-path { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; color: var(--text-light); background: var(--bg-soft); padding: 4px 8px; border-radius: 6px; margin-top: 10px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }

/* Footer */
.footer {
    border-top: 1px solid var(--border); padding: 40px 0; background: var(--bg-soft);
    transition: var(--transition);
}
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 12px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 14px; transition: var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer p { text-align: center; color: var(--text-light); font-size: 13px; }
.beian { text-align: center; margin-top: 12px; font-size: 12px; color: var(--text-light); }
.beian a { color: var(--text-light); text-decoration: none; margin: 0 6px; }
.beian a:hover { color: var(--primary); }
.beian img { height: 14px; vertical-align: middle; margin-right: 3px; }

/* Notice popup - 不可滑动 */
.notice-popup { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.45); z-index: 400; justify-content: center; align-items: center; backdrop-filter: blur(4px); overflow: hidden; }
.notice-popup.show { display: flex; animation: fadeIn 0.3s ease; }
.popup-box { background: var(--bg-card); width: 90%; max-width: 480px; border-radius: var(--radius); padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); animation: slideUp 0.3s ease; transition: var(--transition); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.popup-badge { display: inline-block; padding: 4px 12px; background: var(--primary-light); color: var(--primary); border-radius: 12px; font-size: 12px; font-weight: 500; margin-bottom: 12px; align-self: flex-start; }
.popup-box h3 { font-size: 20px; margin-bottom: 12px; }
.popup-body { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; white-space: pre-wrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.popup-close {
    width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.popup-close:hover { background: var(--primary-dark); }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.5); z-index: 400; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal.show { display: flex; animation: fadeIn 0.3s ease; }
.modal-content { background: var(--bg-card); width: 90%; max-width: 500px; max-height: 80vh; border-radius: var(--radius); padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); animation: slideUp 0.3s ease; overflow: hidden; display: flex; flex-direction: column; transition: var(--transition); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-secondary); padding: 4px 8px; border-radius: 6px; transition: var(--transition); }
.modal-close:hover { background: var(--bg-soft); }

.favorites-list { overflow-y: auto; flex: 1; }
.fav-item {
    display: flex; align-items: center; padding: 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: var(--transition);
}
.fav-item:hover { border-color: var(--primary); background: var(--bg-soft); }
.fav-icon { font-size: 20px; margin-right: 12px; }
.fav-info { flex: 1; min-width: 0; }
.fav-info strong { display: block; font-size: 14px; margin-bottom: 2px; }
.fav-info span { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.fav-remove { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 16px; padding: 4px; }

/* Toast */
.toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
    background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 14px; z-index: 500; opacity: 0; transition: all 0.3s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Detail page */
.detail-hero { background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 40px 0 32px; transition: var(--transition); }
.detail-hero .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); text-decoration: none; font-size: 14px; margin-bottom: 12px; transition: var(--transition); }
.detail-back:hover { color: var(--primary); }
.detail-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.detail-header p { color: var(--text-secondary); font-size: 15px; }
.detail-actions { display: flex; gap: 8px; }

.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.detail-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; margin-bottom: 16px; transition: var(--transition);
}
.detail-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.code-block {
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px; font-family: 'SF Mono', Consolas, monospace; font-size: 13px;
    color: var(--text); overflow-x: auto; word-break: break-all;
}

.param-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.param-table th, .param-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.param-table th { background: var(--bg-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--text-secondary); }
.param-table td code { background: var(--bg-soft); padding: 2px 8px; border-radius: 4px; }

.req-badge {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 600; line-height: 1.5;
}
.req-badge.req-yes { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.req-badge.req-no  { background: var(--bg-soft); color: var(--text-light); border: 1px solid var(--border); }

.required-star { color: #dc2626; font-weight: bold; margin-right: 2px; }

.test-section { margin-top: 16px; }
.test-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-size: 14px; margin-bottom: 8px; }
.test-input:focus { outline: none; border-color: var(--primary); }
.test-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
    background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.test-btn:hover { background: var(--primary-dark); }
.test-result { margin-top: 12px; }

.status-code { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #dcfce7; color: #166534; }
.tips-list { list-style: none; }
.tips-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); display: flex; align-items: flex-start; gap: 8px; }
.tips-list li::before { content: '💡'; font-size: 14px; }

/* Links page */
.links-hero { background: var(--bg-soft); padding: 40px 0 32px; border-bottom: 1px solid var(--border); transition: var(--transition); }
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.link-card {
    display: flex; align-items: center; gap: 14px; padding: 16px 20px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: var(--text); transition: var(--transition);
}
.link-card:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.link-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 20px; overflow: hidden; flex-shrink: 0; }
.link-icon img { width: 100%; height: 100%; object-fit: cover; }
.link-info { flex: 1; min-width: 0; }
.link-info strong { display: block; font-size: 15px; margin-bottom: 2px; }
.link-info span { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.apply-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 32px; transition: var(--transition); }
.apply-form h3 { font-size: 18px; margin-bottom: 16px; }
.apply-form input, .apply-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 14px; margin-bottom: 12px; }
.apply-form input:focus, .apply-form textarea:focus { outline: none; border-color: var(--primary); }
.apply-form button { padding: 10px 24px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition); }
.apply-form button:hover { background: var(--primary-dark); }

.redirect-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.5); z-index: 400; display: none; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.redirect-modal.show { display: flex; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
    .nav { display: none; }
    .hero h1 { font-size: 32px; }
    .stats { padding: 20px 24px; }
    .stat-num { font-size: 24px; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
}

/* Back to top */
.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 44px; height: 44px;
    border-radius: 50%; border: none; background: var(--primary); color: #fff;
    font-size: 20px; cursor: pointer; box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    opacity: 0; transform: translateY(20px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}
.back-to-top.show { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--primary-dark); transform: translateY(-3px); }

/* Recent bar */
.recent-bar {
    position: fixed; bottom: 30px; left: 30px; max-width: 40%;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 14px; box-shadow: var(--shadow-hover); display: flex; align-items: center; gap: 10px;
    font-size: 13px; z-index: 150; max-height: 50px; overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.recent-bar.hidden-bar { opacity: 0; transform: translateX(-30px); pointer-events: none; }
.recent-list { display: flex; gap: 6px; overflow-x: auto; max-width: 320px; }
.recent-list::-webkit-scrollbar { height: 3px; }
.recent-list a {
    padding: 4px 10px; background: var(--bg-soft); color: var(--text-secondary);
    border-radius: 12px; text-decoration: none; font-size: 12px; white-space: nowrap;
    transition: var(--transition);
}
.recent-list a:hover { background: var(--primary-light); color: var(--primary); }

/* Search highlight */
.api-card .highlight { background: #fef3c7; color: #92400e; padding: 0 2px; border-radius: 2px; }
[data-theme="dark"] .api-card .highlight { background: #78350f; color: #fde68a; }

/* Smooth entry animations */
@keyframes cardEntry {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.api-card { animation: cardEntry 0.4s ease backwards; }

/* Hero enhanced */
.hero { position: relative; overflow: hidden; }
.hero::before {
    content: ''; position: absolute; top: -50%; right: -20%; width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.hero::after {
    content: ''; position: absolute; bottom: -50%; left: -20%; width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(124,58,237,0.12) 0%, transparent 70%);
    pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Selection */
::selection { background: var(--primary-light); color: var(--primary-dark); }
[data-theme="dark"] ::selection { background: var(--primary); color: #fff; }

/* Body scroll lock when modal/popup open */
body.no-scroll { overflow: hidden; }

/* ============ 顶部菜单栏（收藏 / 最近浏览 / 友链）============ */
/* 已替换为右上角汉堡菜单按钮 + 弹出面板，见 .menu-toggle-btn / .menu-panel */

/* 手机端：显示汉堡菜单按钮，隐藏桌面导航的部分项 */
@media (max-width: 768px) {
    .menu-toggle-btn { display: flex; }
    .recent-bar { display: none; }
    .hero { padding: 40px 0 30px; }
    .nav { gap: 2px; }
    .nav a { padding: 8px 10px; font-size: 13px; }
}

/* ============ 友链申请验证码 ============ */
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-img {
    height: 42px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.captcha-img:hover { border-color: var(--primary); }

/* ============ 友链卡片美化 ============ */
.link-card { position: relative; overflow: hidden; }
.link-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 3px; height: 100%;
    background: var(--gradient);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
}
.link-card:hover::before { transform: scaleY(1); }

/* ============ 后台美化 - 置顶卡片样式 ============ */
.admin-pin-btn {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    margin-right: 4px;
}
.admin-pin-btn:hover { border-color: var(--primary); color: var(--primary); }
.admin-pin-btn.active { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; border-color: #fcd34d; }

/* ============ 后台美化 - 状态徽章 ============ */
.status-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.status-pill.normal { background: #ecfdf5; color: #059669; }
.status-pill.maintain { background: #fff7ed; color: #c2410c; }
.status-pill.coming { background: #eff6ff; color: #1d4ed8; }
.status-pill.offline { background: #fef2f2; color: #dc2626; }

/* ============ 后台美化 - 渐变标题 ============ */
.gradient-header {
    background: linear-gradient(135deg, rgba(37,99,235,0.05) 0%, rgba(124,58,237,0.05) 100%);
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

/* ============ 后台美化 - 友链回复对话框 ============ */
.reply-modal-content { max-width: 560px; }
.reply-modal-content .reply-info {
    background: var(--bg-soft);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 13px;
}
.reply-modal-content .reply-info div { margin-bottom: 4px; }
.reply-modal-content .reply-info strong { color: var(--text); display: inline-block; min-width: 70px; }
.reply-modal-content textarea { min-height: 140px; }

/* ============ 后台美化 - 统计卡片渐变 ============ */
.dash-card { position: relative; overflow: hidden; }
.dash-card::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: 0.06;
    background: currentColor;
}
.dash-card.blue { color: #2563eb; }
.dash-card.green { color: #10b981; }
.dash-card.orange { color: #f59e0b; }
.dash-card.red { color: #ef4444; }

/* ============ 前台接口调用排行 Top 10 ============ */
.top-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.top-chart-card:hover { box-shadow: var(--shadow-hover); }
.top-chart-list { display: flex; flex-direction: column; gap: 10px; }
.top-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}
.top-row:hover { background: var(--primary-light); border-color: var(--primary); transform: translateX(4px); }
.top-rank {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    background: var(--text-light); flex-shrink: 0;
}
.top-rank.rank-1 { background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 2px 8px rgba(245,158,11,0.4); }
.top-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); box-shadow: 0 2px 8px rgba(100,116,139,0.4); }
.top-rank.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); box-shadow: 0 2px 8px rgba(180,83,9,0.4); }
.top-info { flex: 1; min-width: 0; }
.top-name {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top-tag {
    font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.top-tag-warn { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.top-bar-track {
    height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.top-bar-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.top-calls {
    font-size: 16px; font-weight: 700; color: var(--primary);
    min-width: 60px; text-align: right; flex-shrink: 0;
}
.top-empty { text-align: center; padding: 40px 20px; color: var(--text-light); font-size: 14px; }

@media (max-width: 768px) {
    .top-row { gap: 10px; padding: 10px; }
    .top-rank { width: 28px; height: 28px; font-size: 12px; }
    .top-name { font-size: 13px; }
    .top-calls { font-size: 14px; min-width: 50px; }
}

/* Code example tabs */
.code-tab-btn {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-soft);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.code-tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.code-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Popular APIs section */
.popular-section {
    margin: 40px 0;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.popular-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.popular-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.popular-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
}
.popular-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.popular-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-soft);
    color: var(--text-light);
}
.popular-item:nth-child(1) .popular-rank { background: #ef4444; color: #fff; }
.popular-item:nth-child(2) .popular-rank { background: #f97316; color: #fff; }
.popular-item:nth-child(3) .popular-rank { background: #eab308; color: #fff; }
.popular-info { flex: 1; min-width: 0; }
.popular-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popular-calls { font-size: 11px; color: var(--text-light); }

/* Quick test floating button */
.quick-test-btn {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    z-index: 100;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.quick-test-btn:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5); }

/* API card enhancements */
.api-card-calls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-soft);
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-light);
}

/* Stats bar enhancements */
.stats-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.stat-card {
    flex: 1;
    min-width: 140px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.stat-card .stat-val {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-lbl {
    font-size: 12px;
    color: var(--text-light);
}
