/* ========================================
   セルフホスティングフォント定義
   ======================================== */

/* noto-sans-jp-regular - japanese_latin */
@font-face {
    font-display: swap;
    font-family: 'Noto Sans JP';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/noto-sans-jp-v55-japanese_latin-regular.woff2') format('woff2');
}

/* noto-sans-jp-500 - japanese_latin */
@font-face {
    font-display: swap;
    font-family: 'Noto Sans JP';
    font-style: normal;
    font-weight: 500;
    src: url('../fonts/noto-sans-jp-v55-japanese_latin-500.woff2') format('woff2');
}

/* noto-sans-jp-600 - japanese_latin */
@font-face {
    font-display: swap;
    font-family: 'Noto Sans JP';
    font-style: normal;
    font-weight: 600;
    src: url('../fonts/noto-sans-jp-v55-japanese_latin-600.woff2') format('woff2');
}

/* noto-sans-jp-700 - japanese_latin */
@font-face {
    font-display: swap;
    font-family: 'Noto Sans JP';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/noto-sans-jp-v55-japanese_latin-700.woff2') format('woff2');
}

/* ========================================
   スタイル定義
   ======================================== */

.form-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.7) 0%, rgba(118, 75, 162, 0.7) 100%);
    color: white;
    padding: 24px 22px;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    box-shadow:
        0 8px 32px 0 rgba(102, 126, 234, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.25) inset,
        0 2px 8px 0 rgba(255, 255, 255, 0.08) inset;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 32px;
    margin-bottom: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transform: translateY(0);
}

.form-header:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px 0 rgba(102, 126, 234, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset,
        0 2px 8px 0 rgba(255, 255, 255, 0.12) inset;
}

.form-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    animation: shimmer 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 30px);
    }
}

@media (prefers-color-scheme: dark) {
    .form-header {
        background: linear-gradient(135deg, rgba(76, 99, 210, 0.6) 0%, rgba(90, 61, 138, 0.6) 100%);
        backdrop-filter: blur(30px) saturate(200%);
        -webkit-backdrop-filter: blur(30px) saturate(200%);
        box-shadow:
            0 8px 32px 0 rgba(76, 99, 210, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset,
            0 2px 8px 0 rgba(255, 255, 255, 0.06) inset;
        border: 1.5px solid rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }

    .form-header:hover {
        transform: translateY(-2px);
        box-shadow:
            0 12px 40px 0 rgba(76, 99, 210, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.2) inset,
            0 2px 8px 0 rgba(255, 255, 255, 0.1) inset;
    }

    .form-header h1,
    .form-header h2 {
        color: #ffffff;
    }
}

/* フォーム全体のコンテナ - シームレスデザイン */
.modern-form {
    max-width: 100%;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    transition: none;
    position: relative;
}

/* メインコンテンツ内の最初のフォームの上部マージンを削除 */
.main-content>.modern-form:first-child {
    margin-top: 0;
}

.modern-form:hover {
    box-shadow: none;
    transform: none;
}

.form-title {
    font-family: 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
    color: white;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 18px 0;
    position: relative;
    z-index: 1;
    text-align: center;
    text-shadow:
        0 2px 12px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(102, 126, 234, 0.3);
    letter-spacing: -0.02em;
    filter: drop-shadow(0 1px 4px rgba(255, 255, 255, 0.2));
}

.form-subtitle {
    color: rgba(255, 255, 255, 1);
    font-size: 1.1rem;
    opacity: 1;
    margin: 0;
    font-weight: 500;
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 1.7;
    text-shadow:
        0 1px 6px rgba(0, 0, 0, 0.25),
        0 0 16px rgba(118, 75, 162, 0.25);
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.15));
}

/* フォームセクション - 境界線なし、余白で区切り */
.form-section {
    padding: 24px 0;
    border-bottom: none;
}

.form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    padding-left: 0;
}

.section-title::before {
    display: none;
}

/* フォーム行レイアウト */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

/* フォームグループ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group.full-width {
    grid-column: 1 / -1;
    position: relative;
}

/* ラベルスタイル */
.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 0;
}

/* 親カテゴリ メガメニュー */
.parent-category-field {
    position: relative;
}

.parent-category-dropdown {
    position: relative;
}

.parent-category-menu {
    top: calc(100% + 8px);
    left: 0;
    width: min(790px, calc(100vw - 64px));
    max-height: 380px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 18px 20px;
    overflow-y: auto;
}

.parent-category-menu__header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.parent-category-menu__reset {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    background: rgba(99, 102, 241, 0.08);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.parent-category-menu__reset:hover,
.parent-category-menu__reset:focus {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(79, 70, 229, 0.35);
    outline: none;
}

.parent-category-menu__reset.is-active {
    background: rgba(79, 70, 229, 0.18);
    border-color: rgba(79, 70, 229, 0.35);
    color: #4338ca;
}

.parent-category-menu__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 20px;
}

.parent-category-menu__group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.parent-category-menu__group-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #4338ca;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.18);
    text-transform: none;
    line-height: 1;
}

.parent-category-menu__group-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.45);
}

.parent-category-menu__items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.parent-category-menu__item {
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.92rem;
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.65);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.parent-category-menu__item:hover,
.parent-category-menu__item:focus {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(79, 70, 229, 0.25);
    transform: translateY(-1px);
    outline: none;
}

.parent-category-menu__item.is-active {
    background: rgba(79, 70, 229, 0.18);
    border-color: rgba(79, 70, 229, 0.35);
    color: #4338ca;
}

@media (prefers-color-scheme: dark) {
    .parent-category-menu {
        background: rgba(17, 24, 39, 0.97);
    }

    .parent-category-menu__group-title {
        color: #e0e7ff;
        background: rgba(79, 70, 229, 0.32);
        border-color: rgba(129, 140, 248, 0.4);
        box-shadow: 0 6px 14px rgba(30, 64, 175, 0.35);
    }

    .parent-category-menu__item {
        background: rgba(30, 41, 59, 0.6);
        color: #e2e8f0;
    }

    .parent-category-menu__item.is-active {
        color: #c7d2fe;
        background: rgba(99, 102, 241, 0.22);
        border-color: rgba(129, 140, 248, 0.45);
    }

    .parent-category-menu__reset {
        background: rgba(99, 102, 241, 0.18);
        color: #c7d2fe;
    }

    .parent-category-menu__reset:hover,
    .parent-category-menu__reset:focus {
        background: rgba(99, 102, 241, 0.3);
        border-color: rgba(129, 140, 248, 0.5);
    }

    .parent-category-menu__reset.is-active {
        background: rgba(99, 102, 241, 0.32);
        border-color: rgba(129, 140, 248, 0.55);
        color: #e0e7ff;
    }
}

@media (max-width: 1024px) {
    .parent-category-menu {
        width: min(640px, calc(100vw - 32px));
    }

    .parent-category-menu__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .parent-category-menu {
        width: calc(100vw - 24px);
        left: 50%;
        transform: translateX(-50%);
        max-height: 360px;
    }

    .parent-category-menu__grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* Tom Select モダンデザイン 2025 - アーカイブページと完全一致 */
/* 古いselect-wrapperの基本設定は削除され、必要最小限の設定のみ保持 */

/* === Select wrapper 基本設定 === */
.select-wrapper {
    padding: 0;
    margin: 0;
    position: relative;
}

/* === Select wrapper disabled状態 (非Tom Select用) === */
.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;
    }
}

/* === 2. 質問入力フォーム === */

/* 質問入力コンテナ - グラスモーフィズム */
.question-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(249, 250, 251, 0.85) 100%);
    backdrop-filter: blur(3px) saturate(600%);
    -webkit-backdrop-filter: blur(3px) saturate(600%);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 20px;
    box-sizing: border-box;
    overflow: visible;
    z-index: 10;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s ease;
}

.question-input-container:focus-within {
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow:
        0 6px 24px rgba(102, 126, 234, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

@media (prefers-color-scheme: dark) {
    .question-input-container {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(51, 65, 85, 0.8) 100%);
        border-color: rgba(102, 126, 234, 0.2) !important;
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }

    .question-input-container:focus-within {
        border-color: rgba(102, 126, 234, 0.4) !important;
        box-shadow:
            0 6px 24px rgba(102, 126, 234, 0.25),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    }
}

.question-textarea {
    width: 100%;
    min-height: 44px;
    max-height: 280px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 14px 16px 14px 16px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    font-family: inherit;
    resize: none;
    outline: none;
    overflow-y: hidden;
    box-sizing: border-box;
    transition: none;
}

.question-textarea:focus {
    outline: none;
}

.question-textarea::placeholder {
    color: #797e85;
    font-style: normal;
}

/* 下部固定エリア（ボタンとガイド） - 高さを抑える */
.input-bottom-bar {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 4px 12px 8px 12px;
    height: 50px;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    background: transparent;
    border-top: none;
}

/* フォームガイド（下部バーに配置） */
.form-guide {
    font-size: 0.7rem;
    color: #6b7078;
    margin: 0;
    line-height: 1.3;
    text-align: center;
    flex: 1;
}

/* 送信ボタン（下部バーに配置） */
.submit-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important;
    line-height: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    /* SVG の currentColor に反映 */
    border: 1px solid #d1d5db !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    flex: 0 0 auto !important;
    /* つぶれ防止 */
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

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

.submit-btn svg {
    width: 18px !important;
    height: 18px !important;
    color: #000000 !important;
    stroke: #000000 !important;
    fill: none !important;
}

@media (prefers-color-scheme: dark) {
    .submit-btn {
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #475569 !important;
    }

    .submit-btn:hover {
        background: #ffffff !important;
    }
}

/* ライトモード：送信ボタンは黒背景・白アイコン */
@media (prefers-color-scheme: light) {
    .submit-btn {
        background: #000000 !important;
        color: #ffffff !important;
        border-color: #000000 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    .submit-btn:hover {
        background: #000000 !important;
    }

    .submit-btn svg {
        color: #ffffff !important;
        stroke: #ffffff !important;
        fill: none !important;
    }
}

/* === 8. レガシーナビゲーションボタン（不要） === */
/* サイドバーレイアウトでは使用しない */
.top-links {
    display: none;
}


/* === 3. レスポンシブデザイン === */
@media (max-width: 1024px) {
    .archive-links ul {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .main-layout {
        flex-direction: column;
        gap: 16px;
        margin: 16px auto;
        padding: 0 12px;
    }

    .sidebar-nav {
        width: 100%;
        min-width: auto;
        position: static;
        order: -1;
    }

    .main-content {
        max-width: 100%;
    }

    .nav-links {
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .nav-btn {
        min-width: 200px;
        flex-shrink: 0;
    }

    .nav-text {
        font-size: 0.9rem;
    }

    /* 1024px以下でモバイルヘッダーを表示し、スコア表示コンテナを非表示 */
    .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);
        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);
        text-decoration: none;
        transition: background 0.15s ease, transform 0.1s ease;
    }

    .sidebar-score {
        display: none !important;
    }
}

@media (max-width: 768px) {
    body {
        max-width: 100%;
        padding: 0 16px;
    }

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

    .modern-form {
        margin: 0;
        max-width: 100%;
    }

    .archive-section {
        max-width: 100%;
    }

    .archive-links ul {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }

    .form-header {
        padding: 32px 24px;
        border-radius: 24px;
    }

    .form-title {
        font-size: 1.7rem;
        margin: 0 0 16px 0;
    }

    .form-subtitle {
        font-size: 1.05rem;
    }

    .form-section {
        padding: 18px 0;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .input-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .submit-btn {
        justify-content: center;
        padding: 16px 24px;
    }

    .top-links {
        flex-direction: column;
        gap: 12px;
        margin: 16px auto 32px auto;
        padding: 16px;
    }

    .badge-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}

/* === 8. サイドバーレイアウト === */
.main-layout {
    display: flex;
    gap: 0;
    /* サイドバーとメインコンテンツ間のギャップを削除 */
    max-width: 1400px;
    margin: 0 auto;
    /* 上部マージンを完全に削除 */
    min-height: 100vh;
    /* 上部スペースを完全に削除 */
    padding: 0;
    /* 左右パディングを完全に削除 */
    box-sizing: border-box;
}

/* サイドバーナビゲーション - Archive AI Modern スタイル */
.sidebar-nav {
    width: 450px !important;
    min-width: 450px !important;
    max-width: 450px !important;
    flex-basis: 450px !important;
    background: linear-gradient(180deg,
            var(--container-bg) 0%,
            rgba(249, 250, 251, 0.5) 100%);
    border-right: 1px solid var(--border-color);
    padding: 10px 8px;
    height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    flex-shrink: 0;
    z-index: 10;
    box-sizing: border-box;
    word-wrap: break-word;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

@media (prefers-color-scheme: dark) {
    .sidebar-nav {
        background: linear-gradient(180deg,
                var(--container-bg) 0%,
                rgba(42, 42, 42, 0.5) 100%);
        border-right-color: #444654;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
    }
}

/* === 9. ナビゲーションタイトル（Gimmy） === */
.nav-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 4px 0 4px 0;
    padding: 12px 16px;
    background: none !important;
    box-shadow: none !important;
    padding: 16px 0 12px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.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: none !important;
        box-shadow: none !important;
        padding: 16px 0 12px 0;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }
}

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

/* Navigation buttons - Discord/Slack inspired with modern enhancements */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: all 0.25s ease;
}

.nav-btn:hover {
    background: linear-gradient(90deg, rgba(243, 244, 246, 0.8) 0%, rgba(243, 244, 246, 0.4) 100%);
    color: #111827;
    text-decoration: none;
    transform: translateX(4px);
}

.nav-btn:hover::before {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

/* 各ナビゲーションボタンの固有色（左側の縦線） */
.nav-btn.ask-questions:hover::before {
    background: #000000;
}

.nav-btn.all-questions:hover::before {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.nav-btn.my-questions:hover::before {
    background: #10b981;
}

.nav-btn.liked-questions:hover::before {
    background: linear-gradient(180deg, #ec4899 0%, #f472b6 100%);
}

.nav-btn.active {
    background: linear-gradient(90deg, rgba(229, 231, 235, 0.9) 0%, rgba(243, 244, 246, 0.6) 100%);
    color: #111827;
    font-weight: 600;
}

/* アクティブ時は縦線を非表示 */
.nav-btn.active::before {
    background: transparent !important;
}

/* 特定のナビゲーションボタンスタイル */
.nav-btn.ask-questions:hover {
    /* background: linear-gradient(90deg, #ffffff28 0%, #b0b3b8 100%); */
    background: #f3f4f6;
    color: var(--text-color);
    font-weight: 500;
}

.nav-btn.all-questions.active {
    /* background: linear-gradient(90deg, #ede9fe66 0%, #a5b4fc 100%); */
    background: #f8fafc;
    color: var(--text-color);
    font-weight: 600;
    border-left: 4px solid #6366f1;
    padding-left: 8px;
}

.nav-btn.all-questions:hover {
    /* background: linear-gradient(90deg, #ede9fe66 0%, #7187f7 100%); */
    background: #f3f4f6;
    color: var(--text-color);
}

.nav-btn.my-questions.active {
    /* background: linear-gradient(90deg, #e2fdff66 0%, #8dcbea 100%); */
    background: #f0fdfa;
    color: var(--text-color);
    font-weight: 600;
    border-left: 4px solid #06b6d4;
    padding-left: 8px;
}

.nav-btn.my-questions:hover {
    /* background: linear-gradient(90deg, #e2fdff66 0%, #6cbfe8 100%); */
    background: #f3f4f6;
    color: var(--text-color);
}

.nav-btn.liked-questions.active {
    /* background: linear-gradient(90deg, #ffe0f166 0%, #ff84f3 100%); */
    background: #fdf2f8;
    color: var(--text-color);
    font-weight: 600;
    border-left: 4px solid #ec4899;
    padding-left: 8px;
}

.nav-btn.liked-questions:hover {
    /* background: linear-gradient(90deg, #ffe0f166 0%, #ff70f1 100%); */
    background: #f3f4f6;
    color: var(--text-color);
}

/* ダークモード対応 - 特定のナビゲーションボタン */
@media (prefers-color-scheme: dark) {
    .nav-btn.all-questions.active {
        /* background: linear-gradient(90deg, #3730a3 0%, #6366f1 100%); */
        background: #1e293b;
        color: #f9fafb;
        border-left: 4px solid #6366f1;
        padding-left: 8px;
    }

    .nav-btn.all-questions:hover {
        /* background: #6366f1; */
        background: #4b5563;
        color: #f9fafb;
    }

    .nav-btn.my-questions.active {
        /* background: linear-gradient(90deg, #06b6d4 0%, #22d3ee 100%); */
        background: #0f172a;
        color: #f9fafb;
        border-left: 4px solid #06b6d4;
        padding-left: 8px;
    }

    .nav-btn.my-questions:hover {
        /* background: #0ea5e9; */
        background: #4b5563;
        color: #f9fafb;
    }

    .nav-btn.liked-questions.active {
        /* background: linear-gradient(90deg, #831843 0%, #f472b6 100%); */
        background: #1e1b27;
        color: #f9fafb;
        border-left: 4px solid #ec4899;
        padding-left: 8px;
    }

    .nav-btn.liked-questions:hover {
        /* background: #be185d; */
        background: #4b5563;
        color: #f9fafb;
    }

    /* ダークモード：ナビゲーションボタン基本スタイル */
    .nav-btn {
        color: #d1d5db;
    }

    .nav-btn:hover {
        background: linear-gradient(90deg, rgba(55, 65, 81, 0.8) 0%, rgba(55, 65, 81, 0.4) 100%);
        color: #f9fafb;
    }

    .nav-btn.active {
        background: linear-gradient(90deg, rgba(55, 65, 81, 0.9) 0%, rgba(75, 85, 99, 0.6) 100%);
        color: #f9fafb;
    }
}

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

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

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

/* === 10. サイドバーナビゲーション === */
.main-content {
    max-width: 780px;
    width: 100%;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 24px 32px;
    min-height: 480px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    border: none;
    transition: none;
}

.main-content:hover {
    box-shadow: none;
    transform: none;
}

.main-content-footer {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 32px;
    padding-top: 12px;
    font-size: 0.85rem;
    color: #6b7280;
    letter-spacing: 0.02em;
}

.main-content-footer__text {
    font-weight: 500;
}

@media (prefers-color-scheme: dark) {
    .main-content {
        background: transparent;
        border-color: transparent;
        box-shadow: none;
    }

    .main-content:hover {
        box-shadow: none;
        transform: none;
    }

    .main-content-footer {
        border-top-color: rgba(148, 163, 184, 0.2);
        color: #cdd5f5;
    }
}

/* 2カラムレイアウト全体ラッパー */
.content-ad-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 広告カラム */
.ad-column {
    width: 180px;
    min-width: 160px;
    max-width: 200px;
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 480px;
    position: relative;
    z-index: 0;
}

.ad-placeholder {
    width: 100%;
    min-height: 200px;
    background: #f3f4f6;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.1em;
    margin-top: 12px;
}

/* メインコンテンツ内の最初の要素の上部マージンを削除 */
.main-content>*:first-child {
    margin-top: 0;
}

/* フラッシュメッセージコンテナの上部マージンを削除 */
.flash-messages {
    margin-top: 0;
}

/* 現代的フォームの上部マージンをリセット */
.modern-form {
    margin-top: 0;
}

/* フォームヘッダーの上部マージンをリセット */
.form-header {
    margin-top: 0;
}

/* === 4. レスポンシブ対応 === */

/* タブレット・モバイルサイズでの調整 */

@media (max-width: 1100px) {
    .content-ad-wrapper {
        flex-direction: column;
        max-width: 100vw;
    }

    .main-content {
        max-width: 98vw;
        padding: 18px 4vw 24px 4vw;
    }

    .ad-column {
        width: 100%;
        max-width: 100vw;
        margin-left: 0;
        margin-top: 24px;
        min-height: 120px;
        align-items: center;
    }

    .ad-placeholder {
        margin-top: 0;
    }
}

/* === 互換性のため === */
.font-numeric {
    font-family: 'Noto Sans JP', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

@media (max-width: 768px) {
    .main-layout {
        gap: 16px;
        max-width: 100%;
        margin: 12px auto;
        padding: 0 8px;
    }

    .sidebar-nav {
        padding: 12px;
    }

    .nav-links {
        gap: 8px;
    }

    .nav-btn {
        padding: 12px 16px;
        min-width: 160px;
    }

    .nav-text {
        font-size: 0.85rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-label {
        min-width: auto;
    }
}

/* === 7. チャットタイプ選択 (PC専用) === */
.chat-type-selection {
    margin: 0;
}

/* PC版: チャットタイプグループにmargin-bottom追加 */
.chat-type-group {
    margin-bottom: 24px;
}

/* チャットタイプラベルにmargin-bottom追加（優先順位を高める） */
.chat-type-group .chat-type-label,
.section-subtitle.chat-type-label {
    margin-bottom: 24px !important;
    display: block;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 22px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.45s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, box-shadow, background, border-color;
    flex: 1;
    min-width: 240px;
    /*background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(249, 250, 251, 0.8) 100%);*/
    background: var(--container-bg);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

/* PC版: チャットタイプ選択にmargin-bottomを追加 */
.chat-type-selection {
    margin-bottom: 20px;
}

.radio-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.radio-label:hover {
    border-color: rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(249, 250, 251, 0.85) 100%);
    transform: translateY(-2px);
    box-shadow:
        0 4px 12px rgba(102, 126, 234, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

.radio-label:hover::before {
    opacity: 1;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s ease;
}

.radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #667eea;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s ease;
}

.radio-label input[type="radio"]:checked+.radio-custom {
    border-color: #667eea;
}

.radio-label input[type="radio"]:checked+.radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radio-text strong {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.radio-text small {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.private-radio input[type="radio"]:checked+.radio-custom {
    border-color: #10b981;
}

.private-radio input[type="radio"]:checked+.radio-custom::after {
    background: #10b981;
}

.open-radio input[type="radio"]:checked+.radio-custom {
    border-color: #f59e0b;
}

.open-radio input[type="radio"]:checked+.radio-custom::after {
    background: #f59e0b;
}

/* === チャットタイプ選択：選択済み強調 === */
.radio-label.selected {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px -18px rgba(15, 23, 42, 0.18);
}

.radio-label.selected::before {
    opacity: 1;
}

.private-radio.selected {
    background: linear-gradient(135deg, rgba(19, 206, 144, 0.16) 0%, rgba(20, 176, 124, 0.08) 100%);
    border-color: rgba(16, 185, 129, 0.55);
}

.private-radio.selected .radio-text strong {
    color: #065f46;
}

.private-radio.selected .radio-text small {
    color: #0d6f67;
}

.open-radio.selected {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(238, 154, 7, 0.1) 100%);
    border-color: rgba(245, 158, 11, 0.6);
}

.open-radio.selected .radio-text strong {
    color: #92400e;
}

.open-radio.selected .radio-text small {
    color: #b45309;
}

.private-radio.selected .radio-custom,
.private-radio.selected .radio-custom::after,
.open-radio.selected .radio-custom,
.open-radio.selected .radio-custom::after {
    transition: all 0.3s ease;
}

.private-radio.selected .radio-custom {
    border-color: #10b981;
}

.private-radio.selected .radio-custom::after {
    background: #10b981;
    transform: translate(-50%, -50%) scale(1);
}

.open-radio.selected .radio-custom {
    border-color: #f59e0b;
}

.open-radio.selected .radio-custom::after {
    background: #f59e0b;
    transform: translate(-50%, -50%) scale(1);
}

/* 質問入力ラッパー - 高さを抑える */
.question-input-wrapper {
    position: relative;
    min-height: 110px;
}

/* === 既存のスタイル === */
/* サイドバーゲームコンテナ */
.sidebar-game-container {
    margin: 0;
    width: 100%;
    padding: 0;
    border-top: 1px solid var(--border-color);
    border-radius: 1px;
    overflow: hidden;
    /* キャンバスを角丸に収める */
}

#sidebar-game {
    display: block;
    background: var(--container-bg);
    /* ゲームの背景色 */
}

@media (prefers-color-scheme: dark) {
    #sidebar-game {
        background: var(--container-bg);
    }

    /* ダークモード：チャットタイプ選択のモダンスタイル */
    .radio-label {
        background: linear-gradient(135deg, rgba(31, 41, 55, 0.85) 0%, rgba(17, 24, 39, 0.85) 100%);
        border-color: rgba(148, 163, 184, 0.18);
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.55), 0 0 0 1px rgba(148, 163, 184, 0.08) inset;
        color: #e2e8f0;
    }

    .radio-label:hover {
        background: linear-gradient(135deg, rgba(31, 41, 55, 0.92) 0%, rgba(17, 24, 39, 0.9) 100%);
        border-color: rgba(148, 163, 184, 0.45);
        box-shadow: 0 12px 28px -18px rgba(15, 23, 42, 0.6), 0 0 0 1px rgba(148, 163, 184, 0.12) inset;
    }

    .radio-label.selected {
        box-shadow: 0 24px 44px -20px rgba(15, 23, 42, 0.7);
    }

    .private-radio.selected {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.32) 0%, rgba(6, 95, 70, 0.22) 100%);
        border-color: rgba(52, 211, 153, 0.6);
    }

    .private-radio.selected .radio-text strong,
    .private-radio.selected .radio-text small {
        color: #6ee7b7;
    }

    .open-radio.selected {
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.32) 0%, rgba(146, 64, 14, 0.24) 100%);
        border-color: rgba(251, 191, 36, 0.65);
    }

    .open-radio.selected .radio-text strong,
    .open-radio.selected .radio-text small {
        color: #fcd34d;
    }

    .radio-custom {
        border-color: #475569;
        background: #111827;
    }

    .radio-label input[type="radio"]:checked+.radio-custom {
        border-color: rgba(129, 140, 248, 0.9);
    }

    .radio-text strong {
        color: #e2e8f0;
    }

    .radio-text small {
        color: #94a3b8;
    }

    .mobile-badge-item.selected .mobile-badge-label {
        box-shadow: 0 20px 36px -18px rgba(15, 23, 42, 0.6);
    }

    .mobile-badge-item.private-badge.selected .mobile-badge-label {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.32) 0%, rgba(6, 95, 70, 0.24) 100%);
        border-color: rgba(52, 211, 153, 0.6);
        color: #6ee7b7;
    }

    .mobile-badge-item.open-badge.selected .mobile-badge-label {
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.32) 0%, rgba(146, 64, 14, 0.24) 100%);
        border-color: rgba(251, 191, 36, 0.65);
        color: #fcd34d;
    }
}

/* === 12. その他のコンポーネント === */

/* スコア表示コンテナ */
.score-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.95) 100%);
    border-radius: 14px;
    margin: 0;
    padding: 0 10px 4px 10px;
    display: flex;
    flex-direction: column;
    height: 425px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(229, 231, 235, 0.8);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.score-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981 0%, #059669 50%, #047857 100%);
    opacity: 0.6;
}

.score-container:hover {
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
    flex-shrink: 0;
}

.score-icon {
    color: #f59e0b;
    flex-shrink: 0;
}

.score-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.score-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #10b981;
    font-family: 'Noto Sans JP', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

.score-progress {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.progress-bar-container {
    position: relative;
    margin-bottom: 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #ececec;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg,
            #10b981 0%,
            #059669 25%,
            #10b981 50%,
            #059669 75%,
            #047857 100%);
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 0 12px rgba(16, 185, 129, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    animation: shimmer-progress 3s ease-in-out infinite;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
    border-radius: 6px 6px 0 0;
}

@keyframes shimmer-progress {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* プログレスバーの目盛り線 */
.progress-tick {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    border-left: 1px solid rgba(160, 160, 160, 0.443);
    background: none;
    z-index: 1;
}

@media (prefers-color-scheme: dark) {
    .progress-tick {
        border-left: 1px solid rgba(0, 0, 0, 0.3);
    }
}

.progress-markers {
    position: relative;
    height: 12px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.marker {
    position: absolute;
    transform: translateX(-50%);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.7;
    top: 0;
    /* 全て上段に統一 */
}

/* 100%の目盛りは右端で終了 */
.marker[style*="left: 100%"] {
    transform: translateX(-100%);
}

/* 高スコア時のエフェクト */
.score-container.high-score .progress-fill {
    background: linear-gradient(90deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
}

.score-container.high-score .score-percentage {
    color: #dc2626;
}

/* ダークモード対応 - スコア表示コンテナ */
@media (prefers-color-scheme: dark) {
    .score-container {
        background: var(--container-bg);
        border: 1px solid var(--border-color);
    }

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

    .score-value {
        color: #10b981;
        /* 緑色はダークモードでも視認性が良いのでそのまま */
    }

    .progress-bar {
        background: #374151;
        /* ダークモード用の背景色 */
    }

    .progress-fill {
        background: linear-gradient(90deg, #10b981 0%, #059669 50%, #047857 100%);
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
        /* シャドウを少し強めに */
    }

    .progress-markers {
        color: var(--subtext-color);
    }

    .marker {
        color: var(--subtext-color);
    }

    /* 高スコア時のエフェクト（ダークモード） */
    .score-container.high-score .progress-fill {
        background: linear-gradient(90deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
        box-shadow: 0 0 12px rgba(220, 38, 38, 0.5);
        /* ダークモードでは少し強めに */
    }

    .score-container.high-score .score-percentage {
        color: #dc2626;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .score-container {
        margin: 12px -12px 12px -12px;
        /* モバイルでもサイドバーの余白いっぱいに */
        padding: 12px;
        height: 100px;
    }

    .score-header {
        margin-bottom: 10px;
    }

    .score-title {
        font-size: 0.85rem;
    }

    .score-percentage {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .progress-bar {
        height: 10px;
        margin-bottom: 4px;
    }

    .progress-markers {
        height: 14px;
        font-size: 0.6rem;
    }

    .marker:nth-child(even) {
        top: 7px;
    }
}

/* サイドバーフッター */
.sidebar-footer {
    margin-top: 8px;
    /* 必要最小限に */
    padding-top: 4px;
    /* 必要最小限に */
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* 余白を縮小 */
    flex-shrink: 0;
}

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

.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;
}

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

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

@media (prefers-color-scheme: dark) {
    .footer-link:hover {
        background: #374151;
        color: #d1d5db;
    }
}

.footer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.footer-icon svg {
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

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

.footer-text {
    font-size: 0.813rem;
}

/* ページトップボタンは base_v2.css で統一管理 */

/* 強制的なサイドバー幅設定 */
aside.sidebar-nav,
.sidebar-nav {
    width: 450px !important;
    min-width: 450px !important;
    max-width: 450px !important;
    flex-basis: 450px !important;
}

/* ページヘッダー */
.page-header {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

@media (prefers-color-scheme: dark) {
    .page-header {
        background: #1e1e20;
        border-color: #444654;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    }
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 1.125rem;
    color: var(--subtext-color);
    margin: 0;
    font-weight: 400;
}

/* === 11. Gimmyタイトル設定 === */
.gimmy-title {
    font-family: 'Source Sans 3', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.01em;
    color: #3b3b3b;
    margin-left: 0;
    line-height: 1.2;
}

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

/* nav-title の背景を削除し、シンプルなテキスト表示に */
.nav-title {
    background: none !important;
    box-shadow: none !important;
    padding: 0 0 2px 6px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* ================================================================
   目次 - INDEX.CSS
   ================================================================
   
   1. 現代的フォームデザイン
   2. 質問入力フォーム
   3. Tom Select モダンデザイン 2025（アーカイブページから移植）
   4. レスポンシブ対応
   5. 2カラムレイアウト（メインコンテンツ + 広告）
   6. ダークモード対応
   7. チャットタイプ選択
   8. サイドバーレイアウト
   9. ナビゲーションタイトル（Gimmy）
   10. サイドバーナビゲーション
   11. Gimmyタイトル設定
   12. その他のコンポーネント
       - スコア表示コンテナ
       - サイドバーフッター
       - ページトップボタン
       - 強制的なサイドバー幅設定
       - ページヘッダー
       - サイドバーゲームコンテナ
   
   ================================================================ */

/* === ローディングアニメーション === */

/* ローディングオーバーレイ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.2s ease;
}

/* ダークモード時のローディングオーバーレイ */
[data-theme="dark"] .loading-overlay {
    background: rgba(26, 27, 30, 0.9);
}

/* ローディングコンテナ */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* スピンアニメーション */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e3e3e3;
    border-top: 3px solid #7d2fbe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ダークモード時のスピナー */
[data-theme="dark"] .loading-spinner {
    border: 3px solid #444;
    border-top: 3px solid #7d2fbe;
}

/* スピンキーフレーム */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ローディングテキスト */
.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    text-align: center;
}

/* フォーム送信中のボタン無効化 */
.modern-form.submitting .submit-btn {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.modern-form.submitting .submit-btn:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

/* === Tom Select モダンデザイン 2025（アーカイブページと完全一致） === */
/* Tom Select ラッパー */
.ts-wrapper {
    /* Tom Selectの一番外側 */
    position: relative;
    background: var(--container-bg) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
}

/* Tom Select コントロール（入力フィールド）- グラスモーフィズム */
.ts-wrapper.single .ts-control {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.85) 100%) !important;
    border: 1.5px solid rgba(168, 85, 247, 0.2) !important;
    border-radius: 16px !important;
    padding: 12px 16px !important;
    min-height: 48px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
    position: relative;
    overflow: hidden;
}

/* コントロールのホバー効果 */
.ts-wrapper.single .ts-control:hover {
    border-color: rgba(168, 85, 247, 0.35) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%) !important;
    box-shadow:
        0 4px 12px rgba(168, 85, 247, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
    transform: translateY(-1px);
}

/* フォーカス時の現代的なスタイル */
.ts-wrapper.single .ts-control.focus,
.ts-wrapper.single .ts-control:focus-within {
    border-color: rgba(168, 85, 247, 0.55) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow:
        0 4px 16px rgba(168, 85, 247, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset !important;
    outline: none !important;
    transform: translateY(-2px);
}

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

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

/* 基本的なオプションスタイルはTom Selectのデフォルトを使用（アーカイブページと一致） */

/* 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;
}

/* コントロールの無効状態 */
.ts-wrapper.single .ts-control.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    transform: none !important;
}

/* 無効な選択ラッパー - アーカイブページから削除（重複） */

/* === カテゴリ連動の視覚的フィードバック === */
.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;
}

/* 重複削除 - この定義は既に上の部分で含まれている */

/* スピンアニメーション */
@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;
}

/* ダークモード対応 - グラスモーフィズム */
@media (prefers-color-scheme: dark) {
    .ts-wrapper.single .ts-control {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(38, 50, 65, 0.8) 100%) !important;
        backdrop-filter: blur(10px) saturate(150%);
        -webkit-backdrop-filter: blur(10px) saturate(150%);
        border-color: rgba(168, 85, 247, 0.35) !important;
        box-shadow:
            0 2px 8px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
        color: #f1f5f9 !important;
    }

    .ts-wrapper.single .ts-control:hover {
        border-color: rgba(168, 85, 247, 0.45) !important;
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(38, 50, 65, 0.85) 100%) !important;
        box-shadow:
            0 4px 12px rgba(168, 85, 247, 0.24),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset !important;
    }

    .ts-wrapper.single .ts-control.focus,
    .ts-wrapper.single .ts-control:focus-within {
        border-color: rgba(168, 85, 247, 0.6) !important;
        background: rgba(30, 41, 59, 0.95) !important;
        box-shadow:
            0 4px 16px rgba(168, 85, 247, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.2) inset !important;
    }

    .ts-wrapper.single.dropdown-active .ts-control {
        border-color: #a855f7 !important;
        background: #1e293b !important;
    }

    .ts-dropdown {
        background: #1e293b !important;
        border-color: #a855f7 !important;
        width: auto !important;
        /* アーカイブページと同じく、コンテンツ幅に合わせる */
        min-width: 100% !important;
        /* 最小幅はコントロールと同じ */
    }

    /* ドロップダウンのオプション基本色 */
    .ts-dropdown .option {
        color: #f1f5f9 !important;
        background: #1e293b !important;
    }

    /* 基本的なオプションスタイルはTom Selectのデフォルトを使用（アーカイブページと一致） */

    .ts-dropdown .optgroup-header {
        background: linear-gradient(135deg, #334155 0%, #475569 100%) !important;
        color: #cbd5e1 !important;
        border-bottom-color: #64748b;
    }

    .ts-dropdown .option:hover,
    .ts-dropdown .option.active,
    .ts-dropdown .option.focus {
        background: #2b364b !important;
        color: #fff !important;
    }

    .ts-dropdown .option.disabled {
        color: #64748b !important;
        background: #0f172a !important;
    }

    .ts-wrapper.single .ts-control.disabled {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
        color: #64748b !important;
        border-color: #334155 !important;
    }
}

/* === AIモデル選択機能のスタイル === */

/* 追加のCSS変数定義 */
:root {
    --text-primary: var(--text-color);
    --text-secondary: var(--subtext-color);
    --input-bg: var(--container-bg);
    --success-color: #10b981;

    /* ダークモード用変数 */
    --dark-input-bg: #334155;
    --dark-border-color: #475569;
    --dark-text-primary: #f1f5f9;
    --dark-text-secondary: #94a3b8;
}

/* フォーム下部のコントロール部分 */
.form-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.form-guide-section {
    flex: 1;
}

/* AIモデル選択器 (Alpine.js + Tailwind CSS) */
.ai-model-selector {
    flex-shrink: 0;
    position: relative;
}

.ai-model-selector button[type="button"] {
    min-width: 200px;
    white-space: nowrap;
}

/* ドロップダウンメニューの位置調整 */
.ai-model-selector>div[x-show] {
    bottom: 100%;
    margin-bottom: 8px;
    right: 0;
}

/* モデル変更通知 */
.model-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .form-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ai-model-selector {
        order: -1;
        /* モバイルでは上部に表示 */
    }

    .model-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* ダークモード対応 (不要になった古いmodel-select関連は削除済み) */

/* モデル解放エフェクト */
.model-unlocked-effect {
    animation: modelUnlockPulse 3s ease-in-out;
    border-color: #ffd700 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6) !important;
}

@keyframes modelUnlockPulse {

    0%,
    100% {
        transform: scale(1);
        border-color: var(--border-color);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }

    25% {
        transform: scale(1.05);
        border-color: #ffd700;
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    }

    50% {
        transform: scale(1);
        border-color: #ffd700;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }

    75% {
        transform: scale(1.02);
        border-color: #ffd700;
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
    }
}

/* 解放通知 */
.model-unlock-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
    z-index: 1001;
    border: 2px solid #ffc107;
}

.unlock-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.unlock-icon {
    font-size: 20px;
    animation: bounceIcon 0.6s ease-in-out infinite alternate;
}

@keyframes bounceIcon {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.2);
    }
}

.unlock-text {
    font-size: 16px;
}

/* パーティクルエフェクト */
.unlock-particle {
    animation: particleFloat 1.5s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }

    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

/* API エラーメッセージ用スタイル */
.api-error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.1);
}

.api-error-message h4 {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: #b91c1c;
}

.api-error-message p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.api-error-message .error-details {
    background: rgba(220, 38, 38, 0.05);
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 13px;
    border-left: 3px solid #dc2626;
}

@media (prefers-color-scheme: dark) {
    .api-error-message {
        background: linear-gradient(135deg, #2d1b1b 0%, #3a1f1f 100%);
        border-color: #7f1d1d;
        color: #fca5a5;
    }

    .api-error-message h4 {
        color: #ef4444;
    }

    .api-error-message .error-details {
        background: rgba(239, 68, 68, 0.1);
        border-left-color: #ef4444;
    }
}

/* === Mobile overhaul (Index page) === */
/* モバイル用トップバーはデスクトップでは非表示 */
.mobile-appbar {
    display: none;
}

.mobile-composer-footer {
    display: none;
}

.mobile-only {
    display: none !important;
}

.mobile-hidden {
    display: block;
}

.mobile-sidebar {
    display: none;
}

.mobile-sidebar-overlay {
    display: none;
}

@media (max-width: 1024px) and (min-width: 769px) {
    .mobile-appbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(16px) saturate(160%);
        -webkit-backdrop-filter: blur(16px) saturate(160%);
        z-index: 100;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: var(--text-color);
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .mobile-menu-btn:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .mobile-appbar-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-color);
        letter-spacing: -0.02em;
    }

    .mobile-ai-model-selector {
        display: none !important;
    }

    .mobile-sidebar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: var(--container-bg);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 100;
        overflow-y: auto;
    }

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

    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 99;
    }

    .mobile-sidebar-overlay.visible {
        display: block;
        opacity: 1;
    }

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

    .mobile-sidebar-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-color);
        margin-left: 8px;
    }

    .mobile-sidebar-close {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: var(--text-color);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .mobile-sidebar-close:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .mobile-sidebar-content {
        padding: 8px;
    }

    .mobile-nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: 12px;
        color: var(--text-color);
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 500;
        margin-bottom: 4px;
        transition: background 0.2s ease;
    }

    .mobile-nav-item:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    .mobile-nav-item svg {
        flex-shrink: 0;
        opacity: 0.7;
    }

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

@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }

    .mobile-hidden {
        display: none !important;
    }

    .mobile-appbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        z-index: 100;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: var(--text-color);
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .mobile-menu-btn:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .mobile-appbar-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-color);
        letter-spacing: -0.02em;
    }

    .mobile-appbar-center {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .mobile-ai-model-selector {
        position: relative;
    }

    .mobile-model-btn {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 10px;
        background: rgba(0, 0, 0, 0.04);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 12px;
        font-size: 0.75rem;
        color: var(--subtext-color);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-model-text {
        font-weight: 500;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-model-icon {
        transition: transform 0.2s ease;
    }

    .mobile-model-icon.rotate {
        transform: rotate(180deg);
    }

    .mobile-model-dropdown {
        position: fixed;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100vw - 32px);
        max-width: 400px;
        background: var(--container-bg);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        max-height: 60vh;
        overflow-y: auto;
        z-index: 1000;
    }

    .mobile-model-option {
        width: 100%;
        padding: 12px 16px;
        border: none;
        background: transparent;
        color: var(--text-color);
        cursor: pointer;
        transition: background 0.2s ease;
        text-align: left;
    }

    .mobile-model-option:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    .mobile-model-option.selected {
        background: rgba(102, 126, 234, 0.08);
    }

    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 99;
    }

    .mobile-sidebar-overlay.visible {
        display: block;
        opacity: 1;
    }

    .mobile-sidebar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: var(--container-bg);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 100;
        overflow-y: auto;
    }

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

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

    .mobile-sidebar-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-color);
        margin-left: 8px;
    }

    .mobile-sidebar-close {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: var(--text-color);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .mobile-sidebar-close:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .mobile-sidebar-content {
        padding: 8px;
    }

    .mobile-nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: 12px;
        color: var(--text-color);
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 500;
        margin-bottom: 4px;
        transition: background 0.2s ease;
    }

    .mobile-nav-item:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    .mobile-nav-item svg {
        flex-shrink: 0;
        opacity: 0.7;
    }

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

    .sidebar-nav {
        display: none !important;
    }

    .sidebar-score {
        display: none !important;
    }

    .score-container {
        display: none !important;
    }

    .ad-column {
        display: none !important;
    }

    .input-bottom-bar {
        display: none;
    }

    /* モバイル: 質問入力コンテナとcomposerフッター */
    .mobile-composer-footer {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px;
        margin-top: 12px;
        width: 100%;
        flex-wrap: nowrap;
        /* 1行に収める */
    }

    /* モバイル: 送信ボタン（右端固定） */
    .composer-submit-btn {
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: none;
        background: #000000;
        color: #ffffff;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
        transition: transform 0.15s ease, box-shadow 0.15s ease;
        cursor: pointer;
        margin-left: auto;
        /* 右端に配置 */
        order: 2;
        /* 送信ボタンを後ろに */
    }

    .composer-submit-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    }

    .composer-submit-btn:active {
        transform: translateY(0);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .composer-submit-btn:focus-visible {
        outline: 2px solid rgba(102, 126, 234, 0.6);
        outline-offset: 2px;
    }

    .composer-submit-btn svg {
        width: 20px;
        height: 20px;
        color: currentColor;
        stroke: currentColor;
    }

    .main-layout {
        gap: 0;
        padding: 0;
        margin: 56px 0 0 0;
        min-height: calc(100vh - 56px);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content-ad-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        max-width: 100%;
        width: 100%;
        padding: 20px 16px 24px 16px;
        box-shadow: none;
        border: none;
        background: transparent;
    }

    .modern-form {
        margin: 0 auto;
        background: transparent;
        padding: 0;
        max-width: 600px;
        width: 100%;
    }

    .form-section {
        padding: 0;
        margin-bottom: 0;
    }

    /* モバイル: チャットタイプバッジ（横並び） */
    .mobile-chat-type-badges {
        display: flex !important;
        gap: 10px;
        margin: 0;
        /* margin-bottomは削除 */
        flex: 1 1 auto;
        align-items: center;
        justify-content: flex-start;
        min-width: 0;
        flex-wrap: nowrap;
        order: 1;
        /* チャットタイプを先に */
        max-width: calc(100% - 56px);
        /* 送信ボタンのスペースを確保 */
    }

    .mobile-badge-item {
        flex: 0 1 auto;
        position: relative;
        cursor: pointer;
        display: inline-flex;
    }

    .mobile-badge-item input[type="radio"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-badge-label {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px 14px;
        border-radius: 20px;
        border: 1.5px solid var(--border-color);
        background: var(--container-bg);
        color: var(--subtext-color);
        font-size: 0.85rem;
        font-weight: 500;
        transition: background 0.35s ease, border-color 0.35s ease, color 0.3s ease, box-shadow 0.45s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        white-space: nowrap;
        min-width: auto;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
        will-change: transform, box-shadow, background, border-color;
    }

    .mobile-badge-item.selected .mobile-badge-label {
        transform: translateY(-2px);
        box-shadow: 0 14px 28px -18px rgba(15, 23, 42, 0.24);
        font-weight: 600;
    }

    .mobile-badge-item.private-badge.selected .mobile-badge-label {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.06) 100%);
        border-color: rgba(16, 185, 129, 0.55);
        color: #0f766e;
    }

    .mobile-badge-item.open-badge.selected .mobile-badge-label {
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.08) 100%);
        border-color: rgba(245, 158, 11, 0.6);
        color: #b45309;
    }

    .mobile-badge-label svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    /* PC版のチャットタイプセクションをモバイルで完全非表示 */
    .chat-type-selection {
        display: none !important;
    }

    .radio-group {
        display: none !important;
    }

    .radio-label {
        display: none !important;
    }

    .question-input-wrapper {
        min-height: 0;
        margin-bottom: 0;
    }

    .question-input-container {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        border-radius: 24px;
        min-height: 52px;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.9);
        border: 1.5px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        display: flex;
        flex-direction: column;
        gap: 8px;
        box-sizing: border-box;
    }

    .question-textarea {
        font-size: 1rem;
        padding: 0;
        min-height: 24px;
        line-height: 1.5;
    }

    .question-textarea::placeholder {
        color: var(--subtext-color);
        opacity: 0.6;
    }

    .flash-messages {
        margin: 0 0 16px 0;
    }
}

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .mobile-appbar {
        background: rgba(26, 27, 30, 0.95);
    }

    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .mobile-model-btn {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .mobile-model-option:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .mobile-sidebar {
        background: rgba(26, 27, 30, 0.95);
    }

    .mobile-sidebar-close:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .mobile-nav-item:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .composer-submit-btn {
        background: #ffffff;
        color: #000000;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    }

    .composer-submit-btn:hover {
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
    }

    .question-input-container {
        background: rgba(40, 42, 48, 0.9);
        border-color: rgba(255, 255, 255, 0.12);
    }
}

/* 1024px以下でもモバイルヘッダーを有効化し、サイドバーを隠す（優先度確保のため末尾に配置） */
@media (max-width: 1024px) {
    .mobile-appbar {
        display: flex !important;
    }

    .sidebar-nav {
        display: none !important;
    }

    .sidebar-score {
        display: none !important;
    }

    .sidebar-footer {
        display: none !important;
    }
}