/* ==================== 全局变量 ==================== */
:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --primary-hover: #0369a1;
    --accent: #06b6d4;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --header-h: 60px;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

[data-theme="dark"] {
    --primary: #38bdf8;
    --primary-dark: #0ea5e9;
    --primary-light: #0c4a6e;
    --primary-hover: #7dd3fc;
    --accent: #22d3ee;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
}

/* ==================== 重置 ==================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

#app { flex: 1; display: flex; flex-direction: column; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==================== Header ==================== */
.header {
    height: var(--header-h);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
}

.header-inner {
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.logo-text { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo-sub { font-weight: 400; color: var(--primary); font-size: 13px; margin-left: 2px; }

.header-nav { display: flex; gap: 4px; }

.header-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}

.header-nav a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

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

.theme-toggle {
    background: none;
    border: 0 solid var(--border);
    border-radius: var(--radius-xs);
    padding: 7px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.user-section { position: relative; }
.login-link {
    font-size: 13px; color: var(--text-secondary); text-decoration: none;
    transition: color var(--transition); white-space: nowrap; padding: 4px 6px;
}
.login-link:hover { color: var(--primary); text-decoration: none; }
.user-info { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; padding: 4px 8px; border-radius: var(--radius-xs); transition: background var(--transition); }
.user-info:hover { background: var(--primary-light); }
.user-info::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 4px; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.user-name { font-size: 13px; color: var(--text-primary); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 100px; z-index: 100; }
.user-info:hover .user-dropdown { display: block; }
.user-dropdown a { display: block; padding: 8px 16px; font-size: 13px; color: var(--text-primary); text-decoration: none; transition: background var(--transition); }
.user-dropdown a:hover { background: var(--primary-light); color: var(--primary); }

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}

.mobile-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    z-index: 99;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-lg);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: var(--radius-xs);
    font-weight: 500;
}
.mobile-nav a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

/* ==================== Pages ==================== */
.page { display: none; }
.page.active { display: block; }

.page.active#page-home {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.footer.hidden { display: none; }

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

.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.header-actions { margin-left: auto; display: flex; gap: 8px; }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition);
}
.back-btn:hover { color: var(--primary); }
.back-btn svg { width: 18px; height: 18px; }

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ==================== Hero ==================== */
.hero {
    max-width: 780px;
    width: 100%;
    padding: 0 24px;
    text-align: center;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ==================== Search Box ==================== */
.search-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    padding: 20px;
}

.search-body {
    display: flex;
    align-items: center;
    padding: 0;
    gap: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    transition: all var(--transition);
}
.search-body:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.search-input-group { flex: 1; position: relative; display: flex; align-items: center; }

.search-input-group input {
    width: 100%;
    padding: 14px 40px 14px 20px;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: all var(--transition);
}
.search-input-group input:focus { outline: none; }
.search-input-group input::placeholder { color: var(--text-muted); }

.search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}
.search-clear:hover { color: var(--text); background: var(--border); }

.search-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    height: 100%;
}
.search-btn:hover { background: var(--primary-dark); }
.search-btn:active { background: var(--primary-dark); }

.quick-links {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.quick-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.quick-chips {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-chips a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition);
}

.quick-chips a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* ==================== Feature Cards ==================== */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.feature-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-icon { font-size: 28px; margin-bottom: 8px; }
.feature-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.feature-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ==================== Results Grid ==================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.result-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.result-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.result-cid {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}

.result-formula {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono);
}

.result-weight { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

.result-smiles {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg);
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    word-break: break-all;
    line-height: 1.5;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.result-inchikey {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.result-name {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ==================== Pagination ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 13px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination-info { font-size: 13px; color: var(--text-muted); margin: 0 10px; }

/* ==================== Detail Page ==================== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.detail-card.full-width { grid-column: 1 / -1; }

.detail-card h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 9px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    gap: 12px;
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 110px;
}

.detail-value {
    font-size: 13px;
    color: var(--text);
    text-align: right;
    word-break: break-all;
    font-family: var(--font-mono);
    font-weight: 500;
    flex: 1;
    min-width: 0;
}

.detail-value.copyable {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition);
}
.detail-value.copyable:hover { background: var(--primary-light); color: var(--primary); }

.structure-canvas-container {
    text-align: center;
    padding: 16px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

#structure-canvas { max-width: 100%; height: auto; }

.structure-placeholder {
    padding: 60px 20px;
    color: #64748b;
    font-size: 14px;
}

.cas-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.cas-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.cas-empty { color: var(--text-muted); font-size: 13px; }

/* ==================== Advanced Form ==================== */
.advanced-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.form-section {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.form-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 14px;
}
.form-row:last-child { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: all var(--transition);
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

.range-input {
    display: flex;
    align-items: center;
    gap: 8px;
}
.range-input input { flex: 1; }
.range-input span { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-actions {
    padding: 20px 24px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    padding: 10px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ==================== Batch Page ==================== */
.batch-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.batch-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.batch-tab {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.batch-tab:hover { color: var(--text-secondary); }
.batch-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }

.batch-body { padding: 20px; }

.batch-input-area textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: var(--font-mono);
    color: var(--text);
    background: var(--bg);
    resize: vertical;
    transition: all var(--transition);
}
.batch-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}
.batch-input-area.hidden { display: none; }

.batch-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.batch-hint { font-size: 13px; color: var(--text-muted); }

.batch-results { padding: 0 20px 20px; }

/* ==================== Compare Page ==================== */
.compare-content {
    overflow-x: auto;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13px;
}

.compare-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.compare-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 13px;
}

.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: var(--primary-light); }

.compare-structure {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: #ffffff;
    overflow: hidden;
    margin: 0 auto;
}

.compare-structure canvas {
    display: block;
    max-width: 100%;
}

.compare-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.compare-empty h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-secondary); }

/* ==================== Stats Page ==================== */
.stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 110px;
}

.stats-card .stat-big {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.stats-card .stat-desc {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.stats-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
}

.stats-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.stats-section-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.stats-section-body p { margin-bottom: 6px; }
.stats-section-body a { color: var(--primary); }

.stats-citation {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-xs);
    margin-bottom: 8px !important;
}

/* ==================== Loading & Empty ==================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 300px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    grid-column: 1 / -1;
}

.loading-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 骨架屏 ==================== */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, #f1f5f9 37%, var(--border) 63%);
    background-size: 800px 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-xs);
}

.skeleton-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w30 { width: 30%; }
.skeleton-line.h20 { height: 20px; }

.skeleton-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.skeleton-card + .skeleton-card { margin-top: 0; }

/* 详情页骨架屏 */
.skeleton-detail-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.skeleton-detail-card h3 {
    height: 18px;
    width: 100px;
    margin-bottom: 16px;
}

.skeleton-canvas {
    width: 100%;
    height: 200px;
    border-radius: var(--radius-xs);
}

.skeleton-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.skeleton-detail-row:last-child { border-bottom: none; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}
.empty-state h3 { font-size: 17px; margin-bottom: 8px; color: var(--text-secondary); }

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    top: 76px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--primary); color: #fff; }

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

/* ==================== Footer ==================== */
.footer {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 24px 24px;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
}
.footer-left { max-width: 600px; text-align: center; }
.footer p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; line-height: 1.6; }
.footer a { color: var(--primary); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-icp { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.footer-right { flex-shrink: 0; }
.footer-qrcode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.footer-qrcode img {
    border-radius: var(--radius-xs);
}
.footer-qrcode span {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ==================== User Profile Page ==================== */
.user-profile {
    max-width: 680px;
    margin: 0 auto;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.profile-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.profile-avatar-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
}

.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
}

.profile-avatar-overlay span {
    font-size: 10px;
    white-space: nowrap;
}

.profile-avatar-wrap:hover .profile-avatar-overlay {
    opacity: 1;
}

.profile-avatar-wrap:hover .profile-avatar {
    transform: scale(1.05);
}

.profile-name-display {
    flex: 1;
}

.profile-nickname {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.profile-username {
    font-size: 14px;
    color: var(--text-muted);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-field-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.profile-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: all var(--transition);
}
.profile-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

.profile-save-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.profile-info-list {
    display: flex;
    flex-direction: column;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.profile-info-row:last-child { border-bottom: none; }

.profile-info-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-info-value {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.status-active { color: var(--success); }
.status-disabled { color: var(--danger); }

.profile-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-danger:hover { background: #dc2626; }

/* ==================== Profile Bind ==================== */
.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    gap: 12px;
}
.profile-info-row:last-child { border-bottom: none; }

.profile-bind-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    padding: 4px 12px;
}

.bind-dialog {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.25s;
}
.lightbox-overlay.active .bind-dialog { transform: scale(1); }

.bind-dialog-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    text-align: center;
}

.bind-dialog-field {
    margin-bottom: 16px;
}

.bind-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .header-nav { display: none; }
    .header-actions-right { margin-left: auto; }
    .mobile-menu-btn { display: flex; margin-left: 8px; }
    .user-section { display: none; }
    .hero { padding: 20px 16px; }
    .hero-title { font-size: 22px; }
    .hero-subtitle { font-size: 13px; margin-bottom: 20px; }
    .search-body { flex-direction: column; gap: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; }
    .search-input-group { width: 100%; }
    .search-input-group input { border-right: none; border-bottom: 1px solid var(--border); }
    .search-btn { width: 100%; justify-content: center; border-radius: 0; }
    .quick-links { gap: 8px; }
    .quick-chips { gap: 8px; }
    .quick-chips a { padding: 4px 10px; font-size: 12px; }
    .feature-cards { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
    .feature-card { padding: 14px 12px; display: flex; align-items: center; gap: 12px; text-align: left; }
    .feature-icon { margin-bottom: 0; }
    .detail-grid { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-wrap: wrap; }
    .header-actions { width: 100%; }
    .footer-inner { flex-direction: column; text-align: center; gap: 16px; align-items: center; }
    .footer-left { text-align: center; max-width: 100%; }
    .footer p { font-size: 11px; }
    .footer-right { display: flex; flex-direction: column; align-items: center; gap: 8px; }
    .footer-qrcode img { width: 72px; height: 72px; }
    .compare-table { display: block; overflow-x: auto; }
    .compare-structure canvas { width: 120px; height: 90px; }
    .profile-avatar-section { flex-direction: column; text-align: center; }
    .profile-avatar { width: 64px; height: 64px; }
    .profile-avatar-wrap { width: 64px; height: 64px; }
    .profile-nickname { font-size: 18px; }
    .profile-field-row { flex-direction: column; align-items: stretch; }
    .profile-save-btn { align-self: flex-end; }
    .profile-actions { flex-direction: column; }
    .profile-actions a, .profile-actions button { text-align: center; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 18px; }
    .hero-subtitle { font-size: 12px; }
    .search-input-group input { padding: 10px 12px; font-size: 14px; }
    .search-btn { padding: 10px 20px; font-size: 14px; }
}

/* ==================== Structure Lightbox ==================== */
.structure-canvas-container { cursor: pointer; position: relative; }
.structure-canvas-container::after {
    content: '点击放大';
    position: absolute; bottom: 6px; right: 8px;
    font-size: 11px; color: var(--text-muted); pointer-events: none;
    opacity: 0; transition: opacity 0.2s;
}
.structure-canvas-container:hover::after { opacity: 1; }

.lightbox-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 8px;
    opacity: 0; transition: opacity 0.25s;
    cursor: zoom-out;
}
.lightbox-overlay.active { opacity: 1; }
.lightbox-container {
    position: relative; max-width: 90vw; max-height: 85vh;
    background: var(--bg-card, #fff); border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    overflow: hidden; display: flex; align-items: center; justify-content: center;
    transform: scale(0.9); transition: transform 0.25s;
}
.lightbox-overlay.active .lightbox-container { transform: scale(1); }
.lightbox-container canvas { display: block; max-width: 90vw; max-height: 85vh; }
.lightbox-container img { display: block; max-width: 90vw; max-height: 85vh; object-fit: contain; }
.lightbox-info {
    color: #ccc; font-size: 13px; text-align: center;
    max-width: 90vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lightbox-close {
    position: absolute; top: 12px; right: 16px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.15); border: none;
    color: #fff; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; z-index: 10;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-actions {
    position: absolute; bottom: 12px; right: 16px;
    display: flex; gap: 8px; z-index: 10;
}
.lightbox-actions button {
    padding: 6px 14px; border-radius: 6px;
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; font-size: 12px; cursor: pointer;
    transition: background 0.2s;
}
.lightbox-actions button:hover { background: rgba(255,255,255,0.3); }
