/* ==========================================================================
   ESTILOS LIMPIOS Y RESPONSIVOS: GENERADOR DE FOTOMOSAICOS
   ========================================================================== */

:root {
    --bg-dark: #070d18;
    --panel-bg: rgba(15, 23, 42, 0.92);
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(56, 189, 248, 0.22);
    --border-hover: rgba(56, 189, 248, 0.5);
    --cyan-primary: #06b6d4;
    --cyan-glow: #38bdf8;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

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

body {
    background: radial-gradient(circle at 50% 0%, #0f2744 0%, #060c17 80%);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0.8rem 1.2rem;
    gap: 0.8rem;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
}

/* 1. Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.7rem 1.2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    flex-wrap: wrap;
    gap: 10px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-back-link {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-back-link:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan-glow);
    color: #fff;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #38bdf8 60%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
}

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

.btn-top {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border-color);
    color: #cbd5e1;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-top:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: var(--cyan-glow);
    color: #fff;
}

.btn-top-icon {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border-color);
    color: #f1f5f9;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-top-icon:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan-glow);
}

/* 2. Instructions Card */
.instructions-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.inst-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.inst-content {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #e2e8f0;
}

.inst-content strong {
    color: var(--cyan-glow);
}

/* 3. Main Studio Workspace (2 Columns) */
.studio-workspace {
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 1rem;
    flex: 1;
    min-height: calc(100vh - 170px);
}

@media (max-width: 1080px) {
    .studio-workspace {
        grid-template-columns: 1fr;
    }
}

/* Left Controls Column */
.controls-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100vh - 170px);
    padding-right: 4px;
}

@media (max-width: 1080px) {
    .controls-column {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }
}

/* Card Section */
.card-section {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease;
}

.card-section:hover {
    border-color: var(--border-hover);
}

.card-section.highlight-card {
    border-color: rgba(6, 182, 212, 0.45);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(10, 18, 35, 0.95) 100%);
    box-shadow: 0 6px 25px rgba(6, 182, 212, 0.15);
}

.card-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.step-circle {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--cyan-primary), #0284c7);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.header-titles h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
}

.section-desc {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Target Preview Bar */
.target-preview-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.preview-img-wrap {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.preview-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-details strong {
    font-size: 0.82rem;
    color: var(--cyan-glow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-details span {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* Options Group & Pills */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
}

.pill-buttons-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.choice-pill,
.lib-pill {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}

.choice-pill:hover,
.lib-pill:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: var(--cyan-primary);
    color: #fff;
}

.choice-pill.active,
.lib-pill.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.28) 0%, rgba(2, 132, 199, 0.35) 100%);
    border-color: var(--cyan-primary);
    color: var(--cyan-glow);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed rgba(6, 182, 212, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.8rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.5);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--cyan-glow);
    background: rgba(6, 182, 212, 0.12);
}

.upload-dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.dropzone-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.dropzone-text strong {
    font-size: 0.78rem;
    color: var(--cyan-glow);
}

.dropzone-sub {
    font-size: 0.68rem;
    color: var(--text-dim);
}

/* Status Badge Bar */
.status-badge-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    color: var(--text-muted);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    flex-shrink: 0;
}

/* Density Buttons Grid */
.density-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

@media (max-width: 480px) {
    .density-buttons-grid {
        grid-template-columns: 1fr;
    }
}

.density-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.density-btn .d-title {
    font-size: 0.8rem;
    color: #f1f5f9;
}

.density-btn .d-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.density-btn:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--cyan-primary);
}

.density-btn.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.28) 0%, rgba(2, 132, 199, 0.35) 100%);
    border-color: var(--cyan-primary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.density-btn.active .d-title {
    color: var(--cyan-glow);
}

.exact-size-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: #cbd5e1;
}

.size-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.num-input {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--cyan-primary);
    color: #facc15;
    font-weight: 700;
    font-size: 0.88rem;
    width: 60px;
    padding: 4px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.unit-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.estimate-banner {
    background: rgba(6, 182, 212, 0.08);
    border: 1px dashed rgba(6, 182, 212, 0.3);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 0.76rem;
    color: var(--cyan-glow);
}

/* Advanced Collapsible */
.advanced-collapsible {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.advanced-collapsible summary {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.advanced-collapsible summary:hover {
    color: var(--cyan-glow);
}

.adv-panel {
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.76rem;
}

.adv-item label {
    display: block;
    color: #cbd5e1;
    margin-bottom: 3px;
}

.adv-select {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    color: #f1f5f9;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.alpha-slider-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alpha-slider {
    flex: 1;
    accent-color: var(--cyan-primary);
}

.checkbox-wrap label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #cbd5e1;
}

/* Main Generate Button */
.btn-generate-main {
    background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid #38bdf8;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(6, 182, 212, 0.4);
    transition: all 0.25s ease;
    width: 100%;
    text-align: center;
}

.btn-generate-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(6, 182, 212, 0.6);
    background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%);
}

.btn-generate-main:active {
    transform: translateY(1px);
}

/* Toast Box */
.toast-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #34d399;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.toast-box.hidden {
    display: none;
}

/* Export Box */
.export-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.export-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--cyan-glow);
}

.export-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.btn-export-item {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    padding: 7px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.2;
}

.btn-export-item small {
    display: block;
    color: var(--text-muted);
    font-size: 0.64rem;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 2px;
}

.btn-export-item:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan-glow);
    color: #fff;
}

/* 4. Right Viewport Column */
.viewport-column {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

.viewport-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 8px;
}

.view-modes-group {
    display: flex;
    gap: 5px;
}

.mode-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    border-color: var(--cyan-primary);
    color: #fff;
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--cyan-primary) 0%, #0284c7 100%);
    border-color: var(--cyan-glow);
    color: #fff;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.zoom-controls-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.zoom-text-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-zoom {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-zoom:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan-glow);
}

.zoom-display {
    font-size: 0.78rem;
    color: #facc15;
    min-width: 42px;
    text-align: center;
}

/* Canvas Stage */
.canvas-viewport-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #040810;
    overflow: hidden;
    position: relative;
    min-height: 400px;
    cursor: crosshair;
}

.canvas-render-wrapper {
    position: relative;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 4px;
    transform-origin: center center;
    transition: transform 0.15s ease-out;
}

.canvas-render-wrapper canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

#split-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Scanline Sweep */
.scanline-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--cyan-glow), #a855f7, transparent);
    box-shadow: 0 0 15px var(--cyan-glow), 0 0 25px var(--cyan-primary);
    pointer-events: none;
    animation: scanSweep 0.5s ease-in-out forwards;
}

.scanline-bar.hidden {
    display: none;
}

@keyframes scanSweep {
    0% { top: 0%; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Microscope Floating Card */
.microscope-floating-card {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--cyan-primary);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(6, 182, 212, 0.25);
    z-index: 50;
    width: 310px;
    max-width: calc(100% - 32px);
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

.microscope-floating-card.hidden {
    display: none;
}

.micro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    margin-bottom: 8px;
}

.micro-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--cyan-glow);
}

.micro-coords {
    font-size: 0.7rem;
    color: var(--cyan-glow);
}

.micro-content {
    display: flex;
    gap: 10px;
    align-items: center;
}

.micro-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#micro-magnifier-canvas {
    border: 2px solid var(--cyan-primary);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
    background: #000;
}

.micro-filename {
    font-size: 0.62rem;
    color: var(--text-muted);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.micro-info-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dist-pill {
    font-size: 0.72rem;
    color: #cbd5e1;
}

.swatches-comparison {
    display: flex;
    gap: 8px;
}

.swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.swatch-color {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.swatch-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.swatch-meta small {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.swatch-meta span {
    font-size: 0.62rem;
    color: #f1f5f9;
}

/* Viewport Stats Footer */
.viewport-stats-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.55rem 1rem;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 8px;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
}

.stat-lbl {
    color: var(--text-muted);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid var(--cyan-primary);
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.modal-card.modal-card-lg {
    max-width: 800px;
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #fff;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.modal-scrollable {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-section h3 {
    font-size: 0.95rem;
    color: var(--cyan-glow);
    margin-bottom: 4px;
}

.modal-section p,
.modal-section ul {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #cbd5e1;
}

.modal-section ul {
    padding-left: 20px;
    margin-top: 4px;
}

.math-box {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: #facc15;
    margin: 8px 0;
    font-size: 0.82rem;
}

.modal-footer-btn {
    text-align: center;
    margin-top: 16px;
}

.btn-primary-action {
    background: linear-gradient(135deg, var(--cyan-primary), #0284c7);
    color: #fff;
    border: 1px solid var(--cyan-glow);
    padding: 8px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
}

.btn-secondary-action {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.parts-grid-flow {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-sm);
}

.part-cell-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px;
}

.part-cell-card canvas {
    border-radius: 3px;
}

.part-cell-card span {
    font-size: 0.58rem;
    color: var(--text-muted);
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

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