:root {
    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface-hover: #f7f9fc;
    --border: #e2e8f0;
    --primary: #0891b2;
    --primary-dim: #0e7490;
    --accent: #6366f1;
    --text: #1a202c;
    --text-dim: #64748b;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.header {
    text-align: center;
    padding: 32px 16px 24px;
    position: relative;
}

.header .logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    padding: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 2px;
}

.header .brand-line {
    font-size: 13px;
    color: var(--primary);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 6px;
    font-weight: 500;
}

/* Search */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    padding: 8px 0;
}

.search-bar input {
    flex: 1;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 14px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
}

.search-bar button {
    height: 44px;
    padding: 0 20px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 1px;
    transition: opacity 0.2s, transform 0.1s;
}

.search-bar button:active { transform: scale(0.97); opacity: 0.9; }

/* Category Tabs */
.category-tabs {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 10px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
    flex-shrink: 0;
    padding: 7px 15px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
}

.cat-tab:hover { border-color: var(--primary); color: var(--primary); }

.cat-tab.active {
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(8,145,178,0.25);
}

.cat-tab:active { transform: scale(0.96); }

/* Result Info */
.result-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding: 0 4px;
}

/* QA Cards */
.qa-list { display: flex; flex-direction: column; gap: 10px; }

.qa-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.qa-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition: opacity 0.25s;
}

.qa-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(8,145,178,0.1);
}
.qa-card:hover::before { opacity: 1; }
.qa-card:active { transform: scale(0.985); }

.qa-card .qa-question {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.qa-card .qa-question .q-icon {
    color: var(--primary);
    flex-shrink: 0;
    font-size: 15px;
    margin-top: 1px;
}

.qa-card .qa-meta {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.qa-card .qa-tag {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 12px;
    background: rgba(8,145,178,0.06);
    color: var(--primary);
    border: 1px solid rgba(8,145,178,0.15);
}

.qa-card .qa-tag.stage {
    background: rgba(99,102,241,0.06);
    color: #6366f1;
    border-color: rgba(99,102,241,0.15);
}

.qa-card .qa-preview {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 10px;
    line-height: 1.6;
}

/* Loading */
.loading, .empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 24px 0;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: 0.3; cursor: default; }
.pagination button.active {
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: #fff;
    border-color: transparent;
}

.pagination .page-info { padding: 8px 12px; font-size: 12px; color: var(--text-muted); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 600px;
    margin: 20px 0 60px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    padding-right: 30px;
    color: #0f172a;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    font-size: 18px;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 16px;
    transition: all 0.2s;
}

.modal-close:hover { background: var(--surface-hover); color: var(--text); }

.modal-body { padding: 20px; font-size: 14px; line-height: 1.8; }

.modal-body .detail-label {
    font-size: 11px;
    color: var(--primary);
    margin-top: 16px;
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.modal-body .detail-text {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: 8px;
    white-space: pre-line;
    color: var(--text-dim);
    font-size: 13px;
}

.modal-body .detail-tags {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--surface);
}

.modal-footer button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-footer button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.modal-footer button:disabled { opacity: 0.3; }

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.no-answer { color: #f59e0b; font-style: italic; }
