/* ===================================
   Posimai Brain — Design System 2026
   =================================== */

/* Inter import removed — Geist is loaded via index.html */

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

/* ── Dark Theme (Default) ─────────────── */
:root {
    --bg: #0C1221;
    --surface: #141729;
    --surface2: #1A2040;
    --border: rgba(255,255,255,0.08);
    --text: #F0F2F5;
    --text2: rgba(255,255,255,0.50);
    --text3: rgba(255,255,255,0.28);
    --accent: #818CF8;
    --accent-dim: rgba(129, 140, 248, .12);
    --green: #34D399;
    --amber: #FBBF24;
    --rose: #F87171;
    --sidebar-w: 210px;
    --topbar-h: 52px;
    --addbar-h: 52px;
    --radius: 8px;
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color-scheme: dark;
}

/* ── Light Theme (Apple/Notion-inspired) ─────────────── */
[data-theme="light"] {
    --bg: #ffffff;
    --surface: #f8f9fa;
    --surface2: #f0f1f3;
    --border: #e4e5e7;
    --text: #1a1a1a;
    --text2: #6b6b6b;
    --text3: #a0a0a0;
    --accent: #6366F1;
    --accent-dim: rgba(99, 102, 241, .08);
    --green: #10B981;
    --amber: #F59E0B;
    --rose: #EF4444;
    color-scheme: light;
}

/* Light theme-specific adjustments */
[data-theme="light"] .overlay {
    background: rgba(0, 0, 0, .25);
    backdrop-filter: blur(4px);
}

[data-theme="light"] .article-item:hover {
    background: rgba(0, 0, 0, .02);
}

[data-theme="light"] .article-item.expanded {
    background: rgba(0, 0, 0, .03);
}

[data-theme="light"] .command-palette-backdrop {
    background: rgba(0, 0, 0, .4);
}

[data-theme="light"] .command-palette-box {
    box-shadow: 0 24px 60px rgba(0, 0, 0, .15);
}

[data-theme="light"] .settings-panel {
    box-shadow: -4px 0 24px rgba(0, 0, 0, .08);
}

[data-theme="light"] .nav-user:hover {
    background: rgba(0, 0, 0, .04);
}

html,
body {
    height: 100dvh;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

svg,
i[data-lucide] {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Lucide icon sizing defaults */
i[data-lucide] {
    width: 16px;
    height: 16px;
}

i[data-lucide] svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* ── Overlay ─────────────────────────── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
}

/* ── Sidebar ─────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid rgba(255,255,255,0.06);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    overflow: clip;
    /* 子要素のスクロールを妦妄しない安全な制限 */
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    height: 52px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 8px;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

/* フッターの設定/ログアウトリンク */
.sidebar-footer-item {
    gap: 8px;
    font-size: 12px;
}

.sidebar-footer-logout {
    opacity: .6;
}

.sidebar-footer-logout:hover {
    opacity: 1;
}

/* 歯車・外部リンクアイコン等の右端アイコン */
.nav-external-icon {
    width: 16px !important;
    height: 16px !important;
    opacity: .5;
    flex-shrink: 0;
    transition: opacity .12s;
}

.nav-item:hover .nav-external-icon {
    opacity: .9;
}

/* サイドバーフッター: 固定展示・获职色背景 */
.sidebar-footer {
    flex-shrink: 0;
    padding: 8px;
    border-top: 1px solid var(--border);
}

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

.spin {
    animation: spin 1s linear infinite;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text3);
    padding: 0 10px;
    margin-top: 4px;
    margin-bottom: 2px;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    transition: background .12s, color .12s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}

.nav-item.active {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.nav-item i[data-lucide] {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nav-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text3);
    background: var(--surface2);
    padding: 1px 6px;
    border-radius: 10px;
}

.nav-item.active .nav-count {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-item-disabled {
    opacity: .3;
    pointer-events: none;
}

.nav-item-external:hover {
    color: var(--text);
    background: var(--surface2);
}

.nav-external-icon {
    width: 16px !important;
    height: 16px !important;
    margin-left: auto;
    opacity: .5;
}

.nav-item-external:hover .nav-external-icon {
    opacity: .8;
}

/* ── Accordion (メディアセクション) ─────── */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    user-select: none;
}

.nav-accordion-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    cursor: pointer;
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-accordion-btn i[data-lucide] {
    width: 14px;
    height: 14px;
}

.nav-accordion-btn.open {
    transform: rotate(180deg);
}

.nav-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease-out, opacity .28s ease-out;
    opacity: 0;
}

.nav-accordion-content.expanded {
    max-height: 2000px;
    /* 制限なしで展開: sidebar-nav 全体でスクロールするため、セクション内スクロール不要 */
    overflow: visible;
    opacity: 1;
}

/* ── App layout ──────────────────────── */
.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

/* ── Topbar ──────────────────────────── */
.topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    z-index: 10;
}

.logo {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text2);
    transition: background .12s, color .12s;
}

.icon-btn:hover {
    background: var(--surface2);
    color: var(--text);
}

.filter-pill-wrap {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    padding: 0 2px;
}

.filter-pill {
    flex-shrink: 0;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    background: var(--surface2);
    border: 1px solid var(--border);
    transition: all .12s;
    white-space: nowrap;
}

.filter-pill:hover {
    color: var(--text);
    border-color: var(--text3);
}

.filter-pill.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* アイコンのみのピル（未読・お気に入り）*/
.filter-pill-icon {
    padding: 6px;
    min-width: auto;
    background: transparent !important;
    border-color: transparent !important;
}

.filter-pill-icon i {
    color: var(--text2);
    transition: color .12s;
}

.filter-pill-icon.active i {
    color: var(--amber);
    /* お気に入りは黄色 */
}

/* 星アイコンの色（アクティブ時） */
/* 注意: Lucideは<i>タグを<svg>に置換するので、「i > svg」でなく「button > svg」をターゲットする */
.filter-pill-icon[data-quick="favorite"].active>svg,
.filter-pill-icon[data-quick="favorite"].active svg {
    fill: none !important;
    stroke: var(--amber) !important;
    color: var(--amber) !important;
}

.filter-pill-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

/* Command Bar ボタン (TopBar右端) */
.command-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text2);
    background: transparent;
    border: none;
    flex-shrink: 0;
    transition: background .12s, color .12s;
    margin-left: auto;
}

.command-bar-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.command-shortcut {
    font-size: 11px;
    color: var(--text3);
}

.api-mode-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--green);
    flex-shrink: 0;
}

.api-mode-badge i[data-lucide] {
    width: 12px;
    height: 12px;
}

/* ── 記事リスト ──────────────────────── */
.main {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 40px;
}

.article-list {
    max-width: 760px;
    margin: 0;
    padding: 8px 0;
}

.article-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
    position: relative;
    cursor: pointer;
}

.article-item:hover {
    background: rgba(255, 255, 255, .025);
}

.article-item.expanded {
    background: rgba(255, 255, 255, .03);
}

.article-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-top: 2px;
    flex-shrink: 0;
}

.favicon-placeholder {
    font-size: 16px;
    line-height: 1;
    color: var(--text3);
    flex-shrink: 0;
    margin-top: 1px;
}

.article-body {
    flex: 1;
    min-width: 0;
}

.article-title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.article-summary--pending {
    display: block !important;
}

.ai-pending-icon {
    width: 13px;
    height: 13px;
    color: var(--accent);
    opacity: 0.45;
    animation: pulse 1.8s ease-in-out infinite;
}

.article-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

.article-title a {
    color: var(--text);
}

.article-title a:hover {
    color: var(--accent);
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text2);
}

/* トピックタグ */
.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

.topic-tag-ai {
    background: var(--accent-dim);
    color: var(--accent);
}

.topic-tag-react {
    background: rgba(97, 218, 251, .15);
    color: #61DAFB;
}

.topic-tag-flutter {
    background: rgba(2, 86, 155, .4);
    color: #54C5F8;
}

.topic-tag-postgres {
    background: rgba(51, 103, 145, .4);
    color: #89C4E1;
}

.topic-tag-sake {
    background: rgba(251, 191, 36, .15);
    color: var(--amber);
}

.topic-tag-gadget {
    background: rgba(107, 114, 128, .2);
    color: #9CA3AF;
}

.topic-tag-career {
    background: rgba(52, 211, 153, .15);
    color: var(--green);
}

.topic-tag-other {
    background: var(--surface2);
    color: var(--text3);
}

.source-label {
    color: var(--text3);
}

.reading-time {
    color: var(--text3);
}

.dot-sep {
    color: var(--text3);
}

.unread-badge {
    color: var(--accent);
    font-weight: 500;
}

/* 要約（展開で表示） */
.article-summary {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
    margin-top: 8px;
    display: none;
}

.article-item.expanded .article-summary {
    display: block;
}

/* アクションボタン（常時表示 / PCではホバー時のみ表示） */
.article-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-top: 1px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* PC向けのホバーUI (以前はここで非表示にしていましたが、常時表示に変更しました) */
.article-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    transition: background .12s, color .12s;
}

.article-action-btn i[data-lucide] {
    width: 13px;
    height: 13px;
}

.article-action-btn:hover {
    background: var(--surface2);
    color: var(--text);
}

.status-btn-reading:hover {
    color: #60A5FA;
}

.status-btn-favorite:hover {
    color: var(--amber);
}

/* お気に入りアクティブ状態 */
.status-btn-favorite.active {
    color: var(--amber);
}

.status-btn-favorite.active i[data-lucide] svg {
    fill: var(--amber);
}

.status-btn-archive:hover {
    color: var(--text2);
}

@media (hover: hover) {
    .delete-btn:hover {
        color: var(--rose);
    }
}

/* status ドット */
.article-item[data-status="favorite"] .article-body::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--amber);
    border-radius: 2px 0 0 2px;
}

.article-item[data-status="reading"] .article-body::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #60A5FA;
    border-radius: 2px 0 0 2px;
}

/* ── Bouncing Dots Loader (Feed/Reader統一) ──────────────────────── */
.loader-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.loader-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loader-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2) translateY(-16px);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ── スケルトン ──────────────────────── */
.skeleton-row {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

/* ── アニメーション・スケルトン ──────────────────────── */
.article-item.removing {
    opacity: 0 !important;
    transform: scale(0.95);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

@keyframes shimmer {
    from {
        opacity: .4;
    }

    to {
        opacity: .8;
    }
}

.sk {
    background: var(--surface2);
    border-radius: 4px;
    animation: shimmer 1.2s ease-in-out infinite alternate;
}

.sk-title {
    height: 14px;
    width: 72%;
    margin-bottom: 8px;
}

.sk-meta {
    height: 11px;
    width: 40%;
}

/* ── 空状態 ──────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 72px 0;
    color: var(--text3);
    font-size: 13px;
    gap: 4px;
}

.empty-sub {
    font-size: 12px;
    color: var(--text3);
}

/* ── Command Bar (旧 Search Palette) ───── */
.command-palette {
    position: fixed;
    inset: 0;
    z-index: 100;
}

.command-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .7);
}

.command-palette-box {
    position: relative;
    margin: 80px auto 0;
    width: min(640px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.command-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.command-palette-icon {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.command-palette-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
}

.command-palette-input::placeholder {
    color: var(--text3);
}

.command-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent-dim);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--accent);
}

.command-results {
    list-style: none;
    max-height: 360px;
    overflow-y: auto;
}

.command-result-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    cursor: pointer;
    transition: background .1s;
}

.command-result-item:hover,
.command-result-item.focused {
    background: var(--surface2);
}

.command-result-title {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
}

.command-result-meta {
    font-size: 11px;
    color: var(--text3);
}

.command-palette-footer {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text3);
}

/* ── マイページ / 設定パネル ─────────────── */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 100vw);
    min-width: 280px;
    height: 100dvh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 250;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.settings-panel.open {
    transform: translateX(0);
}

/* ── 記事詳細モーダル（本文全文） ─────────────── */
.article-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.article-detail-overlay.show {
    opacity: 1;
    visibility: visible;
}

.article-detail-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    width: min(560px, 96vw);
    max-height: 85vh;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    z-index: 301;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}
.article-detail-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.article-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.article-detail-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    flex: 1;
    min-width: 0;
}
.article-detail-close {
    flex-shrink: 0;
}
.article-detail-summary {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text2);
    line-height: 1.5;
}
.article-detail-summary-p {
    margin: 0;
}
.article-detail-body {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}
.article-detail-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.article-action-btn.fulltext-btn {
    color: var(--accent);
}

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

.settings-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.settings-section {
    padding: 20px;
}

.settings-title {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 12px;
    font-weight: 600;
}

/* テーマ切替グループ */
.theme-toggle-group {
    display: flex;
    background: var(--surface2);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    padding: 8px 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text3);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn i[data-lucide] {
    width: 14px;
    height: 14px;
}

.theme-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-weight: 500;
    border: 1px solid var(--border);
}


/* ── トースト ────────────────────────── */
.toast {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    white-space: nowrap;
    z-index: 300;
}

.toast.show {
    opacity: 1;
}

.overlay.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
    /* Allow click events when active */
}

/* ── スクロールバー ──────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text3);
}

/* ── PC: サイドバー常時表示 + 折りたたみ対応 (≥1024px) ── */
@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0) !important;
        box-shadow: none !important;
        transition: transform .25s cubic-bezier(.4, 0, .2, 1) !important;
    }

    .app {
        margin-left: var(--sidebar-w);
        transition: margin-left .25s cubic-bezier(.4, 0, .2, 1);
    }

    #menuBtn {
        display: none;
    }

    #overlay {
        display: none !important;
    }

    /* PCではサイドバーでフィルター済み — ヘッダーのカテゴリピルは不要 */
    .filter-pill-wrap {
        display: none;
    }

    /* デスクトップ折りたたみ状態 */
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%) !important;
    }

    body.sidebar-collapsed .app {
        margin-left: 0;
    }

    body.sidebar-collapsed #menuBtn {
        display: flex;
    }
}

/* ── モバイル ────────────────────────── */
@media (max-width: 640px) {
    .article-item {
        padding: 12px 14px;
        touch-action: pan-y;
    }

    .add-bar-inner {
        height: 36px;
    }

    /* モバイルはホバーなし → アクションボタンを常時表示 */
    .article-actions {
        opacity: 1 !important;
        gap: 2px;
    }

    .article-action-btn {
        width: 30px;
        height: 30px;
    }
}

/* ── サイドバーフッター ユーザー行 ──────────────── */
.sidebar-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 8px;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
}

.user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Keyboard Focus (j/k 記事選択用) ── */
.article-item.keyboard-focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: rgba(129, 140, 248, 0.05);
}

/* ── スケルトン最適化 ─────────────────── */
.loading-rows {
    padding: 12px;
    animation: skeletonFadeIn 0.15s ease-out;
    min-height: 300px;
}

@keyframes skeletonFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── A/B Test: Option 1 (Bottom Actions) ──────────────────────── */
body.ab-test-bottom-actions .article-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0 12px;
    align-items: flex-start;
}

body.ab-test-bottom-actions .article-favicon,
body.ab-test-bottom-actions .favicon-placeholder {
    grid-column: 1;
    grid-row: 1;
}

body.ab-test-bottom-actions .article-body {
    grid-column: 2;
    grid-row: 1;
    padding-bottom: 4px;
}

body.ab-test-bottom-actions .article-actions {
    grid-column: 2;
    grid-row: 2;
    margin-top: 6px;
    justify-content: flex-start;
    /* 左寄せ */
    padding-left: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Markdown Content Styling (.article-detail-md)
   ═══════════════════════════════════════════════════════════════ */

.article-detail-md {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Headings */
.article-detail-md h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text);
    line-height: 1.3;
}

.article-detail-md h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 20px 0 10px;
    color: var(--text);
    line-height: 1.35;
}

.article-detail-md h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--text);
    line-height: 1.4;
}

/* First heading: remove top margin */
.article-detail-md h1:first-child,
.article-detail-md h2:first-child,
.article-detail-md h3:first-child {
    margin-top: 0;
}

/* Paragraphs */
.article-detail-md p {
    margin: 0 0 14px;
}

.article-detail-md p:last-child {
    margin-bottom: 0;
}

/* Links */
.article-detail-md a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(129, 140, 248, 0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s, color 0.2s;
    word-break: break-all;
}

.article-detail-md a:hover {
    text-decoration-color: var(--accent);
    color: var(--accent);
}

[data-theme="light"] .article-detail-md a {
    color: var(--accent);
    text-decoration-color: var(--accent-dim);
}

[data-theme="light"] .article-detail-md a:hover {
    text-decoration-color: var(--accent);
}

/* Inline Styles */
.article-detail-md strong {
    font-weight: 600;
    color: var(--text);
}

.article-detail-md em {
    font-style: italic;
    color: var(--text2);
}

/* Code */
.article-detail-md code {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
    border: 1px solid var(--border);
}

[data-theme="light"] .article-detail-md code {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Horizontal Rule */
.article-detail-md hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* Line Breaks */
.article-detail-md br {
    display: block;
    content: "";
    margin-top: 4px;
}