/* ══════════════════════════════════════════════
   The Metamorph — Design System & Dark Theme
   Flat → Depth → Reality
   ══════════════════════════════════════════════ */

/* ── Font ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ── */
:root {
    /* Brand */
    --accent-blue: #5BCEFA;
    --accent-pink: #F5A9B8;
    --accent-white: #FFFFFF;

    /* Gradient */
    --gradient-brand: linear-gradient(135deg, var(--accent-blue), var(--accent-pink));
    --gradient-brand-h: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));

    /* Surfaces */
    --bg-primary: #08080d;
    --bg-card: #0e0e16;
    --bg-card-hover: #12121c;
    --bg-input: #14141e;
    --bg-input-focus: #18182a;

    /* Borders */
    --border: #1e1e2a;
    --border-hover: #2a2a38;
    --border-focus: var(--accent-blue);

    /* Text */
    --text-primary: #e0e0e8;
    --text-secondary: #888;
    --text-muted: #555;
    --text-on-accent: #08080d;

    /* Status */
    --ok: #4ade80;
    --warn: #fbbf24;
    --error: #f87171;

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --sidebar-width: 220px;
    --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-pink); }

::selection {
    background: var(--accent-blue);
    color: var(--bg-primary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }


/* ══════════════════════════════════════════════
   Layout
   ══════════════════════════════════════════════ */

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ── Sidebar ── */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.brand-icon {
    font-size: 28px;
    line-height: 1;
}

.brand-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    display: block;
}

.brand-tagline {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-link:hover {
    background: rgba(91, 206, 250, 0.06);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(91, 206, 250, 0.1);
    color: var(--accent-blue);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 0 20px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 12px;
}

.version-tag {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Main Content ── */
#content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 32px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.view-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}


/* ══════════════════════════════════════════════
   Cards
   ══════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    position: relative;
}

/* Gradient top border effect */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-brand-h);
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.card:hover::before {
    opacity: 1;
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumb-empty {
    font-size: 32px;
    color: var(--text-muted);
}

.card-body {
    padding: 14px 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.card-stats {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    font-size: 11px;
}

.stat { color: var(--text-secondary); }
.stat-ok { color: var(--ok); }
.stat-warn { color: var(--warn); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.set-card {
    cursor: pointer;
}

.angle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}


/* ══════════════════════════════════════════════
   Buttons
   ══════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: var(--accent-blue);
    color: var(--text-on-accent);
}
.btn-primary:hover:not(:disabled) {
    background: #4ac0f0;
    box-shadow: 0 0 16px rgba(91, 206, 250, 0.25);
}

.btn-secondary {
    background: var(--accent-pink);
    color: var(--text-on-accent);
}
.btn-secondary:hover:not(:disabled) {
    background: #f098a8;
    box-shadow: 0 0 16px rgba(245, 169, 184, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
}


/* ══════════════════════════════════════════════
   Inputs & Forms
   ══════════════════════════════════════════════ */

.input {
    width: 100%;
    padding: 9px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--transition);
}

.input:focus {
    border-color: var(--accent-blue);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(91, 206, 250, 0.1);
}

.input::placeholder { color: var(--text-muted); }

select.input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--accent-blue);
    background: rgba(91, 206, 250, 0.04);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.upload-icon {
    font-size: 24px;
    color: var(--text-muted);
}

.upload-placeholder p {
    font-size: 13px;
    color: var(--text-secondary);
}

.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-preview img {
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.upload-filename {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 6px rgba(91, 206, 250, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(91, 206, 250, 0.5);
}

/* File list */
.file-list {
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.file-size {
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}


/* ══════════════════════════════════════════════
   Modal
   ══════════════════════════════════════════════ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

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

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


/* ══════════════════════════════════════════════
   Create View — 3-Panel Layout
   ══════════════════════════════════════════════ */

.create-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 96px);
}

.create-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.create-panel-left {
    width: 260px;
    min-width: 260px;
    overflow-y: auto;
}

.create-panel-center {
    flex: 1;
    min-width: 0;
}

.create-panel-right {
    width: 240px;
    min-width: 240px;
    overflow-y: auto;
}

.panel-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.panel-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

#preview-canvas-wrap {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

#preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.angle-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


/* ══════════════════════════════════════════════
   Empty States & Placeholders
   ══════════════════════════════════════════════ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.placeholder-card {
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}


/* ══════════════════════════════════════════════
   Mobile Blocker
   ══════════════════════════════════════════════ */

#mobile-blocker {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.mobile-msg {
    text-align: center;
    padding: 40px;
}

.mobile-msg h2 {
    font-size: 22px;
    margin: 16px 0 8px;
}

.mobile-msg p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.mobile-msg .tagline {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.mobile-msg .brand-icon {
    font-size: 48px;
}

@media (max-width: 900px) {
    #mobile-blocker {
        display: flex;
    }
    #app {
        display: none;
    }
}


/* ══════════════════════════════════════════════
   Utility
   ══════════════════════════════════════════════ */

.gradient-text {
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}


/* ══════════════════════════════════════════════
   Toast Notifications
   ══════════════════════════════════════════════ */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    animation: toast-in 0.3s ease forwards;
    max-width: 380px;
}

.toast.toast-out {
    animation: toast-out 0.25s ease forwards;
}

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-success { border-left: 3px solid var(--ok); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--accent-blue); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}


/* ══════════════════════════════════════════════
   Set Detail — Enhanced
   ══════════════════════════════════════════════ */

.set-info-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.set-info-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-brand-h);
}

.set-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.set-info-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.set-info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.set-info-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

.set-info-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* Calibration progress bar */
.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    width: 80px;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--gradient-brand-h);
    transition: width 0.3s ease;
}

.progress-fill.progress-full {
    background: var(--ok);
}


/* ══════════════════════════════════════════════
   Dashboard — Recent Exports
   ══════════════════════════════════════════════ */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 36px 0 16px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.recent-exports-placeholder {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}


/* ══════════════════════════════════════════════
   Loading Spinner
   ══════════════════════════════════════════════ */

.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Upload progress */
.upload-progress {
    margin-top: 12px;
    display: none;
}

.upload-progress.active {
    display: block;
}

.upload-progress-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--gradient-brand-h);
    border-radius: 2px;
    width: 0%;
    transition: width 0.2s ease;
}

.upload-progress-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

/* Confirm dialog inline */
.confirm-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #e05555;
    box-shadow: 0 0 16px rgba(248, 113, 113, 0.25);
}


/* ══════════════════════════════════════════════
   3D Style Controls (Create View)
   ══════════════════════════════════════════════ */

#panel-3d-style {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity var(--transition);
}
#panel-3d-style.active {
    opacity: 1;
    pointer-events: auto;
}

.control-group {
    margin-bottom: 14px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.control-value {
    color: var(--accent-blue);
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

/* Material Picker */
.material-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.material-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.material-swatch:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.material-swatch.active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(91, 206, 250, 0.06);
}

.swatch-preview {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.swatch-chrome {
    background: linear-gradient(135deg, #e8e8e8, #888, #e8e8e8, #999);
}

.swatch-matte {
    background: #e0e0e0;
}

.swatch-glass {
    background: linear-gradient(135deg, rgba(200,220,255,0.6), rgba(255,255,255,0.3), rgba(200,220,255,0.5));
    border-color: rgba(200,220,255,0.4);
}

.swatch-acrylic {
    background: linear-gradient(135deg, rgba(220,210,240,0.7), rgba(255,255,255,0.4), rgba(200,220,240,0.6));
}

/* Toggle / Checkbox */
.control-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.control-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

.control-toggle input[type="checkbox"]:checked {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.control-toggle input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: var(--bg-primary);
    font-weight: bold;
}

/* Canvas hint */
.canvas-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: 10px;
    pointer-events: none;
    z-index: 2;
}

/* ======================================
   Calibration View (Phase 3)
   ====================================== */

#calibrate-content {
    display: flex;
    gap: 0;
    height: calc(100vh - 120px);
}

.calibrate-workspace {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #0a0e14;
    overflow: hidden;
}

#calibrate-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.calibrate-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.65);
    padding: 4px 14px;
    border-radius: 10px;
    pointer-events: none;
    z-index: 2;
    white-space: nowrap;
}

.calibrate-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.calibrate-status {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Coordinate input popup */
.coord-input-popup {
    position: absolute;
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 260px;
}

.coord-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.coord-input-row label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    min-width: 14px;
}

.coord-input-row .input-sm {
    width: 70px;
    padding: 5px 8px;
    font-size: 12px;
}

.coord-hint {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Point list (right panel) */
.calibrate-point-list {
    width: 220px;
    min-width: 220px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
}

.calibrate-point-list h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.point-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: background var(--transition);
    border: 1px solid transparent;
}

.point-list-item:hover {
    background: rgba(91, 206, 250, 0.06);
}

.point-list-item.selected {
    background: rgba(91, 206, 250, 0.1);
    border-color: rgba(91, 206, 250, 0.2);
}

.point-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.point-num.no-world {
    background: var(--border);
    color: var(--text-muted);
}

.point-coords {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.point-delete {
    opacity: 0;
    color: var(--error);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    padding: 2px 4px;
    transition: opacity var(--transition);
}

.point-list-item:hover .point-delete {
    opacity: 1;
}

/* Results panel */
.calib-results {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.result-item {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
}

.result-item span:last-child {
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.result-ok { color: var(--ok) !important; }
.result-warn { color: var(--warn) !important; }
.result-bad { color: var(--error) !important; }


/* ══════════════════════════════════════════════
   Angle Thumbnails (Create View — Right Panel)
   ══════════════════════════════════════════════ */

.angle-thumb {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-input);
}

.angle-thumb:hover {
    border-color: var(--border-hover);
    background: var(--bg-input-focus);
}

.angle-thumb.active {
    border-color: var(--accent-blue);
    background: rgba(91, 206, 250, 0.08);
    box-shadow: 0 0 0 2px rgba(91, 206, 250, 0.12);
}

.angle-thumb-nocal {
    opacity: 0.45;
    cursor: not-allowed;
}

.angle-thumb-img {
    width: 56px;
    height: 38px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.angle-thumb-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.angle-thumb-placeholder {
    font-size: 16px;
    color: var(--text-muted);
}

.angle-thumb-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.angle-thumb-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.angle-thumb-cal {
    font-size: 10px;
    font-weight: 500;
}

.angle-thumb-cal.cal-yes {
    color: var(--ok);
}

.angle-thumb-cal.cal-no {
    color: var(--text-muted);
}

.angle-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 8px;
}


/* ══════════════════════════════════════════════
   Render Progress (Create View — Right Panel)
   ══════════════════════════════════════════════ */

.render-progress {
    margin-top: 12px;
}

.render-progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.render-progress-fill {
    height: 100%;
    background: var(--gradient-brand-h);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.render-progress-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}


/* ══════════════════════════════════════════════
   Export View (Phase 5)
   ══════════════════════════════════════════════ */

.export-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.export-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.export-bar-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.export-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.export-set-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.export-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.export-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.export-thumb-wrap {
    width: 100%;
    aspect-ratio: 3/2;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.export-thumb-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.export-item-name {
    display: block;
    padding: 10px 14px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    text-align: center;
    border-top: 1px solid var(--border);
}
