* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    color: #222;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.failsafe_crosslink {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 38px;
    padding: 8px 14px;
    border-bottom: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a5f;
    font-size: 13px;
    line-height: 1.35;
}

html.public_failsafe_offer .failsafe_crosslink {
    display: flex;
}

.failsafe_crosslink strong,
.failsafe_crosslink a {
    font-weight: 700;
}

.failsafe_crosslink a {
    flex: none;
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 640px) {
    .failsafe_crosslink {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 4px;
        padding-right: 52px;
        font-size: 12px;
    }
}

select {
    /* Native arrows steal space from long criteria names and make clipping look messy. */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
}

select::-ms-expand {
    display: none;
}

.api_connection_warning {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10000;
    max-width: min(420px, calc(100vw - 32px));
    background: #111;
    color: #fff;
    border: 1px solid #000;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    display: none;
}

.api_connection_warning.visible {
    display: block;
}

.main_container {
    display: flex;
    flex: 1;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

/* LEFT PANEL - IDEA POOL */
.idea_pool_panel {
    flex: 1 1 0;
    background: #fff;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.idea_list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 14px;
    visibility: visible;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}

.idea_list:focus, .idea_list:focus-visible {
    outline: none;
}

.idea_list::-webkit-scrollbar { width: 8px; }
.idea_list::-webkit-scrollbar-track { background: transparent; }
.idea_list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }

.idea_list.scroll_ready {
    visibility: visible;
}

.idea_item {
    background: none;
    padding: 8px 0;
    margin-bottom: 2px;
    border-bottom: 1px solid #eee;
    font-size: 19px;
    line-height: 1.4;
    color: #000;
    cursor: default;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.import_textarea {
    width: 100%;
    height: 60px;
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 8px;
    font-size: 12px;
    font-family: inherit;
    resize: none;
    margin-bottom: 8px;
}

.import_textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.import_row {
    display: flex;
    gap: 8px;
}

.worktree_actions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.worktree_auto_toggle.enabled {
    border-color: #15803d;
    color: #166534;
    background: #f0fdf4;
}

.worktree_auto_toggle.disabled {
    border-color: #b91c1c;
    color: #991b1b;
    background: #fef2f2;
}

.worktree_status {
    font-size: 11px;
    color: #666;
    line-height: 1.35;
    margin-bottom: 8px;
}

.worktree_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.worktree_card {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px;
    background: #fff;
}

.worktree_title {
    font-size: 12px;
    font-weight: 600;
    color: #111;
    word-break: break-word;
}

.worktree_meta {
    margin-top: 3px;
    font-size: 11px;
    color: #666;
    line-height: 1.35;
    word-break: break-word;
}

.worktree_review {
    margin-top: 4px;
    font-size: 11px;
    color: #166534;
    line-height: 1.35;
    word-break: break-word;
}

.worktree_review_bad {
    color: #991b1b;
    font-weight: 600;
}

.worktree_files {
    margin-top: 6px;
    max-height: 92px;
    overflow-y: auto;
    font-size: 11px;
    color: #444;
    line-height: 1.35;
}

.worktree_file_protected {
    color: #9a3412;
    font-weight: 600;
}

.worktree_buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.worktree_feed {
    padding: 12px;
}

.worktree_feed_header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.codex_messages_header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    font-size: 12px;
}

.codex_messages_header > div:first-child {
    min-width: 220px;
}

.codex_messages_header span {
    margin-left: 8px;
    color: #666;
    font-size: 11px;
}

.codex_messages_actions {
    display: flex;
    gap: 6px;
}

.codex_messages_status {
    padding: 16px;
    color: #777;
    font-size: 13px;
}

.codex_session_group {
    border-bottom: 1px solid #e5e7eb;
}

.codex_session_title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 2px;
    font-size: 12px;
    font-weight: 700;
    color: #111;
}

.codex_session_title span {
    flex: none;
    color: #777;
    font-size: 11px;
    font-weight: 500;
}

.codex_session_meta {
    padding: 0 12px 8px;
    color: #777;
    font-size: 11px;
    word-break: break-word;
}

.codex_message {
    padding: 10px 12px;
    border-top: 1px solid #f2f2f2;
}

.codex_message_meta {
    margin-bottom: 4px;
    color: #777;
    font-size: 11px;
}

.codex_message_text {
    color: #111;
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Three-dots menu */
.menu_wrapper {
    position: relative;
}

.menu_btn {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    letter-spacing: 1px;
}

.menu_dropdown {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #ddd;
    min-width: 220px;
    max-height: none;
    overflow-y: auto;
    z-index: 100;
}

.menu_dropdown.open {
    display: block;
}

.menu_item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    font-family: inherit;
}

.menu_item:hover {
    background: #f5f5f5;
}

.menu_item.active_option {
    font-weight: 600;
    color: #000;
}

.menu_separator {
    border-top: 1px solid #eee;
    margin: 4px 0;
}

.menu_import_section {
    display: none;
    padding: 8px 12px;
    border-top: 1px solid #eee;
}

.menu_import_section.visible {
    display: block;
}

.btn {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    padding: 7px 14px;
    border-radius: 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}
button:focus { outline: none; }

.btn.small {
    padding: 5px 10px;
    font-size: 11px;
}

/* MIDDLE PANEL - IDEA FEED */
.idea_feed_panel {
    flex: 1.2 1 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #eee;
}
.idea_feed_panel.hidden { display: none; }

.feed_extra_panels {
    display: contents;
}

.feed_extra_panel {
    flex: 1.2 1 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #eee;
}

.feed_extra_frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #fff;
}

/* SECOND IDEA LIST PANEL */
.idea_pool_panel_2 {
    flex: 1 1 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #eee;
}
.idea_pool_panel.hidden { display: none; }
.idea_pool_panel_2.hidden { display: none; }

.hidden_compat_select {
    display: none !important;
}

.feed_source_multi {
    position: relative;
    flex: none;
}

.feed_source_button {
    height: 24px;
    min-width: 86px;
    max-width: 190px;
    border: 1px solid #ccc;
    background: #fff;
    color: #555;
    padding: 0 8px;
    font-size: 12px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed_source_menu {
    position: absolute;
    top: 28px;
    left: 0;
    z-index: 2000;
    min-width: 190px;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    padding: 5px 0;
}

.feed_source_menu.hidden {
    display: none;
}

.feed_source_menu label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    color: #444;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.feed_source_menu label:hover {
    background: #f6f6f6;
}

.feed_source_menu input {
    margin: 0;
}

.feed_list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}
.feed_list::-webkit-scrollbar { width: 8px; }
.feed_list::-webkit-scrollbar-track { background: transparent; }
.feed_list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }
.feed_list:focus, .feed_list:focus-visible { outline: none; }
.feed_idea {
    display: flex;
    align-items: flex-start;
    gap: 11.5px;
    padding: 8px 12px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 19px;
    line-height: 1.55;
}
.feed_idea input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-top: 7px;
    cursor: pointer;
    border-radius: 3px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
}
.feed_idea input[type="checkbox"]:focus {
    outline: none;
}
.feed_idea input[type="checkbox"]:checked {
    background: #22c55e;
    border: 1.5px solid #22c55e;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>');
    background-size: 11px;
    background-position: center;
    background-repeat: no-repeat;
}
/* feed_idea_body owns the column layout (text + user note) so the
   feed_user_note div is a clean sibling of the text span, not nested
   inside an inline span where browsers auto-close it. */
.feed_idea_body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feed_idea_text {
    cursor: pointer;
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.feed_idea_text strong { font-weight: 600; }
.feed_code_block {
    margin: 6px 0;
    padding: 7px 9px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #f8fafc;
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-x: auto;
}
.feed_inline_code {
    padding: 1px 4px;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    background: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    font-size: 0.9em;
}
.feed_criteria_score {
    display: inline-block;
    min-width: 28px;
    padding: 1px 6px;
    margin-right: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 3px;
    vertical-align: 2px;
}
.feed_criteria_reason {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.45;
    color: #6b7280;
}
/* User's own reasoning + pick score, persisted via /api/strategy-ideas/user-note.
   Sits directly under the AI reason for the same idea so the eye reads
   idea -> ai reason -> your reason -> your score in one column. */
.feed_user_note {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin-top: 6px;
}
.feed_user_reason {
    flex: 1;
    min-height: 28px;
    max-height: 200px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    line-height: 1.45;
    font-family: inherit;
    color: #111;
    background: #fff;
    resize: none;
    box-sizing: border-box;
}
.feed_user_reason:focus { outline: none; }
.feed_user_score {
    width: 56px;
    min-width: 56px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    font-family: inherit;
    text-align: center;
    background: #fff;
    box-sizing: border-box;
}
.feed_user_score:focus { outline: none; }
.feed_user_score::-webkit-inner-spin-button,
.feed_user_score::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.feed_user_score { -moz-appearance: textfield; }
.feed_score_input {
    width: 52px;
    min-width: 52px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 2px 6px;
    font-size: 13px;
    font-family: inherit;
    text-align: right;
    margin-top: 3px;
    flex-shrink: 0;
    cursor: default;
}
.feed_score_input:focus { outline: none; border-color: #ddd; caret-color: transparent; }
.feed_score_input::-webkit-inner-spin-button,
.feed_score_input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.feed_score_input { -moz-appearance: textfield; }
.feed_list.show_selected .feed_score_input { display: none; }
/* Inline reply thread: opens under an idea on Ctrl+Click. Each thread is its
   own chat session — fire-and-forget so multiple ideas can stream in parallel. */
.feed_inline_thread {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
}
.feed_inline_thread_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.feed_inline_thread_close {
    border: 0;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
}
.feed_inline_thread_close:hover { color: #000; }
.feed_inline_msgs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
}
.feed_inline_msg { display: flex; flex-direction: column; }
.feed_inline_msg_user { align-items: flex-end; }
.feed_inline_msg_assistant { align-items: flex-start; }
.feed_inline_bubble {
    max-width: 92%;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}
.feed_inline_msg_user .feed_inline_bubble { background: #e5edff; border-radius: 10px 10px 2px 10px; color: #111; }
.feed_inline_msg_assistant .feed_inline_bubble { background: #fff; border: 1px solid #ececec; border-radius: 10px 10px 10px 2px; color: #111; }
.feed_inline_bubble pre { background: #f4f4f4; padding: 6px 8px; border-radius: 4px; overflow-x: auto; font-size: 12px; }
.feed_inline_bubble code { background: #f0f0f0; padding: 1px 4px; border-radius: 2px; font-size: 12px; }
.feed_inline_bubble pre code { background: none; padding: 0; }
.feed_inline_input_row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}
/* Same look as .feed_user_reason but takes the full row width. */
.feed_inline_input {
    flex: 1;
    min-height: 28px;
    max-height: 200px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.45;
    font-family: inherit;
    color: #111;
    background: #fff;
    resize: none;
    box-sizing: border-box;
    width: 100%;
}
.feed_inline_input:focus { outline: none; border-color: #aab8d4; }
.feed_inline_send {
    height: 30px;
    min-width: 56px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #111;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}
.feed_inline_send:disabled { opacity: 0.4; cursor: not-allowed; }
.feed_inline_status {
    font-size: 11px;
    color: #888;
    font-style: italic;
}
.feed_inline_status.thinking::after {
    content: ' \2026';
    animation: feed_inline_dots 1s steps(3, end) infinite;
}
@keyframes feed_inline_dots {
    0% { opacity: 0.3; } 50% { opacity: 1; } 100% { opacity: 0.3; }
}
/* Hover icons + sibling navigator: each message has a meta row that
   appears on hover. Pencil for user (edit-and-rerun), circle-arrow for
   assistant (regenerate). When the message has siblings (= alternative
   branches diverged at this position), a < N/M > navigator shows up
   permanently. */
.feed_inline_msg_meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
    min-height: 16px;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 0.12s;
}
.feed_inline_msg:hover .feed_inline_msg_meta { opacity: 1; }
.feed_inline_msg_meta .feed_inline_sibnav { opacity: 1; }   /* always visible if present */
.feed_inline_msg:has(.feed_inline_sibnav) .feed_inline_msg_meta { opacity: 1; }
.feed_inline_msg_meta button {
    border: 0;
    background: transparent;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
    font-size: 13px;
    line-height: 1;
    border-radius: 3px;
}
.feed_inline_msg_meta button:hover { background: #ececec; color: #000; }
.feed_inline_msg_meta button:disabled { opacity: 0.35; cursor: not-allowed; }
.feed_inline_sibnav {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-variant-numeric: tabular-nums;
    color: #555;
}
.feed_inline_sibnav button {
    font-size: 14px;
    padding: 0 3px;
    color: #555;
}
/* When a bubble is being edited it turns into a textarea-shaped block
   — we keep it visually identical to .feed_user_reason so the input
   field design promise still holds. */
.feed_inline_edit_box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.feed_inline_edit_box textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #aab8d4;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
}
.feed_inline_edit_box .feed_inline_edit_row {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}
.feed_inline_edit_box button {
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.feed_inline_edit_box .feed_inline_edit_save { background: #111; color: #fff; }
.feed_inline_edit_box .feed_inline_edit_cancel { background: #fff; color: #111; }
.feed_group { }
.feed_gap {
    display: none;
    cursor: pointer;
    position: relative;
    border-bottom: 1px solid #f5f5f5;
    padding: 0 12px 0 39.5px;
    align-items: center;
    height: 28px;
}
.feed_gap_label {
    font-size: 11px;
    color: #bbb;
}

/* RIGHT PANEL - PROMPT BUILDER */
.prompt_panel {
    flex: 0.85 1 0;
    background: #fff;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #eee;
}

.prompt_nav_bar {
    padding: 6px 16px 2px 16px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    flex: none;
}

.prompt_nav_bar .btn {
    height: 24px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-sizing: border-box;
}
/* Match the feed-source dropdown height to surrounding nav buttons.
   Arena/Conductor reuse .feed_source_select outside this bar at 28px. */
.prompt_nav_bar .feed_source_select {
    height: 24px;
    box-sizing: border-box;
}

.prompt_nav_bar .active_criteria_select {
    max-width: 170px;
}

.nav_btn {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.nav_btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#bookmark_btn.bookmarked svg {
    fill: currentColor;
}

.prompt_counter {
    font-size: 11px;
    color: #888;
    min-width: 60px;
    text-align: center;
    cursor: pointer;
}
.prompt_counter_input {
    font-size: 11px;
    color: #888;
    width: 36px;
    text-align: center;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    padding: 0;
    -moz-appearance: textfield;
}
.prompt_counter_input::-webkit-inner-spin-button,
.prompt_counter_input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.spacer {
    flex: 1;
    min-width: 0;
}

.prompt_split {
    flex: none;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.prompt_scroll_area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}

.prompt_scroll_area::-webkit-scrollbar { width: 8px; }
.prompt_scroll_area::-webkit-scrollbar-track { background: transparent; }
.prompt_scroll_area::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }

.prompt_panel.browse_mode .prompt_scroll_area,
.prompt_panel.bookmarks_mode .prompt_scroll_area,
.prompt_panel.matrix_mode .prompt_scroll_area {
    display: none;
}

.prompt_textarea, .notes_textarea {
    flex: none;
    width: 100%;
    max-width: none;
    min-height: min(48vh, 520px);
    box-sizing: border-box;
    background: #fff;
    border: none;
    color: #000;
    padding: 16px;
    padding-bottom: 40px;
    font-size: 21px;
    line-height: 1.6;
    resize: none;
    font-family: inherit;
    overflow-y: hidden;
    overflow-x: hidden;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}
.prompt_textarea::-webkit-scrollbar, .notes_textarea::-webkit-scrollbar { width: 8px; }
.prompt_textarea::-webkit-scrollbar-track, .notes_textarea::-webkit-scrollbar-track { background: transparent; }
.prompt_textarea::-webkit-scrollbar-thumb, .notes_textarea::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }

.notes_textarea {
    border-top: 1px solid #eee;
    padding-bottom: 16px;
    height: min(28vh, 300px);
    min-height: 120px;
    overflow-y: auto;
}

/* Notes-field / list-2-field selectors live inside the 3-dots menu */
.menu_field_row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}
.menu_field_label {
    font-size: 11px;
    color: #888;
    width: 42px;
    flex-shrink: 0;
}
.field_select {
    flex: 1;
    height: 20px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 11px;
    font-family: inherit;
    color: #333;
    padding: 0 4px;
    border-radius: 0;
    min-width: 0;
}
.field_header .mini_btn {
    height: 20px;
    width: 20px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    background: #fff;
    border: 1px solid #ccc;
    color: #555;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.field_header .mini_btn:hover { background: #f0f0f0; }
.field_name_input {
    display: none;
    flex: 1;
    height: 20px;
    border: 1px solid #999;
    padding: 0 4px;
    font-size: 11px;
    font-family: inherit;
    min-width: 0;
}
.field_name_input.editing { display: block; }
.field_select.hidden_editing { display: none; }

.prompt_textarea:focus, .notes_textarea:focus,
.prompt_textarea:focus-visible, .notes_textarea:focus-visible {
    outline: none;
}

/* WRAPPER PANEL */
.wrapper_panel {
    display: none;
    flex-direction: column;
    border-bottom: 1px solid #eee;
    background: #fff;
}
.wrapper_panel.visible {
    display: flex;
}
.wrapper_header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 3px 16px 6px 16px;
    border-bottom: 1px solid #eee;
}
.wrapper_select {
    flex: 1;
    min-width: 80px;
    height: 24px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 12px;
    font-family: inherit;
    color: #333;
    padding: 0 6px;
    border-radius: 0;
}
.wrapper_header .btn {
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
}
.wrapper_edit_btn {
    background: #fff;
    border: 1px solid #ccc;
    cursor: pointer;
    color: #555;
    padding: 0 5px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: inherit;
    box-sizing: border-box;
}
.wrapper_edit_btn:hover { color: #000; border-color: #999; }
/* Chevron arrow buttons — same footprint as pencil */
#wrapper_prev_btn, #wrapper_next_btn,
#generator_prev_btn, #generator_next_btn {
    padding: 0 5px;
}
.wrapper_name_input {
    width: 110px;
    height: 24px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 12px;
    font-family: inherit;
    color: #333;
    padding: 0 6px;
    display: none;
}
.wrapper_name_input:focus { outline: none; border-color: #aaa; }
.wrapper_textarea,
.generator_textarea,
.criteria_textarea {
    flex: none;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    background: #fff;
    border: none;
    color: #555;
    padding: 6px 16px;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    font-family: inherit;
    overflow-y: hidden;
}
.wrapper_textarea,
.generator_textarea {
    min-height: 140px;
}
.criteria_textarea {
    min-height: 200px;
}
.wrapper_textarea::-webkit-scrollbar { width: 8px; }
.wrapper_textarea::-webkit-scrollbar-track { background: transparent; }
.wrapper_textarea::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }
.wrapper_textarea { scrollbar-color: rgba(0,0,0,0.05) transparent; }
.wrapper_textarea:focus, .wrapper_textarea:focus-visible,
.generator_textarea:focus, .generator_textarea:focus-visible,
.criteria_textarea:focus, .criteria_textarea:focus-visible { outline: none; }

/* GENERATOR PANEL (identical look to wrapper panel) */
.generator_panel { display: none; flex-direction: column; border-bottom: 1px solid #eee; background: #fff; }
.generator_panel.visible { display: flex; }
.generator_header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 16px 6px 16px; border-bottom: 1px solid #eee; }
.generator_select { flex: 1; min-width: 80px; height: 24px; border: 1px solid #ddd; background: #fff; font-size: 12px; font-family: inherit; color: #333; padding: 0 6px; border-radius: 0; }
.generator_header .btn { height: 24px; padding: 0 8px; font-size: 11px; }
.generator_edit_btn { background: #fff; border: 1px solid #ccc; cursor: pointer; color: #555; padding: 0 5px; height: 24px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-family: inherit; box-sizing: border-box; }
.generator_edit_btn:hover { color: #000; border-color: #999; }
.generator_name_input { width: 110px; height: 24px; border: 1px solid #ddd; background: #fff; font-size: 12px; font-family: inherit; color: #333; padding: 0 6px; display: none; }
.generator_name_input:focus { outline: none; border-color: #aaa; }
.generator_textarea::-webkit-scrollbar { width: 8px; }
.generator_textarea::-webkit-scrollbar-track { background: transparent; }
.generator_textarea::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }
.generator_textarea { scrollbar-color: rgba(0,0,0,0.05) transparent; }

/* CRITERIA PANEL (identical look to wrapper / generator panels) */
.criteria_panel { display: none; flex-direction: column; border-bottom: 1px solid #eee; background: #fff; }
.criteria_panel.visible { display: flex; }
.criteria_header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 16px 6px 16px; border-bottom: 1px solid #eee; }
.criteria_select { flex: 1; min-width: 80px; height: 24px; border: 1px solid #ddd; background: #fff; font-size: 12px; font-family: inherit; color: #333; padding: 0 6px; border-radius: 0; }
.criteria_header .btn { height: 24px; padding: 0 8px; font-size: 11px; }
.criteria_edit_btn { background: #fff; border: 1px solid #ccc; cursor: pointer; color: #555; padding: 0 5px; height: 24px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-family: inherit; box-sizing: border-box; }
.criteria_edit_btn:hover { color: #000; border-color: #999; }
#criteria_prev_btn, #criteria_next_btn { padding: 0 5px; }
.criteria_name_input { width: 110px; height: 24px; border: 1px solid #ddd; background: #fff; font-size: 12px; font-family: inherit; color: #333; padding: 0 6px; display: none; }
.criteria_name_input:focus { outline: none; border-color: #aaa; }
.criteria_textarea::-webkit-scrollbar { width: 8px; }
.criteria_textarea::-webkit-scrollbar-track { background: transparent; }
.criteria_textarea::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }
.criteria_textarea { scrollbar-color: rgba(0,0,0,0.05) transparent; }

/* SNIPPETS SECTION */
.snippets_section {
    border-top: 1px solid #eee;
    background: #fff;
}

.snippets_header {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.snippets_list {
    padding: 10px 14px;
    display: none;
    flex-wrap: wrap;
    gap: 6px;
}

.snippet_btn {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    padding: 5px 10px;
    border-radius: 0;
    cursor: pointer;
    font-size: 12px;
}

/* Snippet editor - inline at bottom */
.snippet_editor {
    display: none;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    background: #fff;
}

.snippet_editor.visible {
    display: block;
}

.snippet_editor_row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.snippet_name_input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 8px 10px;
    font-size: 13px;
}

.snippet_name_input:focus {
    outline: none;
    border-color: #2563eb;
}


/* Hidden file input */
#excel_file_input {
    display: none;
}

/* Browse mode */
.browse_view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.browse_view.active {
    display: block;
}

.prompt_panel.browse_mode .prompt_split,
.prompt_panel.browse_mode .notes_textarea,
.prompt_panel.browse_mode .snippets_section {
    display: none;
}

.prompt_panel.browse_mode .browse_view {
    display: block;
}

/* Bookmarks mode — fully separate from Browse */
.bookmarks_view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.prompt_panel.bookmarks_mode .prompt_split,
.prompt_panel.bookmarks_mode .notes_textarea,
.prompt_panel.bookmarks_mode .snippets_section,
.prompt_panel.bookmarks_mode .browse_view {
    display: none;
}
.prompt_panel.bookmarks_mode .bookmarks_view {
    display: block;
}

/* Matrix (attribution) mode — fully separate from Browse / Bookmarks */
.matrix_view {
    display: none;
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
    font-size: 12px;
}
.prompt_panel.matrix_mode .prompt_split,
.prompt_panel.matrix_mode .notes_textarea,
.prompt_panel.matrix_mode .snippets_section,
.prompt_panel.matrix_mode .browse_view,
.prompt_panel.matrix_mode .bookmarks_view {
    display: none;
}
.prompt_panel.matrix_mode .matrix_view {
    display: block;
}
.matrix_controls {
    position: sticky; top: 0; z-index: 2;
    background: #fff;
    padding: 6px 0 10px 0;
    border-bottom: 1px solid #eee;
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.matrix_controls input[type="text"] {
    height: 26px; border: 1px solid #ccc; padding: 0 8px; font-size: 12px; font-family: inherit;
}
.matrix_controls label {
    font-size: 12px; color: #444; user-select: none;
}
.matrix_controls .matrix_crit_list {
    display: flex; flex-wrap: wrap; gap: 2px 10px;
    max-width: 100%; flex-basis: 100%;
    padding: 4px 0 0 0; border-top: 1px dashed #eee; margin-top: 4px;
}
.matrix_controls .matrix_crit_list label {
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}
.matrix_status {
    font-size: 11px; color: #666; margin-left: 8px;
}
.matrix_grid_wrap {
    margin-top: 12px;
    overflow: auto;
}
table.matrix_grid {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
}
table.matrix_grid th, table.matrix_grid td {
    border: 1px solid #eee;
    padding: 4px 6px;
    vertical-align: top;
}
table.matrix_grid thead th {
    background: #fafafa;
    position: sticky; top: 0;
    text-align: left;
    font-weight: 600;
    color: #444;
    writing-mode: horizontal-tb;
}
table.matrix_grid th.matrix_crit_col {
    /* Narrow pick columns — keep them tight */
    min-width: 40px;
    text-align: center;
    font-size: 10px;
    white-space: nowrap;
}
table.matrix_grid td.matrix_pick_cell {
    text-align: center;
    width: 40px;
    font-weight: 600;
    color: #aaa;
}
table.matrix_grid td.matrix_pick_yes { background: #d1fae5; color: #047857; }
table.matrix_grid td.matrix_pick_no  { background: #fff; color: #d1d5db; }
table.matrix_grid td.matrix_pick_yes.liked  { background: #a7f3d0; }
table.matrix_grid td.matrix_pick_yes.rejected { background: #fecaca; color: #991b1b; }
table.matrix_grid tr.matrix_row_liked td.matrix_idea_text {
    background: #ecfdf5;
}
table.matrix_grid tr.matrix_row_rejected td.matrix_idea_text {
    background: #fef2f2;
}
table.matrix_grid td.matrix_idea_text {
    max-width: 560px;
    word-break: break-word;
}
.matrix_row_tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 2px;
    margin-right: 6px;
    font-weight: 600;
    vertical-align: middle;
}
.matrix_row_tag.liked { background: #10b981; color: #fff; }
.matrix_row_tag.rejected { background: #ef4444; color: #fff; }
.matrix_row_tag.unlabeled { background: #e5e7eb; color: #555; }

.browse_item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0;
    margin-bottom: 12px;
}

.browse_copy_btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    color: #bbb;
}

.browse_copy_btn svg {
    width: 14px;
    height: 14px;
}

.browse_item_footer {
    display: flex;
    align-items: center;
    padding: 0 4px 4px;
}

.browse_approve_btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    color: #999;
    margin-left: auto;
}

.browse_approve_btn.approved {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.browse_item_content {
    padding: 12px;
    font-size: 20px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: #333;
}
.browse_item_textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 20px;
    line-height: 1.5;
    color: #333;
    font-family: inherit;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    overflow: hidden;
    min-height: 48px;
    field-sizing: content;
}
.browse_item_textarea:focus, .browse_item_textarea:focus-visible { outline: none; }

.browse_bookmark_filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    border: 1px solid #eee;
    background: none;
    font-family: inherit;
}
.browse_bookmark_filter.active {
    color: #000;
    border-color: #ccc;
    font-weight: 600;
}
.browse_bookmark_filter svg {
    width: 14px;
    height: 14px;
}
.browse_bookmark_filter.active svg {
    fill: currentColor;
}

/* Bookmark row extras (wrapper+prompt preview) */
.browse_empty_hint {
    padding: 16px 12px;
    font-size: 13px;
    color: #999;
}
.browse_composed {
    margin: 0 12px 10px 12px;
    border: 1px solid #eee;
    background: #fafafa;
}
.browse_composed_summary {
    cursor: pointer;
    padding: 6px 10px;
    font-size: 11px;
    color: #777;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.browse_composed_label {
    flex-shrink: 0;
    color: #aaa;
}
.browse_composed_preview {
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}
.browse_composed_summary::-webkit-details-marker { display: none; }
.browse_composed_summary::before {
    content: '\25B8';
    display: inline-block;
    margin-right: 6px;
    color: #aaa;
    transition: transform 0.1s;
}
.browse_composed[open] > .browse_composed_summary::before {
    transform: rotate(90deg);
}
.browse_composed_summary:hover { color: #000; }
.browse_composed_full {
    margin: 0;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    font-size: 12px;
    line-height: 1.5;
    color: #444;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    font-family: inherit;
    background: #fff;
}
.browse_composed_empty {
    margin: 0 12px 10px 12px;
    padding: 6px 10px;
    font-size: 11px;
    color: #bbb;
    font-style: italic;
}
.browse_unbookmark_btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    color: #999;
}
.browse_unbookmark_btn:hover {
    color: #c00;
    border-color: #c00;
}
.browse_goto_btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    color: #555;
}
.browse_goto_btn:hover {
    color: #000;
    border-color: #888;
}
.bookmark_prompt_readonly {
    padding: 12px;
    font-size: 20px;
    line-height: 1.5;
    color: #222;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

/* Feed context menu */
.feed_ctx_menu {
    display: none;
    position: fixed;
    z-index: 200;
    background: #fff;
    border: 1px solid #ddd;
    min-width: 300px;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.feed_ctx_menu.open { display: block; }
.feed_ctx_prompt {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #555;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    border-bottom: 1px solid #eee;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}
.feed_ctx_prompt::-webkit-scrollbar { width: 6px; }
.feed_ctx_prompt::-webkit-scrollbar-track { background: transparent; }
.feed_ctx_prompt::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }
.feed_ctx_bar {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    gap: 4px;
}
.feed_ctx_bar .ctx_label {
    font-size: 11px;
    color: #aaa;
    margin-right: auto;
}
.feed_ctx_btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 11px;
    font-family: inherit;
    color: #666;
}
.feed_ctx_btn:hover { background: #f5f5f5; }
.feed_ctx_btn.bookmarked { color: #000; font-weight: 600; }
.feed_ctx_btn.bookmarked svg { fill: currentColor; }
.feed_ctx_btn svg { width: 13px; height: 13px; }
.feed_ctx_no_prompt {
    padding: 12px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}
.feed_ctx_section_label {
    padding: 6px 12px 2px;
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feed_source_select {
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 0 6px;
    font-size: 12px;
    font-family: inherit;
    color: #555;
    background: #fff;
    cursor: pointer;
}
.feed_source_select:focus { outline: none; }

.btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.btn.running {
}

.btn.flash-green, .nav_btn.flash-green {
    background: #f0fdf4;
    border-color: #86efac;
    color: #555;
}

/* ARENA (inside feed panel) */
.arena_config {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.arena_config.hidden { display: none; }
.arena_config_row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.arena_config input[type="text"],
.arena_config input[type="number"] {
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 0 8px;
    font-size: 12px;
    font-family: inherit;
    color: #555;
    background: #fff;
}
.arena_config input:focus { outline: none; }
.arena_config input[type="text"] { flex: 1; min-width: 0; }
.arena_config input[type="number"] { width: 44px; text-align: center; -moz-appearance: textfield; }
.arena_config input[type="number"]::-webkit-inner-spin-button,
.arena_config input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.arena_config label { font-size: 11px; color: #999; white-space: nowrap; }
.arena_msg {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 14px;
    margin-bottom: 4px;
    animation: arenaSlideIn 0.3s ease-out;
}
@keyframes arenaSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.arena_msg.msg_a { align-items: flex-end; }
.arena_msg.msg_b { align-items: flex-start; }
.arena_bubble {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
}
.arena_msg.msg_a .arena_bubble {
    background: #f0f0f0;
    color: #000;
}
.arena_msg.msg_b .arena_bubble {
    background: transparent;
    color: #1e293b;
    max-width: 100%;
}
.arena_msg.msg_synth {
    align-items: stretch;
    margin-top: 16px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}
.arena_msg.msg_synth .arena_bubble {
    background: #f8fafc;
    color: #1e293b;
    max-width: 100%;
    border: 1px solid #e2e8f0;
}
.arena_msg.msg_system {
    align-items: center;
    margin-top: 8px;
}
.arena_msg.msg_system .arena_bubble {
    background: #fffde7;
    color: #795548;
    max-width: 100%;
    border: 1px solid #ffe082;
    font-size: 13px;
    padding: 8px 14px;
}
.arena_msg_text { white-space: pre-wrap; word-break: break-word; }

/* PERFECTIONIST (worker = right blue, critic = left red) */
.arena_msg.msg_worker { align-items: flex-end; }
.arena_msg.msg_critic { align-items: flex-start; }
.arena_msg.msg_worker .arena_bubble {
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #bbdefb;
}
.arena_msg.msg_critic .arena_bubble {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
    max-width: 100%;
}
.arena_msg.msg_worker .arena_bubble::before {
    content: "Worker"; display: block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; margin-bottom: 4px;
}
.arena_msg.msg_critic .arena_bubble::before {
    content: "Critic"; display: block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; margin-bottom: 4px;
}
/* Stress-test annotation: planted flaw from worker, hidden from critic */
.arena_msg.msg_planted {
    align-items: flex-end;
    margin-top: -6px;
    margin-bottom: 4px;
}
.arena_msg.msg_planted .arena_bubble {
    background: transparent;
    color: #777;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11px;
    font-style: italic;
    max-width: 75%;
}
.arena_msg.msg_planted .arena_bubble::before {
    content: "Planted (hidden from critic)"; display: block; font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; font-style: normal; opacity: 0.6; margin-bottom: 2px;
}

/* CONDUCTOR (inside feed panel) */
.conductor_config {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.conductor_config.hidden { display: none; }
.conductor_config input[type="number"] {
    height: 28px; width: 44px; border: 1px solid #ccc; border-radius: 0;
    padding: 0 8px; font-size: 12px; font-family: inherit; color: #555;
    text-align: center; -moz-appearance: textfield;
}
.conductor_config input[type="number"]::-webkit-inner-spin-button,
.conductor_config input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.conductor_config input:focus { outline: none; }
.conductor_config label { font-size: 11px; color: #999; white-space: nowrap; }
.cond_msg {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 14px; margin-bottom: 4px;
    animation: arenaSlideIn 0.3s ease-out;
}
.cond_bubble {
    padding: 10px 14px; border-radius: 12px; word-wrap: break-word;
    line-height: 1.5; font-size: 14px; max-width: 100%;
}
.cond_msg.cond_response .cond_bubble { background: #f0f0f0; color: #000; }
.cond_msg.cond_judge .cond_bubble { background: #fffde7; color: #795548; border: 1px solid #ffe082; font-size: 13px; }
.cond_msg.cond_decision .cond_bubble { background: #fff; color: #000; font-weight: 600; border: 1px solid #ddd; font-size: 13px; }
.cond_msg.cond_rewrite .cond_bubble { background: #f0f4ff; color: #1e3a5f; border: 1px solid #bfdbfe; font-size: 13px; font-style: italic; }
.cond_msg.cond_control .cond_bubble { background: #dcfce7; color: #14532d; border: 1px solid #86efac; font-size: 13px; font-weight: 600; }
.cond_msg.cond_system .cond_bubble { background: #f8f8f8; color: #888; font-size: 12px; padding: 6px 12px; }
.cond_msg .arena_msg_text { white-space: normal; }
.cond_msg .arena_msg_text p { margin: 0 0 0.5em 0; }
.cond_msg .arena_msg_text p:last-child { margin-bottom: 0; }
.cond_msg .arena_msg_text ul, .cond_msg .arena_msg_text ol { margin: 0.3em 0; padding-left: 1.4em; }
.cond_msg .arena_msg_text h1, .cond_msg .arena_msg_text h2, .cond_msg .arena_msg_text h3 { margin: 0.5em 0 0.3em; font-size: 1em; }
.cond_msg.cond_rewrite .arena_msg_text { white-space: pre-wrap; }
.cond_label { font-size: 10px; color: #999; margin-bottom: 2px; }

/* CHAT PANEL */
.chat_panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.chat_panel.hidden { display: none; }
.chat_tabs_bar {
    display: flex; align-items: center; gap: 4px; padding: 6px 10px 10px;
    border-bottom: 1px solid #e8e8e8; overflow-x: auto; flex-shrink: 0;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}
.chat_tabs_bar::-webkit-scrollbar { height: 8px; }
.chat_tabs_bar::-webkit-scrollbar-track { background: transparent; }
.chat_tabs_bar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }
.chat_tab {
    border: 1px solid #ddd; background: #fff; padding: 3px 8px 3px 10px;
    font-size: 11px; cursor: pointer; display: inline-flex; align-items: center;
    gap: 5px; white-space: nowrap; font-family: inherit; border-radius: 12px;
    color: #666; transition: background 0.15s, border-color 0.15s;
}
.chat_tab:hover { background: #f5f5f5; border-color: #bbb; color: #333; }
.chat_tab.active { background: #f0f0f0; font-weight: 600; border-color: #999; color: #000; }
.chat_tab.pending { opacity: 0.72; }
.chat_tab.failed { border-color: #b00020; color: #8a0018; }
.chat_tab_close {
    color: #bbb; font-size: 14px; line-height: 1; background: none;
    border: none; cursor: pointer; padding: 0; font-family: inherit;
}
.chat_tab_close:hover { color: #555; }
.chat_messages {
    flex: 1; overflow-y: auto; padding: 10px 12px 12px; display: flex;
    flex-direction: column; gap: 10px;
    scrollbar-color: rgba(0,0,0,0.05) transparent;
}
.chat_messages::-webkit-scrollbar { width: 8px; }
.chat_messages::-webkit-scrollbar-track { background: transparent; }
.chat_messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.05); border-radius: 4px; }
.chat_msg { display: flex; flex-direction: column; gap: 2px; }
.chat_msg_user { align-items: flex-end; }
.chat_msg_assistant { align-items: flex-start; }
.chat_bubble {
    max-width: 85%; padding: 8px 12px; font-size: 17px;
    line-height: 1.55; word-break: break-word;
}
.chat_msg_user .chat_bubble { background: #f0f0f0; border-radius: 14px 14px 4px 14px; }
.chat_msg_assistant .chat_bubble { background: #fff; padding-left: 2px; }
.chat_msg_actions {
    display: flex; gap: 6px; max-width: 85%;
    opacity: 0.72; transition: opacity 0.12s;
}
.chat_msg:hover .chat_msg_actions,
.chat_msg:focus-within .chat_msg_actions { opacity: 1; }
.chat_msg_user .chat_msg_actions { justify-content: flex-end; }
.chat_msg_action_btn {
    border: 1px solid #ddd; background: #fff; color: #555;
    font-family: inherit; font-size: 11px; height: 24px;
    padding: 0 8px; cursor: pointer;
}
.chat_msg_action_btn:hover { background: #f5f5f5; color: #111; }
.chat_edit_textarea {
    width: min(620px, 70vw); max-width: 100%; min-height: 82px;
    border: 1px solid #d0d0d0; background: #fff; color: #111;
    font-family: inherit; font-size: 15px; line-height: 1.45;
    padding: 8px; resize: none; box-sizing: border-box;
}
.chat_edit_textarea:focus { outline: 2px solid #111; outline-offset: 1px; }
.chat_bubble p { margin: 0 0 6px; }
.chat_bubble p:last-child { margin: 0; }
.chat_bubble h1, .chat_bubble h2, .chat_bubble h3, .chat_bubble h4 {
    margin: 12px 0 6px; line-height: 1.25; font-weight: 700;
}
.chat_bubble h1:first-child, .chat_bubble h2:first-child,
.chat_bubble h3:first-child, .chat_bubble h4:first-child { margin-top: 0; }
.chat_bubble h1 { font-size: 22px; }
.chat_bubble h2 { font-size: 20px; }
.chat_bubble h3 { font-size: 18px; }
.chat_bubble h4 { font-size: 17px; }
.chat_bubble pre { background: #f8f8f8; padding: 8px; overflow-x: auto;
    font-size: 12px; margin: 6px 0; }
.chat_bubble code { background: #f0f0f0; padding: 1px 4px; font-size: 12px; border-radius: 2px; }
.chat_bubble pre code { background: none; padding: 0; }
.chat_bubble a { color: #0645ad; text-decoration: underline; text-underline-offset: 2px; }
.chat_bubble blockquote {
    margin: 8px 0; padding: 0; color: inherit; background: transparent;
}
.chat_bubble blockquote p { margin: 0; }
.chat_bubble hr { border: none; border-top: 1px solid #e8e8e8; margin: 16px 0; }
.chat_bubble ul, .feed_inline_bubble ul { padding-left: 1.35em; margin: 4px 0; }
.chat_bubble ol, .feed_inline_bubble ol {
    /* 18px wrapped two-digit markers, but larger values push normal lists too far right. */
    padding-left: 1.65em;
    margin: 4px 0;
    list-style-position: outside;
}
.chat_bubble li, .feed_inline_bubble li {
    display: list-item;
    margin-bottom: 3px;
    line-height: 1.5;
}
.chat_table_wrap { max-width: 100%; overflow-x: auto; margin: 8px 0 10px; }
.chat_bubble table, .feed_inline_bubble table {
    border-collapse: collapse; width: max-content; max-width: 100%;
    font-size: 14px; line-height: 1.35;
}
.chat_bubble th, .chat_bubble td,
.feed_inline_bubble th, .feed_inline_bubble td {
    vertical-align: top;
    padding: 6px 12px 6px 8px;
    border: 1px solid #e2e2e2;
}
.chat_bubble th, .feed_inline_bubble th {
    background: #f7f7f7; font-weight: 700; color: #111;
}
.chat_bubble th:first-child, .chat_bubble td:first-child,
.feed_inline_bubble th:first-child, .feed_inline_bubble td:first-child {
    white-space: nowrap;
    min-width: 1.8em;
}
.chat_message_attachments {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.chat_message_attachment {
    max-width: 220px; max-height: 180px; border: 1px solid #ddd;
    object-fit: contain; background: #f8f8f8;
}
.chat_input_bar {
    display: flex; flex-direction: column; gap: 4px;
    padding: 6px 10px; margin: 0 8px 8px;
    background: #fff; border: 1px solid #d0d0d0;
    border-radius: 20px; flex-shrink: 0;
}
.chat_input_textarea {
    width: 100%; border: none; padding: 4px 2px; font-size: 14px;
    font-family: inherit; resize: none; min-height: 22px; max-height: 200px;
    overflow-y: auto; line-height: 1.5; background: transparent; box-sizing: border-box;
}
.chat_input_textarea:focus { outline: none; }
.chat_slash_panel {
    border: 1px solid #e0e0e0; background: #fafafa; color: #222;
    max-height: 170px; overflow-y: auto; padding: 8px 10px;
    font-size: 12px; line-height: 1.45; white-space: pre-wrap;
}
.chat_slash_panel.hidden { display: none; }
.chat_slash_panel .chat_slash_title {
    font-weight: 700; margin-bottom: 5px; color: #111;
}
.chat_slash_panel .chat_slash_hint {
    color: #666; margin-bottom: 7px;
}
.chat_attachment_tray {
    display: none; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px;
}
.chat_attachment_tray.visible { display: flex; }
.chat_attachment_chip {
    position: relative; width: 68px; height: 68px; border: 1px solid #ddd;
    background: #f8f8f8; overflow: hidden;
}
.chat_attachment_chip img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.chat_attachment_remove {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
    border: 1px solid rgba(0,0,0,0.2); background: rgba(255,255,255,0.92);
    color: #111; cursor: pointer; font-size: 13px; line-height: 16px;
    padding: 0; font-family: inherit;
}
.chat_input_actions {
    display: flex; justify-content: space-between; align-items: center;
}
.chat_plus_btn {
    width: 32px; height: 32px; padding: 0 0 6px; border-radius: 16px;
    border: 1px solid #ddd; background: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: #333; position: relative;
    font-size: 24px; font-family: inherit; font-weight: 300; line-height: 1;
    transition: background 0.2s;
}
.chat_plus_btn:hover { background: #f0f0f0; }
.chat_model_menu {
    position: absolute; bottom: calc(100% + 6px); left: 0;
    background: #fff; border: 1px solid #ddd; z-index: 50; min-width: 160px;
    max-height: min(70vh, 360px); overflow-y: auto;
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
}
.chat_model_menu.hidden { display: none; }
.chat_model_menu button {
    display: block; width: 100%; padding: 7px 12px; background: none;
    border: none; text-align: left; cursor: pointer; font-size: 12px;
    font-family: inherit; color: #333;
}
.chat_model_menu button:hover { background: #f5f5f5; }
.chat_model_menu button.active { font-weight: 700; }
.chat_menu_checkbox {
    display: flex; align-items: center; gap: 7px; padding: 7px 12px;
    font-size: 12px; color: #333; cursor: pointer; white-space: nowrap;
}
.chat_menu_checkbox:hover { background: #f5f5f5; }
.chat_menu_checkbox input { margin: 0; }
.chat_send_icon_btn {
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: #000; opacity: 1; cursor: pointer; color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: opacity 0.15s;
}
.chat_send_icon_btn.running { background: #000; opacity: 1; cursor: pointer; }
.chat_send_icon_btn:disabled { opacity: 0.2; cursor: not-allowed; }
.chat_send_icon_btn svg { width: 16px; height: 16px; }
.chat_stop_square { width: 13px; height: 13px; background: #fff; display: block; border-radius: 2px; }
.chat_workflow_select { font-size: 12px; padding: 2px 5px; border: 1px solid #ddd; border-radius: 4px; background: #fff; color: #555; width: 100%; }
.chat_workflow_progress { font-size: 11px; color: #888; white-space: nowrap; }
.chat_workflow_stop_btn { font-size: 11px; padding: 1px 6px; border: 1px solid #ddd; border-radius: 4px; background: #fff; cursor: pointer; color: #666; }
.chat_workflow_stop_btn:hover { background: #f5f5f5; }
/* ============ MOBILE LAYOUT ============ */
.mobile_top_box, .mobile_notes_box {
    display: none;
}

@media (max-width: 1200px) {
    /* Hide desktop panels */
    .idea_feed_panel { display: none !important; }
    .feed_extra_panel { display: none !important; }
    .idea_pool_panel_2 { display: none !important; }
    .prompt_nav_bar { display: none !important; }
    .prompt_scroll_area { display: none !important; }
    .prompt_split { display: none !important; }
    .snippets_section { display: none !important; }
    .browse_view { display: none !important; }
    .bookmarks_view { display: none !important; }
    .mobile_top_box { display: none !important; }
    .wrapper_panel { display: none !important; }
    .generator_panel { display: none !important; }
    .criteria_panel { display: none !important; }
    .matrix_view { display: none !important; }
    .prompt_panel > #notes_textarea { display: none !important; }

    /* Main container stacks vertically */
    .main_container {
        flex-direction: column;
    }

    /* Idea pool panel: top 60%, full width */
    .idea_pool_panel {
        flex: 6 1 0;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        min-height: 0;
    }

    /* Prompt panel: bottom 40%, just the notes box */
    .prompt_panel {
        flex: 4 1 0;
        width: 100%;
        border-left: none;
        display: flex;
        flex-direction: column;
        padding: 0;
        gap: 0;
        background: #fff;
    }

    /* Bottom box: notes */
    .mobile_notes_box {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
        background: #fff;
    }
    .mobile_notes_box .notes_textarea {
        flex: 1;
        min-height: 80px;
        background: #fff;
        border: none;
        color: #000;
        padding: 16px;
        font-size: 21px;
        line-height: 1.6;
        resize: none;
        font-family: inherit;
        overflow-y: auto;
        scrollbar-color: rgba(0,0,0,0.05) transparent;
    }
    .mobile_notes_box .notes_textarea:focus { outline: none; }

    /* Idea list styling for mobile */
    .idea_pool_panel .idea_list,
    .idea_pool_panel_2 .idea_list {
        padding: 4px 14px;
    }
    .idea_pool_panel .idea_list .idea_item,
    .idea_pool_panel_2 .idea_list .idea_item {
        font-size: 21px;
        line-height: 1.6;
        border-bottom: none;
        padding: 0;
        margin-bottom: 0;
    }

    /* If list 1 is hidden and list 2 is on, show list 2 as the top panel */
    .main_container:has(> .idea_pool_panel.hidden) .idea_pool_panel_2:not(.hidden) {
        display: flex !important;
        flex: 6 1 0;
        width: 100%;
        border-left: none;
        border-bottom: 1px solid #eee;
        min-height: 0;
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 1201px) {
    .mobile_top_box { display: none !important; }
    .mobile_notes_box { display: none !important; }
}

html.embed_feed_view,
html.embed_feed_view body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

html.embed_feed_view .main_container > .idea_pool_panel,
html.embed_feed_view .main_container > .idea_pool_panel_2,
html.embed_feed_view .main_container > .prompt_panel,
html.embed_feed_view .main_container > .feed_extra_panels,
html.embed_feed_view .api_connection_warning {
    display: none !important;
}

html.embed_feed_view .main_container {
    flex-direction: row !important;
}

html.embed_feed_view .main_container > .idea_feed_panel {
    display: flex !important;
    flex: 1 1 auto;
    width: 100%;
    border-left: none;
}
