:root {
    /* カラーパレット */
    --line-green: #06C755;
    --line-green-dark: #05b34c;
    --line-bg: #8cabd0;
    --line-white: #FFFFFF;
    --line-gray: #E5E5EA;
    --line-bubble-user: #85e249;
    --line-text: #333333;
    --line-text-light: #8E8E93;
    --radius: 12px;
}

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

html {
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    /* 横スクロールバー非表示 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f0f0;
    color: var(--line-text);
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    /* 横スクロールバー非表示 */
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--line-bg);
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 固定ヘッダー */
.fixed-header {
    background: #353b48;
    color: white;
    padding: 10px 15px;
    z-index: 100;
    flex-shrink: 0;
}

.header-content h1 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.header-content select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.header-content select option {
    background: #353b48;
    color: white;
}

/* チャットセクション */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* 横スクロールバー非表示 */
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* スクロールバーのスタイリング - 使用時のみ表示 */
.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* チャットバブル */
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 15px;
    position: relative;
    word-wrap: break-word;
}

/* ホバー時の追加ボタン */
.bubble-add-btn {
    position: absolute;
    top: 50%;
    right: -120px;
    transform: translateY(-50%);
    padding: 6px 12px;
    background: var(--line-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    /* 見えない時はクリック不可 */
    transition: opacity 0.2s, right 0.2s;
    white-space: nowrap;
    z-index: 10;
}

.chat-bubble.show-actions .bubble-add-btn {
    opacity: 1;
    pointer-events: auto;
    /* 表示時のみクリック可能 */
    right: -130px;
}

.bubble-add-btn:hover {
    background: var(--line-green-dark);
}


/* User bubble specific button positioning */
.chat-bubble.user .bubble-add-btn {
    right: auto;
    left: -120px;
}

.chat-bubble.user.show-actions .bubble-add-btn {
    right: auto;
    left: -130px;
}

.chat-bubble.user {
    background: var(--line-bubble-user);
    color: #000;
    align-self: flex-end;
    border-top-right-radius: 4px;
}

.chat-bubble.ai {
    background: var(--line-white);
    color: var(--line-text);
    align-self: flex-start;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-bubble.system {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    align-self: center;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 10px;
    margin: 10px 0;
}

.model-info-text {
    font-size: 0.7rem;
    color: var(--line-text-light);
    margin-top: 4px;
    text-align: right;
    white-space: nowrap;
    opacity: 0.8;
}

/* プロパティカード（AIバブル内に表示） */
.props-card {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    border-left: 3px solid var(--line-green);
    font-size: 13px;
}

.props-card-row {
    display: flex;
    flex-direction: column;
    padding: 3px 0;
}

.props-card-row+.props-card-row {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 3px;
    padding-top: 6px;
}

.props-card-key {
    font-size: 11px;
    font-weight: 600;
    color: var(--line-text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.props-card-val {
    color: var(--line-text);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

/* AI応答待ちインジケーター */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    margin: 0 15px 10px 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    max-width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-typing-indicator.hidden {
    display: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--line-green);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.typing-text {
    font-size: 13px;
    color: var(--line-text-light);
    font-weight: 500;
}

/* 入力コンテナ */
.input-container {
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.status-area {
    padding: 4px 15px;
    min-height: 24px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--line-text-light);
    background: rgba(255, 255, 255, 0.8);
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top: 2px solid var(--line-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 属性コンテナ */
.properties-container {
    background: white;
    border-top: 1px solid #eee;
}

.toggle-props-btn {
    width: 100%;
    padding: 12px 15px;
    background: #f9f9f9;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.toggle-props-btn:hover {
    background: #f0f0f0;
}

.toggle-props-btn:active {
    background: #e8e8e8;
}

/* 属性セクション（アニメーション付き） */
.properties-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
    padding: 0 15px;
    border-bottom: none;
}

.properties-section:not(.hidden) {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    /* 横スクロールバー非表示 */
    padding: 15px;
    border-bottom: 1px solid #eee;
}

/* 属性セクションのスクロールバー - 使用時のみ表示 */
.properties-section::-webkit-scrollbar {
    width: 6px;
}

.properties-section::-webkit-scrollbar-track {
    background: transparent;
}

.properties-section::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.properties-section::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.prop-field {
    margin-bottom: 12px;
}

.prop-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.prop-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
    background: white;
}

/* ===== INPUT AREA - LINE STYLE ===== */
.input-area {
    padding: 10px 15px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

/* ===== Image Attachment Area (shared: image preview + image gen tag) ===== */
.image-attachment-area {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 5px;
}

.image-preview-item {
    position: relative;
    display: inline-block;
}

.image-preview-item img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

/* Image Gen Tag Item */
.image-gen-tag-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.image-gen-tag {
    display: inline-block;
    padding: 6px 12px;
    background: #fff3e0;
    color: #f57c00;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid #ffe0b2;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.remove-image-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Input Row - LINE Style */
.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.btn-add-media {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--line-green);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.btn-add-media:hover {
    background: var(--line-green-dark);
}

.btn-add-media:active {
    transform: scale(0.95);
}

.input-row textarea {
    flex: 1;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 45px 8px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    background: #f9f9f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-y: hidden;
    width: 100%;
}

.input-row textarea:focus {
    background: white;
    border-color: var(--line-green);
}

/* テキスト入力とスタンプボタンのラッパー */
.input-wrapper {
    flex: 1;
    position: relative;
}

.btn-send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--line-green);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.btn-send:hover {
    background: var(--line-green-dark);
}

.btn-send:active {
    transform: scale(0.95);
}

/* Media Menu */
.media-menu {
    position: absolute;
    bottom: 70px;
    left: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #e0e0e0;
}

.media-menu button {
    padding: 12px 16px;
    background: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.media-menu button:hover {
    background: #f5f5f5;
}

/* Emoji/Stamp Button - テキストボックス内右側配置 */
.btn-emoji {
    position: absolute;
    right: 8px;
    bottom: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: #333;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
    padding: 0;
    z-index: 5;
}

.btn-emoji:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btn-emoji:active {
    transform: scale(0.95);
}

/* Emoji Palette - LINE Style (slide up from bottom) */
.emoji-palette {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18);
    padding: 16px;
    z-index: 200;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.emoji-palette:not(.hidden) {
    transform: translateY(0);
}

.emoji-palette-header {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    padding: 0 4px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    /* 横スクロールバー非表示 */
}

/* 絵文字グリッドのスクロールバー - 使用時のみ表示 */
.emoji-grid::-webkit-scrollbar {
    width: 6px;
}

.emoji-grid::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.emoji-btn {
    width: 100%;
    aspect-ratio: 1;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    padding: 4px;
}

.emoji-btn:hover {
    background: #f0f0f0;
    transform: scale(1.15);
}

.emoji-btn:active {
    transform: scale(0.95);
}

/* スタンプ表示（吹き出しなしの大きな絵文字・右側表示） */
.chat-stamp {
    font-size: 64px;
    line-height: 1.2;
    padding: 8px;
    background: transparent;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
}

/* スタンプ表示（インライン用） */
.stamp-display {
    font-size: 64px;
    line-height: 1;
    display: block;
}

/* 会話クリアボタン（チャットログ右下に浮遊表示） */
.btn-clear-session-floating {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 8px 16px;
    background: rgba(240, 240, 240, 0.95);
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 50;
    backdrop-filter: blur(8px);
}

.btn-clear-session-floating:hover {
    background: rgba(229, 229, 229, 0.95);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.btn-clear-session-floating:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}




/* Notion-style Table */
.notion-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    /* 縦スクロールバー非表示 */
}

/* Notionテーブルラッパーのスクロールバー - 使用時のみ表示 */
.notion-table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.notion-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.notion-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.notion-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.notion-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.notion-table th {
    background: #f4f4f4;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #ddd;
}

.notion-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

/* Notion Blocks */
.notion-block {
    margin-bottom: 8px;
}

.notion-heading_1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 16px;
}

.notion-heading_2 {
    font-size: 1.3rem;
    font-weight: bold;
    margin-top: 12px;
}

.notion-heading_3 {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 8px;
}

.notion-paragraph {
    line-height: 1.6;
}

.notion-bulleted_list_item::before {
    content: "• ";
    margin-right: 8px;
}

.notion-numbered_list_item {
    list-style-position: inside;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 300;
}

.hidden {
    display: none !important;
}

.placeholder-text {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}

/* ヘッダーコントロール */
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-controls select {
    flex: 1;
    width: auto;
}

.header-btn {
    padding: 8px 16px;
    background: var(--line-green);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.header-btn:hover:not(:disabled) {
    background: var(--line-green-dark);
}

.header-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* モーダルオーバーレイ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

/* モーダルコンテンツ */
.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* モーダルヘッダー */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* モーダルボディ */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-info {
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 14px;
}

.prompt-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    min-height: 200px;
    box-sizing: border-box;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--line-green);
    box-shadow: 0 0 0 2px rgba(6, 199, 85, 0.1);
}



/* モーダルフッター */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-secondary,
.btn-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-primary {
    background: var(--line-green);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--line-green-dark);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 全画面モーダル用スタイル */
.modal-fullscreen {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

.modal-fullscreen .modal-body {
    max-height: calc(100% - 140px);
}

/* コンテンツプレビューボックス */
.content-preview-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.content-preview-box.database-view {
    border: 2px solid var(--line-green);
    margin: 10px;
    border-radius: 10px;
    padding: 10px;
}

/* Settings Menu */
.settings-menu {
    position: absolute;
    top: 60px;
    right: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 250px;
    z-index: 200;
    overflow: hidden;
    padding: 8px 0;
    border: 1px solid #e0e0e0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 14px;
    color: #333;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: #eee;
    margin: 8px 0;
}

.menu-info-item {
    padding: 10px 16px;
    font-size: 12px;
    color: #666;
    background: #fdfdfd;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toggle Switch in Menu */
.toggle-item {
    justify-content: space-between;
    cursor: pointer;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-item input {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: #ddd;
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-item input:checked+.toggle-switch {
    background: var(--line-green);
}

.toggle-item input:checked+.toggle-switch::after {
    transform: translateX(16px);
}

/* State Display */
.state-display {
    padding: 8px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.state-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #555;
    cursor: pointer;
}

#stateText {
    flex: 1;
    margin-left: 10px;
    font-weight: 500;
}

.state-toggle {
    background: none;
    border: none;
    color: #999;
    font-size: 10px;
    cursor: pointer;
}

.state-details {
    margin-top: 8px;
    padding: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow-x: auto;
}

#stateDetailsContent {
    margin: 0;
    font-family: monospace;
    font-size: 11px;
    white-space: pre-wrap;
    color: #666;
}

/* Model Selection List */
.model-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-category {
    margin-bottom: 24px;
}

.model-category:last-child {
    margin-bottom: 0;
}

.model-category-header {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: #333;
}

.model-category-note {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
}

.model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.model-item:hover {
    background: #f9f9f9;
    border-color: #ddd;
}

.model-item.selected {
    border-color: var(--line-green);
    background: rgba(6, 199, 85, 0.05);
}

.model-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-name {
    font-weight: 600;
    font-size: 14px;
}

.model-provider {
    font-size: 12px;
    color: #888;
}

.model-check {
    color: var(--line-green);
    font-weight: bold;
    font-size: 18px;
}

/* Model Badges */
.model-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 4px;
    width: fit-content;
}

.model-badge.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.model-badge.not-recommended {
    background: #f5f5f5;
    color: #ff8c00;
    border: 1px solid #ddd;
}

.model-badge.recommended {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.model-pricing {
    display: inline-block;
    font-size: 0.7em;
    color: #999;
    margin-left: 8px;
    font-weight: normal;
}


/* ⚠️ 本番環境では削除: デバッグ関連スタイル */

/* デバッグメニューアイテム */
.debug-menu-item {
    border-top: 1px solid rgba(255, 100, 100, 0.2);
    background-color: rgba(255, 100, 100, 0.05);
}

.debug-menu-item:hover {
    background-color: rgba(255, 100, 100, 0.1);
}

/* デバッグモーダル（幅広） */
.modal-wide {
    max-width: 900px;
    width: 90%;
}

/* デバッグ情報コンテンツ（スクロールは .modal-body に委譲） */

.debug-timestamp {
    text-align: right;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1rem;
}

.debug-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.debug-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

/* グリッドレイアウト */
.debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.debug-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #4CAF50;
}

.debug-label {
    font-weight: 600;
    color: #555;
}

.debug-value {
    color: #333;
    font-family: 'Courier New', monospace;
}

.debug-path {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9rem;
    word-break: break-all;
}

/* ファイルシステムリスト */
.debug-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debug-fs-item {
    padding: 0.75rem;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #ddd;
}

.debug-fs-item.exists {
    border-left-color: #4CAF50;
}

.debug-fs-item.missing {
    border-left-color: #f44336;
    background: #ffebee;
}

.debug-fs-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.debug-fs-status {
    font-size: 1.2rem;
}

.debug-fs-path {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #333;
    flex: 1;
}

.debug-fs-details {
    margin-top: 0.25rem;
    margin-left: 2rem;
    font-size: 0.85rem;
    color: #666;
}

/* ルート情報 */
.debug-routes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.debug-route-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.debug-route-path {
    flex: 1;
    font-family: 'Courier New', monospace;
    color: #1976D2;
}

.debug-route-methods {
    padding: 2px 8px;
    background: #E3F2FD;
    color: #1565C0;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
}

.debug-route-name {
    color: #666;
    font-size: 0.85rem;
}

/* エラー表示 */
.debug-error {
    text-align: center;
    padding: 2rem;
}

.debug-error h3 {
    color: #f44336;
    margin-bottom: 1rem;
}

.debug-hint {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #FFF3E0;
    border-left: 4px solid #FF9800;
    border-radius: 4px;
    text-align: left;
}

.debug-hint code {
    background: #FFE0B2;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* === API通信履歴セクション (Debug API History) === */
.btn-copy-debug {
    margin-left: 10px;
    padding: 4px 10px;
    font-size: 0.75rem;
    background: var(--line-green);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-copy-debug:hover {
    background: var(--line-green-dark);
}

.debug-api-history {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debug-api-entry {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    border-left: 4px solid #4CAF50;
}

.debug-api-entry.error {
    border-left-color: #f44336;
}

.debug-api-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.debug-api-num {
    font-weight: bold;
    color: #666;
}

.debug-api-endpoint {
    font-family: 'Courier New', monospace;
    color: #1976D2;
    font-weight: 600;
}

.debug-api-status {
    padding: 2px 8px;
    background: #E8F5E9;
    color: #2E7D32;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
}

.debug-api-entry.error .debug-api-status {
    background: #FFEBEE;
    color: #C62828;
}

.debug-api-time {
    color: #999;
    font-size: 0.8rem;
    margin-left: auto;
}

.debug-api-details {
    margin-top: 0.5rem;
}

.debug-api-details summary {
    cursor: pointer;
    color: #666;
    font-size: 0.85rem;
    padding: 4px 0;
}

.debug-api-details summary:hover {
    color: #333;
}

.debug-api-body {
    margin-top: 0.5rem;
}

.debug-api-body strong {
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: #333;
}

.debug-code {
    background: #263238;
    color: #ECEFF1;
    padding: 0.75rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}

.debug-error-label {
    color: #f44336 !important;
}

.debug-error-text {
    background: #FFEBEE;
    color: #C62828;
}

/* プロンプトモーダル内のターゲット選択 */
.modal-info {
    margin-bottom: 16px;
}

.modal-info label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

#promptTargetSelect {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

#promptTargetSelect:hover {
    border-color: var(--line-green);
    background: white;
}

#promptTargetSelect:focus {
    border-color: var(--line-green);
    background: white;
    box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.1);
}

#promptTargetSelect option {
    padding: 10px;
    background: white;
    color: #333;
}

/* モデル選択リストのプロバイダーグループヘッダー */
.model-group-header {
    font-weight: 600;
    font-size: 0.85em;
    color: #666;
    padding: 10px 12px 6px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.model-group-header:first-of-type {
    border-top: none;
}

/* ⚠️ ここまで削除（本番環境では） */
#appSelector option {
    background-color: #353b48 !important;
    color: var(--line-white) !important;
    padding: 8px 12px;
}

/* === 画像生成タグエリア === */
/* (old image-gen-tag-area styles removed - now handled by .image-attachment-area) */

/* === AI生成画像コンテナ === */
.generated-image-container {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.generated-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}
