/* ===== DECISION TREE STYLES ===== */

/* Section Header Wrapper */
.tree-section-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Title Row (h3 + options button) */
.tree-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tree-title-row h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

/* Options Menu Button */
.tree-options-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.tree-options-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--gold-start);
}

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

/* Locked Gate - KB Oracle Style */
.tree-locked-gate {
    background: rgba(212, 175, 55, 0.05);
    /* Removed hard border for softer appearance */
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.tree-lock-content {
    max-width: 500px;
    margin: 0 auto;
}

.tree-lock-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tree-progress-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
    text-align: left;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

.check-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.checklist-item.complete .check-icon {
    color: var(--accent-positive);
    font-size: 0; /* Hide the original ○ */
}

.checklist-item.complete .check-icon::before {
    content: '✓';
    font-size: 1.5rem; /* Restore font size for the checkmark */
    display: inline-block;
}

.tree-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0 0.5rem 0;
}

.tree-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-start), var(--gold-end));
    transition: width 0.5s ease;
}

.tree-progress-text {
    font-weight: 600;
    color: var(--gold-start);
    margin: 0;
}

/* Initialize Prompt - KB Oracle Style */
.tree-initialize-prompt {
    background: rgba(212, 175, 55, 0.05);
    /* Removed hard border for softer appearance */
    border-radius: 8px;
    padding: 2rem;
}

.tree-init-content h4 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

/* Active Tree Container */
.tree-active-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Tree Controls */
.tree-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tree-navigate-btn {
    background: linear-gradient(135deg, var(--gold-start), var(--gold-end));
    color: white;
    font-weight: 600;
}

/* Suggestions Badge */
.tree-suggestions-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid var(--gold-start);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tree-suggestions-badge:hover {
    background: rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
}

.badge-icon {
    font-size: 1.5rem;
}

/* Tree Visualization - KB Oracle Style */
.tree-visualization-wrapper {
    background: rgba(212, 175, 55, 0.03);
    /* Removed hard border for softer appearance */
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 500px; /* Increased from 400px */
    /* Break out of panel-content max-width to fill commitment-panel */
    width: 100vw;
    max-width: calc(100vw - 240px); /* Full panel width minus sidebar */
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .tree-visualization-wrapper {
        max-width: 100vw; /* Full width on mobile (no sidebar) */
        height: 65vh;
        max-height: 65vh;
    }
}

/* Zoom wrapper for pan and zoom functionality */
.tree-zoom-wrapper {
    width: 100%;
    max-width: 100%;
    height: auto; /* Expand to show full tree */
    overflow: visible; /* Tree affects layout and is fully visible */
    position: relative;
    background: transparent; /* Transparent background */
    pointer-events: none; /* Tree is non-interactive like background */
}

/* Mobile sections view */
.tree-mobile-sections {
    display: none;
}

@media (max-width: 768px) {
    .tree-mobile-sections {
        display: block;
    }
    .tree-desktop-view {
        display: none;
    }
}

.tree-section {
    background: rgba(212, 175, 55, 0.03);
    /* Removed hard border for softer appearance */
    border-radius: 8px;
    margin-bottom: 1rem;
}

.tree-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    cursor: pointer;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 8px 8px 0 0; /* Rounded top corners only */
}

.tree-section-header:hover {
    background: rgba(212, 175, 55, 0.08);
}

.tree-section-title {
    font-weight: 600;
    font-size: 1rem;
}

.tree-section-toggle {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.tree-section.expanded .tree-section-toggle {
    transform: rotate(180deg);
}

.tree-section-content {
    padding: 1rem;
    display: none;
}

.tree-section.expanded .tree-section-content {
    display: block;
}

/* Desktop full view */
.tree-desktop-view {
    width: 100%;
    max-width: 100%;
    background: transparent; /* Transparent background */
    position: relative; /* For positioning fullscreen button */
}

/* Fullscreen toggle button */
.tree-fullscreen-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 0.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100;
    pointer-events: auto; /* Override parent's pointer-events: none */
}

.tree-fullscreen-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.5);
    transform: scale(1.05);
}

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

/* Zoom controls - hidden by default, shown only in fullscreen */
.tree-zoom-controls {
    display: none;
    position: absolute;
    top: 1rem;
    left: 1rem;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.tree-zoom-btn {
    width: 40px;
    height: 40px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-primary);
}

.tree-zoom-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.5);
    transform: scale(1.05);
}

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

/* Fullscreen mode styles */
.tree-desktop-view.fullscreen {
    position: fixed;
    top: 0;
    left: 240px; /* Start after sidebar */
    right: 0;
    bottom: 0;
    width: calc(100vw - 240px); /* Full width minus sidebar */
    height: 100vh;
    max-width: calc(100vw - 240px);
    background: var(--bg-primary);
    z-index: 9999;
    padding: 2rem;
    overflow: auto;
}

.tree-desktop-view.fullscreen .tree-zoom-controls {
    display: flex; /* Show zoom controls in fullscreen */
}

.tree-desktop-view.fullscreen .tree-zoom-wrapper {
    cursor: grab; /* Enable grab cursor in fullscreen */
    pointer-events: auto; /* Enable pointer events in fullscreen */
}

.tree-desktop-view.fullscreen .tree-zoom-wrapper:active {
    cursor: grabbing;
}

.tree-desktop-view.fullscreen #tree-mermaid-container {
    transform: none; /* Remove the sidebar offset in fullscreen */
    transform-origin: top left; /* Set transform origin for zoom */
    pointer-events: auto; /* Enable interactions in fullscreen */
}

#tree-mermaid-container {
    width: 100%;
    max-width: none !important; /* Override any inline max-width from Mermaid */
    height: auto; /* Expand to fit tree content */
    min-height: 400px;
    transform: translateX(120px); /* Shift tree right by half sidebar width (240px / 2) */
}

/* Ensure SVG inside mermaid container displays at full size */
#tree-mermaid-container svg {
    max-width: none !important; /* Override Mermaid's inline max-width */
    width: 100%;
    height: auto;
}

/* Navigation Mode (Mobile) */
.tree-navigation-mode {
    padding: 1.5rem;
}

.navigation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.navigation-node {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(255, 215, 0, 0.1));
    border: 2px solid var(--gold-start);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.navigation-node h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.navigation-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.navigation-option-btn {
    padding: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.navigation-option-btn:hover {
    border-color: var(--gold-start);
    background: rgba(212, 175, 55, 0.05);
}

/* Tree Metadata */
.tree-metadata {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Premium Badge */
.premium-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, var(--gold-start), var(--gold-end));
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

/* Mobile: tree visualization wrapper sizing */
@media (max-width: 768px) {
    .tree-visualization-wrapper {
        max-width: 100vw; /* Full width on mobile (no sidebar) */
        height: 65vh;
        max-height: 65vh;
    }

    .tree-controls {
        flex-direction: column;
    }

    .tree-controls button {
        width: 100%;
    }
}

/* ===== NATURAL LANGUAGE TREE MODAL ===== */

.tree-nl-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.tree-nl-content-wrapper {
    background: var(--bg-primary);
    border-radius: 0.5rem;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.tree-nl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tree-nl-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-nl-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.tree-nl-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tree-nl-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.tree-nl-content {
    color: var(--text-primary);
    line-height: 1.8;
}

.nl-section-title {
    color: var(--gold-start);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.nl-subsection-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
}

.tree-nl-content p {
    margin: 0.75rem 0;
    color: var(--text-primary);
}

.tree-nl-content strong {
    color: var(--gold-start);
    font-weight: 600;
}

.tree-nl-content ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.tree-nl-content li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.tree-nl-content li::before {
    content: '•';
    position: absolute;
    left: 0.5rem;
    color: var(--gold-start);
    font-weight: bold;
}

.nl-arrow {
    color: var(--gold-start);
    font-weight: bold;
    margin: 0 0.25rem;
}

/* Read Tree Button */
.tree-read-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-read-btn:hover {
    border-color: var(--gold-start);
    background: rgba(212, 175, 55, 0.05);
}

/* Knowledge Bank heading style (Foundation Reading) */
.kb-reading-type {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile adjustments for natural language modal */
@media (max-width: 768px) {
    .tree-nl-content-wrapper {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .tree-nl-body {
        padding: 1.5rem;
    }
    
    .tree-ai-actions {
        flex-direction: column;
    }

    .tree-ai-actions button {
        width: 100%;
    }
}

/* ===== CHOICE MODE STYLES ===== */

/* View Toggle */
.tree-view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-primary);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.tree-view-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tree-view-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tree-view-btn.active {
    background: linear-gradient(135deg, var(--gold-start), var(--gold-end));
    color: white;
}

/* Choice Mode Container */
.tree-choice-mode {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

/* Section Headers */
.choice-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

/* Breadcrumb Card */
.choice-breadcrumb {
    /* No background/border - part of main section */
    padding: 0;
}

.breadcrumb-trail {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-separator {
    color: var(--text-secondary);
    opacity: 0.5;
}

.breadcrumb-divider {
    width: 100%;
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
    opacity: 0.5;
}

.breadcrumb-current {
    display: block;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.25rem;
    line-height: 1.4;
    margin-top: 0.25rem;
}

/* Context Section (Unicode Tree - Mobile Map View) */
.choice-context-section {
    /* No background/border - part of main section */
    padding: 0;
    display: none; /* Hidden by default on desktop - only shown on mobile in map view */
}

.choice-unicode-tree {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 70vh;
    overflow-y: auto;
}

/* Options Card */
.choice-options-card {
    /* No background/border - part of main section */
    padding: 0;
}

/* Considerations Card (for single-path reflection) */
.choice-considerations-card {
    /* No background/border - part of main section */
    padding: 0;
}

.choice-considerations-text {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.consideration-node-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.consideration-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: all 0.2s;
    flex-shrink: 0;
}

.consideration-edit-btn:hover {
    opacity: 1;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: 0.25rem;
}

.choice-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-btn {
    padding: 1.125rem 1.25rem;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.choice-btn:hover {
    border-color: var(--gold-start);
    background: var(--bg-primary);
    transform: translateX(4px);
    box-shadow: -4px 0 0 var(--gold-start);
}

.choice-btn:active {
    transform: translateX(2px);
}

/* Controls */
.choice-controls {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.choice-control-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.choice-control-btn:hover:not(:disabled) {
    border-color: var(--text-secondary);
    background: var(--bg-primary);
}

.choice-control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* End State Card */
.choice-end-card {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(255, 215, 0, 0.08));
    border-radius: 0.5rem;
    padding: 2rem;
    border: 2px solid var(--gold-start);
    text-align: center;
    margin-top: 0.5rem; /* Add some separation from controls */
}

.choice-end-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* Edit Modal */
.choice-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.choice-edit-modal.hidden {
    display: none;
}

.choice-edit-modal-content {
    background: var(--bg-primary);
    border-radius: 0.5rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.choice-edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.choice-edit-modal-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

.choice-edit-modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-edit-option-btn {
    padding: 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text-primary);
    font-size: 1rem;
}

.choice-edit-option-btn:hover {
    border-color: var(--gold-start);
    background: var(--bg-primary);
}

.choice-edit-danger {
    color: #e74c3c;
    border-color: #e74c3c;
}

.choice-edit-danger:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: #c0392b;
}

/* Node Search Modal */
.node-search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.node-search-input:focus {
    outline: none;
    border-color: var(--gold-start);
}

.choice-label-input-wrapper {
    margin-bottom: 1rem;
}

.choice-label-input-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Edit Choice Buttons Container */
.edit-choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.node-search-results {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.node-search-result-btn {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text-primary);
}

.node-search-result-btn:hover {
    border-color: var(--gold-start);
    background: var(--bg-primary);
}

.node-search-result-btn .node-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.node-search-result-btn .node-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Disabled state for node search results */
.node-search-results.disabled {
    position: relative;
    opacity: 0.4;
    pointer-events: none;
}

.node-search-results.disabled::before {
    content: '↑ Enter a name for your choice first';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
}

/* ===== COMPLETION BUTTON STYLES ===== */

.choice-btn-container {
    margin-bottom: 0.75rem;
}

.completion-selected-container {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(255, 215, 0, 0.08));
    border: 2px solid var(--gold-start);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.choice-btn-selected {
    background: var(--gold-start);
    color: white;
    border-color: var(--gold-start);
    font-weight: 600;
    cursor: default;
    margin-bottom: 1rem;
}

.choice-btn-selected:hover {
    background: var(--gold-start);
    border-color: var(--gold-start);
}

.choice-btn-dimmed {
    opacity: 0.4;
    cursor: default;
    margin-bottom: 0.5rem;
}

.completion-instruction {
    text-align: center;
    margin: 1rem 0;
}

.completion-instruction p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.completion-instruction strong {
    color: var(--gold-start);
    font-size: 1.1rem;
}

.completion-btn {
    width: 100%;
    margin: 1rem 0;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.completion-change-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
    width: 100%;
}

.completion-change-link:hover {
    color: var(--text-primary);
}

.completion-others-dimmed {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ===== EXPANDABLE PREVIEW STYLES ===== */

.choice-preview {
    margin-top: 0.5rem;
}

.choice-preview-toggle {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.choice-preview-toggle:hover {
    border-color: var(--gold-start);
    background: var(--bg-primary);
}

.preview-label {
    flex: 1;
    text-align: left;
}

.preview-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.choice-preview-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    padding: 0.75rem;
    margin-top: -0.375rem;
}

.choice-preview-content.hidden {
    display: none;
}

.preview-intro {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.choice-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice-preview-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.preview-icon-emoji {
    font-size: 1.1rem;
    min-width: 1.5rem;
    text-align: center;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    /* Show view toggle on mobile - toggles between Choice Mode and Unicode Tree Map */
    .tree-view-toggle {
        display: flex; /* Visible on mobile */
    }

    /* On mobile, hide Mermaid visualization wrapper entirely */
    #tree-visualization-wrapper {
        display: none !important;
    }

    /* Show unicode tree when in map view on mobile */
    .tree-choice-mode.show-context .choice-context-section {
        display: block;
    }

    /* Hide other Choice Mode UI elements when showing map on mobile */
    .tree-choice-mode.show-context .choice-breadcrumb,
    .tree-choice-mode.show-context .choice-considerations-card,
    .tree-choice-mode.show-context .choice-options-card,
    .tree-choice-mode.show-context .choice-controls,
    .tree-choice-mode.show-context .choice-end-state {
        display: none;
    }

    .choice-actions {
        flex-direction: column;
    }

    .choice-action-btn {
        width: 100%;
    }

    .choice-unicode-tree {
        font-size: 0.75rem;
    }
}

/* ===== FLOW SCHEMA STYLES FOR CHOICE MODE ===== */
/* Styles for the conversational flow screens */

/* Base flow typography */
.flow-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.flow-body {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.flow-footer {
    font-size: 1rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    font-weight: 500;
}

/* Success screen styling */
.flow-success {
    color: var(--success-color, #28a745);
}

.flow-empathy {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 0.5rem;
    border-left: 3px solid var(--gold-start);
}

.flow-affirmation {
    font-size: 1rem;
    color: var(--gold-start);
    font-style: italic;
    margin-top: 1rem;
    text-align: center;
}

.flow-suggestions {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Reflection screen sections */
.reflection-section {
    background: var(--card-bg, #fafafa);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color, #e0e0e0);
}

.reflection-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold-start);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.reflection-section p {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
}

/* Reflection questions */
.reflection-questions {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.reflection-questions li {
    font-size: 1rem;
    color: var(--text-primary);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    position: relative;
    padding-left: 1.5rem;
}

.reflection-questions li:last-child {
    border-bottom: none;
}

.reflection-questions li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--gold-start);
}

/* Action list chips */
.action-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
}

.action-chip {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(255, 215, 0, 0.1));
    border: 1px solid var(--gold-start);
    border-radius: 2rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-chip:hover {
    background: linear-gradient(135deg, var(--gold-start), var(--gold-end));
    color: white;
    transform: translateY(-2px);
}

.flow-after-action {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 1.5rem;
    text-align: center;
}

/* Choice button variations */
.choice-btn-restart {
    background: var(--text-secondary) !important;
    border-color: var(--text-secondary) !important;
}

.choice-btn-restart:hover {
    background: var(--text-primary) !important;
    border-color: var(--text-primary) !important;
}

/* Stop screen styling */
.flow-stop {
    color: var(--danger-color, #dc3545);
}

/* Compact mode for screens with lots of content */
.flow-compact .reflection-section {
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.flow-compact .reflection-section h4 {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.flow-compact .reflection-section p {
    font-size: 0.9rem;
}

/* Animation for screen transitions */
@keyframes flowFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#choice-node-text,
#choice-buttons-container {
    animation: flowFadeIn 0.3s ease;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .flow-title {
        font-size: 1.2rem;
    }

    .flow-body {
        font-size: 1rem;
    }

    .reflection-section {
        padding: 0.875rem 1rem;
    }

    .action-chip {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}
/* ===== BUILD MODE STYLES ===== */

/* Build Mode - Enhanced border on choice mode */
.tree-choice-mode.build-mode-active {
    border: 2px solid var(--gold-start);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

/* Inline Edit Buttons Container */
.choice-inline-edit-btns {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* Individual Inline Edit Buttons */
.choice-inline-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.choice-inline-edit-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--gold-start);
}

.choice-inline-edit-btn:active {
    transform: scale(0.95);
}

/* Edit button icon colors */
.choice-inline-edit-btn.edit-btn {
    color: var(--gold-start);
}

.choice-inline-edit-btn.add-btn {
    color: #28a745;
}

.choice-inline-edit-btn.delete-btn {
    color: #dc3545;
}

.choice-inline-edit-btn.edit-btn:hover,
.choice-inline-edit-btn.add-btn:hover,
.choice-inline-edit-btn.delete-btn:hover {
    background: var(--bg-primary);
}

/* Build Mode - Section styling */
.build-mode-active .choice-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Empty State for Build Mode */
.build-mode-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
}

.build-mode-empty-state h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.build-mode-empty-state p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
}

.build-mode-empty-state input {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 1rem auto;
    display: block;
}

/* Mobile Adjustments for Build Mode */
@media (max-width: 768px) {
    .choice-inline-edit-btns {
        justify-content: center;
    }

    .choice-inline-edit-btn {
        font-size: 0.75rem;
        padding: 0.325rem 0.625rem;
    }
}

/* ===== PER-CHOICE EDITING BUTTONS (Food Plan Aesthetic) ===== */

/* Choice button container in build mode */
.choice-btn-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Choice actions (edit/delete buttons) */
.choice-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.choice-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    border-radius: 0.25rem;
}

.choice-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.choice-action-delete:hover {
    color: #dc3545;
}

/* Add Choice Button */
.choice-add-container {
    position: relative;
    margin-top: 0.75rem;
}

.choice-add-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.choice-add-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--gold-start);
    color: var(--text-primary);
}

/* Add Choice Dropdown Menu */
.add-choice-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    overflow: hidden;
}

.add-choice-menu-option {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.2s;
}

.add-choice-menu-option:last-child {
    border-bottom: none;
}

.add-choice-menu-option:hover {
    background: var(--bg-secondary);
}

/* Breadcrumb inline edit buttons - simplified for build mode */
.build-mode-active #choice-breadcrumb {
    position: relative;
}

.build-mode-active #choice-breadcrumb .choice-inline-edit-btns {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.build-mode-active #choice-breadcrumb .choice-inline-edit-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .choice-actions {
        gap: 0.125rem;
    }
    
    .choice-action-btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.875rem;
    }
    
    .choice-add-btn {
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
    }
}
