
/* 質問投稿ボタンのSVGアイコンの色をモードで切り替え */
.ask-questions-icon {
  color: #111;
  fill: #111;
  transition: color 0.2s, fill 0.2s;
}

@media (prefers-color-scheme: dark) {
  .ask-questions-icon {
    color: #e0e0e0;
    fill: #e0e0e0;
  }
}
/* === Modern AI Platform Inspired Archive Design === */
/* 
 * このCSSファイルは、index.cssと統一されたデザインを提供します。
 * サイドバー幅: 380px
 * サイドバーフッター: 統一されたスタイル
 * ナビゲーションボタン: 統一されたスタイル
 * メインコンテンツエリア: 統一されたレイアウト
 * 
 * 保守性の改善:
 * - !importantの使用を最小限に抑制
 * - CSS変数によるテーマカラーの統一管理
 * - カード回答テキストはプレーンテキスト表示に最適化
 * - 不要なMarkdown/HTMLレンダリング用CSSを削除
 * - 再利用可能なコンポーネントの整理
 * - tsクラスは外部ライブラリのため!important保持
 */

/* === CSS Variables for Theme Management === */
:root {
    /* Layout */
    --sidebar-width: 380px;
    
    /* Colors - Light Theme */
    --primary-color: #6366f1;
    --secondary-color: #06b6d4;
    --accent-color: #ec4899;
    --success-color: #10b981;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    
    /* Border Colors */
    --border-color: #e5e7eb;
    --border-color-light: #f3f4f6;
    
    /* Shadow */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Dark Theme Variables */
@media (prefers-color-scheme: dark) {
    :root {
        /* Background Colors */
        --bg-primary: #303339;
        --bg-secondary: #2c2c2e;
        --bg-tertiary: #374151;
        
        /* Text Colors */
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-muted: #9ca3af;
        
        /* Border Colors */
        --border-color: #444654;
        --border-color-light: #4b5563;
        
        /* Shadow */
        --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    }
}

/* === Main Layout - Modern AI Platform Inspired === */
.main-layout {
    display: flex;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    background: transparent;
    box-sizing: border-box;
}

/* ==== Mobile Appbar (hidden by default) ==== */
.mobile-appbar { display: none; }
.appbar-btn { text-decoration: none; }

/* ==== Mobile-first overrides ==== */
@media (max-width: 768px) {
    /* Appbar */
    .mobile-appbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 12px;
        background: var(--container-bg);
        border-bottom: 1px solid var(--border-color);
        z-index: 50;
        backdrop-filter: saturate(140%) blur(6px);
    }
    .mobile-appbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text-color); letter-spacing: 0.01em; }
    .mobile-appbar .appbar-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--text-color); transition: background .15s ease; }
    .mobile-appbar .appbar-btn:hover { background: rgba(0,0,0,.05); }
    @media (prefers-color-scheme: dark) { .mobile-appbar .appbar-btn:hover { background: rgba(255,255,255,.06); } }

    /* Hide sidebar and heavy sections */
    .sidebar-nav { display: none !important; }
    .top-ad-container { display: none !important; }
    .search-filter-section { display: none !important; }

    /* Main content full width */
    .main-content { max-width: 100% !important; width: 100% !important; padding: 8px 12px 16px 12px !important; border-left: none !important; }

    /* Sticky mobile search */
    .mobile-search { position: sticky; top: 56px; z-index: 40; background: var(--container-bg); border-bottom: 1px solid var(--border-color); padding: 8px 0; margin: 0 -12px 8px -12px; }
    .mobile-search-form { display: grid; grid-template-columns: 20px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 12px; }
    .mobile-search-icon { display: inline-flex; align-items: center; justify-content: center; color: var(--subtext-color); }
    .mobile-search-input { width: 100%; height: 38px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--container-bg); color: var(--text-color); font-size: .95rem; }
    .mobile-search-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(99,102,241,.12); }
    .mobile-search-clear { height: 36px; padding: 0 10px; border: 1px solid var(--border-color); background: transparent; color: var(--subtext-color); border-radius: 10px; cursor: pointer; }
    .mobile-search-submit { height: 36px; padding: 0 12px; background: linear-gradient(135deg, #d63dee 0%, #524cf1 100%); color: #fff; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; }
    .mobile-search-submit:hover { filter: brightness(1.05); }

    /* Cards as main focus */
    .questions-grid { grid-template-columns: 1fr !important; gap: 12px !important; margin-top: 4px !important; }
    .question-card { padding: 16px !important; border-radius: 14px !important; }
}

/* Sidebar styles - unified with index.css */
.sidebar-nav {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--container-bg);
    border-right: 1px solid var(--border-color);
    padding: 8px 12px;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    box-sizing: border-box;
    word-wrap: break-word;
}

@media (prefers-color-scheme: dark) {
    .sidebar-nav {
        background: var(--container-bg);
        border-right-color: var(--border-color);
    }
}

/* Navigation styles - unified with index.css */
.nav-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 8px 0 12px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
    border-radius: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    letter-spacing: 0.025em;
    text-transform: none;
    position: relative;
    overflow: hidden;
}

.nav-title::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.22) 0%, transparent 12px),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.18) 0%, transparent 10px),
        radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.15) 0%, transparent 8px);
    animation: enhanced-nav-circles 12s ease-in-out infinite;
    pointer-events: none;
}

.nav-title::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        polygon(10% 5%, 15% 5%, 12.5% 10%) at 10px 5px,
        polygon(70% 15%, 75% 15%, 72.5% 20%) at 30px 15px;
    background-size: 50px 50px;
    opacity: 0.18;
    animation: enhanced-nav-triangles 15s linear infinite;
    pointer-events: none;
}

@keyframes enhanced-nav-circles {
    0%, 100% { 
        transform: translateX(0) translateY(0);
    }
    33% { 
        transform: translateX(5px) translateY(-3px);
    }
    66% { 
        transform: translateX(-5px) translateY(3px);
    }
}

@keyframes enhanced-nav-triangles {
    0% { 
        background-position: 10px 5px, 30px 15px;
        transform: translateX(0) translateY(0);
    }
    33% { 
        background-position: 30px 5px, 50px 15px;
        transform: translateX(2px) translateY(-1px);
    }
    66% { 
        background-position: 50px 5px, 70px 15px;
        transform: translateX(-2px) translateY(1px);
    }
    100% { 
        background-position: 60px 5px, 80px 15px;
        transform: translateX(0) translateY(0);
    }
}

/* Navigation styles - unified with index.css */
.nav-title .folder-icon {
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.nav-title-text {
    font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.nav-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

@media (prefers-color-scheme: dark) {
    .nav-title {
        background: linear-gradient(135deg, #4338ca 0%, #6d28d9 50%, #0891b2 100%);
        box-shadow: 0 2px 8px rgba(67, 56, 202, 0.4);
    }
    
    .nav-title::before {
        background: 
            radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.25) 0%, transparent 12px),
            radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.20) 0%, transparent 10px),
            radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.18) 0%, transparent 8px);
    }
    
    .nav-title::after {
        opacity: 0.22;
    }
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Navigation buttons - unified with index.css */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    position: relative;
    cursor: pointer;
}

.nav-btn:hover {
    background: #f3f4f6;
    color: #111827;
    text-decoration: none;
}

.nav-btn.active {
    background: #e5e7eb;
    color: #111827;
    font-weight: 600;
}

.nav-btn.ask-questions:hover {
    background: #f3f4f6;
    color: var(--text-color);
    font-weight: 500;
}

.nav-btn.all-questions.active {
    background: #e4e5ff;
    color: var(--text-color);
    font-weight: 600;
    border-left: 4px solid #6366f1;
    padding-left: 8px;
}
.nav-btn.all-questions:hover {
    background: #f3f4f6;
    color: var(--text-color);
}

.nav-btn.my-questions.active {
    background: hsl(166, 100%, 95%);
    color: var(--text-color);
    font-weight: 600;
    border-left: 4px solid #06b6d4;
    padding-left: 8px;
}
.nav-btn.my-questions:hover {
    background: #f3f4f6;
    color: var(--text-color);
}

.nav-btn.liked-questions.active {
    background: #ffe0f1;
    color: var(--text-color);
    font-weight: 600;
    border-left: 4px solid #ec4899;
    padding-left: 8px;
}
.nav-btn.liked-questions:hover {
    background: #f3f4f6;
    color: var(--text-color);
}

@media (prefers-color-scheme: dark) {
    .nav-btn {
        color: #d1d5db;
    }
    .nav-btn:hover {
        background: rgba(99, 165, 250, 0.12);
        color: #f9fafb;
    }
    .nav-btn.ask-questions:hover {
        background: rgba(99, 165, 250, 0.12);
        color: #f9fafb;
    }
    .nav-btn.all-questions.active {
        background: rgba(99, 165, 250, 0.12);
        color: #f9fafb;
        border-left: 4px solid #6366f1;
        padding-left: 8px;
    }
    .nav-btn.all-questions:hover {
        background: rgba(99, 165, 250, 0.12);
        color: #f9fafb;
    }
    .nav-btn.my-questions.active {
        background: #1e293b;
        color: #f9fafb;
        border-left: 4px solid #06b6d4;
        padding-left: 8px;
    }
    .nav-btn.my-questions:hover {
        background: rgba(99, 165, 250, 0.12);
        color: #f9fafb;
    }
    .nav-btn.liked-questions.active {
        background: #1e293b;
        color: #f9fafb;
        border-left: 4px solid #ec4899;
        padding-left: 8px;
    }
    .nav-btn.liked-questions:hover {
        background: rgba(99, 165, 250, 0.12);
        color: #f9fafb;
    }
}

/* Navigation icon and text styles */

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
}

.nav-text {
    font-size: 0.875rem;
    line-height: 1.25;
}

/* Main Content Area - unified with index.css */
.main-content {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - var(--sidebar-width));
    width: calc(100% - var(--sidebar-width));
    background: var(--bg-secondary);
    padding: 12px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-left: 1px solid var(--border-color);
    box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
    .main-content {
        background: #24282a;
        border-left-color: var(--border-color);
    }
}

/* Page Header - Enhanced visibility */
.page-header {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

@media (prefers-color-scheme: dark) {
    .page-header {
        background: var(--bg-primary);
        border-color: var(--border-color);
        box-shadow: var(--shadow-sm);
    }
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

@media (prefers-color-scheme: dark) {
    .page-title {
        color: var(--text-primary);
    }
}

/* Active Filters - Compact and clean */
.active-filters {
    margin-top: 16px;
}

.filter-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (prefers-color-scheme: dark) {
    .filter-title {
        color: var(--text-muted);
    }
}

.filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

@media (prefers-color-scheme: dark) {
    .filter-badge {
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        border-color: var(--border-color-light);
    }
}

/* Search & Filter Section - Enhanced contrast */
.search-filter-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

@media (prefers-color-scheme: dark) {
    .search-filter-section {
        background: var(--container-bg);
        border-color: var(--border-color);
        box-shadow: var(--shadow-sm);
    }
}

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

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
    .filter-group label {
        color: var(--text-secondary);
    }
}

/* Form inputs - Clean and modern */
select, input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    box-shadow: none;
}

@media (prefers-color-scheme: dark) {
    select, input[type="text"] {
        background: var(--bg-tertiary);
        color: var(--text-primary);
        border-color: var(--border-color-light);
    }
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--text-muted);
    box-shadow: none;
}

/* Disabled select styling */
select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    border-color: var(--border-color);
}

@media (prefers-color-scheme: dark) {
    select:disabled {
        background-color: #1f2937;
        color: #6b7280;
        border-color: #374151;
    }
}

.select-wrapper.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.select-wrapper.disabled select {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    .select-wrapper.disabled select {
        background-color: #1f2937;
        color: #6b7280;
    }
}

/* Search Section */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

#search_input {
    flex: 1;
    min-width: 0;
}

.search-btn, .clear-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-btn {
    background: linear-gradient(135deg, #d63dee 0%, #524cf1 100%);
    color: white;
    border: none;
}

.search-btn:hover {
    background: linear-gradient(135deg, #d63dee 0%, #524cf1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.clear-btn {
    background: white;
    color: #6b7280;
}

@media (prefers-color-scheme: dark) {
    .clear-btn {
        background: #374151;
        color: #9ca3af;
        border-color: #4b5563;
    }
}

.clear-btn:hover {
    background: #f9fafb;
    color: #374151;
}

@media (prefers-color-scheme: dark) {
    .clear-btn:hover {
        background: #4b5563;
        color: #d1d5db;
    }
}

/* Questions Grid - Pinterest/Masonry style */
.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

/* Question Card - 紫を基調としたモダンデザイン */
.question-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
    .question-card {
        background: linear-gradient(135deg, #2a2d47 0%, #262841 100%);
        border: 1px solid #4c4f69;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

.question-card:hover {
    border-color: #a855f7;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.12);
    transform: translateY(-2px);
}

@media (prefers-color-scheme: dark) {
    .question-card:hover {
        border-color: #a855f7;
        box-shadow: 0 4px 24px rgba(168, 85, 247, 0.2);
    }
}

/* いいね済みカードは全体に紫色を適用 */
.question-card.liked {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border-color: #a855f7;
}

@media (prefers-color-scheme: dark) {
    .question-card.liked {
        background: linear-gradient(135deg, #411d95 0%, #51187c 100%);
        border-color: #a855f7;
    }
}

.question-card.liked:hover {
    border-color: #9333ea;
    box-shadow: 0 4px 24px rgba(147, 51, 234, 0.2);
}

/* Badge Container - 統一されたカテゴリバッジデザイン */
.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.77rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    border: none;
}

@media (prefers-color-scheme: dark) {
    .badge {
        background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
        color: #f3e8ff;
    }
}

/* 古いバッジスタイルを削除 */
.badge-primary,
.badge-secondary,
.badge-auto,
.badge-error,
.badge-tag {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    border: none;
}

@media (prefers-color-scheme: dark) {
    .badge-primary,
    .badge-secondary,
    .badge-auto,
    .badge-error,
    .badge-tag {
        background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
        color: #f3e8ff;
    }
}

/* Card Content - Clean typography */
.card-content-link {
    text-decoration: none;
    color: var(--text-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-content-link:hover {
    text-decoration: none;
    color: var(--text-color);
}

.card-content-link:hover .question-text {
    color: var(--text-color);
}

.card-content-link:hover .answer-text {
    color: var(--text-color);
}

@media (prefers-color-scheme: dark) {
    .card-content-link:hover .answer-text {
        color: inherit;
    }
}

.question-content,
.answer-content {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
}

.question-label, .answer-label {
    font-weight: 700;
    font-size: 0.88rem;
    min-width: 20px;
    color: #555b65;
    margin-left: 2px;
}

@media (prefers-color-scheme: dark) {
    .question-label, .answer-label {
        color: #9ca3af;
    }
}

.question-text {
    flex: 1;
    line-height: 1.7;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

@media (prefers-color-scheme: dark) {
    .question-text {
        color: #e2e8f0;
    }
}

/* Answer Text（archive.htmlで使用） */
.answer-text {
    flex: 1;
    line-height: 1.6;
    color: var(--subtext-color);
    font-size: 0.875rem;
    word-break: break-word;
    text-align: left;
    
    /* 4行制限で末尾を省略 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.6em * 4);
}

@media (prefers-color-scheme: dark) {
    .answer-text {
        color: #cbd5e1;
    }
}

/* === Card Footer === */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

@media (prefers-color-scheme: dark) {
    .card-footer {
        border-top-color: #475569;
    }
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.timestamp {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

/* スコア表示 */
.score-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #10b981, #059669);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.score-label {
    font-size: 0.7rem;
    opacity: 0.9;
    letter-spacing: 0.025em;
}

.score-value {
    font-family: 'Noto Sans Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
}

@media (prefers-color-scheme: dark) {
    .timestamp {
        color: #94a3b8;
    }
}

.like-section {
    display: flex;
    align-items: center;
}

.like-form {
    margin: 0;
}

/* いいねボタン - 透明背景、ホバー時は外枠のみ濃いピンクに */
.like-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 0.875rem;
    outline: none;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

.like-button:hover {
    background: transparent;
    color: #e11d48;
}

.like-button.liked {
    background: transparent;
    color: #e11d48;
}

.like-button.liked:hover {
    background: transparent;
    color: #be185d;
}

@media (prefers-color-scheme: dark) {
    .like-button {
        color: #94a3b8;
        border-color: transparent;
    }
    
    .like-button:hover {
        color: #ec4899;
        background: transparent;
    }
    
    .like-button.liked {
        color: #ca1963;
        background: transparent;
    }
    
    .like-button.liked:hover {
        color: #ba175b;
        background: transparent;
    }
}

/* Material Symbols thumb_upアイコンのFILL切り替え */
.like-icon {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-size: 1.1rem;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    transition: font-variation-settings 0.2s, color 0.2s;
    color: inherit;
}

.like-button.liked .like-icon {
    color: inherit;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}


/* ホバー時もFILLは0のまま（小さいハートが出ないように） */
.like-button:hover .like-icon {
    color: inherit;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* いいね済みのボタンはホバーしてもFILL 1のまま */
.like-button.liked:hover .like-icon {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.like-count {
    font-size: 0.875rem;
    color: inherit;
    font-weight: 500;
}

/* No Results - Friendly empty state */
.no-results {
    text-align: center;
    padding: 48px 24px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
}

@media (prefers-color-scheme: dark) {
    .no-results {
        background: #1f2937;
        border-color: #374151;
        color: #9ca3af;
    }
}

.no-results-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.125rem;
    color: #374151;
    margin-bottom: 8px;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .no-results h3 {
        color: #d1d5db;
    }
}

.no-results p {
    color: #6b7280;
    font-size: 0.875rem;
}

@media (prefers-color-scheme: dark) {
    .no-results p {
        color: #9ca3af;
    }
}

/* Load Indicators */
.load-indicators {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.loading-indicator, .end-indicator {
    text-align: center;
    padding: 16px;
    color: #9ca3af;
    font-size: 0.875rem;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Archive Section */
.archive-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-top: 24px;
}

@media (prefers-color-scheme: dark) {
    .archive-section {
        background: #1f2937;
        border-color: #374151;
    }
}

.section-header {
    text-align: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

@media (prefers-color-scheme: dark) {
    .section-title {
        color: #f9fafb;
    }
}

.section-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .section-subtitle {
        color: #9ca3af;
    }
}

.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.category-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    .category-card {
        background: #374151;
        border-color: #4b5563;
    }
}

.category-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    .category-card:hover {
        border-color: #6b7280;
    }
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.category-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

@media (prefers-color-scheme: dark) {
    .category-card h3 {
        color: #f9fafb;
    }
}

.category-card p {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .category-card p {
        color: #9ca3af;
    }
}

/* === Material Symbols Support === */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined', 'Material Icons', sans-serif;
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
    user-select: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-nav {
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 16px;
    }
    
    @media (prefers-color-scheme: dark) {
        .sidebar-nav {
            border-bottom-color: #444654;
        }
    }
    
    .nav-links {
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
    }
    
    .nav-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px 20px;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .questions-grid {
        grid-template-columns: 1fr;
    }
    
    .search-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
}

/* Accessibility improvements - !important preserved for motion reduction override */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.nav-btn:focus-visible,
.search-btn:focus-visible,
.clear-btn:focus-visible,
.like-button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* === サイドバーフッター === */
.sidebar-footer {
    margin-top: auto; /* サイドバーの下部に配置 */
    padding: 16px 8px 8px 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (prefers-color-scheme: dark) {
    .sidebar-footer {
        border-top-color: #444654;
    }
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.footer-link:hover {
    background: #f3f4f6;
    text-decoration: none;
    color: #374151;
}

@media (prefers-color-scheme: dark) {
    .footer-link {
        color: #9ca3af;
    }
    
    .footer-link:hover {
        background: rgba(99, 165, 250, 0.12);
        color: inherit;
        text-decoration: none;
    }
}

.footer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-link:hover .footer-icon {
    opacity: 1;
}

/* SVGアイコンは外枠のみ（塗りなし、線のみ） */
.footer-icon svg {
    width: 16px;
    height: 16px;
    color: #111;
    fill: none;
    stroke: currentColor;
    stroke-width: 2px;
    transition: color 0.2s;
}

@media (prefers-color-scheme: dark) {
    .footer-icon svg {
        color: #e0e0e0;
    }
}

.footer-text {
    flex: 1;
    line-height: 1.4;
}



/* === Tom Select モダンデザイン 2025 === */
/* 
 * 注意: Tom Selectは外部ライブラリのため、!importantを使用してスタイルを確実にオーバーライドします。
 * これは保守性のために必要な措置です。
 */

/* Tom Select ラッパー - 外部ライブラリのデフォルトスタイルをリセット */
.ts-wrapper {
    position: relative;
    background: transparent;
    border: none !important;
    box-shadow: none !important;
}

/* Tom Select コントロール（入力フィールド）- 最新デザイン */
.ts-wrapper.single .ts-control {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    min-height: 48px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    position: relative;
    overflow: hidden;
}

/* コントロールのホバー効果 */
.ts-wrapper.single .ts-control:hover {
    border-color: #afbfd5 !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12) !important;
}

/* フォーカス時の現代的なスタイル */
.ts-wrapper.single .ts-control.focus,
.ts-wrapper.single .ts-control:focus-within {
    border-color: #667eea !important;
    background: #ffffff !important;
    outline: none !important;
    transform: translateY(-2px);
}

/* アクティブ状態（ドロップダウン開いている時） */
.ts-wrapper.single.dropdown-active .ts-control {
    border-color: #667eea !important;
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
    background: #ffffff !important;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3) !important;
}

/* ドロップダウンメニューの最新デザイン */
.ts-dropdown {
    background: #ffffff !important;
    border: 2px solid #667eea !important;
    border-top: none !important;
    border-radius: 0 0 12px 12px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
    margin-top: -2px !important;
    z-index: 1000 !important;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

/* optgroupヘッダー */
.ts-dropdown .optgroup-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    color: #475569 !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 8px 20px !important;
    cursor: default !important;
    border-bottom: 2px solid #cbd5e1;
}

/* 無効なオプション */
.ts-dropdown .option.disabled {
    color: #94a3b8 !important;
    background: #f8fafc !important;
    font-weight: 400 !important;
    font-style: italic !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    transform: none !important;
}

/* カテゴリ選択特殊スタイル */
.ts-dropdown .option.category_select {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
    color: #3730a3 !important;
    font-weight: 600 !important;
    border-left: 4px solid #6366f1 !important;
    padding-left: 16px !important;
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    /* === インデックスページと同一のダークモードTom Selectドロップダウンメニュー === */
    .ts-wrapper.single .ts-control {
        background: linear-gradient(135deg, #1e293b 0%, #263241 100%) !important;
        border-color: #475569 !important;
        color: #f1f5f9 !important;
    }
    .ts-wrapper.single .ts-control:hover {
        border-color: #64748b !important;
        background: linear-gradient(135deg, #1e293b 0%, #263241 100%) !important;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12) !important;
    }
    .ts-wrapper.single .ts-control.focus,
    .ts-wrapper.single .ts-control:focus-within {
        border-color: var(--dark-primary-color) !important;
        background: #1e293b !important;
    }
    .ts-wrapper.single.dropdown-active .ts-control {
        border-color: var(--dark-primary-color) !important;
        background: #1e293b !important;
    }
    .ts-dropdown {
        background: #1e293b !important;
        border-color: var(--dark-primary-color) !important;
        width: auto !important; /* アーカイブページと同じく、コンテンツ幅に合わせる */
        min-width: 100% !important; /* 最小幅はコントロールと同じ */
    }
    .ts-dropdown .option,
    .ts-dropdown .optgroup-header {
        color: #f1f5f9 !important;
    }
    .ts-dropdown .option:hover,
    .ts-dropdown .option.active,
    .ts-dropdown .option.focus {
        background: #2b364b !important;
        color: #fff !important;
    }
    .ts-dropdown .optgroup-header {
        background: linear-gradient(135deg, #334155 0%, #475569 100%) !important;
        color: #cbd5e1 !important;
        font-weight: 600 !important;
        font-size: 0.75rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        padding: 8px 20px !important;
        cursor: default !important;
        border-bottom: 2px solid #64748b;
    }
}

/* === カテゴリ連動の視覚的フィードバック === */
.select-wrapper.loading .ts-control {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.select-wrapper.loading .ts-control::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.select-wrapper.disabled .ts-control {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #9ca3af !important;
    cursor: not-allowed;
}

/* スピンアニメーション */
@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* カテゴリオプションの特殊スタイル */
.ts-dropdown .option.option-disabled {
    color: #9ca3af !important;
    background: #f8fafc !important;
    font-style: italic !important;
    cursor: not-allowed !important;
}

.ts-dropdown .option.option-all {
    font-weight: 600 !important;
    color: #059669 !important;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    border-left: 3px solid #10b981 !important;
    padding-left: 17px !important;
}

.ts-dropdown .option.option-empty {
    color: #6b7280 !important;
    background: #f9fafb !important;
    font-style: italic !important;
    text-align: center !important;
}

/* === ページトップボタンのアニメーション強化 === */
/* 他のページと統一するためのアニメーション確保 */
.page-top-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    transform: translateY(0) !important;
}

.page-top-btn.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.page-top-btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 4px 12px rgba(142, 154, 206, 0.4) !important;
}

.page-top-btn svg {
    transition: all 0.2s ease !important;
}


