/* Medical Image Viewer - Professional Styling */

:root {
    /* Professional grey-white color scheme */
    --primary-color: #6B7280; /* Medium grey */
    --primary-hover: #4B5563; /* Darker grey */
    --secondary-color: #9CA3AF; /* Light grey */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    --bg-primary: #000000; /* Main panel pure black */
    --bg-secondary: #000000; /* Side/top panels pure black */
    --bg-tertiary: #000000; /* Sidebar/header pure black */
    --text-primary: #FFFFFF; /* White text */
    --text-secondary: #A0AEC0; /* Muted grey text */
    --text-muted: #6B7280;

    --border-color: #23263A;
    --border-light: #23263A;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: -0.01em;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Disclaimer Styles */
.disclaimer {
    background: linear-gradient(90deg, #fffbe6 0%, #ffe066 100%); /* Standard disclaimer yellow */
    color: #7c4700;
    padding: 0.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid #ffe066;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}

.disclaimer p {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.4;
}

.disclaimer i {
    font-size: 0.875rem;
}

/* Header */
.header {
    background: #000000;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
}

.header h1 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    letter-spacing: -0.025em;
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.3;
}

.header h1 i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Branding Styles */
.branding {
    display: flex;
    align-items: center;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.brand-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.85;
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: 0.015em;
    text-transform: uppercase;
}

.brand-icon {
    color: #D1D5DB; /* Light grey shade */
    margin-right: 0.5rem;
}

.ai-gradient {
    font-size: 1.5rem;
    font-weight: 400;
    background: linear-gradient(90deg, #888 0%, #bbb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.status-indicator.active {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* Compact Results Styles */
.results-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.compact-result-summary {
    margin-bottom: 1rem;
}

.compact-result-summary p {
    margin: 0.25rem 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.compact-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.export-details {
    width: 100%;
}

.export-summary {
    cursor: pointer;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    outline: none;
}

.export-summary:hover {
    background: var(--bg-secondary);
}

.export-list {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.export-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.75rem;
}

.export-item:last-child {
    border-bottom: none;
}

.export-item .file-name {
    flex: 1;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-item .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-width: auto;
    border-radius: 2rem;
    border: 1px solid var(--primary-color);
    background: #0a0a0a;
    color: var(--primary-color);
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

.export-item .btn:hover {
    background: #313132;
    color: var(--text-primary);
    border-color: #313132;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: linear-gradient(180deg, #111 0%, #222 100%);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1.5rem;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
    font-family: 'Inter', system-ui, sans-serif;
}

.sidebar-section h3 i {
    color: var(--text-secondary);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    letter-spacing: 0.005em;
    font-family: 'Inter', system-ui, sans-serif;
}

.form-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.4;
}

.form-select[multiple] {
    min-height: 8rem;
    overflow-y: auto;
}

.form-select[multiple] option {
    padding: 0.25rem 0.5rem;
    margin: 0.125rem 0;
    border-radius: var(--radius-sm);
}

.form-select[multiple] option:checked {
    background: #4a4a4a;
    color: white;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-help {
    display: block;
    margin-top: 0.375rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.005em;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0.01em;
    font-family: 'Inter', system-ui, sans-serif;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary, #a0a0b0);
    border-color: var(--border-color, #2d3150);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-secondary, #1e2030);
    color: var(--text-primary, #fff);
    border-color: var(--primary-color, #6366f1);
}

.btn-secondary {
    background: var(--bg-secondary, #1e2030);
    color: var(--text-primary, #fff);
    border-color: var(--border-color, #2d3150);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary, #252840);
    border-color: var(--primary-color, #6366f1);
}

/* Mode toggle pill buttons */
.mode-toggle-group {
    display: flex;
    gap: 0;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.mode-toggle-btn {
    flex: 1;
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: 'Inter', system-ui, sans-serif;
    border: none;
    cursor: pointer;
    background: #2a2a2a;
    color: #888;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    letter-spacing: 0.02em;
}

.mode-toggle-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.mode-toggle-btn.mode-toggle-active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.45), 0 1px 0 rgba(255,255,255,0.08) inset;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.mode-toggle-btn:hover:not(.mode-toggle-active) {
    background: #383838;
    color: #bbb;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

/* Viewer Container */
.viewer-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-content i {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loading-progress {
    margin-top: 1.5rem;
    width: 300px;
    max-width: 80vw;
}

.loading-progress .progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.loading-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.loading-progress .progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.loading-progress .progress-text {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.welcome-content {
    max-width: 500px;
}

.welcome-content i {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.welcome-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    font-family: 'Inter', system-ui, sans-serif;
}

.welcome-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.005em;
}

.features {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.005em;
}

.feature i {
    color: var(--primary-color);
}

/* Viewer Grid - Three equal panels */
.viewer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr auto;
    height: 100%;
    gap: 1px;
    background: var(--border-color);
}

.viewer-panel {
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    min-height: 200px; /* Ensure minimum height for controls */
}

.viewer-panel:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.info-panel {
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    padding: 1rem;
    max-height: 150px;
    overflow-y: auto;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

.viewer-header .header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-header .fullscreen-btn {
    padding: 0.25rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-header .fullscreen-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.viewer-header .header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-header .fullscreen-btn {
    padding: 0.25rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-header .fullscreen-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.viewer-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.viewer-panel:hover .viewer-header::before {
    transform: translateX(0);
}

.viewer-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.slice-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.viewer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0; /* Allow flexbox to shrink */
}

.image-container {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    min-height: 0; /* Allow shrinking */
}

.image-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: loading-slide 1.5s infinite;
    z-index: 5;
}

@keyframes loading-slide {
    0% { left: -100%; }
    100% { left: 100%; }
}

.medical-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* High-quality image rendering for smooth CT images */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    image-rendering: smooth;
    -ms-interpolation-mode: bicubic;
    transition: opacity 0.2s ease-in-out;
    transform-origin: center center;
    display: block; /* Show img tags for rendering */
    /* Anti-aliasing for better quality */
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
    will-change: transform;
}

.image-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Ensure canvas can receive hover events */
canvas.medical-canvas {
    display: block;
    cursor: crosshair;
    /* High-quality canvas rendering */
    image-rendering: high-quality;
    image-rendering: smooth;
    -ms-interpolation-mode: bicubic;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Smooth slice navigation indicators */
.slice-change-indicator {
    font-family: monospace;
    box-shadow: var(--shadow-md);
}

/* Enhanced slider with smooth animations */
.slice-slider {
    width: 100%;
    transition: all 0.2s ease-in-out;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--border-color);
}

.slice-slider:hover {
    transform: scaleY(1.5);
    height: 10px;
}

.slice-slider:active {
    transform: scaleY(2);
    height: 12px;
}

/* Webkit browsers (Chrome, Safari, newer Edge) */
.slice-slider::-webkit-slider-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.slice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    margin-top: -6px; /* Centers the thumb on the track */
}

.slice-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-hover);
}

/* Firefox */
.slice-slider::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.slice-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.slice-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-hover);
}

/* Smooth hover effects for viewer panels */
.viewer-panel:hover .viewer-header {
    background: #4a4a4a;
    transition: background-color 0.2s ease-in-out;
}

.viewer-panel:hover .viewer-header h4 {
    color: white;
}

.viewer-controls {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    flex-shrink: 0; /* Prevent controls from shrinking */
}

/* Dragging cursor */
.image-container.dragging {
    cursor: ns-resize !important;
}

/* Panning cursor */
.image-container.panning {
    cursor: move !important;
}

/* Zoomed state cursor */
.image-container.zoomed {
    cursor: move;
}

/* Zoom interaction hint */
.image-container:hover::after {
    content: 'Ctrl+Wheel: Zoom | Double-click: Reset';
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Slice progress indicator */
.slice-progress {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.slice-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--progress, 0%);
    background: var(--primary-color);
    border-radius: 2px;
    transition: height 0.2s ease-out;
}

.image-container:hover .slice-progress,
.image-container.dragging .slice-progress {
    opacity: 1;
}

/* Info Panel */
.info-panel {
    background: var(--bg-secondary);
    padding: 1rem;
}

.info-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-content h4 i {
    color: var(--primary-color);
}

.image-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-row span:last-child {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Organs Panel */
.organs-list {
    max-height: 300px;
    overflow-y: auto;
}

.organ-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    background: var(--bg-tertiary);
    font-size: 0.875rem;
}

.organ-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.organ-item span {
    flex: 1;
    color: var(--text-primary);
}

.organ-label {
    font-family: monospace;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Tooltip */
.organ-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    min-width: 120px;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.organ-tooltip.with-color-accent {
    border-left-width: 4px;
}

.tooltip-content {
    white-space: nowrap;
}

/* Enhanced tooltip content */
.tooltip-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.organ-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.2rem;
}

.organ-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.tooltip-stats {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tooltip-stats div {
    margin-bottom: 0.2rem;
    display: flex;
    justify-content: space-between;
}

.tooltip-stats div:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .viewer-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: minmax(180px, 1fr) auto auto;
    }
    
    .viewer-panel:nth-child(3) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }
    
    .viewer-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(3, minmax(150px, 1fr)) auto;
    }
    
    .viewer-panel {
        grid-column: 1;
        min-height: 150px; /* Smaller minimum for mobile */
    }
    
    .info-panel {
        grid-column: 1;
        max-height: 120px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        position: relative;
    }
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

input:focus,
select:focus,
button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Upload and Segment Styles */
.form-file {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.form-file:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.form-file:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.file-info {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    word-break: break-all;
    white-space: normal;
    overflow-wrap: anywhere;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-details i {
    color: #A0AEC0 !important; /* Muted grey shade for file icons */
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.btn.btn-secondary {
    background: #4a4a4a;
    border-color: #4a4a4a;
    color: white;
}

.btn.btn-secondary:hover {
    background: #5a5a5a;
    border-color: #5a5a5a;
    color: white;
}

.btn.btn-secondary:disabled {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Viewer button hover effect */
.viewer-btn:hover {
    background: #5a5a5a !important;
    border-color: #5a5a5a !important;
    color: white !important;
}

.upload-progress {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 100%;
    animation: progressAnimation 2s infinite;
}

@keyframes progressAnimation {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.notification i {
    font-size: 1.1rem;
    opacity: 0.8;
}

.notification-success i {
    color: var(--success-color);
}

.notification-error i {
    color: var(--danger-color);
}

.notification-info i {
    color: var(--primary-color);
}

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

/* Segmentation Results Styles */
.segmentation-results {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.segmentation-results h3 {
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.segmentation-results p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.results-list {
    margin: 1rem 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item i {
    color: var(--primary-color);
    width: 16px;
    text-align: center;
}

.result-item span {
    flex: 1;
    font-weight: 500;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

.btn-sm i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* Enhanced Segmentation Results Styling - Inspired by segment.py */
.segmentation-results {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1rem;
}

.segmentation-results h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.text-success {
    color: var(--success-color) !important;
}

.result-summary {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--success-color);
}

.result-summary p {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.result-summary p:last-child {
    margin-bottom: 0;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.results-actions {
    margin-bottom: 1.5rem;
}

.action-group {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.action-group h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    width: 100%;
}

.help-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.download-item:last-child {
    margin-bottom: 0;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.btn-outline-primary {
    background: #0a0a0a;
    border: 1px solid #4a4a4a;
    color: #a0a0a0;
    border-radius: 2rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

.btn-outline-primary:hover {
    background: #5a5a5a;
    color: white;
    border-color: #5a5a5a;
}

.btn-outline-secondary {
    background: #0a0a0a;
    border: 1px solid #4a4a4a;
    color: #a0a0a0;
    border-radius: 2rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

.btn-outline-secondary:hover {
    background: #5a5a5a;
    color: white;
    border-color: #5a5a5a;
}

.action-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.text-muted {
    color: var(--text-muted);
    font-style: italic;
}

/* Viewer placeholder for loading states */
.viewer-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    text-align: center;
}

.viewer-placeholder i {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.viewer-placeholder p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.viewer-placeholder small {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Status indicators */
.status-active {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.notification i {
    font-size: 1.25rem;
}

.notification-success i {
    color: var(--success-color);
}

.notification-error i {
    color: var(--danger-color);
}

.notification-info i {
    color: var(--primary-color);
}

/* Fullscreen styles */
.fullscreen-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-primary) !important;
    display: flex !important;
    flex-direction: column !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.fullscreen-panel .viewer-header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

.fullscreen-panel .viewer-header h4 {
    font-size: 1rem;
    font-weight: 700;
}

.fullscreen-panel .viewer-header .fullscreen-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.fullscreen-panel .viewer-header .fullscreen-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.fullscreen-panel .viewer-content {
    flex: 1;
    padding: 1rem;
}

.fullscreen-panel .image-container {
    height: calc(100vh - 120px); /* Account for header and controls */
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
}

.fullscreen-panel .medical-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fullscreen-panel .viewer-controls {
    padding: 1rem 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.fullscreen-panel .slice-slider {
    width: calc(100% - 2rem);
    margin: 0 1rem;
    height: 8px;
}

.fullscreen-panel .slice-info {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Fullscreen tooltip adjustments */
.fullscreen-panel .organ-tooltip {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Hide other UI elements when any panel is fullscreen */
body:has(.fullscreen-panel) .header,
body:has(.fullscreen-panel) .sidebar {
    display: none !important;
}

/* Smooth transitions */
.viewer-panel {
    transition: all 0.3s ease;
}

.fullscreen-panel * {
    transition: all 0.2s ease;
}

/* Bottom Results Section */
.bottom-results {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.bottom-results .segmentation-results {
    max-width: 1200px;
    margin: 0 auto;
}

.bottom-results .segmentation-results h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

.bottom-results .result-summary {
    margin-bottom: 1.5rem;
}

.bottom-results .result-summary p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.bottom-results .results-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.bottom-results .action-group h4 {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

.bottom-results .action-footer {
    margin-top: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Adjust main content to account for bottom results */
body:has(.bottom-results[style*="block"]) .main-content {
    margin-bottom: 300px;
}

#login-btn.btn.btn-primary.btn-large {
    border-radius: 2rem;
    border: 1px solid var(--primary-color);
    background: #0a0a0a;
    color: var(--primary-color);
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border 0.2s;
}
#login-btn.btn.btn-primary.btn-large:hover {
    background: #313132;
    color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Landing Page Styles */
.homepage {
    display: flex;
    flex-direction: column;
    background: #000000;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Navigation Bar */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-justify-content: space-between;
    -moz-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-flex-align: center;
    align-items: center;
}

.nav-brand {
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 0.75rem;
    -webkit-gap: 0.75rem;
    -moz-gap: 0.75rem;
}

/* Safari gap fallback */
@supports not (gap: 0.75rem) {
    .nav-brand > * + * {
        margin-left: 0.75rem;
    }
}

.brand-logo {
    height: 2rem;
    width: auto;
    object-fit: contain;
}

.nav-brand .brand-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-links {
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 2rem;
    -webkit-gap: 2rem;
    -moz-gap: 2rem;
}

/* Safari gap fallback for nav links */
@supports not (gap: 2rem) {
    .nav-links > * + * {
        margin-left: 2rem;
    }
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
}

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

/* Landing Sections - Stack Vertically */
.landing-section {
    padding: 6rem 0;
    display: block;
    width: 100%;
    float: none;
    position: relative;
}

.section-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
    display: block;
}

.section-header {
    margin-bottom: 4rem;
    display: block;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.section-divider {
    display: none;
}

/* Hero Section */
.hero-section {
    background: #000000;
    position: relative;
    padding-top: 8rem;
    min-height: 80vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 100%;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        /* Horizontal traces */
        linear-gradient(90deg, transparent 0%, transparent calc(50% - 1px), rgba(218, 165, 32, 0.3) calc(50% - 1px), rgba(218, 165, 32, 0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent 100%),
        /* Vertical traces */
        linear-gradient(0deg, transparent 0%, transparent calc(50% - 1px), rgba(218, 165, 32, 0.3) calc(50% - 1px), rgba(218, 165, 32, 0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent 100%),
        /* Connection nodes */
        radial-gradient(circle at 25% 25%, rgba(218, 165, 32, 0.4) 0%, rgba(218, 165, 32, 0.4) 3px, transparent 3px),
        radial-gradient(circle at 75% 25%, rgba(218, 165, 32, 0.4) 0%, rgba(218, 165, 32, 0.4) 3px, transparent 3px),
        radial-gradient(circle at 25% 75%, rgba(218, 165, 32, 0.4) 0%, rgba(218, 165, 32, 0.4) 3px, transparent 3px),
        radial-gradient(circle at 75% 75%, rgba(218, 165, 32, 0.4) 0%, rgba(218, 165, 32, 0.4) 3px, transparent 3px),
        radial-gradient(circle at 50% 50%, rgba(218, 165, 32, 0.5) 0%, rgba(218, 165, 32, 0.5) 4px, transparent 4px);
    background-size: 120px 120px, 120px 120px, 120px 120px, 120px 120px, 120px 120px, 120px 120px, 120px 120px;
    background-position: 0 0;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.hero-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 300%;
    height: 100%;
    background: 
        /* Animated light pulse */
        radial-gradient(ellipse 150px 100px at var(--light-x, 0%) 30%, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.3) 30%, transparent 60%),
        radial-gradient(ellipse 150px 100px at var(--light-x, 10%) 50%, rgba(255, 215, 0, 0.5), rgba(255, 215, 0, 0.2) 30%, transparent 60%),
        radial-gradient(ellipse 150px 100px at var(--light-x, 20%) 70%, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.3) 30%, transparent 60%);
    background-size: 100% 100%;
    animation: circuitLightFlow 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: screen;
}

@keyframes circuitLightFlow {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(0);
        opacity: 0;
    }
}

.hero-gradient {
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: radial-gradient(circle at 30% 50%, rgba(45, 127, 249, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(45, 127, 249, 0.08) 0%, transparent 50%);
    animation: gradientShift 20s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-5%, 5%) scale(1.1);
    }
}

.hero-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(45, 127, 249, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(45, 127, 249, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 30s linear infinite;
    opacity: 0.5;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(60px, 60px);
    }
}

.hero-content {
    text-align: left;
    max-width: 1000px;
    margin: 0;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    max-width: 900px;
    opacity: 0;
    transform: translateY(30px);
}

.hero-title.animate-in {
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-subtitle {
    font-size: 1.35rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-weight: 400;
    line-height: 1.7;
    max-width: 700px;
    opacity: 0;
    transform: translateY(30px);
}

.hero-subtitle.animate-in {
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.hero-description {
    display: none;
}

.hero-product-intro {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.hero-product-logo {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    display: inline-block;
}

.hero-product-name {
    color: #00c2cc;
    font-weight: 700;
}

.hero-actions {
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(30px);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-actions.animate-in {
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
}

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

.btn-large {
    padding: 1.125rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.2s, color 0.2s;
}

.btn-outline:hover {
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

.disclaimer-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* About Section */
.about-section {
    background: #000000;
    border-top: 1px solid var(--border-color);
    display: block;
    width: 100%;
}

.about-content {
    display: block;
    width: 100%;
}

.about-text {
    max-width: 900px;
    margin-bottom: 3rem;
    display: block;
}

.about-text h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.about-text p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.features-grid {
    display: -webkit-grid;
    display: -ms-grid;
    display: grid;
    -webkit-grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    -ms-grid-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    -webkit-gap: 1.5rem;
    -moz-gap: 1.5rem;
}

/* Safari grid fallback for features */
@supports not (display: grid) {
    .features-grid {
        display: -webkit-flex;
        display: -moz-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-flex-wrap: wrap;
        -moz-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        -webkit-justify-content: space-between;
        -moz-justify-content: space-between;
        -ms-flex-pack: justify;
        justify-content: space-between;
    }
    
    .feature-card {
        -webkit-flex: 0 0 calc(50% - 0.75rem);
        -moz-flex: 0 0 calc(50% - 0.75rem);
        -ms-flex: 0 0 calc(50% - 0.75rem);
        flex: 0 0 calc(50% - 0.75rem);
        margin-bottom: 1.5rem;
    }
}

.feature-card {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem 1.75rem;
    text-align: left;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(30px);
}

.feature-card.animate-in {
    animation: fadeSlideUp 0.6s ease-out forwards;
}

.feature-card:nth-child(1).animate-in {
    animation-delay: 0.1s;
}

.feature-card:nth-child(2).animate-in {
    animation-delay: 0.2s;
}

.feature-card:nth-child(3).animate-in {
    animation-delay: 0.3s;
}

.feature-card:nth-child(4).animate-in {
    animation-delay: 0.4s;
}

@keyframes fadeSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card:hover {
    border-color: rgba(45, 127, 249, 0.4);
    background: rgba(10, 10, 10, 0.5);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1.25rem;
}

.feature-card h4 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.feature-card p {
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Contact Section */
.contact-section {
    background: #000000;
    border-top: 1px solid var(--border-color);
}

.contact-content {
    max-width: 900px;
}

.contact-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.contact-info > p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.8;
}

.contact-methods {
    display: grid;
    gap: 1.5rem;
}

.contact-method {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.contact-method:hover {
    border-color: rgba(45, 127, 249, 0.4);
    background: rgba(10, 10, 10, 0.5);
}

.contact-method i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 0.125rem;
}

.contact-method strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-weight: 600;
}

.contact-method p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9375rem;
}

/* Footer */
/* Partners Section */
.partners-section {
    background: #000000;
    border-top: 1px solid var(--border-color);
}

.section-subtitle {
    font-size: 1.0625rem;
    color: var(--text-muted);
    margin-top: -2.5rem;
    margin-bottom: 0;
}

.partners-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.partner-row {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.partner-badge-wrap {
    flex-shrink: 0;
    background: #fff;
    border-radius: 6px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.partner-desc {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.partner-desc-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.partner-desc-text {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin: 0;
    max-width: 520px;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .partner-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.landing-footer {
    background: #000000;
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1.5rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-bottom: 3rem;
}

.footer-brand p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.footer-column h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-column a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
    cursor: pointer;
}

.footer-column a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Team Section */
.team-section {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
}

.team-grid {
    display: -webkit-grid;
    display: -ms-grid;
    display: grid;
    -webkit-grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    -ms-grid-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    -webkit-gap: 2.5rem;
    -moz-gap: 2.5rem;
    margin-top: 3rem;
}

/* Safari grid fallback */
@supports not (display: grid) {
    .team-grid {
        display: -webkit-flex;
        display: -moz-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-flex-wrap: wrap;
        -moz-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        -webkit-justify-content: space-between;
        -moz-justify-content: space-between;
        -ms-flex-pack: justify;
        justify-content: space-between;
    }
    
    .team-member {
        -webkit-flex: 0 0 calc(50% - 1.25rem);
        -moz-flex: 0 0 calc(50% - 1.25rem);
        -ms-flex: 0 0 calc(50% - 1.25rem);
        flex: 0 0 calc(50% - 1.25rem);
        margin-bottom: 2.5rem;
    }
}

.team-member {
    background: #1a1a1a;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    -webkit-transition: -webkit-transform 0.3s ease, box-shadow 0.3s ease;
    -moz-transition: -moz-transform 0.3s ease, box-shadow 0.3s ease;
    -ms-transition: -ms-transform 0.3s ease, box-shadow 0.3s ease;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}

.team-member:hover {
    -webkit-transform: translateY(-5px) translateZ(0);
    -moz-transform: translateY(-5px) translateZ(0);
    -ms-transform: translateY(-5px) translateZ(0);
    transform: translateY(-5px) translateZ(0);
    box-shadow: var(--shadow-lg);
}

.member-photo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    width: 150px;
    height: 150px;
}

.member-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border-radius: 50%;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(107, 114, 128, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.member-photo-container:hover .photo-overlay {
    opacity: 1;
}

.member-photo-container:hover .member-photo {
    transform: scale(1.1);
}

.photo-overlay i {
    color: white;
    font-size: 1.5rem;
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.member-photo-container.active .photo-overlay i {
    transform: rotate(45deg);
}

.member-info {
    margin-bottom: 1rem;
}

.member-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.member-role {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 1rem;
    margin: 0;
}

.member-details {
    max-height: none;
    overflow: visible;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding-top 0.3s ease;
    opacity: 1;
    text-align: left;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.member-details.expanded {
    max-height: none;
    opacity: 1;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.member-details p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.member-specialties {
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -moz-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 0.5rem;
    -webkit-gap: 0.5rem;
    -moz-gap: 0.5rem;
    margin-top: 1rem;
}

/* Safari gap fallback for specialties */
@supports not (gap: 0.5rem) {
    .member-specialties > * + * {
        margin-left: 0.5rem;
    }
    .member-specialties > *:nth-child(n+3) {
        margin-top: 0.5rem;
    }
}

.specialty-tag {
    background: rgba(107, 114, 128, 0.2);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.member-social {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(107, 114, 128, 0.2);
}

.social-link {
    display: -webkit-inline-flex;
    display: -moz-inline-flex;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 0.5rem;
    -webkit-gap: 0.5rem;
    -moz-gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
    background: transparent;
}

/* Safari gap fallback for social links */
@supports not (gap: 0.5rem) {
    .social-link > * + * {
        margin-left: 0.5rem;
    }
}

.social-link:hover {
    background: var(--primary-color);
    color: white;
    -webkit-transform: translateY(-1px);
    -moz-transform: translateY(-1px);
    -ms-transform: translateY(-1px);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

.social-link i {
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        gap: 1rem;
        -webkit-gap: 1rem;
        -moz-gap: 1rem;
    }
    
    /* Safari gap fallback for mobile nav links */
    @supports not (gap: 1rem) {
        .nav-links > * + * {
            margin-left: 1rem;
        }
    }
    
    .nav-link {
        display: none;
    }
    
    .landing-section {
        padding: 4rem 0;
    }
    
    .hero-section {
        padding-top: 6rem;
        min-height: 70vh;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .features-grid {
        -webkit-grid-template-columns: 1fr;
        -ms-grid-columns: 1fr;
        grid-template-columns: 1fr;
    }
    
    /* Safari grid fallback for mobile features */
    @supports not (display: grid) {
        .feature-card {
            -webkit-flex: 1 1 100%;
            -moz-flex: 1 1 100%;
            -ms-flex: 1 1 100%;
            flex: 1 1 100%;
        }
    }
    
    .team-grid {
        -webkit-grid-template-columns: 1fr;
        -ms-grid-columns: 1fr;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        -webkit-gap: 1.5rem;
        -moz-gap: 1.5rem;
    }
    
    /* Safari grid fallback for mobile team */
    @supports not (display: grid) {
        .team-member {
            -webkit-flex: 1 1 100%;
            -moz-flex: 1 1 100%;
            -ms-flex: 1 1 100%;
            flex: 1 1 100%;
        }
    }
    
    .team-member {
        padding: 1.5rem;
    }
    
    .member-photo-container {
        width: 120px;
        height: 120px;
    }
    
    .footer-content {
        -webkit-grid-template-columns: 1fr;
        -ms-grid-columns: 1fr;
        grid-template-columns: 1fr;
        gap: 2rem;
        -webkit-gap: 2rem;
        -moz-gap: 2rem;
    }
}

/* ============================================================
   Training Data Upload Button (header)
   ============================================================ */
.btn-training {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    gap: 0.4rem;
}
.btn-training:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
}

/* ============================================================
   Training Data Upload Modal
   ============================================================ */
.training-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.training-modal {
    background: #111827;
    border: 1px solid #374151;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.training-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #1f2937;
}

.training-modal-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #a78bfa;
    font-size: 1.1rem;
    font-weight: 600;
}
.training-modal-title-row h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f9fafb;
}

.training-modal-close {
    background: none;
    border: 1px solid #374151;
    border-radius: var(--radius-sm);
    color: #9ca3af;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.training-modal-close:hover {
    border-color: #6b7280;
    color: #f9fafb;
    background: #1f2937;
}

/* Constraints info banner */
.training-info-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #0f172a;
    border-bottom: 1px solid #1f2937;
}

.training-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: #9ca3af;
    line-height: 1.4;
}
.training-info-item i {
    color: #818cf8;
    font-size: 0.85rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}
.training-info-item strong {
    color: #e2e8f0;
}

/* Drop zone */
.training-dropzone {
    margin: 1.25rem 1.5rem;
    border: 2px dashed #374151;
    border-radius: var(--radius-md);
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}
.training-dropzone:hover,
.training-dropzone.dragover {
    border-color: #818cf8;
    background: rgba(99,102,241,0.05);
}
.training-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    text-align: center;
    pointer-events: none;
}
.training-dropzone-icon {
    font-size: 2.5rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}
.training-dropzone.dragover .training-dropzone-icon {
    color: #818cf8;
}
.training-dropzone-text {
    font-size: 1rem;
    font-weight: 500;
    color: #d1d5db;
}
.training-dropzone-sub {
    font-size: 0.8rem;
    color: #6b7280;
}
.training-dropzone-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}
/* browse button sits inside the drop zone — needs pointer-events */
.training-dropzone .btn {
    pointer-events: all;
}

/* File queue */
.training-file-queue {
    margin: 0 1.5rem 1rem;
}
.training-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

.training-file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 260px;
    overflow-y: auto;
}

.training-file-item {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
}
.training-file-item.error {
    border-color: #ef4444;
    background: rgba(239,68,68,0.07);
}
.training-file-item.success {
    border-color: #10b981;
    background: rgba(16,185,129,0.07);
}
.training-file-item.uploading {
    border-color: #818cf8;
}

.training-file-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.training-file-icon {
    color: #818cf8;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.training-file-name {
    flex: 1;
    font-size: 0.82rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.training-file-size {
    font-size: 0.75rem;
    color: #6b7280;
    flex-shrink: 0;
}
.training-file-status {
    font-size: 0.75rem;
    flex-shrink: 0;
    min-width: 5rem;
    text-align: right;
}
.training-file-status.queued   { color: #9ca3af; }
.training-file-status.uploading{ color: #818cf8; }
.training-file-status.success  { color: #10b981; }
.training-file-status.error    { color: #ef4444; }
.training-file-remove {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.training-file-remove:hover { color: #ef4444; }

.training-file-progress {
    margin-top: 0.4rem;
    height: 3px;
    background: #374151;
    border-radius: 9999px;
    overflow: hidden;
}
.training-file-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.2s ease;
    border-radius: 9999px;
}
.training-file-message {
    margin-top: 0.3rem;
    font-size: 0.72rem;
    color: #9ca3af;
}
.training-file-item.error   .training-file-message { color: #f87171; }
.training-file-item.success .training-file-message { color: #6ee7b7; }

/* Modal footer */
.training-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #1f2937;
}
.training-upload-summary {
    font-size: 0.8rem;
    color: #9ca3af;
    flex: 1;
}

/* ── Tool Selection Modal ───────────────────────────────────────── */
.tool-select-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-select-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.tool-select-dialog {
    position: relative;
    background: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 600px;
    width: calc(100% - 2rem);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: toolSelectIn 0.25s ease-out;
}

@keyframes toolSelectIn {
    from { opacity: 0; transform: scale(0.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.tool-select-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    border-radius: 4px;
    transition: color 0.15s;
}
.tool-select-close:hover { color: var(--text-primary); }

.tool-select-header {
    text-align: center;
    margin-bottom: 2rem;
}
.tool-select-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}
.tool-select-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tool-select-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tool-option-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}
.tool-option-card:hover {
    border-color: var(--primary-color);
    background: #1c1c1c;
}

.tool-option-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(107, 114, 128, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.tool-option-body {
    flex: 1;
}
.tool-option-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.tool-option-body p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.tool-option-arrow {
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}
.tool-option-card:hover .tool-option-arrow {
    transform: translateX(4px);
    color: var(--primary-color);
}

/* ── Training-only mode ─────────────────────────────────────────── */
.app-container.training-mode .main-content {
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

.app-container.training-mode .sidebar {
    width: 100%;
    max-width: 640px;
    border-right: none;
    margin: 0 auto;
}

.app-container.training-mode .sidebar-section:not(#training-data-section) {
    display: none !important;
}

.app-container.training-mode #training-data-section {
    display: block !important;
}

.app-container.training-mode .viewer-container {
    display: none !important;
}

/* ── Validate Tool ─────────────────────────────────────────────── */
.validate-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

.validate-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.validate-sidebar {
    width: 280px;
    min-width: 260px;
    max-width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 0.5rem 0;
    flex-shrink: 0;
}

.validate-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Dropzone */
.validate-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 0.5rem;
}
.validate-dropzone.dragover,
.validate-dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(107, 114, 128, 0.05);
}
.validate-dropzone-inner p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.4rem 0;
}
.validate-dz-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.25rem;
}

/* File list badges */
.validate-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}
.validate-file-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.validate-file-badge .remove-badge {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
    font-size: 0.9rem;
    line-height: 1;
    transition: color 0.15s;
}
.validate-file-badge .remove-badge:hover { color: var(--danger-color); }

/* Structure list (sidebar filter) */
.validate-structure-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 250px;
    overflow-y: auto;
}
.validate-structure-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
}
.validate-structure-item:hover { background: rgba(255,255,255,0.05); }
.validate-structure-item.active { background: rgba(107,114,128,0.15); color: var(--text-primary); }
.validate-structure-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Welcome screen */
.validate-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.validate-welcome-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
    justify-content: center;
}
.validate-feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    background: rgba(107,114,128,0.1);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.validate-feature-pill i { color: var(--primary-color); }

/* Metrics summary bar */
.validate-metrics-bar {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #0a0a0a;
    flex-wrap: wrap;
}
.validate-metric-card {
    flex: 1;
    min-width: 100px;
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    text-align: center;
}
.vm-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.vm-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}
.vm-value.good  { color: var(--success-color); }
.vm-value.warn  { color: var(--warning-color); }
.vm-value.bad   { color: var(--danger-color); }

/* Side-by-side viewer section */
.validate-viewer-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.validate-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 1rem;
}
.validate-viewer-label {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.validate-viewer-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.gt-label   { color: #10b981; }
.pred-label { color: #3b82f6; }

.validate-viewer-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.validate-panel {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.viewer-panel-inner {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.viewer-panel-inner canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.validate-canvas-placeholder {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Per-structure table */
.validate-table-section {
    padding: 1rem 1.25rem 2rem;
}
.validate-table-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.validate-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}
.validate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.validate-table th {
    background: #111;
    color: var(--text-muted);
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.validate-table td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid #111;
    color: var(--text-secondary);
    white-space: nowrap;
}
.validate-table tr:hover td { background: rgba(255,255,255,0.03); }
.validate-table tr:last-child td { border-bottom: none; }
.validate-table .structure-name {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.metric-good { color: var(--success-color); font-weight: 600; }
.metric-warn  { color: var(--warning-color); font-weight: 600; }
.metric-bad   { color: var(--danger-color);  font-weight: 600; }

/* Loading state overlay inside viewer panel */
.viewer-panel-inner .panel-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-direction: column;
    gap: 0.5rem;
}

/* ─── MARKETING IFRAME ───────────────────────────────────── */
.marketing-iframe {
    display: block;
    width: 100%;
    height: 100vh;
    border: none;
    overflow: hidden;
}

/* ─── CONTOUR AI IFRAME TAB ───────────────────────────────── */
/* Hidden by default; JS toggles display when ContourAI nav is clicked */
#contour-section {
    display: none;
    padding: 0;
    height: 100vh;
    background: #000;
}

.active-tab-link {
    color: var(--text-primary) !important;
    border-bottom: 2px solid rgba(255,255,255,0.7);
    padding-bottom: 2px;
}

/* ─── CONTOUROAI INTRO SECTION ───────────────────────────── */
.contouroai-intro-section {
    background: #05080f;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.contouroai-intro-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

.contouroai-intro-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #00c2cc;
    margin-bottom: 1.2rem;
}

.contouroai-intro-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.contouroai-intro-logo {
    height: 2rem;
    width: auto;
}

.contouroai-intro-brand {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.contouroai-accent {
    color: #00c2cc;
}

.contouroai-intro-desc {
    font-size: 1.05rem;
    line-height: 1.75;
    color: rgba(255,255,255,0.65);
    margin-bottom: 1.75rem;
    max-width: 520px;
}

.contouroai-intro-pills {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.contouroai-intro-pills li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.75);
}

.contouroai-intro-pills li i {
    color: #00c2cc;
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.contouroai-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.contouroai-stat {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.contouroai-stat-num {
    font-size: 2.25rem;
    font-weight: 700;
    color: #00c2cc;
    line-height: 1;
    margin-bottom: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.contouroai-stat-num span {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(0,194,204,0.6);
    margin-left: 2px;
}

.contouroai-stat-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.4;
}

.contouroai-btn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.differs-wrap {
    position: relative;
}

.differs-btn {
    font-size: 0.85rem;
    white-space: nowrap;
}

.differs-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    z-index: 200;
    width: 540px;
    max-width: 90vw;
    filter: drop-shadow(0 8px 32px rgba(0,0,0,0.6));
}

.differs-wrap .differs-popover.open {
    display: block;
}

.differs-popover-inner {
    background: #0e1826;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    overflow: hidden;
}

.differs-popover-inner::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 2rem;
    border: 8px solid transparent;
    border-top-color: rgba(255,255,255,0.12);
}

.differs-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    position: sticky;
    top: 0;
    background: #0a1120;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 0.75rem 1.25rem;
}

.differs-col-header {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.differs-col-header.differs-col-other { color: rgba(255,255,255,0.45); }
.differs-col-header.differs-col-ours  { color: #00c2cc; padding-left: 1.25rem; }

.differs-scroll {
    max-height: 260px;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.differs-scroll::-webkit-scrollbar { width: 4px; }
.differs-scroll::-webkit-scrollbar-track { background: transparent; }
.differs-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.differs-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: start;
}

.differs-point-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin-bottom: 0.4rem;
}

.differs-col-ours .differs-point-label { color: rgba(0,194,204,0.6); }

.differs-col p {
    font-size: 0.83rem;
    line-height: 1.65;
    color: rgba(255,255,255,0.65);
    margin: 0;
}

.differs-divider {
    width: 1px;
    background: rgba(255,255,255,0.1);
    align-self: stretch;
}

.differs-separator {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 1rem 0;
}

@media (max-width: 900px) {
    .contouroai-intro-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

@media (max-width: 640px) {
    /* Switch popover to a fixed full-screen bottom sheet */
    .differs-popover {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        z-index: 1000;
        filter: none;
    }

    .differs-popover-inner {
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 1px solid rgba(255,255,255,0.15);
        box-shadow: 0 -8px 40px rgba(0,0,0,0.7);
    }

    .differs-popover-inner::after {
        display: none;
    }

    .differs-header {
        grid-template-columns: 1fr;
        padding: 1rem 1.25rem 0.75rem;
        gap: 0.2rem;
    }

    .differs-col-header.differs-col-ours {
        padding-left: 0;
    }

    .differs-header::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255,255,255,0.2);
        border-radius: 2px;
        margin: 0 auto 0.75rem;
        grid-column: 1;
    }

    .differs-scroll {
        max-height: 55vh;
        padding: 1rem 1.25rem 2rem;
    }

    /* Stack each comparison point: Other → ContourOAI */
    .differs-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .differs-divider {
        display: none;
    }

    .differs-col-other {
        background: rgba(255,255,255,0.03);
        border-radius: 8px;
        padding: 0.75rem;
    }

    .differs-col-ours {
        background: rgba(0,194,204,0.05);
        border: 1px solid rgba(0,194,204,0.12);
        border-radius: 8px;
        padding: 0.75rem;
    }
}

/* ─── INTERACTIVE DEMO SECTION ───────────────────────────── */
.demo-section {
    background: linear-gradient(180deg, #060d1a 0%, #0a1628 60%, #060d1a 100%);
    padding: 6rem 0;
}

.demo-section .section-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto 0.5rem;
    text-align: center;
    line-height: 1.7;
}

.demo-group-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.demo-group-btn {
    padding: 0.45rem 1.2rem;
    border-radius: 20px;
    border: 1px solid rgba(0,194,204,0.3);
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.demo-group-btn:hover {
    border-color: rgba(0,194,204,0.7);
    color: rgba(255,255,255,0.85);
    background: rgba(0,194,204,0.05);
}

.demo-group-btn.active {
    border-color: #00c2cc;
    background: rgba(0,194,204,0.12);
    color: #00c2cc;
    font-weight: 600;
}

.demo-viewer-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.demo-canvas-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.demo-canvas-frame {
    position: relative;
    width: 520px;
    height: 520px;
    border: 1px solid rgba(0,194,204,0.2);
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 40px rgba(0,194,204,0.08), 0 8px 32px rgba(0,0,0,0.6);
    flex-shrink: 0;
}

#demo-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.demo-canvas-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.demo-label-corner {
    position: absolute;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.05em;
}
.demo-label-corner.tl { top: 6px; left: 8px; }
.demo-label-corner.tr { top: 6px; right: 8px; }
.demo-label-corner.bl { bottom: 6px; left: 8px; }
.demo-label-corner.br { bottom: 6px; right: 8px; }

.demo-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 520px;
}

.demo-slider-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.demo-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
    outline: none;
    cursor: pointer;
}

.demo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00c2cc;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0,194,204,0.6);
}

.demo-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00c2cc;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0,194,204,0.6);
}

.demo-slice-num {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    min-width: 2rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.demo-legend-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
    padding-top: 0.5rem;
}

.demo-legend-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.demo-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.demo-legend li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
    transition: opacity 0.2s;
}

.demo-legend li.inactive {
    opacity: 0.25;
}

.demo-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid;
    background: transparent;
}

.demo-badge {
    margin-top: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(0,194,204,0.06);
    border: 1px solid rgba(0,194,204,0.15);
    font-size: 0.78rem;
    color: rgba(0,194,204,0.8);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .demo-canvas-frame { width: 90vw; height: 90vw; max-width: 520px; max-height: 520px; }
    .demo-slider-row { width: min(520px, 90vw); }
    .demo-viewer-wrap { gap: 1.5rem; }
    .demo-legend-col { min-width: 150px; }
}

@media (max-width: 540px) {
    .demo-viewer-wrap {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
    }
    .demo-canvas-frame {
        width: 92vw;
        height: 92vw;
        max-width: none;
        max-height: none;
    }
    .demo-slider-row {
        width: 92vw;
    }
    .demo-legend-col {
        width: 92vw;
        min-width: unset;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        padding-top: 0;
    }
    .demo-legend {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem 1rem;
    }
    .demo-legend-title,
    .demo-badge {
        width: 100%;
    }
    .demo-group-selector {
        gap: 0.4rem;
    }
    .demo-group-btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.75rem;
    }

    /* ContourOAI intro tile */
    .contouroai-intro-title {
        font-size: 1.5rem !important;
    }
    .contouroai-intro-desc {
        font-size: 0.95rem;
    }
    .contouroai-stat-grid {
        gap: 0.75rem;
    }
    .contouroai-stat {
        padding: 1.25rem 1rem;
    }
    .contouroai-stat-num {
        font-size: 1.75rem;
    }
    .contouroai-btn-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

