/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    color: #e0e0e0;
    min-height: 100vh;
    overflow: auto;
}

/* Container and layout */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}


/* Navigation tabs */
.nav-tabs {
    display: flex;
    justify-content: left;
    gap: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-tab {
    background: transparent;
    color: #a0a0a0;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-tab:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}

.nav-tab.active:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Level Generator Styles */
.level-generator-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 4px;
}

.generator-header {
    text-align: center;
    margin-bottom: 4px;
}

.generator-header h2 {
    font-size: 2rem;
    color: #64ffda;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

.generator-header p {
    font-size: 1.1rem;
    color: #a0a0a0;
    font-weight: 300;
}

.generator-content {
    display: flex;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.generator-panel{
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 750px;
}

.generator-panel h3,
.preview-panel h3 {
    color: #64ffda;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

/* Custom select dropdown with images */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-selected {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.custom-select-selected:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.custom-select-selected.active {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.custom-select-options.show {
    display: block;
}

.custom-select-option {
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.custom-select-option:hover {
    background: rgba(102, 126, 234, 0.2);
}

.custom-select-option.selected {
    background: rgba(102, 126, 234, 0.3);
}

.enemy-type-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-text {
    color: #e0e0e0;
    font-size: 0.9rem;
    user-select: none;
}

.generator-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.generate-btn {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%) !important;
    box-shadow: 0 4px 15px rgba(80, 250, 123, 0.25) !important;
}

.generate-btn:hover {
    box-shadow: 0 6px 20px rgba(80, 250, 123, 0.4) !important;
}

.preview-btn {
    background: linear-gradient(45deg, #74b9ff 0%, #0984e3 100%) !important;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.25) !important;
}

.preview-btn:hover {
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.4) !important;
}

.preview-container {
    min-height: 400px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    overflow-y: auto;
    word-wrap: break-word;
    word-break: break-word;
    position: relative;
}

/* Touchup Button Styles */
.touchup-button-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 8px;
}

.touchup-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.touchup-btn:hover {
    background: linear-gradient(45deg, #ff5252, #d63031);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    transform: translateY(-1px);
}

.touchup-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
}

.touchup-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.touchup-btn.enhanced {
    background: linear-gradient(45deg, #ff9500, #ff7b00);
    color: black;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.touchup-btn.enhanced:hover {
    background: linear-gradient(45deg, #ff8c00, #ff6b00);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
    transform: translateY(-1px);
}

.touchup-btn.enhanced:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 149, 0, 0.3);
}

.edit-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.edit-btn:hover {
    background: linear-gradient(45deg, #764ba2, #667eea);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.edit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.edit-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.edit-btn.editing {
    background: linear-gradient(45deg, #50fa7b, #44bd32);
    color: black;
    box-shadow: 0 2px 8px rgba(80, 250, 123, 0.3);
}

.edit-btn.editing:hover {
    background: linear-gradient(45deg, #44bd32, #50fa7b);
    box-shadow: 0 4px 12px rgba(80, 250, 123, 0.4);
    transform: translateY(-1px);
}

.edit-btn.editing:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(80, 250, 123, 0.3);
}

/* Mask Edit Grid Styles */
.mask-edit-container {
    position: relative;
    display: inline-block;
    cursor: crosshair;
}

.mask-edit-grid {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 5;
}

.mask-edit-grid-line {
    position: absolute;
    background: rgba(100, 255, 218, 0.3);
    pointer-events: none;
}

.mask-edit-grid-line.horizontal {
    width: 100%;
    height: 1px;
    left: 0;
}

.mask-edit-grid-line.vertical {
    height: 100%;
    width: 1px;
    top: 0;
}

.mask-edit-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 10;
    cursor: crosshair;
}

/* Mask Edit Modal Styles */
#mask-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    animation: fadeIn 0.2s ease-in-out;
}

.mask-edit-modal-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(100, 255, 218, 0.3);
    padding: 20px;
    max-width: 95vw;
    max-height: 95vh;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.2s ease-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mask-edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 255, 218, 0.3);
    flex-shrink: 0;
}

.mask-edit-modal-header h3 {
    margin: 0;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.mask-edit-modal-body {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    min-height: 0;
}

.mask-edit-modal-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

.mask-edit-modal-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    border: 1px solid rgba(100, 255, 218, 0.3);
    position: relative;
    z-index: 0;
}

.mask-edit-preview-background {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.5;
    z-index: 1;
    pointer-events: none;
    border-radius: 8px;
}

.mask-edit-modal-actions {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    flex-shrink: 0;
}

.mask-edit-modal-actions .mask-edit-color-palette {
    margin: 0;
    order: -1; /* Place color palette above buttons */
}

.mask-edit-button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mask-edit-save-btn {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: #000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(80, 250, 123, 0.3);
}

.mask-edit-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(80, 250, 123, 0.4);
    background: linear-gradient(45deg, #44bd32 0%, #50fa7b 100%);
}

.mask-edit-cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 24px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mask-edit-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.mask-edit-preview-bg-btn {
    background: linear-gradient(45deg, #74b9ff 0%, #0984e3 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.mask-edit-preview-bg-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.4);
    background: linear-gradient(45deg, #0984e3 0%, #74b9ff 100%);
}

.mask-edit-instructions {
    position: absolute;
    display: none;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #64ffda;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    z-index: 20;
    border: 1px solid rgba(100, 255, 218, 0.3);
}

/* Color Palette Styles */
.mask-edit-color-palette {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(100, 255, 218, 0.3);
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: rgba(0, 0, 0, 0.2);
}

.color-option:hover {
    background: rgba(100, 255, 218, 0.1);
    border-color: rgba(100, 255, 218, 0.5);
    transform: translateY(-2px);
}

.color-option.active {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-option span {
    color: #64ffda;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

/* Key Hints Styles */
.mask-edit-key-hints {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0;
    padding: 8px;
}

.key-hint {
    color: #888888;
    font-size: 12px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.2s ease;
}

.preview-placeholder {
    text-align: center;
    color: #666;
}

.preview-placeholder p {
    font-size: 1rem;
    color: #888;
}

/* Level Grid Styles */
.level-grid {
    display: grid;
    gap: 2px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.grid-cell {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.grid-cell.empty {
    background: rgba(255, 255, 255, 0.1);
}

.grid-cell.obstacle {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.generated-level {
    color: #e0e0e0;
}

.generated-level h4 {
    color: #64ffda;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.level-info {
    margin-bottom: 20px;
}

.level-info p {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.level-info strong {
    color: #64ffda;
}

.level-visual {
    margin-top: 15px;
}

/* Preview Navigation Tabs */
.preview-tabs {
    margin-top: 20px;
}

.preview-nav-tabs {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.preview-nav-tab {
    background: transparent;
    color: #a0a0a0;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    flex: 1;
}

.preview-nav-tab:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.1);
}

.preview-nav-tab.active {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.status-indicators {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status.enabled {
    background: rgba(80, 250, 123, 0.2);
    color: #50fa7b;
    border: 1px solid rgba(80, 250, 123, 0.3);
}

.status.disabled {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* .mask-preview,
.background-preview,
.integration-preview {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    text-align: center;
    color: #888;
    margin-top: 10px;
} */

/* Loading and Error States */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: #e0e0e0;
}

.loading-state h4 {
    color: #64ffda;
    margin-bottom: 15px;
}

.loading-spinner-large {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(100, 255, 218, 0.3);
    border-top: 4px solid #64ffda;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}


.error-state {
    text-align: center;
    padding: 40px 20px;
    color: #e0e0e0;
}

.error-state h4 {
    color: #ff6b6b;
    margin-bottom: 15px;
}

/* Level Map Rendering */
.level-map {
    margin-top: 15px;
}

.level-map h5 {
    color: #64ffda;
    margin-bottom: 10px;
    font-size: 1rem;
}

.level-map .level-grid {
    display: grid;
    gap: 1px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    max-width: 100%;
    overflow-x: auto;
}

.level-map .grid-cell {
    width: 12px;
    height: 12px;
    border-radius: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    color: white;
}

.level-map .grid-cell.player {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%);
}

.level-map .grid-cell.enemy {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%);
}

.level-map .grid-cell.obstacle {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
}

.level-map .grid-cell.empty {
    background: rgba(255, 255, 255, 0.1);
}

.level-stats {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.level-stats p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.saved-files {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #28a745;
}

.saved-files h5 {
    margin: 0 0 8px 0;
    color: #28a745;
    font-size: 14px;
}

.saved-files p {
    margin: 4px 0;
    font-size: 13px;
    color: #555;
}

.generation-history {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.slider-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.generation-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.generation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.generation-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.generation-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

#currentGeneration {
    font-weight: 500;
}

#totalGenerations {
    font-style: italic;
}

.raw-response {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.raw-response pre {
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.api-response-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.api-response-info h5 {
    color: #64ffda;
    margin-bottom: 10px;
    font-size: 1rem;
}

.api-response-info p {
    margin: 5px 0;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .generator-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .generator-actions {
        flex-direction: column;
    }
    
    .level-grid {
        gap: 1px;
    }
    
    .grid-cell {
        width: 15px;
        height: 15px;
    }
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.file-upload-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-btn {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%) !important;
    box-shadow: 0 4px 15px rgba(80, 250, 123, 0.25) !important;
    padding: 10px 15px;
}

.upload-btn:hover {
    box-shadow: 0 6px 20px rgba(80, 250, 123, 0.4) !important;
}

.download-btn {
    /* background: linear-gradient(45deg, #74b9ff 0%, #0984e3 100%) !important; */
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.25) !important;
    /* padding: 10px 15px; */
}

.download-btn:hover {
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.4) !important;
}

.root-btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 4px 4px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: small;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
    
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.25);
    margin-left: 8px;
}

.root-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.back-btn {
    padding: 4px 4px;
    background: linear-gradient(45deg, #8be9fd 0%, #50fa7b 100%) !important;
    box-shadow: 0 4px 15px rgba(139, 233, 253, 0.25) !important;
}

.back-btn:hover {
    box-shadow: 0 6px 20px rgba(139, 233, 253, 0.4) !important;
}

.back-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25) !important;
    padding: 10px 10px;
    margin-right: 0px;
}

.settings-btn:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.reset-zoom-btn {
    background: linear-gradient(45deg, #fdcb6e 0%, #e17055 100%) !important;
    box-shadow: 0 4px 15px rgba(253, 203, 110, 0.25) !important;
    padding: 10px 15px;
    margin-right: 0px;
}

.reset-zoom-btn:hover {
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.4) !important;
}

.lock-panel-btn {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%) !important;
    box-shadow: 0 4px 15px rgba(80, 250, 123, 0.25) !important;
    padding: 6px 8px;
    font-size: 0.8rem;
    margin: 0;
}

.lock-panel-btn:hover {
    box-shadow: 0 6px 20px rgba(80, 250, 123, 0.4) !important;
}

.lock-panel-btn.locked {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%) !important;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.25) !important;
}

.lock-panel-btn.locked:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4) !important;
}

.breadcrumb-path {
    display: inline-flex;
    align-items: center;
    margin-left: 0px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: #e0e0e0;
    background: rgba(30, 30, 50, 0.6);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(100, 255, 218, 0.2);
    backdrop-filter: blur(10px);
    max-width: 600px;
    overflow-x: auto;
    white-space: nowrap;
    margin-bottom: 4px;
}

.breadcrumb-item {
    cursor: pointer;
    color: #64ffda;
    padding: 0px 0px;
    border-radius: 4px;
    transition: all 0.15s ease;
    text-decoration: none;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-item:hover {
    background: rgba(100, 255, 218, 0.1);
    color: #50fa7b;
    transform: translateY(-1px);
}

.breadcrumb-item.current {
    color: #ff79c6;
    font-weight: 600;
    cursor: default;
}

.breadcrumb-item.current:hover {
    background: none;
    transform: none;
}

.breadcrumb-separator {
    color: #6272a4;
    margin: 0 4px;
    font-weight: 300;
    user-select: none;
}

.breadcrumb-path:empty {
    display: none;
}

@media (max-width: 768px) {
    .breadcrumb-path {
        max-width: 300px;
        font-size: 12px;
        padding: 4px 4px;
    }
    
    .breadcrumb-item {
        max-width: 80px;
        padding: 2px 4px;
    }
    
    .breadcrumb-separator {
        margin: 0 4px;
    }
}



/* Main content layout */
.main-content {
    display: flex;
    gap: 20px;
    width: 100%;
    height: calc(100vh - 300px); /* Fixed height based on viewport minus header, search, and controls */
    margin-bottom: 20px; /* Space between panels and search */
    min-height: 800px; /* Ensure minimum height for visualization */
}

/* Visualization container */
.visualization-container {
    position: relative;
    width: 66.66%; /* 2/3 of the width */
    height: 100%; /* Use full height of main-content */
    min-width: 800px;
    min-height: 800px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* JSON Panel */
.json-panel {
    width: 33.33%; /* 1/3 of the width */
    height: 100%; /* Use full height of main-content */
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent panel itself from overflowing */
}

.panel-header {
    padding: 20px 20px 10px 20px;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-json-btn {
    background: linear-gradient(45deg, #ff79c6 0%, #bd93f9 100%) !important;
    box-shadow: 0 4px 15px rgba(255, 121, 198, 0.25) !important;
    padding: 8px 12px;
    font-size: 0.9rem;
    margin: 0;
}

.edit-json-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 121, 198, 0.4) !important;
}

.edit-json-btn.editing {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%) !important;
    box-shadow: 0 4px 15px rgba(80, 250, 123, 0.25) !important;
}

.edit-json-btn.editing:hover {
    box-shadow: 0 6px 20px rgba(80, 250, 123, 0.4) !important;
}

.panel-header .node-key {
    color: #ff79c6;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(255, 121, 198, 0.4);
}

/* Search Container */
.search-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 400px;
    max-width: 80%;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: all 0.15s ease;
}

.search-input::placeholder {
    color: rgba(224, 224, 224, 0.5);
}

.search-input:focus {
    border-color: #64ffda;
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.2);
    background: rgba(0, 0, 0, 0.6);
}

.search-icon {
    position: absolute;
    right: 15px;
    font-size: 16px;
    color: #64ffda;
    pointer-events: none;
    opacity: 0.7;
}

.json-display {
    flex: 1;
    padding: 20px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: transparent;
    border: none;
    margin: 0;
    overflow-y: auto; /* Only vertical scrolling */
    overflow-x: hidden; /* Prevent horizontal overflow */
    white-space: pre-wrap;
    word-wrap: break-word;
    /* max-height no longer needed as parent has fixed height */
}

.json-display.editing {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 121, 198, 0.3);
    border-radius: 8px;
    outline: none;
    cursor: text;
}

.json-display.editing:focus {
    border-color: rgba(255, 121, 198, 0.6);
    box-shadow: 0 0 15px rgba(255, 121, 198, 0.2);
}

.json-display::-webkit-scrollbar {
    width: 8px;
}

.json-display::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb {
    background: rgba(100, 255, 218, 0.3);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 255, 218, 0.5);
}

/* JSON Syntax Highlighting */
.json-key {
    color: #ff79c6;
    font-weight: 500;
}

.json-string {
    color: #d8d8d8;
}

.json-number {
    color: #bd93f9;
}

.json-boolean {
    color: #ffb86c;
    font-weight: 500;
}

.json-null {
    color: #6272a4;
    font-style: italic;
}

.loading {
    text-align: center;
    color: #64ffda;
    font-size: 1.2rem;
    padding: 40px;
}

/* Sunburst Chart Styles */
.sunburst-segment {
    cursor: pointer;
    transition: all 0.15s ease;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
}

.sunburst-segment:hover {
    filter: brightness(1.3) drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
}

.magic-segment {
    cursor: pointer;
    transition: all 0.15s ease;
    filter: drop-shadow(0 0 5px rgba(100, 255, 218, 0.4));
}

.magic-segment:hover {
    filter: brightness(1.2) drop-shadow(0 0 12px rgba(100, 255, 218, 0.7));
    stroke-width: 4px !important;
}

.center-node {
    filter: drop-shadow(0 0 10px rgba(100, 255, 218, 0.4));
}

.center-node circle {
    cursor: pointer;
    transition: all 0.15s ease;
}

.segment-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Tooltip styles */
.tooltip-title {
    font-weight: 700;
    color: #64ffda;
    font-size: 14px;
    margin-bottom: 6px;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.tooltip-content {
    color: #e0e0e0;
    font-size: 11px;
    line-height: 1.4;
}

#segment-tooltip {
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* SVG styles */
svg {
    overflow: visible;
    width: 100%;
    height: 100%;
}

/* Generation Prompt Styles */
#generation-prompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.15s ease-in-out;
}

.prompt-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(100, 255, 218, 0.3);
    padding: 0;
    min-width: 400px;
    max-width: 500px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.15s ease-out;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.prompt-header h3 {
    margin: 0;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

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

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.prompt-body {
    padding: 24px;
}

.prompt-info {
    margin-bottom: 20px;
}

.prompt-info p {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.context-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 5px 0;
}

.context-preview-header:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 5px 10px;
    margin: -5px -10px;
}

.context-toggle-icon {
    color: #64ffda;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.context-preview-content {
    margin-top: 10px;
    transition: all 0.3s ease;
}

.context-preview {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.context-preview-header strong {
    color: #64ffda;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.context-text {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 10px;
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    color: #b0b0b0;
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.prompt-body label {
    display: block;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.additional-instructions {
    margin-top: 20px;
}

.additional-instructions label {
    display: block;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.additional-instructions-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.additional-instructions-input::placeholder {
    color: rgba(224, 224, 224, 0.5);
}

.additional-instructions-input:focus {
    outline: none;
    border-color: #64ffda;
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

/* Knowledge Base Toggle and Context Selection Row Styles */
.options-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.knowledge-base-toggle {
    flex: 1;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    gap: 12px;
    width: 100%;
    min-height: 24px;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
    top: 6px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #e0e0e0;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-slider {
    background: rgba(100, 255, 218, 0.2);
    border-color: rgba(100, 255, 218, 0.6);
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #64ffda;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

.toggle-text {
    flex: 1;
}

/* Context Selection Button Styles */
.context-selection {
    flex: 1;
}

.select-context-btn {
    background: linear-gradient(45deg, #ff79c6 0%, #bd93f9 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(255, 121, 198, 0.3);
    width: 100%;
}

.select-context-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 121, 198, 0.4);
    background: linear-gradient(45deg, #bd93f9 0%, #ff79c6 100%);
}

.select-context-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 121, 198, 0.2);
}





.prompt-actions {
    display: flex;
    justify-content: flex-end;
}

.generate-btn {
    background: linear-gradient(135deg, #64ffda, #50e3c2);
    border: none;
    color: #000;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 255, 218, 0.4);
    background: linear-gradient(135deg, #50e3c2, #64ffda);
}

.generate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(100, 255, 218, 0.2);
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateX(100%);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .file-upload-container {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .file-name {
        max-width: 250px;
    }
    
    .main-content {
        flex-direction: column;
        gap: 15px;
        height: calc(100vh - 290px); /* Adjust for mobile header spacing, search, and controls below */
        margin-bottom: 20px;
    }
    
    .search-box {
        width: 100%;
        max-width: 350px;
    }
    
    .search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .visualization-container {
        width: 100%;
        height: 60%; /* 60% of available height on mobile */
        min-width: 400px;
        min-height: 400px;
    }
    
    .json-panel {
        width: 100%;
        height: 40%; /* 40% of available height on mobile */
    }
    
    .json-display {
        font-size: 10px;
    }
    
    svg {
        max-width: 100%;
        height: auto;
    }
    
    .segment-label {
        font-size: 6px;
    }
    
    #segment-tooltip {
        max-width: 250px;
        font-size: 10px;
    }
    
    /* Generation prompt mobile styles */
    .prompt-content {
        min-width: 300px;
        max-width: 90vw;
        margin: 20px;
    }
    
    .suggestion-buttons {
        gap: 6px;
    }
    
    .suggestion-btn {
        font-size: 11px;
        padding: 8px 12px;
    }
    
    /* Selection window mobile styles */
    .selection-content {
        min-width: 300px;
        max-width: 95vw;
        max-height: 90vh;
        margin: 20px;
    }
    
    .selection-header, .selection-body {
        padding: 16px 20px;
    }
    
    .selection-panels {
        flex-direction: column;
        gap: 16px;
    }
    
    .left-panel h4, .right-panel h4 {
        font-size: 14px;
        padding: 8px;
    }
    
    .option-btn {
        padding: 12px;
    }
    
    .option-json {
        font-size: 11px;
    }
    
    .example-json {
        font-size: 10px;
    }
}


/* Settings Modal Styles */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease-in-out;
}

.settings-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 30px;
    min-width: 500px;
    max-width: 80vw;
    max-height: 80vh;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.2s ease-out;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.settings-header h3 {
    margin: 0;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    /* gap: 8px; */
}

.form-group label {
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.color-scheme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.scheme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
}

.scheme-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.scheme-btn.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.8);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

.scheme-preview {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.color-sample {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.save-btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 24px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.logout-btn {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

/* RAG Modal Styles */
#rag-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease-in-out;
}

.rag-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(100, 255, 218, 0.3);
    padding: 30px;
    min-width: 600px;
    max-width: 90vw;
    min-height: 80vh;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.2s ease-out;
    overflow-y: auto;
}

.rag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 255, 218, 0.3);
}

.rag-header h3 {
    margin: 0;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.rag-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.rag-input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.rag-input:focus {
    outline: none;
    border-color: rgba(100, 255, 218, 0.5);
    box-shadow: 0 0 0 3px rgba(100, 255, 218, 0.1);
}

.rag-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.rag-test-btn, .rag-context-btn, .rag-info-btn {
    background: linear-gradient(45deg, #64ffda 0%, #4fc3f7 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: #1a1a2e;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.rag-test-btn:hover, .rag-context-btn:hover, .rag-info-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(100, 255, 218, 0.3);
}

.rag-results {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.rag-results h4 {
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

#ragResultsContent {
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rag-document {
    background: rgba(100, 255, 218, 0.1);
    border-left: 4px solid #64ffda;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
}

.rag-document-title {
    color: #64ffda;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.rag-document-score {
    color: #4fc3f7;
    font-size: 12px;
    margin-bottom: 10px;
}

.rag-document-content {
    color: #e0e0e0;
    font-size: 12px;
    line-height: 1.5;
}

/* Color Scheme Selector Styles */
#color-scheme-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease-in-out;
}

.color-scheme-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 30px;
    min-width: 600px;
    max-width: 80vw;
    max-height: 80vh;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.2s ease-out;
}

.color-scheme-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 107, 107, 0.3);
}

.color-scheme-header h3 {
    margin: 0;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
}

.color-scheme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.scheme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.scheme-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 107, 107, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.scheme-btn.active {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.8);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
}

.scheme-preview {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.color-sample {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.scheme-btn span {
    font-size: 14px;
    font-weight: 600;
}

/* Selection Window Styles */
#selection-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease-in-out;
}

.selection-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(100, 255, 218, 0.3);
    padding: 0;
    min-width: 600px;
    max-width: 80vw;
    max-height: 80vh;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.2s ease-out;
    display: flex;
    flex-direction: column;
}

.selection-header {
    padding: 24px 32px 0 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.selection-header h3 {
    margin: 0;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
}

.selection-header .parent-key {
    color: #ff79c6;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 121, 198, 0.4);
}

.selection-body {
    padding: 24px 32px 32px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.selection-panels {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

.left-panel, .right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.left-panel h4, .right-panel h4 {
    margin: 0 0 16px 0;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    padding: 12px;
    background: rgba(100, 255, 218, 0.05);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 8px;
}

.examples-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.example-item {
    background: rgba(30, 30, 50, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
}

.example-json {
    margin: 0;
    font-size: 11px;
    line-height: 1.3;
    white-space: pre-wrap;
    overflow-x: auto;
    color: #a0a0a0;
}

.selection-info {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(100, 255, 218, 0.05);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 8px;
    text-align: center;
}

.selection-info p {
    margin: 0;
    color: #64ffda;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
}

.selection-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.option-container {
    background: rgba(30, 30, 50, 0.7);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-container:hover {
    background: rgba(40, 40, 70, 0.8);
    border-color: rgba(100, 255, 218, 0.4);
    box-shadow: 0 4px 20px rgba(100, 255, 218, 0.1);
}

.option-content {
    flex: 1;
}

.option-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.accept-btn, .reject-btn {
    background: rgba(40, 40, 70, 0.8);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accept-btn:hover:not(:disabled) {
    background: rgba(80, 250, 123, 0.2);
    border-color: rgba(80, 250, 123, 0.5);
    box-shadow: 0 2px 10px rgba(80, 250, 123, 0.2);
}

.reject-btn:hover:not(:disabled) {
    background: rgba(255, 85, 85, 0.2);
    border-color: rgba(255, 85, 85, 0.5);
    box-shadow: 0 2px 10px rgba(255, 85, 85, 0.2);
}

.accept-btn:disabled, .reject-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.accept-btn:disabled span, .reject-btn:disabled span {
    font-weight: 600;
}

.option-btn {
    background: rgba(30, 30, 50, 0.7);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
}

.option-btn:hover:not(:disabled) {
    background: rgba(40, 40, 70, 0.8);
    border-color: rgba(100, 255, 218, 0.4);
    box-shadow: 0 4px 20px rgba(100, 255, 218, 0.1);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.option-btn:disabled span {
    font-weight: 600;
}

.option-json {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-x: auto;
}

.selection-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.additional-instructions-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions-label {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.instructions-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    transition: all 0.15s ease;
    box-sizing: border-box;
    min-width: 200px;
}

.instructions-input:focus {
    outline: none;
    border-color: #64ffda;
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.2);
}

.instructions-input::placeholder {
    color: rgba(224, 224, 224, 0.5);
}

.selection-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.close-selection-btn {
    background: rgba(60, 60, 80, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    transition: all 0.15s ease;
}

.close-selection-btn:hover {
    background: rgba(70, 70, 90, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.generate-again-btn {
    background: linear-gradient(45deg, #64ffda 0%, #4fc3f7 100%);
    border: none;
    color: #1a1a2e;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.generate-again-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.3);
}

.generate-again-btn:disabled {
    background: rgba(100, 100, 100, 0.5) !important;
    color: rgba(255, 255, 255, 0.5) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.generate-btn:disabled {
    background: rgba(100, 100, 100, 0.5) !important;
    color: rgba(0, 0, 0, 0.5) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.example-item.collapsed {
    background: rgba(30, 30, 50, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.1);
}

.example-item.expanded {
    background: rgba(30, 30, 50, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
}

.example-item.negative-recommendation {
    background: rgba(80, 30, 30, 0.4);
    border: 1px solid rgba(255, 100, 100, 0.2);
}

.example-item.collapsed.negative-recommendation {
    background: rgba(80, 30, 30, 0.3);
    border: 1px solid rgba(255, 100, 100, 0.15);
}

.example-item.expanded.negative-recommendation {
    background: rgba(80, 30, 30, 0.5);
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.example-item.generated {
    background: rgba(255, 165, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.example-item.collapsed.generated {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.example-item.expanded.generated {
    background: rgba(255, 165, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
}

/* Rejection Reason Modal */
#rejection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    animation: fadeIn 0.2s ease-in-out;
}

.rejection-modal-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.rejection-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 107, 107, 0.2);
}

.rejection-modal-content .modal-header h3 {
    color: #ff6b6b;
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.rejection-modal-content .modal-body p {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 14px;
}

#rejection-reason-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    transition: all 0.15s ease;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 20px;
}

#rejection-reason-input:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

#rejection-reason-input::placeholder {
    color: rgba(224, 224, 224, 0.5);
}

.rejection-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.rejection-actions .btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.rejection-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.rejection-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.rejection-actions .btn-primary {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.rejection-actions .btn-primary:hover {
    background: linear-gradient(45deg, #ff5555 0%, #dd4a42 100%);
    border-color: rgba(255, 107, 107, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.expand-btn {
    background: none;
    border: none;
    color: #64ffda;
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
    border-radius: 6px;
}

.expand-btn:hover {
    background: rgba(100, 255, 218, 0.1);
    color: #50fa7b;
}

.expand-icon {
    font-size: 10px;
    color: #64ffda;
    transition: all 0.15s ease;
    min-width: 12px;
}

.expand-btn:hover .expand-icon {
    color: #50fa7b;
}

.key-name {
    color: #e0e0e0;
    font-weight: 500;
}

.expanded-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(100, 255, 218, 0.2);
}

/* Generated node styling */
.generated-segment {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    animation: generatedGlow 2s ease-in-out infinite alternate;
}

.generated-label {
    font-weight: 700 !important;
    fill: #ffffff !important;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
}

@keyframes generatedGlow {
    0% {
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
    }
}

/* Negative recommendation node styling */
.negative-segment {
    filter: drop-shadow(0 0 8px rgba(255, 85, 85, 0.6));
    animation: negativeGlow 2s ease-in-out infinite alternate;
}

.negative-label {
    font-weight: 700 !important;
    fill: #ffffff !important;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
}

@keyframes negativeGlow {
    0% {
        filter: drop-shadow(0 0 8px rgba(255, 85, 85, 0.6));
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(255, 85, 85, 0.9));
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .sunburst-segment {
        stroke: black !important;
        stroke-width: 1 !important;
    }
    
    .magic-segment {
        stroke: black !important;
        stroke-width: 2 !important;
    }
    
    .segment-label {
        fill: black !important;
    }
    
    .center-node text {
        fill: black !important;
    }
    
    #selection-window, #generation-prompt {
        display: none !important;
    }
}

/* Level Browser Styles */
.level-browser-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.browser-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #64ffda, #50e3c2);
    color: #000;
    position: relative;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.4);
}

.filter-icon {
    font-size: 16px;
}

.filter-count {
    background: rgba(0, 0, 0, 0.3);
    color: #64ffda;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.image-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    margin-left: 0px;
    width: 52px;
}

.image-type-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.3);
}

.image-type-btn:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    transform: scale(1.1);
}

.image-type-btn.active {
    background: rgba(100, 255, 218, 0.3);
    border-color: #64ffda;
    box-shadow: 0 0 8px rgba(100, 255, 218, 0.4);
}

.display-info {
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
}

.display-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.display-options label {
    color: #e0e0e0;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
}

.display-input {
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
}

.display-input:focus {
    outline: none;
    border-color: #64ffda;
    box-shadow: 0 0 5px rgba(100, 255, 218, 0.3);
}

/* Filter Modal Styles */
.filter-modal-content {
    max-width: 600px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 14px;
}

.filter-input {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
}

.filter-input:focus {
    outline: none;
    border-color: #64ffda;
    box-shadow: 0 0 5px rgba(100, 255, 218, 0.3);
}

.filter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.clear-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Responsive Design for Level Browser */
@media (max-width: 768px) {
    .browser-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .controls-left, .controls-right {
        justify-content: center;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .generations-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-modal-content {
        max-width: 95%;
        margin: 20px auto;
    }
}

.loading-state {
    text-align: center;
    padding: 40px;
    color: #e0e0e0;
}

.loading-state p {
    margin-top: 15px;
    font-family: 'JetBrains Mono', monospace;
}

.generations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.generation-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.generation-card:hover {
    border-color: #64ffda;
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.2);
    transform: translateY(-2px);
}

.generation-card.generated {
    /* background: linear-gradient(135deg, rgba(255, 165, 0, 0.25) 0%, rgba(255, 140, 0, 0.25) 100%); */
    border: 1px solid rgba(255, 165, 0, 0.6);
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.3);
}

.generation-card.generated:hover {
    border-color: #FFA500;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
    /* padding-left: 4px; Space for buttons */
}

.card-actions {
    display: flex;
    gap: 4px;
    position: absolute;
    top: 0;
    left: 0;
}

.card-header h4 {
    color: #64ffda;
    margin: 0;
    font-size: 14px;
    flex: 1;
    text-align: left;
    margin-left: 50px;
}

.card-header h4.generated-title {
    color: #FFA500;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 165, 0, 0.4);
}

.timestamp {
    color: #e0e0e0;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.card-mask {
    margin-bottom: 0px;
    text-align: center;
}

.image-container {
    position: relative;
    display: inline-block;
    overflow: hidden;
    max-width: 100%;
}

.mask-image {
    max-width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    /* border: 1px solid rgba(100, 255, 218, 0.3); */
    transition: opacity 0.3s ease;
}

.regenerate-background-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(100, 255, 218, 0.6);
    border-radius: 3px;
    color: #64ffda;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.regenerate-background-btn:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    transform: scale(1.1);
}

.regenerate-background-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.regenerate-background-btn:disabled:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(100, 255, 218, 0.6);
    transform: none;
}

.image-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 5;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.image-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(100, 255, 218, 0.3);
    border-top: 2px solid #64ffda;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mask-image:not([src*="data:image/svg"]):not(.loaded) {
    opacity: 0;
}

.mask-image.loaded {
    opacity: 1;
}

/* Mask Overlay Styles */
.mask-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.image-container:hover .mask-overlay {
    opacity: 0.5;
}

.mask-overlay-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Image Preview Modal Styles */
.image-preview-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.image-preview-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content-preview-image {
    background: #1a1a1a;
    border-radius: 0;
    box-shadow: none;
    width: 70vw;
    height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-body-preview-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.preview-image {
    width: 70vw;
    height: 70vh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

/* Modal Mask Overlay Styles */
.modal-mask-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.modal-body-preview-image:hover .modal-mask-overlay {
    opacity: 0.5;
}

.modal-mask-overlay-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
}

/* Clickable Image Styles */
.clickable-image {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.clickable-image:hover {
    opacity: 0.8;
}

.no-mask {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
}

.no-background {
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    gap: 10px;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.no-integration {
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    gap: 10px;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.no-integration-text {
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    text-align: center;
}

.generate-integration-btn {
    background: linear-gradient(45deg, #4CAF50 0%, #45a049 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    display: inline-block;
    min-width: 160px;
}

.generate-integration-btn:hover {
    background: linear-gradient(45deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.generate-integration-btn:disabled {
    background: linear-gradient(45deg, #666 0%, #555 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.generate-integration-btn:disabled:hover {
    background: linear-gradient(45deg, #666 0%, #555 100%);
    transform: none;
    box-shadow: none;
}

.create-merged-mask-btn {
    background: linear-gradient(45deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    /* width: 100%; */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.create-merged-mask-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #6c5ce7 0%, #5f3dc4 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.create-merged-mask-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.create-merged-mask-btn:disabled {
    background: linear-gradient(45deg, #666 0%, #555 100%);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.create-merged-mask-btn:disabled:hover {
    background: linear-gradient(45deg, #666 0%, #555 100%);
    transform: none;
    box-shadow: none;
}

.no-background-text {
    font-size: 0.9rem;
    color: #a0a0a0;
}

.generate-background-btn {
    background: linear-gradient(45deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.generate-background-btn:hover {
    background: linear-gradient(45deg, #0984e3 0%, #74b9ff 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.generate-background-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.generate-background-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(45deg, #666 0%, #555 100%);
}

.generate-background-btn:disabled:hover {
    background: linear-gradient(45deg, #666 0%, #555 100%);
    transform: none;
    box-shadow: none;
}

.prompt-display {
    height: 150px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.4;
    overflow-y: auto;
    text-align: left;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.card-metadata {
    margin-bottom: 0px;
}

.metadata-item {
    margin-bottom: 2px;
    margin-left: 10px;
    font-size: 10px;
    color: #e0e0e0;
}

.metadata-item strong {
    color: #64ffda;
}

.btn-icon {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.3);
}

.btn-icon:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    transform: scale(1.1);
}

.view-btn:hover {
    background: rgba(116, 185, 255, 0.3);
    border-color: #74b9ff;
}

.download-btn:hover {
    background: rgba(0, 184, 148, 0.3);
    border-color: #00b894;
}

.generator-btn {
    background: rgba(100, 255, 218, 0.1);
    color: #64ffda;
    border: 1px solid rgba(100, 255, 218, 0.3);
    left: 50;
}

.enhancement-btn {
    background: rgba(100, 255, 218, 0.1);
    color: #64ffda;
    border: 1px solid rgba(100, 255, 218, 0.3);
    left: 50;
}

.enhancement-btn:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    transform: scale(1.1);
}

.enhancement-btn.enhanced {
    background: linear-gradient(45deg, #ff9500, #ff7b00);
    color: black;
    border-color: #ff9500;
}

.enhancement-btn.enhanced:hover {
    background: linear-gradient(45deg, #ff8c00, #ff6b00);
    border-color: #ff8c00;
    transform: scale(1.1);
}

.enhancement-btn:disabled {
    background: #666;
    border-color: #666;
    cursor: not-allowed;
    transform: none;
}

/* Orange styling for buttons in generated cards */
.generation-card.generated .view-btn {
    border-color: rgba(255, 165, 0, 0.6);
}

.generation-card.generated .view-btn:hover {
    background: rgba(255, 165, 0, 0.3);
    border-color: #FFA500;
}

.generation-card.generated .download-btn {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.6);
}

.generation-card.generated .download-btn:hover {
    background: rgba(255, 165, 0, 0.4);
    border-color: #FFA500;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.pagination-controls {
    display: flex;
    gap: 10px;
}

.pagination-btn {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    border-color: #64ffda;
    background: rgba(100, 255, 218, 0.1);
}

.pagination-btn.active {
    background: #64ffda;
    color: #000;
    border-color: #64ffda;
}

/* Modal Styles */
#generation-modal, #filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-hidden {
    display: none !important;
    opacity: 0;
}

.modal-content {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
}

.modal-header h3 {
    color: #64ffda;
    margin: 0;
}

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

.close-btn:hover {
    color: #64ffda;
}

.modal-body {
    padding: 20px;
}

.generation-details h4 {
    color: #64ffda;
    margin-bottom: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h5 {
    color: #e0e0e0;
    margin-bottom: 10px;
    font-size: 16px;
}

.detail-section p {
    color: #e0e0e0;
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
}

.json-preview {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 4px;
    padding: 15px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Rating Page Styles */
.rate-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.rate-header {
    text-align: center;
    margin-bottom: 40px;
}

.rate-header h1 {
    font-size: 2.5rem;
    color: #64ffda;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

.rate-header p {
    font-size: 1.1rem;
    color: #a0a0a0;
    font-weight: 300;
}

.rate-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
}

.mask-card-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center;
}

.mask-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    width: 100%;
}

.mask-card:hover {
    border-color: #64ffda;
    box-shadow: 0 6px 30px rgba(100, 255, 218, 0.2);
}

.mask-card .mask-image {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.rating-form {
    width: 100%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.rating-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    justify-content: space-between;
}

.rating-group.comment-group {
    flex-direction: column;
    align-items: flex-start;
}

.rating-label {
    font-size: 1.1rem;
    color: #64ffda;
    font-weight: 500;
    min-width: 120px;
}

.star-rating {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    flex: 1;
}

.star-rating .star {
    font-size: 5rem;
    color: #444;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
    margin: -15px -0px 0px 0px;
}

.star-rating .star:hover {
    transform: scale(1.1);
    color: #64ffda;
}

.star-rating .star.active {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.comment-input {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 8px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.comment-input:focus {
    outline: none;
    border-color: #64ffda;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.2);
}

.comment-input::placeholder {
    color: #666;
}

.next-btn {
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%);
    box-shadow: 0 4px 15px rgba(80, 250, 123, 0.25);
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
}

.next-btn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(80, 250, 123, 0.4);
    transform: translateY(-2px);
}

.next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #e0e0e0;
}

.loading-state p {
    margin-top: 20px;
    font-size: 1.1rem;
    color: #a0a0a0;
}

.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #e0e0e0;
}

.error-state p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #ff6b6b;
}

.error-state .btn {
    margin-top: 20px;
}

/* ===== Study Flow ===== */

.study-progress-bar-container {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.study-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.study-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #64ffda, #50fa7b);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.study-progress-text {
    font-size: 0.85rem;
    color: #64ffda;
    min-width: 36px;
    text-align: right;
    font-weight: 500;
}

/* Landing page */

.study-landing {
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
    /* padding: 40px 0 20px; */
}

.study-landing-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.study-landing h1 {
    font-size: 2.4rem;
    color: #64ffda;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

.study-landing-lead {
    font-size: 1.15rem;
    color: #c0c0c0;
    line-height: 1.6;
    margin-bottom: 32px;
}

.study-landing-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    margin: 0 auto 32px;
    max-width: 400px;
}

.study-detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    color: #e0e0e0;
}

.study-detail-icon {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.study-landing-note {
    font-size: 0.95rem;
    color: #888;
    font-style: italic;
    margin-bottom: 36px;
    line-height: 1.5;
}

.study-start-btn {
    background: linear-gradient(45deg, #64ffda 0%, #50fa7b 100%);
    color: #0a0a0a;
    padding: 16px 56px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(100, 255, 218, 0.3);
}

.study-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(100, 255, 218, 0.45);
}

/* Examples on landing page */

.study-examples {
    margin: 0 auto 32px;
    max-width: 700px;
}

.study-examples-title {
    font-size: 1.1rem;
    color: #64ffda;
    margin-bottom: 16px;
    font-weight: 600;
}

.study-examples-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: nowrap;
    flex-direction: row;
}

.study-example-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 255, 218, 0.15);
    border-radius: 10px;
    padding: 12px;
    flex: 1;
    min-width: 500px;
    max-width: 500px;
}

.study-example-img,
.study-example-video {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin-bottom: 10px;
}

.study-example-rating {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 8px;
}

.study-example-label {
    font-size: 0.9rem;
    color: #a0a0a0;
    font-weight: 500;
}

.star-rating-fixed .star {
    cursor: default;
    font-size: 1.4rem;
}

.star-rating-fixed .star:hover {
    transform: none;
}

/* Phase label & counter */

.study-phase-label {
    font-size: 1.5rem;
    font-weight: 600;
    color: #64ffda;
    text-align: center;
    text-shadow: 0 0 12px rgba(100, 255, 218, 0.3);
}


/* AI detection buttons */

.ai-detection-group {
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.ai-detection-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.ai-detect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 36px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(100, 255, 218, 0.2);
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 160px;
}

.ai-detect-btn:hover {
    border-color: #64ffda;
    background: rgba(100, 255, 218, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(100, 255, 218, 0.2);
}

.ai-detect-btn.selected {
    border-color: #64ffda;
    background: rgba(100, 255, 218, 0.15);
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.25);
}

.ai-detect-icon {
    font-size: 2rem;
}

/* Completion page */

.study-break,
.study-complete {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 0 20px;
}

.study-complete h1 {
    font-size: 2.4rem;
    color: #64ffda;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

.study-remarks {
    margin-top: 32px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.study-remarks .comment-input {
    min-height: 80px;
}

.study-submit-remarks-btn {
    align-self: flex-end;
    background: linear-gradient(45deg, #64ffda 0%, #50fa7b 100%);
    color: #0a0a0a;
    padding: 10px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.study-submit-remarks-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(100, 255, 218, 0.3);
}

.study-remarks-confirmation {
    color: #64ffda;
    font-size: 0.95rem;
    text-align: center;
}

/* Login page */

.login-container {
    max-width: 400px;
    margin: 120px auto 0;
    text-align: center;
}

.login-container h1 {
    font-size: 2rem;
    color: #64ffda;
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-input {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 8px;
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.3s ease;
}

.login-input:focus {
    outline: none;
    border-color: #64ffda;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.2);
}

.login-error {
    color: #ff6b6b;
    font-size: 0.95rem;
    margin: 0;
}

/* Layer Button Loading Animation */
.layer-use-mask-btn,
.layer-use-coarse-mask-btn,
.layer-restyle-mask-btn,
.layer-final-touchup-btn {
    position: relative;
    overflow: hidden;
}

/* Gray background when loading */
.layer-use-mask-btn.loading,
.layer-use-coarse-mask-btn.loading,
.layer-restyle-mask-btn.loading,
.layer-final-touchup-btn.loading {
    background: #666 !important;
}

/* Green fill animation */
.layer-use-mask-btn::before,
.layer-use-coarse-mask-btn::before,
.layer-restyle-mask-btn::before,
.layer-final-touchup-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(45deg, #50fa7b 0%, #44bd32 100%);
    z-index: 0;
    pointer-events: none;
    transition: width 0s linear;
}

.layer-use-mask-btn.loading::before {
    width: 100%;
    transition-duration: 15s;
    transition-timing-function: linear;
}

.layer-use-coarse-mask-btn.loading::before {
    width: 100%;
    transition-duration: 3s;
    transition-timing-function: linear;
}

.layer-restyle-mask-btn.loading::before {
    width: 100%;
    transition-duration: 26s;
    transition-timing-function: linear;
}

.layer-final-touchup-btn.loading::before {
    width: 100%;
    transition-duration: 70s;
    transition-timing-function: linear;
}

/* Touchup Settings Modal Styles */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 3000;
    animation: fadeIn 0.2s ease-in-out;
}

.settings-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.settings-modal-content {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 30px;
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.2s ease-out;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.settings-modal-header h3 {
    margin: 0;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
}

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

.settings-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-modal-body {
    margin-bottom: 20px;
}

.settings-modal-body input[type="range"] {
    width: 100%;
    margin-top: 8px;
    cursor: pointer;
}

.settings-modal-body #guidanceValue {
    color: rgba(102, 126, 234, 1);
    font-weight: 600;
    margin-left: 8px;
}

.settings-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 2px solid rgba(102, 126, 234, 0.3);
}

.layer-use-mask-btn > *,
.layer-use-coarse-mask-btn > *,
.layer-restyle-mask-btn > *,
.layer-final-touchup-btn > * {
    position: relative;
    z-index: 1;
}