:root {
    --bg-color: #080c18;
    --text-primary: #eef2ff;
    --text-secondary: #8b9cc8;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
    --accent-from: #3b82f6;
    --accent-to: #a855f7;
    --hero-tint: rgba(59, 130, 246, 0.18);
    --discipline-gradient: linear-gradient(135deg, var(--accent-from) 0%, var(--accent-to) 100%);
    --card-bg: rgba(14, 20, 40, 0.72);
    --card-border: rgba(255, 255, 255, 0.07);
    --hover-bg: rgba(25, 35, 65, 0.75);
    --surface-glass: rgba(10, 15, 30, 0.65);
}

body.light-mode {
    --bg-color: #eef1fb;
    --text-primary: #141930;
    --text-secondary: #3d4e72;
    --card-bg: #ffffff;
    --card-border: rgba(79, 70, 229, 0.14);
    --hover-bg: #f3f5ff;
    --surface-glass: rgba(255, 255, 255, 0.96);
}

/* ── Light mode overrides ── */
body.light-mode .background-blobs { opacity: 0.12; }

body.light-mode .paper-card {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.14);
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.07), 0 1px 3px rgba(0,0,0,0.05);
}
body.light-mode .paper-card:hover {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 8px 28px rgba(79, 70, 229, 0.14), 0 2px 6px rgba(0,0,0,0.06);
}
body.light-mode .paper-title  { color: #141930; }
body.light-mode .paper-summary { color: #3d4e72; }
body.light-mode .paper-authors { color: #4f46e5; }

/* 搜尋框 */
body.light-mode .search-box input {
    background: #ffffff;
    color: #141930;
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
body.light-mode .search-box input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14), 0 2px 8px rgba(0,0,0,0.06);
}
body.light-mode .search-icon { color: #6366f1; opacity: 0.7; }

/* 排序觸發按鈕 */
body.light-mode .sort-trigger {
    background: #ffffff;
    color: #3d4e72;
    border-color: rgba(99, 102, 241, 0.22);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
body.light-mode .sort-trigger:hover {
    border-color: #6366f1;
    color: #141930;
}

/* 排序 / 頂會 子選單 */
body.light-mode .sort-submenu,
body.light-mode .conf-submenu {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 12px 40px rgba(79, 70, 229, 0.15), 0 2px 8px rgba(0,0,0,0.08);
}
body.light-mode .sort-item { color: #3d4e72; }
body.light-mode .sort-item:hover { background: rgba(99, 102, 241, 0.08); color: #141930; }
body.light-mode .sort-item.active { background: rgba(99, 102, 241, 0.1); color: #4f46e5; }

/* 分類按鈕列 */
body.light-mode .category-btn {
    background: #ffffff;
    color: #374171;
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
body.light-mode .category-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #3730a3;
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}
body.light-mode .category-btn.active {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 3px 14px rgba(79, 70, 229, 0.4);
}
body.light-mode .top-conf-btn {
    background: #fff8ed;
    border-color: rgba(251, 146, 60, 0.45);
    color: #b45309;
}
body.light-mode .conf-submenu::before { color: rgba(180, 83, 9, 0.65); }
body.light-mode .conf-item {
    background: rgba(251, 146, 60, 0.08);
    border-color: rgba(251, 146, 60, 0.25);
    color: #92400e;
}
body.light-mode .conf-item:hover {
    background: rgba(251, 146, 60, 0.18);
    color: #78350f;
}

/* 統計面板 */
body.light-mode .stats-panel {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.14);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* 卡片細節 */
body.light-mode .paper-date {
    background: rgba(99, 102, 241, 0.07);
    color: #4e5b80;
}
body.light-mode .paper-link { color: #6d28d9; }
body.light-mode .paper-link:hover { color: #5b21b6; }
body.light-mode .paper-card .star-btn { color: rgba(0,0,0,0.2); }

/* 引用 badge */
body.light-mode .citation-badge {
    background: rgba(52, 211, 153, 0.1);
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.25);
}

/* count header */
body.light-mode .count-meta {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.18);
    color: #4f46e5;
}

/* 右下角按鈕 */
body.light-mode .back-to-top,
body.light-mode .kbd-hint-btn {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.18);
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.12);
}
body.light-mode .kbd-hint-btn { color: #4f46e5; }

/* header badges */
body.light-mode .header-badge {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.22);
    color: #4338ca;
}

/* per-page selector */
body.light-mode .per-page-select {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.22);
    color: #141930;
}

/* 搜尋推薦下拉 */
body.light-mode .search-suggest-dropdown {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 16px 40px rgba(79, 70, 229, 0.18), 0 2px 8px rgba(0,0,0,0.1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body.light-mode .suggest-chip {
    background: rgba(99, 102, 241, 0.07);
    border-color: rgba(99, 102, 241, 0.2);
    color: #4338ca;
}
body.light-mode .suggest-chip:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #3730a3;
}

/* 筆記面板 */
body.light-mode .note-panel {
    background: rgba(238, 242, 255, 0.8);
    border-color: rgba(99, 102, 241, 0.2);
}
body.light-mode .note-textarea {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.18);
    color: #141930;
}


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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

h1, h2, h3, h4, .logo {
    font-family: 'Outfit', sans-serif;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    opacity: 1;
    animation: float 22s infinite alternate ease-in-out;
}

.blob-1 {
    top: -15%; left: -15%;
    width: 55vw; height: 55vw;
    background: radial-gradient(circle, var(--hero-tint) 0%, rgba(0,0,0,0) 70%);
}

.blob-2 {
    bottom: -25%; right: -15%;
    width: 65vw; height: 65vw;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.16) 0%, rgba(0,0,0,0) 70%);
    animation-delay: -7s;
}

.blob-3 {
    top: 35%; left: 35%;
    width: 35vw; height: 35vw;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, rgba(0,0,0,0) 70%);
    animation-duration: 28s;
    animation-delay: -14s;
}

@keyframes float {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 60px) scale(1.08); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ── Header ── */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3.5rem;
    flex-wrap: wrap;
    gap: 2rem;
    animation: slideDown 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    z-index: 10;
}

.logo {
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.logo span {
    color: var(--accent-to);
    -webkit-text-fill-color: initial;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.45rem;
    line-height: 1.65;
    letter-spacing: 0.01em;
}

/* Header 功能 badge 列表 */
.header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.header-badge {
    font-size: 0.76rem;
    color: rgba(167, 162, 255, 0.85);
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 999px;
    padding: 0.22rem 0.8rem;
    white-space: nowrap;
    letter-spacing: 0.01em;
    transition: background 0.2s, border-color 0.2s;
}
.header-badge:hover {
    background: rgba(79, 70, 229, 0.18);
    border-color: rgba(124, 58, 237, 0.35);
}

.controls {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

/* ── Search Box ── */
.search-box {
    position: relative;
    flex-shrink: 0;
}

.search-box input {
    background: var(--surface-glass);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0.75rem 1.5rem 0.75rem 2.6rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    width: 250px;
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.search-box input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-box input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 4px 16px rgba(99, 102, 241, 0.15);
    width: 320px;
    background: rgba(14, 20, 40, 0.85);
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    opacity: 0.6;
}

.pin-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    padding: 2px 4px;
    border-radius: 6px;
    transition: opacity 0.2s, background 0.2s;
    line-height: 1;
}
.pin-search-btn.visible {
    opacity: 0.4;
    pointer-events: auto;
}
.pin-search-btn.visible:hover {
    opacity: 1;
    background: rgba(168, 85, 247, 0.2);
}
.search-box input.has-text {
    padding-right: 2.2rem;
}

/* 語意搜尋切換 + 跨領域切換 — 永遠可見，stack 在 input 右側、pin 按鈕左邊 */
.semantic-toggle,
.cross-disc-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    opacity: 0.45;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.semantic-toggle { right: 64px; }
.cross-disc-toggle { right: 38px; }
.semantic-toggle:hover,
.cross-disc-toggle:hover { opacity: 0.85; }
.semantic-toggle.active {
    opacity: 1;
    background: rgba(168, 85, 247, 0.18);
    border-color: rgba(168, 85, 247, 0.45);
}
.cross-disc-toggle.active {
    opacity: 1;
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.45);
}
/* 當 semantic 開啟時，搜尋框右側 padding 預留 3 顆按鈕的位置 */
.search-box input { padding-right: 5.5rem; }

/* 釘選主題標籤 */
.pinned-topic-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-color: rgba(251, 191, 36, 0.3) !important;
}
.pinned-topic-btn .pin-icon {
    font-size: 0.75em;
    opacity: 0.65;
    flex-shrink: 0;
}

/* ── 搜尋推薦下拉 ── */
.search-suggest-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: auto;
    width: max-content;
    min-width: 100%;
    max-width: min(440px, calc(100vw - 2rem));
    max-height: 240px;
    overflow-y: auto;
    z-index: 9999;
    background: rgba(10, 14, 28, 0.98);
    border: 1px solid rgba(124, 58, 237, 0.35);
    border-radius: 1.1rem;
    padding: 0.85rem 0.95rem 0.8rem;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(99,102,241,0.08) inset;
    display: none;
    flex-wrap: wrap;
    gap: 0.4rem;
    scrollbar-width: thin;
}

.search-suggest-dropdown::before {
    content: '🔍 熱門搜尋';
    display: block;
    width: 100%;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: rgba(168, 85, 247, 0.65);
    margin-bottom: 0.6rem;
    text-transform: uppercase;
}

.search-suggest-dropdown.open {
    display: flex;
    animation: suggestFadeIn 0.18s ease;
}

@keyframes suggestFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.suggest-chip {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 999px;
    padding: 0.28rem 0.88rem;
    color: #a5b4fc;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.suggest-chip:hover {
    background: rgba(124, 58, 237, 0.22);
    border-color: rgba(168, 85, 247, 0.5);
    color: #e9d5ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

/* ── 排序下拉選單 ── */
.sort-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* count-header 是常駐元素(index.html 內);time-range 推到右邊、sort 緊接其後 */
.count-header > .time-range-wrapper { margin-left: auto; }
.count-header > .sort-wrapper { margin-left: 0; }

.time-range-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    padding: 3px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.time-range-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 999px;
    padding: 0.42rem 0.76rem;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.time-range-btn span {
    font-size: 0.66rem;
    opacity: 0.52;
}

.time-range-btn:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.time-range-btn.active {
    color: #a5b4fc;
    background: rgba(79, 70, 229, 0.2);
    font-weight: 650;
}

/* 在 count-header 中視覺更輕盈一點 */
.count-header > .sort-wrapper .sort-trigger {
    padding: 0.45rem 0.95rem;
    font-size: 0.82rem;
}

.sort-trigger {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--surface-glass);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0.75rem 1.35rem;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.sort-trigger:hover,
.sort-wrapper.open .sort-trigger {
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 16px rgba(99, 102, 241, 0.12);
}

.sort-chevron {
    transition: transform 0.25s ease;
    opacity: 0.5;
}

.sort-wrapper.open .sort-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* 子選單面板 */
.sort-submenu {
    position: fixed;
    z-index: 9997;
    background: rgba(10, 14, 28, 0.97);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 1.15rem;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 205px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(99,102,241,0.07) inset;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sort-submenu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.sort-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    white-space: nowrap;
}

.sort-item span {
    font-size: 0.73rem;
    color: rgba(148, 163, 184, 0.45);
    font-weight: 400;
    margin-left: auto;
}

.sort-item:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--text-primary);
}

.sort-item.active {
    background: rgba(79, 70, 229, 0.18);
    color: #a5b4fc;
    font-weight: 600;
}

.sort-item.active span {
    color: rgba(165, 180, 252, 0.45);
}


.primary-btn {
    background: var(--accent-gradient);
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 18px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: 0.9rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.55);
    opacity: 0.95;
}

.primary-btn:active {
    transform: translateY(0px);
}

/* ── Grid layout ── */
.papers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.75rem;
}

/* ── Card Styling ── */
.paper-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 1.75rem;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.2),
                border-color 0.3s ease,
                box-shadow 0.35s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    opacity: 0;
    animation: fadeIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
    /* viewport 外的卡片跳過渲染與佈局，回滾不再雪崩 */
    content-visibility: auto;
    contain-intrinsic-size: 0 420px;
}

/* 卡片頂部的彩色裝飾線（hover 時顯現） */
.paper-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.35s ease;
    border-radius: 1.25rem 1.25rem 0 0;
}

.paper-card:hover::before {
    opacity: 1;
}

/* Star / 收藏按鈕 */
.star-btn {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.2);
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s, background 0.2s;
    z-index: 1;
    font-size: 1.1rem;
}

.star-btn:hover {
    color: #facc15;
    background: rgba(250, 204, 21, 0.1);
    transform: scale(1.15);
}

.star-btn.starred {
    color: #facc15;
}

.star-btn.starred:hover {
    color: #fde047;
    background: rgba(250, 204, 21, 0.12);
}

.paper-card:hover {
    transform: translateY(-5px);
    border-color: rgba(124, 58, 237, 0.38);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(124, 58, 237, 0.1) inset;
}

/* ── Venue Badge ── */
.venue-badge {
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 0.18em 0.65em;
    border-radius: 0.45em;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: var(--venue-color, #4f46e5);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--venue-color, #4f46e5) 35%, transparent);
}

.paper-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.55;
    margin-bottom: 0.55rem;
    color: var(--text-primary);
    padding-right: 3rem;
    letter-spacing: 0.01em;
}
.paper-title-link {
    color: inherit;
    text-decoration: none;
}
.paper-title-link:hover {
    text-decoration: underline;
    text-decoration-color: rgba(148, 163, 184, 0.6);
    text-underline-offset: 3px;
}

.paper-authors {
    font-size: 0.82rem;
    color: #7c83e8;
    margin-bottom: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

.paper-summary {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

/* ── Citation Badge ── */
.citation-badge {
    font-size: 0.8rem;
    color: #34d399;
    background: rgba(52, 211, 153, 0.09);
    border: 1px solid rgba(52, 211, 153, 0.22);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
}

/* ── Influential Citation Badge ── */
.influential-badge {
    font-size: 0.8rem;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.09);
    border: 1px solid rgba(251, 191, 36, 0.22);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
    cursor: default;
}
/* ── Survey Badge ── */
.survey-badge {
    font-size: 0.8rem;
    color: #818cf8;
    background: rgba(129, 140, 248, 0.09);
    border: 1px solid rgba(129, 140, 248, 0.22);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
    cursor: default;
}
.speed-badge {
    font-size: 0.8rem;
    color: #fb7185;
    background: rgba(251, 113, 133, 0.1);
    border: 1px solid rgba(251, 113, 133, 0.28);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
    cursor: default;
}
.h5-badge {
    font-size: 0.78rem;
    color: #c084fc;
    background: rgba(192, 132, 252, 0.1);
    border: 1px solid rgba(192, 132, 252, 0.28);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: default;
}
.hf-badge {
    font-size: 0.8rem;
    color: #facc15;
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.28);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
    cursor: default;
}
.similar-fav-badge {
    font-size: 0.78rem;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.28);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
    cursor: default;
}
body.light-mode .similar-fav-badge {
    background: rgba(126, 34, 206, 0.08);
    color: #6b21a8;
    border-color: rgba(126, 34, 206, 0.22);
}
body.light-mode .speed-badge {
    background: rgba(225, 29, 72, 0.08);
    color: #9f1239;
    border-color: rgba(225, 29, 72, 0.22);
}
body.light-mode .h5-badge {
    background: rgba(126, 34, 206, 0.08);
    color: #6b21a8;
    border-color: rgba(126, 34, 206, 0.22);
}
body.light-mode .hf-badge {
    background: rgba(202, 138, 4, 0.1);
    color: #854d0e;
    border-color: rgba(202, 138, 4, 0.25);
}
body.light-mode .influential-badge {
    background: rgba(217, 119, 6, 0.08);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.22);
}
body.light-mode .survey-badge {
    background: rgba(99, 102, 241, 0.08);
    color: #3730a3;
    border-color: rgba(99, 102, 241, 0.22);
}

/* ── 分頁控制 ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    padding: 2.5rem 0 1.5rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 2.65rem;
    height: 2.65rem;
    padding: 0 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(.disabled) {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
    color: #c084fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
}

.page-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    cursor: default;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.45);
    transform: translateY(-1px);
}

.page-btn.disabled {
    opacity: 0.18;
    cursor: default;
    pointer-events: none;
}

.page-dots {
    color: rgba(255,255,255,0.18);
    padding: 0 0.2rem;
    font-size: 1rem;
    letter-spacing: 0.1em;
    user-select: none;
}

.paper-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--card-border);
    padding-top: 1.1rem;
    margin-top: auto;
    gap: 0.5rem;
}

.paper-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.01em;
}

.paper-link {
    text-decoration: none;
    color: #9333ea;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s, gap 0.2s;
    white-space: nowrap;
}

.paper-link:hover {
    color: #c084fc;
    gap: 0.5rem;
}

.paper-link svg {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.paper-link:hover svg {
    transform: translateX(3px) translateY(-3px);
}

/* ── Loader ── */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 40vh;
    gap: 0;
}

.loader-container p {
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
    letter-spacing: 0.05em;
    animation: pulse 1.5s infinite;
}

.spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #4f46e5, #7c3aed, #a855f7, #4f46e5);
    animation: spin 0.9s linear infinite;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    inset: 5px;
    background: var(--bg-color);
    border-radius: 50%;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes slideDown {
    0%   { opacity: 0; transform: translateY(-24px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    0%   { opacity: 0; transform: translateY(24px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* ── 空狀態 ── */
.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 5rem 2rem;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.no-results-icon {
    font-size: 3.5rem;
    line-height: 1;
    opacity: 0.4;
}

.no-results-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
}

.no-results-hint {
    font-size: 0.92rem;
    color: var(--text-secondary);
    max-width: 360px;
    line-height: 1.7;
}

.no-results-action {
    margin-top: 0.5rem;
    background: rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: 999px;
    padding: 0.6rem 1.5rem;
    color: #a5b4fc;
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.no-results-action:hover {
    background: rgba(79, 70, 229, 0.25);
    border-color: rgba(124, 58, 237, 0.55);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25);
}

.topic-suggestions {
    margin: 0.75rem 0 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.topic-suggestions.hidden { display: none; }
.topic-suggestions .ts-label {
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
}
.topic-suggestions .ts-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.ts-chip {
    background: rgba(79, 70, 229, 0.14);
    border: 1px solid rgba(124, 58, 237, 0.35);
    color: var(--text-primary, #e2e8f0);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ts-chip:hover {
    background: rgba(124, 58, 237, 0.28);
    transform: translateY(-1px);
}

/* ── Category Filters ── */
.category-filters-wrapper {
    position: relative;
    margin-bottom: 2.25rem;
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-arrow {
    display: none !important;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s, opacity 0.18s;
    backdrop-filter: blur(8px);
    user-select: none;
    z-index: 3;
}
.filter-arrow:hover {
    background: rgba(124, 58, 237, 0.18);
    color: var(--accent);
}
.filter-arrow:disabled,
.filter-arrow.hidden-arrow {
    opacity: 0;
    pointer-events: none;
}

.category-filters {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 0.55rem 0.65rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    align-content: flex-start;
    max-height: calc(38px * 3 + 0.55rem * 2 + 1.2rem);
    overflow-y: auto;
    overflow-x: hidden;
    animation: slideDown 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.15s;
    opacity: 0;
    padding: 0.6rem 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}

.category-filters::-webkit-scrollbar { width: 6px; }
.category-filters::-webkit-scrollbar-track { background: transparent; }
.category-filters::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }

.category-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 0.5rem 1.15rem;
    min-height: 38px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.22s ease;
    backdrop-filter: blur(8px);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.category-btn:hover {
    background: rgba(79, 70, 229, 0.13);
    color: var(--text-primary);
    border-color: rgba(99, 102, 241, 0.38);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}

.category-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 18px rgba(79, 70, 229, 0.45);
    font-weight: 600;
}

/* ── 頂會嚴選 wrapper + hover 子選單 ── */
.top-conf-wrapper {
    position: relative;
    flex-shrink: 0;
}

.top-conf-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-color: rgba(251, 146, 60, 0.38);
    color: rgba(251, 191, 36, 0.85);
}

.top-conf-btn:hover,
.top-conf-wrapper:hover .top-conf-btn {
    background: rgba(251, 146, 60, 0.12);
    border-color: rgba(251, 146, 60, 0.6);
    color: rgb(251, 191, 36);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(251, 146, 60, 0.15);
}

.top-conf-btn.active {
    background: linear-gradient(135deg, #f97316, #eab308) !important;
    border-color: transparent !important;
    box-shadow: 0 4px 18px rgba(249, 115, 22, 0.45) !important;
    color: white !important;
}

.chevron-icon {
    transition: transform 0.25s ease;
    opacity: 0.7;
}

.top-conf-wrapper:hover .chevron-icon {
    transform: rotate(180deg);
    opacity: 1;
}

.conf-submenu {
    position: fixed;
    z-index: 9998;
    background: rgba(10, 14, 28, 0.97);
    border: 1px solid rgba(251, 146, 60, 0.28);
    border-radius: 1.15rem;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 225px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(251,146,60,0.07) inset;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.conf-submenu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.conf-submenu::before {
    content: '🏆 選擇會議';
    display: block;
    width: 100%;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: rgba(251, 146, 60, 0.6);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    padding-left: 0.1rem;
}

.conf-item {
    background: rgba(251, 146, 60, 0.07);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 999px;
    padding: 0.3rem 0.95rem;
    color: rgba(251, 191, 36, 0.82);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.conf-item:hover {
    background: rgba(251, 146, 60, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
    color: rgb(251, 191, 36);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(251, 146, 60, 0.18);
}

.conf-item.active {
    background: linear-gradient(135deg, #f97316, #eab308);
    border-color: transparent;
    color: white;
    box-shadow: 0 3px 12px rgba(249, 115, 22, 0.38);
}

/* ── 右鍵選單 ── */
.ctx-menu {
    position: fixed;
    z-index: 10000;
    background: rgba(10, 14, 28, 0.98);
    border: 1px solid rgba(124, 58, 237, 0.35);
    border-radius: 11px;
    padding: 0.4rem;
    box-shadow: 0 12px 36px rgba(0,0,0,0.55);
    backdrop-filter: blur(18px);
    min-width: 148px;
    animation: ctxFadeIn 0.12s ease;
}

@keyframes ctxFadeIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.ctx-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.9rem;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: #e2e8f0;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.ctx-item:hover { background: rgba(124, 58, 237, 0.18); }
.ctx-danger { color: #f87171; }
.ctx-danger:hover { background: rgba(239, 68, 68, 0.12); }

/* ── Toast 通知 ── */
.toast {
    position: fixed;
    bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: rgba(10, 14, 28, 0.98);
    border: 1px solid rgba(124, 58, 237, 0.45);
    color: #c4b5fd;
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    font-size: 0.88rem;
    backdrop-filter: blur(18px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(124, 58, 237, 0.12);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* ── 已讀/未讀標記 ── */
.read-btn {
    position: absolute;
    top: 1rem;
    right: 3.2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.18);
    padding: 3px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s, background 0.2s;
    z-index: 1;
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    gap: 3px;
    border-radius: 999px;
}

.read-btn:hover {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    transform: scale(1.05);
}

.read-btn.is-read {
    color: #34d399;
    background: rgba(52, 211, 153, 0.09);
}

.read-btn.is-read:hover {
    color: #6ee7b7;
    background: rgba(52, 211, 153, 0.18);
}

.paper-card.is-read {
    opacity: 0.68;
}

.paper-card.is-read .paper-title {
    color: #94a3b8;
    text-decoration: line-through;
    text-decoration-color: rgba(148, 163, 184, 0.35);
}

.paper-card.is-read:hover {
    opacity: 1;
}

/* ── 讀取進度角標 ── */
.read-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 32px 32px 0 0;
    border-color: transparent;
    transition: border-color 0.2s;
    border-top-left-radius: 1.25rem;
}

.paper-card.is-read .read-ribbon {
    border-color: rgba(52, 211, 153, 0.5) transparent transparent transparent;
}

/* ── 筆記按鈕與面板 ── */
.note-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.18);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: color 0.2s, background 0.2s, transform 0.2s;
    flex-shrink: 0;
    font-family: inherit;
}

.note-btn:hover {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.12);
    transform: scale(1.05);
}

.note-btn.has-note {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.note-panel {
    background: rgba(10, 14, 28, 0.7);
    border: 1px solid rgba(124, 58, 237, 0.28);
    border-radius: 0.85rem;
    padding: 0.85rem;
    margin-top: 0.75rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    animation: fadeIn 0.2s ease;
}

.note-panel.open { display: flex; }

.note-textarea {
    background: rgba(10, 14, 28, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0.6rem;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.65;
    padding: 0.65rem 0.85rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.note-textarea:focus {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.note-textarea::placeholder { color: #475569; }

.note-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.note-save-btn {
    background: var(--accent-gradient);
    border: none;
    border-radius: 999px;
    padding: 0.38rem 1rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
}

.note-save-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.note-cancel-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    padding: 0.38rem 0.9rem;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.note-cancel-btn:hover { background: rgba(255, 255, 255, 0.09); }

/* ── 匯出按鈕 ── */
.gemini-key-btn {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 999px;
    padding: 0.75rem 1.2rem;
    color: #fbbf24;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.gemini-key-btn:hover {
    background: rgba(251, 191, 36, 0.16);
    border-color: rgba(251, 191, 36, 0.55);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.18);
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: rgba(14, 20, 40, 0.98);
    border: 1px solid rgba(251, 191, 36, 0.28);
    border-radius: 1.2rem;
    padding: 2rem;
    width: min(420px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    animation: fadeIn 0.2s ease;
}
.modal-box h3 { color: #fbbf24; margin: 0; font-size: 1.1rem; }
.modal-desc { color: #94a3b8; font-size: 0.9rem; margin: 0; }
.modal-desc a { color: #60a5fa; }
.modal-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.65rem;
    padding: 0.75rem 1rem;
    color: #e2e8f0;
    font-family: monospace;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.modal-input:focus { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1); }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.modal-btn-primary {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    border: none;
    border-radius: 0.65rem;
    padding: 0.58rem 1.3rem;
    color: #000;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}
.modal-btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.modal-btn-secondary {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.65rem;
    padding: 0.58rem 1.2rem;
    color: #94a3b8;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-btn-secondary:hover { background: rgba(255,255,255,0.1); }

.set-key-link { color: #fbbf24; font-size: 0.85rem; cursor: pointer; }


/* ── 鍵盤快捷鍵提示 ── */
.kbd-hint {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: rgba(10, 14, 28, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    font-size: 0.77rem;
    color: #64748b;
    line-height: 2;
    backdrop-filter: blur(14px);
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.3s;
    opacity: 0;
}

.kbd-hint.visible { opacity: 1; }

.kbd-hint kbd {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 1px 7px;
    font-family: monospace;
    font-size: 0.8em;
    color: #a855f7;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 2.25rem;
    }
    .container {
        padding: 1.5rem 1rem;
    }
    .logo { font-size: 2.4rem; }
    .controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .search-box { width: 100%; }
    .search-box input { width: 100%; font-size: 1rem; }
    .search-box input:focus { width: 100%; }
    .paper-card:hover { transform: none; }
    .papers-grid {
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }
    .paper-card { padding: 1.25rem; }
    .paper-title { font-size: 1rem; }
    .page-btn { min-width: 3rem; height: 3rem; font-size: 1rem; }
    .filter-arrow { width: 28px; height: 28px; font-size: 1.1rem; }
    .header-badges { display: none; }
    .category-btn { padding: 0.55rem 1rem; font-size: 0.86rem; }
    .glass-select { width: 100%; padding-right: 1rem; }
    .kbd-hint { display: none; }
}

/* ── Count Header (結果標題列) ── */
.count-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0 0.9rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0.5rem;
}
.count-theme {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}
.count-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 999px;
    padding: 0.18rem 0.75rem;
    white-space: nowrap;
}

/* ── GitHub Link Button ── */
.github-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: #8b9cc8;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.github-link-btn:hover {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
    border-color: rgba(79, 70, 229, 0.38);
}

/* ── Author Button ── */
.author-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
    text-decoration: none;
}
.author-btn:hover { color: #a855f7; text-decoration: underline; }
.author-sep { color: var(--text-secondary); font-size: 0.8rem; }

/* ── Summary Expand/Collapse ── */
.paper-summary.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* ── Per Page Selector ── */
.per-page-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.per-page-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.per-page-select {
    background: var(--surface-glass);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    backdrop-filter: blur(8px);
    transition: border-color 0.2s;
}
.per-page-select:hover { border-color: rgba(79, 70, 229, 0.38); }

/* ── Stats Panel ── */
.stats-panel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    margin-bottom: 1.1rem;
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
}
.stats-item {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    cursor: default;
}
.stats-item:hover { color: var(--text-primary); }
.stats-read  { color: rgba(52, 211, 153, 0.8); }
.stats-fav   { color: rgba(250, 204, 21, 0.8); }
.stats-notes { color: rgba(168, 85, 247, 0.8); }
.stats-total { color: rgba(99, 172, 241, 0.8); }
.stats-read:hover  { color: #34d399; }
.stats-fav:hover   { color: #fde047; }
.stats-notes:hover { color: #c084fc; }
.stats-total:hover { color: #93c5fd; }
.stats-divider {
    color: var(--card-border);
    font-size: 1rem;
    opacity: 0.6;
}

/* ── Top Progress Bar ── */
.top-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2.5px;
    width: 0%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #a855f7, #ec4899);
    z-index: 9999;
    transition: width 0.4s ease, opacity 0.6s ease;
    opacity: 0;
    pointer-events: none;
}
.top-progress-bar.active { opacity: 1; }

/* ── Back to Top ── */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 900;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.15rem;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(79, 70, 229, 0.45);
    transition: transform 0.2s, opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: scale(1.1) translateY(-3px); }

/* ── Keyboard Hint Toggle Button ── */
.kbd-hint-btn {
    position: fixed;
    bottom: 8.5rem;
    right: 1.5rem;
    z-index: 900;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
    transition: transform 0.2s, color 0.2s;
    box-shadow: 0 2px 14px rgba(0,0,0,0.22);
}
.kbd-hint-btn:hover { transform: scale(1.1); color: var(--text-primary); }

/* ── Google 登入 UI ─────────────────────────────────────────── */
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-box { display: flex; align-items: center; }
.sign-in-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px;
    background: var(--card-bg); color: var(--text-primary);
    border: 1px solid var(--card-border); cursor: pointer;
    font-size: 14px; font-weight: 500; transition: background .15s;
}
.sign-in-btn:hover { background: var(--hover-bg); }
.user-info {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px; border-radius: 999px;
    background: var(--card-bg); border: 1px solid var(--card-border);
    color: var(--text-primary); font-size: 13px;
}
.user-info img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.sign-out-btn {
    background: transparent; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px;
}
.sign-out-btn:hover { color: var(--text-primary); background: var(--hover-bg); }

/* ── 論文卡片自訂標籤 ───────────────────────────────────────── */
.paper-tags {
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
    margin: 6px 0 8px; min-height: 22px;
}
.tag-chips { display: contents; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 2px 6px 2px 8px; border-radius: 10px;
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.38);
    color: #818cf8; font-size: 11px; line-height: 1.4;
}
body.light-mode .tag-chip {
    background: rgba(99, 102, 241, 0.09);
    border-color: rgba(99, 102, 241, 0.35);
    color: #4f46e5;
}
.tag-label {
    cursor: pointer;
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-label:hover { text-decoration: underline; }
.tag-x {
    background: transparent; border: none; color: inherit;
    cursor: pointer; font-size: 14px; line-height: 1;
    padding: 0 2px; opacity: 0.5;
}
.tag-x:hover { opacity: 1; }
.tag-add-btn {
    background: transparent; border: 1px dashed var(--card-border);
    color: var(--text-secondary); cursor: pointer;
    padding: 2px 8px; border-radius: 10px;
    font-size: 11px; line-height: 1.4;
    transition: color 0.15s, border-color 0.15s;
}
.tag-add-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }

/* ── 低動畫偏好：關閉大型模糊動畫 ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .background-blobs, .blob { display: none !important; }
}

/* ── 研究領域切換按鈕（Header） ─────────────────────────────────── */
.switch-discipline-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; margin-left: 14px;
    background: var(--hero-tint);
    border: 1px solid var(--accent-from);
    color: var(--text-primary);
    border-radius: 999px; cursor: pointer;
    font-size: 13px; font-weight: 500;
    transition: all 0.2s;
}
.switch-discipline-btn:hover {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    border-color: var(--accent-to);
    color: #fff;
    transform: translateY(-1px);
}
.switch-discipline-btn .discipline-badge { font-weight: 600; letter-spacing: 0.2px; }

/* ── 研究領域選擇器 Modal ───────────────────────────────────────── */
.discipline-picker {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.discipline-picker.hidden { display: none; }
.dp-backdrop {
    position: absolute; inset: 0;
    background: rgba(5, 8, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.dp-modal {
    position: relative;
    display: flex; flex-direction: column;
    width: min(94vw, 1180px);
    max-height: 90vh;
    padding: 28px 32px 20px;
    background: var(--card-bg, #111827);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.dp-header { text-align: center; margin-bottom: 18px; position: relative; flex-shrink: 0; }
.dp-title {
    margin: 0 0 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 28px; font-weight: 700;
    background: var(--discipline-gradient);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.dp-subtitle {
    margin: 0; color: var(--text-secondary);
    font-size: 14px; line-height: 1.6;
}
.dp-close {
    position: absolute; top: -8px; right: -8px;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    font-size: 22px; line-height: 1; cursor: pointer;
    transition: all 0.15s;
}
.dp-close:hover { background: rgba(255,255,255,0.1); }

/* ── Picker toolbar (search + category chips) ── */
.dp-toolbar {
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px 0 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 12px;
    flex-shrink: 0;
}
.dp-search {
    position: relative;
    display: flex; align-items: center;
}
.dp-search svg {
    position: absolute; left: 14px;
    color: var(--text-secondary); pointer-events: none;
}
.dp-search input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    font: inherit; font-size: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.dp-search input:focus {
    border-color: rgba(168,85,247,0.55);
    background: rgba(255,255,255,0.06);
}
.dp-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 72px; overflow-y: auto;
}
.dp-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px;
    font: inherit; font-size: 12.5px; font-weight: 500;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.dp-chip:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.dp-chip.active {
    background: rgba(168,85,247,0.18);
    border-color: rgba(168,85,247,0.55);
    color: #e9d5ff;
}
.dp-chip-count {
    font-size: 10.5px; font-variant-numeric: tabular-nums;
    padding: 1px 6px; border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    opacity: 0.85;
}
.dp-chip.active .dp-chip-count { background: rgba(168,85,247,0.28); color: #fff; }

/* ── Picker body (scrollable sections) ── */
.dp-body {
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 18px;
    padding-right: 6px;
    flex: 1 1 auto;
}
.dp-body::-webkit-scrollbar { width: 8px; }
.dp-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1); border-radius: 4px;
}
.dp-section { display: flex; flex-direction: column; gap: 10px; }
.dp-section-head {
    display: flex; align-items: baseline; gap: 8px;
    padding: 4px 4px 6px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
}
.dp-section-icon { font-size: 18px; }
.dp-section-title {
    font-size: 14px; font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}
.dp-section-en {
    font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary); opacity: 0.7;
}
.dp-section-count {
    margin-left: auto;
    font-size: 11px; font-variant-numeric: tabular-nums;
    padding: 2px 8px; border-radius: 999px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}
.dp-empty {
    padding: 32px 20px; text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}
.dp-empty.hidden { display: none; }

.dp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 10px;
}
.dp-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 14px 14px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    cursor: pointer; text-align: left;
    color: var(--text-primary);
    transition: all 0.18s ease;
    position: relative;
}
.dp-card:hover {
    transform: translateY(-2px);
    background: rgba(168,85,247,0.08);
    border-color: rgba(168,85,247,0.5);
    box-shadow: 0 10px 24px rgba(168,85,247,0.15);
}
.dp-card.active {
    border-color: rgba(59,130,246,0.6);
    background: rgba(59,130,246,0.12);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.35) inset;
}
.dp-card-head {
    display: flex; align-items: center; gap: 10px;
}
.dp-card-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dp-card-icon { font-size: 24px; line-height: 1; flex-shrink: 0; }
.dp-card-name {
    font-size: 15px; font-weight: 600;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dp-card-name-en {
    font-size: 11px; color: var(--text-secondary);
    letter-spacing: 0.3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dp-card-confs,
.dp-card-topics {
    font-size: 10.5px; color: var(--text-secondary);
    opacity: 0.8; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 1;
    -webkit-box-orient: vertical; overflow: hidden;
}
.dp-card-arxiv {
    font-size: 10px; letter-spacing: 0.4px;
    color: rgba(168,85,247,0.85);
    font-family: 'Inter', monospace;
    margin-top: 2px;
}

/* ==================================================================
   PR#1 · Shell Redesign — Sidebar layout (260px fixed left)
   降飽和紫 + 精簡 header；不動卡片內容
   ================================================================== */
:root {
    --side-bg:        rgba(10, 14, 28, 0.72);
    --side-line:      rgba(255, 255, 255, 0.06);
    --side-line-soft: rgba(255, 255, 255, 0.03);
    --ink-side:       #eef2ff;
    --ink-side-soft:  #a2acd0;
    --ink-side-mute:  #6b759a;
    --purple-ink:     #a78bfa;
    --purple-soft:    rgba(139, 92, 246, 0.18);
    --purple-line:    rgba(139, 92, 246, 0.35);
    --side-item-hover: rgba(139, 92, 246, 0.10);
}
body.light-mode {
    --side-bg:        #f5f3ee;
    --side-line:      rgba(20, 25, 48, 0.08);
    --side-line-soft: rgba(20, 25, 48, 0.04);
    --ink-side:       #141930;
    --ink-side-soft:  #4a4a58;
    --ink-side-mute:  #8b8b98;
    --purple-ink:     #5b4fc9;
    --purple-soft:    rgba(91, 79, 201, 0.10);
    --purple-line:    rgba(91, 79, 201, 0.30);
    --side-item-hover: rgba(91, 79, 201, 0.08);
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar root */
.side {
    position: sticky; top: 0;
    height: 100vh;
    background: var(--side-bg);
    border-right: 1px solid var(--side-line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex; flex-direction: column;
    gap: 14px;
    padding: 22px 0 16px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 5;
}
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: var(--side-line); border-radius: 3px; }

/* Brand block */
.side-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}
.side-brand:hover { opacity: 0.85; }
.side-brand:focus-visible { outline: 2px solid rgba(99,102,241,0.5); outline-offset: 4px; border-radius: 6px; }
.side-brand .brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--accent-gradient);
    display: grid; place-items: center;
    font-size: 17px; color: white; flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.side-brand .logo {
    font-size: 1.35rem !important;
    margin: 0; letter-spacing: -0.02em;
    line-height: 1.1;
}
.side-brand .logo span { font-size: 1.3rem; }

/* Sidebar discipline switcher */
.side-discipline { padding: 0 16px; }
.side-discipline .switch-discipline-btn {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--side-line);
    color: var(--ink-side-soft);
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
body.light-mode .side-discipline .switch-discipline-btn {
    background: rgba(255, 255, 255, 0.7);
}
.side-discipline .switch-discipline-btn:hover {
    background: var(--side-item-hover);
    border-color: var(--purple-line);
    color: var(--ink-side);
}
.side-discipline .discipline-badge {
    font-size: 12px;
    background: none; border: none; padding: 0; color: inherit;
    letter-spacing: 0.01em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Sidebar search (mini, optional visual only — actual search stays in header) */
.side-hint {
    padding: 0 20px;
    font-size: 11px; color: var(--ink-side-mute);
    line-height: 1.6;
}

/* Nav sections (wrapper replaces .category-filters-wrapper in sidebar mode) */
.side-nav {
    padding: 0 10px;
    display: flex; flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-height: 0;
}
.side-section-label {
    padding: 14px 10px 6px;
    font-size: 10.5px;
    color: var(--ink-side-mute);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 500;
    display: flex; justify-content: space-between; align-items: baseline;
}
.side-section-label .hint { color: var(--ink-side-mute); opacity: 0.6; font-size: 10px; text-transform: none; letter-spacing: 0.04em; font-weight: 400; }

/* Scope: category-filters inside sidebar → vertical list */
.side-nav .category-filters-wrapper {
    flex-direction: column;
    margin: 0; padding: 0;
    gap: 0;
    align-items: stretch;
}
.side-nav .category-filters {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: none;
    overflow: visible;
    gap: 2px;
    padding: 0 0 6px;
    animation: none;
    opacity: 1;
}
.side-nav .filter-arrow { display: none !important; }

/* Category button → sidebar list item */
.side-nav .category-btn {
    display: flex; align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 10px;
    height: 30px;
    box-sizing: border-box;
    border-radius: 6px;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--ink-side-soft);
    font-size: 12.5px;
    font-weight: 400;
    text-align: left;
    justify-content: flex-start;
    box-shadow: none;
    letter-spacing: 0.01em;
    transition: background 0.12s, color 0.12s;
    min-height: 0;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}
.side-nav .category-btn .label-span,
.side-nav .category-btn > span:not(.pin-icon):not(.chevron-icon) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}
.side-nav .category-btn .pin-icon { flex: 0 0 auto; font-size: 11px; }
.side-nav .category-btn:hover {
    background: var(--side-item-hover) !important;
    color: var(--ink-side) !important;
    transform: none;
}
.side-nav .category-btn.active {
    background: var(--purple-soft) !important;
    color: var(--purple-ink) !important;
    border-color: transparent !important;
    font-weight: 500;
}

/* Top-conf wrapper inside sidebar */
.side-nav .top-conf-wrapper { width: 100%; }
.side-nav .top-conf-wrapper .category-btn .chevron-icon {
    margin-left: auto;
    transition: transform 0.15s;
}

/* ── 兩層折疊式主題群組（sidebar 內聯展開）────────────────── */
.side-nav .topic-group-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 1px;
}
.side-nav .topic-group-btn {
    color: var(--ink-side);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.02em;
}
.side-nav .topic-group-btn .topic-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    overflow: hidden;
}
.side-nav .topic-group-btn .topic-group-icon {
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 1;
}
.side-nav .topic-group-btn .topic-group-en {
    font-style: normal;
    font-size: 9.5px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--ink-side-mute);
    opacity: 0.7;
    text-transform: uppercase;
}
.side-nav .topic-group-btn .chevron-icon {
    margin-left: auto;
    transition: transform 0.18s ease;
    opacity: 0.55;
}
.side-nav .topic-group-wrapper.open .topic-group-btn .chevron-icon {
    transform: rotate(180deg);
    opacity: 0.9;
}
.side-nav .topic-group-wrapper.open .topic-group-btn {
    color: var(--ink-side);
    background: var(--side-item-hover) !important;
}
.side-nav .topic-submenu {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0 4px 8px;
    border-left: 1.5px solid var(--side-line-soft);
    margin-left: 14px;
}
.side-nav .topic-group-wrapper.open .topic-submenu {
    display: flex;
    animation: topic-submenu-in 0.16s ease;
}
@keyframes topic-submenu-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}
.side-nav .topic-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 5px 10px 5px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--ink-side-soft);
    font-size: 12px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    letter-spacing: 0.01em;
    transition: background 0.12s, color 0.12s;
}
.side-nav .topic-item:hover {
    background: var(--side-item-hover);
    color: var(--ink-side);
}
.side-nav .topic-item.active {
    background: var(--purple-soft);
    color: var(--purple-ink);
    font-weight: 500;
}

/* Sidebar footer: keyboard hints */
.side-foot {
    margin-top: auto;
    padding: 12px 20px 4px;
    border-top: 1px solid var(--side-line-soft);
    display: flex; flex-direction: column; gap: 5px;
}
.side-foot-item {
    font-size: 10.5px;
    color: var(--ink-side-mute);
    letter-spacing: 0.02em;
}
.side-foot-item kbd {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 9.5px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--side-line);
    color: var(--ink-side-soft);
    margin-right: 3px;
}
body.light-mode .side-foot-item kbd {
    background: rgba(20, 25, 48, 0.05);
}

/* Right content pane: override .container to drop max-width + center */
.app-shell > .container {
    max-width: 1200px;
    margin: 0;
    padding: 28px 40px 80px;
    width: 100%;
}

/* Slim header inside shell: remove bottom margin overload, smaller logo area */
.app-shell > .container > header {
    margin-bottom: 1.75rem;
    gap: 1rem;
    align-items: center;
}
.app-shell > .container > header .header-content {
    justify-content: flex-end;
    gap: 10px;
}
/* Hide original brand+switch block in main header (moved to sidebar) */
.app-shell > .container > header .header-content .logo,
.app-shell > .container > header .header-content .switch-discipline-btn {
    display: none;
}
.app-shell > .container > header .controls {
    flex-wrap: wrap;
    flex: 1;
}

/* Narrow desktop: shrink sidebar but keep it on the side */
@media (max-width: 960px) and (min-width: 721px) {
    .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
    .side { padding: 18px 10px 14px; gap: 10px; }
    .side-nav .category-btn { font-size: 12.5px; padding: 6px 10px; }
}

/* Real mobile: collapse sidebar on top */
@media (max-width: 720px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .side {
        position: relative;
        height: auto;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--side-line);
        padding: 16px 0 12px;
    }
    .side-nav .category-filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 0 14px 8px;
    }
    .side-nav .category-btn:not(.topic-group-btn) {
        width: auto;
    }
    /* 手機版：topic-group 變成 100% 寬手風琴條，展開時 chips 用水平捲動省高度 */
    .side-nav .topic-group-wrapper {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .side-nav .topic-group-btn {
        width: 100%;
        padding: 6px 12px;
        height: 32px;
        background: rgba(124, 58, 237, 0.04) !important;
        border: 1px solid var(--side-line-soft) !important;
        border-radius: 8px;
    }
    .side-nav .topic-group-wrapper.open .topic-group-btn {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
    .side-nav .topic-submenu {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        padding: 6px 10px 6px 12px;
        margin-left: 0;
        border-left: 0;
        border: 1px solid var(--side-line-soft);
        border-top: 0;
        border-radius: 0 0 8px 8px;
        gap: 5px;
        -webkit-overflow-scrolling: touch;
    }
    .side-nav .topic-submenu::-webkit-scrollbar { height: 4px; }
    .side-nav .topic-submenu::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 2px; }
    .side-nav .topic-item {
        flex: 0 0 auto;
        width: auto;
        padding: 5px 11px;
        border-radius: 999px;
        background: rgba(124, 58, 237, 0.06);
        border: 1px solid transparent;
        font-size: 11.5px;
    }
    .side-nav .topic-item.active {
        background: var(--purple-soft);
    }
    .side-foot { display: none; }
    .app-shell > .container {
        padding: 20px 20px 60px;
    }
    .app-shell > .container > header .header-content .logo { display: inline-block; }
}

/* ==================================================================
   PR#2 · Signal — AI 摘要前置 + 6 軸分數條 + 原文摘要 <details>
   ================================================================== */
/* Signal 6 軸：緊貼 venue badge 下方 */
.signal-block {
    margin: 6px 0 8px;
}
.signal-block .signal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.signal-block .signal-score {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    color: var(--purple-ink, #a78bfa);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.signal-block .signal-score b {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-color);
    margin-left: 2px;
}
.value-tier {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 0.62rem;
    line-height: 1.5;
    background: rgba(99, 102, 241, 0.12);
    color: var(--purple-ink, #a78bfa);
}
.value-tier[data-tier="high"],
.value-tier[data-tier="hot"] {
    background: rgba(251, 146, 60, 0.16);
    color: #c2410c;
}
.value-tier[data-tier="solid"] {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}
.value-tier[data-tier="emerging"] {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}
.signal-axes {
    display: flex;
    gap: 6px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}
.signal-axis {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
    color: var(--sidebar-text, #a2acd0);
    min-width: 0;
}
.signal-axis .sa-label {
    opacity: 0.7;
    min-width: 14px;
    text-align: center;
}
.signal-axis .sa-track {
    display: inline-block;
    width: 28px;
    height: 4px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.signal-axis .sa-fill {
    display: block;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--purple-ink, #a78bfa),
        rgba(139, 92, 246, 0.6)
    );
    border-radius: 2px;
    transition: width 0.4s ease;
}
.value-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}
.value-reason {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 0.64rem;
    line-height: 1.4;
}
body.light-mode .signal-axis .sa-track {
    background: rgba(91, 79, 201, 0.08);
}

.view-badge {
    font-size: 0.8rem;
    color: #2563eb;
    background: rgba(59, 130, 246, 0.09);
    border: 1px solid rgba(59, 130, 246, 0.22);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
}

/* ==================================================================
   PR#3 · Multi-discipline — Bridge badge + 追蹤星星
   ================================================================== */
.bridge-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 6px 4px 0;
    padding: 3px 9px;
    background: linear-gradient(
        90deg,
        rgba(168, 85, 247, 0.22) 0%,
        rgba(59, 130, 246, 0.18) 100%
    );
    border: 1px solid rgba(168, 85, 247, 0.38);
    border-radius: 12px;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: #e9d5ff;
    font-weight: 600;
    vertical-align: middle;
}
.bridge-badge .bridge-others {
    opacity: 0.8;
    font-weight: 400;
    font-size: 0.66rem;
}
body.light-mode .bridge-badge {
    background: linear-gradient(
        90deg,
        rgba(91, 79, 201, 0.14) 0%,
        rgba(59, 130, 246, 0.10) 100%
    );
    border-color: rgba(91, 79, 201, 0.34);
    color: #4a3fb4;
}

/* picker：★ 追蹤按鈕 */
.dp-card {
    position: relative;
}
.dp-track-star {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    font-size: 1.1rem;
    color: var(--ink-side-mute, #8b8b98);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease, transform 0.15s ease;
    z-index: 2;
}
.dp-track-star:hover {
    color: #fbbf24;
    transform: scale(1.15);
}
.dp-card.tracked .dp-track-star {
    color: #fbbf24;
}
.dp-card.tracked {
    outline: 1px solid rgba(251, 191, 36, 0.35);
    outline-offset: -1px;
}
