@media (prefers-color-scheme: dark) {
    /* AIモデル選択のドロップダウンもTom Selectと同じスタイルに */
    .model-select,
    .model-select:focus,
    .model-select:hover {
        background: linear-gradient(135deg, #1e293b 0%, #1b232f 100%) !important;
        border-color: #5b5e8d !important;
        color: #e0e3ea !important;
        transition: background 0.2s, color 0.2s, border 0.2s;
    }
    .model-select:focus {
        border-color: #60a5fa !important;
        background: #1e293b !important;
    }
    .model-select:disabled {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
        color: #64748b !important;
        border-color: #334155 !important;
    }
}
@media (prefers-color-scheme: dark) {
    /* ドロップダウンメニューのホバー時の背景を濃い青系に */
    .ts-dropdown .option:hover,
    .ts-dropdown .option.active,
    .ts-dropdown .option.focus {
        background: #22305a !important;
        color: #e0e3ea !important;
    }
}
@media (prefers-color-scheme: dark) {
    /* Tom Selectドロップダウンメニュー内のテキストを明るいグレーに */
    .ts-dropdown,
    .ts-dropdown .option,
    .ts-dropdown .optgroup-header {
        color: #e0e3ea !important;
    }
}
@media (prefers-color-scheme: dark) {
    /* ドロップダウンメニューのテキストをグレー系に */
    .dropdown-menu,
    .dropdown-item {
        color: #bfc4ce !important;
    }
    /* ナビゲーションボタンのSVGとテキストも明るいグレーに */
    .nav-btn,
    .nav-btn .nav-text,
    .nav-btn .nav-icon svg {
        color: #e0e3ea !important;
        fill: none !important; /* 外枠のみ */
        stroke: #e0e3ea !important;
        stroke-width: 2px !important;
    }
    /* gimmy-titleも明るいグレー系に */
    .gimmy-title {
        color: #e0e3ea !important;
    }
}
/* ================================================================
   INDEX.CSS - 質問投稿ページ専用スタイル
   ================================================================
   
   目次:
   1. 現代的フォームデザイン
   2. 質問入力フォーム
   3. Tom Select モダンデザイン 2025（アーカイブページから移植）
   4. レスポンシブ対応
   5. 2カラムレイアウト（メインコンテンツ + 広告）
   6. ダークモード対応
   7. チャットタイプ選択
   8. サイドバーレイアウト
   9. ナビゲーションタイトル（Gimmy）
   10. サイドバーナビゲーション
   11. Gimmyタイトル設定
   12. その他のコンポーネント
   
   保守性の改善:
   - 不要な!importantの削除
   - 適切なコメントの追加
   - 再利用可能なスタイルの整理
   
   ================================================================ */

/* === 1. 現代的フォームデザイン === */

/* フォーム全体のコンテナ */
.modern-form {
    max-width: 100%;
    margin: 0 0 20px 0;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.modern-form:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* フォームヘッダー */
.form-header {
    background: linear-gradient(135deg, #3290f5 0%, #2dc3d7 100%);
    color: white;
    padding: 24px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.form-header::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.22) 0%, transparent 30px),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.20) 0%, transparent 25px),
        radial-gradient(circle at 60% 80%, rgba(255, 255, 255, 0.18) 0%, transparent 28px),
        radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.15) 0%, transparent 22px);
    animation: enhanced-float 15s ease-in-out infinite;
    pointer-events: none;
}

.form-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        polygon(20% 10%, 25% 10%, 22.5% 15%) at 0 0,
        polygon(60% 20%, 65% 20%, 62.5% 25%) at 40px 30px,
        polygon(80% 60%, 85% 60%, 82.5% 65%) at -20px 50px;
    background-size: 100px 100px;
    opacity: 0.20;
    animation: enhanced-triangle-drift 20s linear infinite;
    pointer-events: none;
}

@keyframes enhanced-float {
    0%, 100% { 
        transform: translateX(0) translateY(0);
    }
    25% { 
        transform: translateX(8px) translateY(-6px);
    }
    50% { 
        transform: translateX(0) translateY(2px);
    }
    75% { 
        transform: translateX(-8px) translateY(4px);
    }
}

@keyframes enhanced-triangle-drift {
    0% { 
        background-position: 0 0, 40px 30px, -20px 50px;
        transform: translateX(0) translateY(0);
    }
    25% { 
        background-position: 25px 0, 65px 30px, 5px 50px;
        transform: translateX(3px) translateY(-2px);
    }
    50% { 
        background-position: 50px 0, 90px 30px, 30px 50px;
        transform: translateX(0) translateY(0);
    }
    75% { 
        background-position: 75px 0, 115px 30px, 55px 50px;
        transform: translateX(-3px) translateY(2px);
    }
    100% { 
        background-position: 100px 0, 140px 30px, 80px 50px;
        transform: translateX(0) translateY(0);
    }
}

@media (prefers-color-scheme: dark) {
    .form-header {
        background: linear-gradient(135deg, #381e94 0%, #051e38 100%);
    }
}

.form-title {
    font-family: 'Source Sans 3', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    position: relative;
    z-index: 1;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.form-subtitle {
    color: white;
    font-size: 1.05rem;
    opacity: 0.95;
    margin: 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* フォームセクション */
.form-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

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

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

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

/* 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: var(--container-bg);
    border: 2px solid #e1e5e9;
    border-radius: 16px;
    box-sizing: border-box;
    overflow: visible;
    z-index: 10; /* 上に重ねる */
}
.question-input-container:focus-within {
    border-color: var(--primary-color);
}

@media (prefers-color-scheme: dark) {
  .question-input-container {
    border-color: #70737865 !important; /* 濃いグレー */
  }
  .question-input-container:focus-within {
    border-color: var(--dark-primary-color) !important;
  }
}

.question-textarea {
    width: 100%;
    min-height: 48px; /* 1行分の高さを固定 */
    max-height: 300px; /* 最大高さを拡大 */
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 16px 16px 0 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: #9ca3af;
    font-style: normal;
}

/* 下部固定エリア（ボタンとガイド） */
.input-bottom-bar {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 4px 12px 10px 12px;
    height: 56px; /* 固定高さに変更 */
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    background: transparent; /* 背景を透明にしてコンテナの角丸を表示 */
    border-top: none; /* ボーダーを削除 */
}

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

/* 送信ボタン（下部バーに配置） */
.submit-btn,
.mobile-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,
.mobile-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

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

.submit-btn svg,
.mobile-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,
    .mobile-submit-btn { background: #ffffff !important; color: #000000 !important; border-color: #475569 !important; }
    .submit-btn:hover,
    .mobile-submit-btn:hover { background: #ffffff !important; }
}

/* ライトモード：送信ボタンは黒背景・白アイコン */
@media (prefers-color-scheme: light) {
    .submit-btn,
    .mobile-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,
    .mobile-submit-btn:hover { background: #000000 !important; }
    .submit-btn svg,
    .mobile-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);
        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);
        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 0 32px 0;
        max-width: 100%;
    }

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

    .archive-links ul {
        grid-template-columns: 1fr; /* モバイルでは1列 */
        gap: 12px;
        padding: 16px;
    }

    .form-header {
        padding: 24px 20px;
    }

    .form-title {
        font-size: 1.5rem;
    }

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

    .form-section {
        padding: 24px;
    }

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

/* === 5. 2カラムレイアウト（メインコンテンツ + 広告） === */
@media (max-width: 768px) {
    .question-input-container {
        min-height: 70px;
    }
    
    .question-textarea {
        font-size: 1rem;
        padding: 12px 12px 0 12px;
        min-height: 22px;
    }
    
    .input-bottom-bar {
        padding: 6px 12px 10px 12px;
        min-height: 48px;
        gap: 8px;
    }
    
    .form-guide {
        font-size: 0.75rem;
        line-height: 1.3;
    }
    
    .submit-btn,
    .mobile-submit-btn { width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important; aspect-ratio: 1 / 1 !important; }
    
    .submit-btn svg,
    .mobile-submit-btn svg { width: 14px !important; height: 14px !important; }
}

@media (max-width: 480px) {
    .question-input-container {
        min-height: 65px;
    }
    
    .question-textarea {
        font-size: 0.95rem;
        padding: 10px 10px 0 10px;
        min-height: 20px;
    }
    
    .input-bottom-bar {
        padding: 5px 10px 8px 10px;
        min-height: 45px;
        gap: 6px;
    }
    
    .form-guide {
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .submit-btn,
    .mobile-submit-btn { width: 30px !important; height: 30px !important; min-width: 30px !important; min-height: 30px !important; aspect-ratio: 1 / 1 !important; }
    
    .submit-btn svg,
    .mobile-submit-btn svg { width: 14px !important; height: 14px !important; }
}

/* === 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: var(--container-bg);
    border-right: 1px solid var(--border-color);
    padding: 8px 6px;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0; /* サイドバーを左端に固定 */
    overflow-y: hidden; /* 縦スクロールバーを削除 */
    overflow-x: hidden; /* 横スクロールバーを完全に削除 */
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    flex-shrink: 0;
    z-index: 10;
    box-sizing: border-box;
    word-wrap: break-word; /* 長いテキストを折り返し */
}

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

/* === 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 */
.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;
    transition: all 0.15s ease;
    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: 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-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: 680px;
    width: 100%;
    margin: 0;
    background: var(--container-bg);
    border-radius: 16px;
    box-shadow: 0 0 8px rgba(0,0,0,0.04);
    padding: 4px 6px 4px 6px;
    min-height: 480px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

/* 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: 'Roboto 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. チャットタイプ選択 === */
.chat-type-selection {
    margin: 16px 0;
}

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

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 200px;
}

.radio-label:hover {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

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

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

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

/* === チャットタイプ選択：選択済み強調 === */
.private-radio.selected {
    background: rgba(16, 185, 129, 0.12);
    border-color: #10b981;
    box-shadow: 0 0 0 1px #10b98133;
}
.open-radio.selected {
    background: rgba(245, 158, 11, 0.12);
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px #f59e0b33;
}

/* 質問入力ラッパー */
.question-input-wrapper {
    position: relative; /* 絶対配置コンテナの基準 */
    min-height: 124px; /* 初期コンテナ高さ (textarea 64px + 下部バー 56px +border 4px) */
}

/* === 既存のスタイル === */
/* サイドバーゲームコンテナ */
.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); /* ダークモードの背景色 */
    }
}

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

/* スコア表示コンテナ */
.score-container {
    background: var(--container-bg);
    border-radius: 12px;
    margin: 0;
    padding: 0 8px 2px 8px;
    display: flex;
    flex-direction: column;
    height: 425px; /* 固定高さを設定 */
}

.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 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 50%, #047857 100%);
    border-radius: 6px;
    transition: width 0.6s ease-in-out;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* プログレスバーの目盛り線 */
.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: 500;
    font-size: 1.7rem;
    letter-spacing: 0.02em;
    color: #3b3b3b;
    margin-left: 0;
    line-height: 1.2;
}

/* 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, #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),
        0 0 0 0px rgba(59, 130, 246, 0) !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;
    box-shadow: 0 3px 14px rgba(59, 131, 246, 0.22) !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 10px 40px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(59, 130, 246, 0.2) !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, #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;
    }
    
    .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; /* 最小幅はコントロールと同じ */
    }
    
    /* 基本的なオプションスタイルは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モデル選択器 */
.ai-model-selector {
    flex-shrink: 0;
}

.model-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.model-select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    min-width: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.model-select:hover {
    border-color: var(--primary-color);
}

/* モデル変更通知 */
.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-selector-wrapper {
        justify-content: space-between;
    }
    
    .model-select {
        min-width: 140px;
    }
    
    .model-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .model-select {
        background-color: var(--dark-input-bg);
        border-color: var(--dark-border-color);
        color: var(--dark-text-primary);
    }
    
    .model-select:focus {
        border-color: var(--dark-primary-color);
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
    
    .model-select:hover {
        border-color: var(--dark-primary-color);
    }
    
    .model-label {
        color: var(--dark-text-secondary);
    }
}

/* モデル解放エフェクト */
.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-controls { display: none; }

@media (max-width: 768px) {
    /* モバイル用トップバー */
    .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);
        text-decoration: none;
        transition: background 0.15s ease, transform 0.1s ease;
    }

    .mobile-appbar .appbar-btn:hover { background: rgba(0,0,0,0.05); }
    @media (prefers-color-scheme: dark) {
        .mobile-appbar .appbar-btn:hover { background: rgba(255,255,255,0.06); }
    }

    /* サイドバーとスコア、広告をモバイルで非表示化 */
    .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; }

    /* モバイル専用コントロールの表示と配置 */
    .mobile-controls {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 10px 0 0 0;
    }
    .mobile-model-controls { flex: 1 1 auto; min-width: 0; }
    .mobile-model-controls .model-select { width: 100%; }
    .mobile-submit-btn { flex: 0 0 auto; }

    /* レイアウトの呼吸を確保 */
    .main-layout {
        gap: 12px;
        padding: 0 10px 16px 10px;
        margin: 0 auto;
        min-height: calc(100vh - 56px);
    }

    .content-ad-wrapper { width: 100%; max-width: 100%; margin: 0 auto; }
    .main-content { max-width: 100%; width: 100%; padding: 12px 8px 16px 8px; box-shadow: none; border: none; }

    /* フォームの余白最適化 */
    .modern-form { margin: 8px 0 16px 0; border-radius: 14px; }
    .form-section { padding: 16px; }
    .form-header { padding: 18px 16px; }
    .form-title { font-size: 1.25rem; }
    .form-subtitle { font-size: 0.9rem; }

    /* 入力エリアはモバイルで通常フローに */
    .question-input-wrapper { min-height: 0; }
    .question-input-container { position: relative; }
}

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