/* --- Riglogic futurist neon css layout --- */

:root {
    --bg-color: #0f1115;
    --panel-bg: rgba(15, 17, 21, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --cyan-glow: #2dd4bf;
    --blue-glow: #6366f1;
    --red-glow: #f43f5e;
    --text-color: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    height: 100dvh;
    width: 100dvw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Safe margins framing the app console to avoid notched bezel & Safari toolbar cuts */
    padding: calc(20px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) calc(20px + env(safe-area-inset-left, 0px));
}

.glass-container {
    position: relative;
    /* Anchor absolutely positioned controls safely! */
    display: flex;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: radial-gradient(circle at top left, rgba(100, 116, 139, 0.1), transparent),
        radial-gradient(circle at bottom right, rgba(244, 63, 94, 0.05), transparent);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}

.sidebar {
    width: 280px;
    background-color: rgba(0, 0, 0, 0.95);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
    overflow-y: auto;
    /* Enable vertical scrolling for overflowing menu content */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Slim, premium global scrollbar style */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.38);
}

/* --- Glowing Panel Scrollbars --- */
.panel-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.panel-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 4px;
}

.panel-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.75), rgba(99, 102, 241, 0.75));
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 255, 0.85);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.panel-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.95);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.9);
}

.panel-body {
    box-shadow: inset 0 -8px 12px -8px rgba(0, 240, 255, 0.25);
}



.logo-area {
    margin-bottom: 8px;
}

.logo-area h1 {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--blue-glow);
    text-shadow: 0 0 10px rgba(100, 116, 139, 0.4);
}

.sub-logo {
    font-size: 9px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 1.5px;
}

.divider {
    border: none;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 20px 0;
}

.menu-section {
    margin-bottom: 24px;
}

.menu-section h2 {
    font-size: 10px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.asset-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asset-btn,
.bg-btn {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.asset-btn:hover,
.bg-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.asset-btn.active,
.bg-btn.active {
    background-color: var(--text-color);
    color: #000;
    border-color: var(--blue-glow);
    box-shadow: 0 0 15px rgba(100, 116, 139, 0.25);
}

.asset-btn .icon,
.bg-btn .icon {
    font-size: 18px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

/* 3D VIEW RENDER MODES */
.render-mode-btn {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Share Tech Mono', inherit;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    justify-content: center;
    gap: 4px;
}

.render-mode-btn:hover {
    background-color: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 0 0 8px rgba(148, 163, 184, 0.15);
}

.render-mode-btn.active {
    background-color: var(--cyan-glow);
    color: #000;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.45);
    font-weight: 800;
}

.switches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

.switch-control {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
}

.switch-control input {
    cursor: pointer;
    accent-color: var(--blue-glow);
}

.switch-lbl {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.spacer {
    flex-grow: 1;
}

/* High-tech Record button styling */
.record-btn {
    background-color: rgba(244, 63, 94, 0.15);
    border: 2px solid var(--red-glow);
    color: var(--text-color);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.35s ease;
}

.record-btn:hover {
    background-color: rgba(244, 63, 94, 0.3);
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

.record-btn.recording {
    background-color: var(--red-glow);
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.6);
    animation: pulse 1.5s infinite alternate;
}

.record-btn .dot {
    width: 10px;
    height: 10px;
    background-color: var(--red-glow);
    border-radius: 50%;
}

.record-btn.recording .dot {
    background-color: #fff;
}

/* 2. Workspace Viewport splits */
.workspace {
    flex-grow: 1;
    display: flex;
    background-color: #000;
    position: relative;
}

.panel {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Full-Screen Render Panel occupying entire workspace background */
.render-panel.full-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Picture-in-Picture (PIP) Floating Camera card in bottom-right corner */
.camera-panel.pip-mode {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    width: 280px;
    height: 157.5px;
    /* Locked 16:9 aspect ratio */
    z-index: 20;
    border: 2px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(148, 163, 184, 0.15),
        0 0 15px rgba(148, 163, 184, 0.3),
        inset 0 0 10px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.85);
    transition: all 0.3s ease;
}

/* Subtle highlight when camera is active */
.camera-panel.pip-mode:hover {
    border-color: var(--cyan-glow);
    box-shadow: 0 12px 48px rgba(148, 163, 184, 0.25),
        0 0 25px rgba(148, 163, 184, 0.5);
    transform: translateY(-2px);
}

/* Zoom HUD controls styling */
.zoom-hud {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: calc(24px + env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    background: rgba(10, 15, 25, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 30;
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 0 10px rgba(148, 163, 184, 0.05);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-color);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: var(--blue-glow);
    border-color: var(--cyan-glow);
    box-shadow: 0 0 10px rgba(100, 116, 139, 0.4);
    color: #fff;
}

.zoom-btn:active {
    transform: scale(0.92);
}

.zoom-slider {
    width: 140px;
    accent-color: var(--cyan-glow);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.zoom-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.zoom-slider::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--cyan-glow);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 0 8px var(--cyan-glow);
    transition: transform 0.1s ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative !important;
    z-index: 5;
    pointer-events: auto !important;
}

.tag {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 4px 10px;
    background-color: rgba(0, 0, 0, 0.75);
    border-radius: 6px;
    pointer-events: auto;
}

.tag-cyan {
    color: var(--cyan-glow);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.tag-blue {
    color: var(--blue-glow);
    border: 1px solid rgba(100, 116, 139, 0.15);
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    /* mirror webcam */
}

#camera-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#landmarks-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    transform: scaleX(-1);
    /* mirror drawn points to align with mirrored camera */
}

#webgl-container {
    width: 100%;
    height: 100%;
    background-color: transparent;
    position: relative;
    cursor: grab;
}

#webgl-container:active {
    cursor: grabbing;
}

canvas {
    display: block;
}

/* Diagnostics Panel */
.diagnostics-hud {
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 14px;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    pointer-events: auto;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
}

.hud-lbl {
    color: rgba(255, 255, 255, 0.6);
}

.text-green {
    color: #00ff66;
    text-shadow: 0 0 5px rgba(0, 255, 102, 0.3);
}

.text-blue {
    color: var(--blue-glow);
}

/* Initialization Loader overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(100, 116, 139, 0.1);
    border-top: 3px solid var(--blue-glow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--blue-glow);
}

/* Animations */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.02);
    }
}

/* Custom 3D Mesh Uploader styling */
.uploader-area {
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 6px;
}

.uploader-area:hover {
    background-color: rgba(148, 163, 184, 0.04);
    border-color: var(--cyan-glow);
    box-shadow: 0 0 10px rgba(148, 163, 184, 0.15);
}

.uploader-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.upload-icon {
    font-size: 22px;
    color: var(--cyan-glow);
}

.upload-lbl {
    font-size: 10px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 1px;
}

#export-rig-btn {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#export-rig-btn:hover {
    background-color: rgba(148, 163, 184, 0.25) !important;
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.35);
    transform: scale(1.02);
}

#export-rig-btn:active {
    transform: scale(0.98);
}

/* Smoothing control styles */
.smoothing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

.smoothing-hud-val {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    color: var(--cyan-glow);
    text-shadow: 0 0 6px rgba(148, 163, 184, 0.4);
    letter-spacing: 0.5px;
    text-align: center;
    margin-top: 4px;
}

/* Custom Background Uploader cards overrides */
.bg-uploader {
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.bg-uploader:hover {
    background-color: rgba(148, 163, 184, 0.10) !important;
    border-color: var(--cyan-glow) !important;
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.3);
    transform: scale(1.02);
}

.bg-uploader:active {
    transform: scale(0.98);
}

/* Responsive Hamburger Menu Button */
.hamburger-btn {
    display: none;
    /* Hidden on desktop viewports */
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
    width: 44px;
    height: 44px;
    background: rgba(10, 15, 25, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 50%;
    color: var(--cyan-glow);
    font-size: 20px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    z-index: 90;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(148, 163, 184, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.hamburger-btn:hover {
    background: var(--blue-glow);
    border-color: var(--cyan-glow);
    box-shadow: 0 0 15px rgba(100, 116, 139, 0.45);
    transform: scale(1.05);
}

.hamburger-btn:active {
    transform: scale(0.95);
}

/* Sidebar Blur Background Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Blender Import Script Button Override */
#download-blender-btn {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#download-blender-btn:hover {
    background-color: rgba(255, 136, 0, 0.25) !important;
    border-color: #ffaa44 !important;
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.35);
    transform: scale(1.02);
}

#download-blender-btn:active {
    transform: scale(0.98);
}

/* Responsive Media Query for smaller iPad Portrait & Mobile Screens */
@media (max-width: 850px) {
    .hamburger-btn {
        display: flex;
        /* Show floating hamburger toggle button */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        transform: translateX(-100%);
        /* Tuck offscreen by default */
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.85);
        z-index: 10;
        border-radius: 0;
        border-right: 1px solid rgba(148, 163, 184, 0.15);
    }

    .sidebar.open {
        transform: translateX(0);
        /* Slide open seamlessly */
    }

    body.ui-hidden #sidebar {
        transform: translateX(-100%) !important;
        margin-left: 0 !important;
    }

    /* Optimize workspace padding and spacing for floating triggers */
    .zoom-hud {
        left: calc(16px + env(safe-area-inset-left, 0px)) !important;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .camera-panel.pip-mode {
        right: calc(16px + env(safe-area-inset-right, 0px)) !important;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        width: 140px !important;
        height: 210px !important;
        /* Premium 2:3 portrait format */
    }
}

/* --- Warp Calibration Studio CSS --- */
.calibration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(3, 5, 8, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    animation: modal-fadeIn 0.3s ease;
}

@keyframes modal-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.calibration-content {
    background: rgba(10, 15, 25, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 16px;
    width: 90%;
    max-width: 820px;
    max-height: 90%;
    box-shadow: 0 0 50px rgba(148, 163, 184, 0.15), 0 20px 50px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: content-slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes content-slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.calibration-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-calibration-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-calibration-btn:hover {
    color: #ff3366;
    text-shadow: 0 0 8px rgba(255, 51, 102, 0.4);
}

.calibration-body {
    padding: 24px;
    display: flex;
    gap: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.workspace-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    align-items: center;
}

.calibration-canvas-container {
    position: relative;
    width: 420px;
    height: 420px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calibration-canvas-container img {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

#calibration-grid-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.calibration-pin {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.85);
    border: 2px solid var(--pin-color, #94a3b8);
    box-shadow: 0 0 10px var(--pin-color, #94a3b8);
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 8px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    touch-action: none;
}

.calibration-pin:hover {
    transform: translate(-50%, -50%) scale(1.25);
    box-shadow: 0 0 16px var(--pin-color, #94a3b8);
    z-index: 100;
}

.calibration-pin.active {
    transform: translate(-50%, -50%) scale(1.35);
    border-color: #fff;
    box-shadow: 0 0 20px #fff, 0 0 10px var(--pin-color, #94a3b8);
    z-index: 1000;
}

.calibration-status {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--cyan-glow);
    text-shadow: 0 0 8px rgba(148, 163, 184, 0.35);
    text-align: center;
    letter-spacing: 0.5px;
}

.calibration-controls {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calibration-instruction {
    font-size: 11px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.65);
    font-family: 'Outfit', sans-serif;
}

.calibration-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

/* Responsive adjustment for calibrator modal on smaller screens */
@media (max-width: 850px) {
    .calibration-content {
        max-width: 500px;
        max-height: 95%;
    }

    .calibration-body {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .calibration-canvas-container {
        width: 320px;
        height: 320px;
    }

    .calibration-controls {
        width: 100%;
    }
}

#mouth-studio-header,
#eye-studio-header,
#body-studio-header,
#face-layer-header,
#jaw-studio-header,
#character-builder-header {
    pointer-events: auto !important;
}

#close-mouth-studio-btn,
#close-eye-studio-btn,
#close-body-studio-btn,
#close-face-layer-btn,
#close-jaw-studio-btn,
#close-character-builder-btn {
    pointer-events: auto !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    cursor: pointer !important;
    font-size: 16px !important;
    outline: none !important;
    transition: all 0.2s ease-in-out !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    margin-left: 10px !important;
}

#close-mouth-studio-btn:hover,
#close-eye-studio-btn:hover,
#close-body-studio-btn:hover,
#close-face-layer-btn:hover,
#close-jaw-studio-btn:hover,
#close-character-builder-btn:hover {
    background-color: rgba(255, 51, 102, 0.2) !important;
    border-color: rgba(255, 51, 102, 0.5) !important;
    color: #ff3366 !important;
    box-shadow: 0 0 8px rgba(255, 51, 102, 0.4) !important;
    transform: scale(1.05) !important;
}

/* Glassmorphism Neon Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2px;
    background-color: #aaa;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
}

input:checked+.slider {
    background-color: rgba(255, 153, 0, 0.2);
    border-color: #ff9900;
    box-shadow: 0 0 8px rgba(255, 153, 0, 0.35);
}

input:checked+.slider:before {
    transform: translateX(12px);
    background-color: #ff9900;
    box-shadow: 0 0 6px #ff9900;
}

.slider.round {
    border-radius: 16px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- High-Fidelity Mobile Responsive Floating Studio Panels --- */
/* --- High-Fidelity Mobile Responsive Floating Studio Panels --- */
@media (max-width: 768px) {

    #mouth-studio-panel,
    #eye-studio-panel,
    #body-studio-panel,
    #face-layer-panel,
    #jaw-studio-panel,
    #character-builder-panel {
        width: 100% !important;
        max-width: none !important;
        height: 65vh !important;
        max-height: 65vh !important;
        min-height: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: none !important;
        border-radius: 20px 20px 0 0 !important;
        border-bottom: none !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.75) !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }



    /* Pin headers to the top of the sheets so close buttons are permanently visible & clickable! */
    .panel-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        background: rgba(10, 15, 25, 0.98) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        height: 44px !important;
        min-height: 44px !important;
        box-sizing: border-box !important;
    }

    /* Force the panel-body to scroll vertically on mobile so all content is reachable! */
    #mouth-studio-panel .panel-body,
    #eye-studio-panel .panel-body,
    #body-studio-panel .panel-body,
    #face-layer-panel .panel-body,
    #jaw-studio-panel .panel-body,
    #character-builder-panel .panel-body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        flex: 1 !important;
        padding-top: 10px !important;
    }

    /* Position webcam feed safely below the Hide UI button at the top right */
    .camera-panel.pip-mode {
        width: 80px !important;
        height: 120px !important;
        /* Premium 2:3 portrait format */
        right: 12px !important;
        top: 76px !important;
        /* Clear the Hide UI button vertical footprint */
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        z-index: 100 !important;
        box-shadow: 0 4px 15px rgba(148, 163, 184, 0.25) !important;
    }

    .mouth-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .uploader-area {
        height: 52px !important;
    }

    .uploader-label {
        font-size: 8px !important;
    }
}

@media (max-width: 480px) {

    #mouth-studio-panel,
    #eye-studio-panel,
    #body-studio-panel,
    #face-layer-panel,
    #jaw-studio-panel,
    #character-builder-panel {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        height: 70vh !important;
        max-height: 70vh !important;
        min-height: 0 !important;
    }



    .camera-panel.pip-mode {
        width: 70px !important;
        height: 105px !important;
        /* Premium 2:3 portrait format */
        right: 8px !important;
        top: 76px !important;
        bottom: auto !important;
    }

    .tab-btn {
        padding: 6px 8px !important;
        font-size: 9px !important;
    }
}

/* --- Premium Glassmorphic Hide UI Toggle with Dropdown --- */
.mobile-hide-ui-wrapper {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.mobile-hide-ui-btn {
    display: flex !important;
    position: static !important;
    /* Managed by wrapper flow */
    width: 44px;
    height: 44px;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--cyan-glow);
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(148, 163, 184, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.mobile-hide-ui-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    box-shadow: 0 0 12px var(--cyan-glow);
    transform: scale(1.02);
}

.ui-dropdown-menu {
    display: none;
    /* Managed by JS toggle class '.open' */
    flex-direction: column;
    width: 210px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    margin-top: 8px;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(45, 212, 191, 0.35);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85),
        0 0 20px rgba(45, 212, 191, 0.2);
    animation: dropdown-slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    /* Force Hardware Accelerated Layer in Safari */
}

.ui-dropdown-menu.open {
    display: flex;
}

@keyframes dropdown-slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ui-dropdown-header {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--cyan-glow);
    text-shadow: 0 0 8px rgba(45, 212, 191, 0.4);
    padding: 10px 14px 6px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(45, 212, 191, 0.03);
}

.ui-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.ui-dropdown-item:last-child {
    border-bottom: none;
}

.ui-dropdown-item:hover {
    background: rgba(45, 212, 191, 0.1);
    color: #fff;
    padding-left: 18px;
    /* smooth sliding transition */
    text-shadow: 0 0 8px rgba(45, 212, 191, 0.35);
}

.ui-dropdown-icon {
    font-size: 13px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.ui-dropdown-item:hover .ui-dropdown-icon {
    transform: scale(1.2);
}

.ui-dropdown-text {
    flex-grow: 1;
}

.ui-dropdown-item.active {
    background: rgba(45, 212, 191, 0.12) !important;
    color: #00ff66 !important;
    border-left: 3px solid #00ff66 !important;
    padding-left: 15px !important;
    text-shadow: 0 0 8px rgba(0, 255, 102, 0.35) !important;
}

/* --- Premium Mobile Stop Export Button --- */
.mobile-stop-export-btn {
    display: none;
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: calc(72px + env(safe-area-inset-right, 0px));
    width: 44px;
    height: 44px;
    z-index: 10000;
    /* Maintain clickability above all layers */
    background: rgba(255, 51, 102, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid #ff3366;
    color: #ff3366;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 51, 102, 0.4),
        inset 0 0 10px rgba(255, 51, 102, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.mobile-stop-export-btn:hover {
    background: rgba(255, 51, 102, 0.35);
    box-shadow: 0 0 20px #ff3366;
    transform: scale(1.05);
}

.mobile-stop-export-btn:active {
    transform: scale(0.95);
}

@media (max-width: 850px) {
    .mobile-stop-export-btn.active {
        display: flex !important;
        /* Render only when recording is active on mobile screen widths */
    }
}

/* Hide UI active state rules */
body.ui-hidden .hamburger-btn,
body.ui-hidden .zoom-hud,
body.ui-hidden #diagnostics-hud,
body.ui-hidden .sidebar-overlay {
    display: none !important;
}

body.ui-hidden #sidebar {
    transform: translateX(-100%);
    margin-left: -280px;
    pointer-events: none;
}

/* Hide all studio panels and camera feed when UI is hidden */
body.ui-hidden #mouth-studio-panel,
body.ui-hidden #eye-studio-panel,
body.ui-hidden #body-studio-panel,
body.ui-hidden #face-layer-panel,
body.ui-hidden #jaw-studio-panel,
body.ui-hidden #character-builder-panel,
body.ui-hidden .camera-panel.pip-mode {
    display: none !important;
}

/* --- Premium Floating Global Slider Overlay for Mobile Adjustments --- */
.mobile-slider-overlay {
    position: fixed !important;
    bottom: 24px !important;
    left: 20px !important;
    right: 20px !important;
    z-index: 100000 !important;
    /* High enough to float over everything including camera feed */
    background: rgba(10, 15, 25, 0.92) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(148, 163, 184, 0.45) !important;
    border-radius: 14px !important;
    padding: 14px 18px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7) !important;
    display: none;
    /* Controlled dynamically in JS */
    flex-direction: column !important;
    gap: 8px !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
}

.slider-overlay-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
}

.slider-overlay-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-family: 'Share Tech Mono', monospace !important;
    font-size: 11px !important;
    color: rgba(148, 163, 184, 0.9) !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
}

#slider-overlay-value {
    color: #00ff66 !important;
    font-weight: 800 !important;
}

#slider-overlay-range {
    width: 100% !important;
    margin-top: 4px !important;
    display: block !important;
    cursor: pointer !important;
}

/* --- Smooth Non-destructive Panel Hiding during mobile slide --- */
.panel.panel-hidden-sliding {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(100vh) !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
}

/* --- High-Tech Accordion System --- */
.accordion-header {
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 6px;
}

/* Specific theme classes for headers */
.accordion-header.theme-2d {
    border: 1px solid rgba(255, 204, 0, 0.25);
    background: rgba(255, 204, 0, 0.05);
    box-shadow: inset 0 0 10px rgba(255, 204, 0, 0.05);
}

.accordion-header.theme-2d:hover {
    background: rgba(255, 204, 0, 0.08);
    border-color: rgba(255, 204, 0, 0.45);
}

.accordion-header.theme-3d {
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(148, 163, 184, 0.05);
    box-shadow: inset 0 0 10px rgba(148, 163, 184, 0.05);
}

.accordion-header.theme-3d:hover {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.45);
}

.accordion-header.theme-config {
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(148, 163, 184, 0.05);
    box-shadow: inset 0 0 10px rgba(148, 163, 184, 0.05);
}

.accordion-header.theme-config:hover {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.45);
}

.accordion-header.theme-save {
    border: 1px solid rgba(224, 64, 251, 0.25);
    background: rgba(224, 64, 251, 0.05);
    box-shadow: inset 0 0 10px rgba(224, 64, 251, 0.05);
}

.accordion-header.theme-save:hover {
    background: rgba(224, 64, 251, 0.08);
    border-color: rgba(224, 64, 251, 0.45);
}

.accordion-content {
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, margin 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 12px !important;
    border: 1px solid transparent !important;
    background: transparent;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-content.expanded.theme-2d {
    max-height: 2000px;
    opacity: 1;
    margin: 4px 0 10px 0 !important;
    padding: 12px !important;
    border: 1px solid rgba(255, 204, 0, 0.15) !important;
    background: rgba(255, 204, 0, 0.02);
}

.accordion-content.expanded.theme-3d {
    max-height: 2000px;
    opacity: 1;
    margin: 4px 0 10px 0 !important;
    padding: 12px !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    background: rgba(148, 163, 184, 0.02);
}

.accordion-content.expanded.theme-config {
    max-height: 2000px;
    opacity: 1;
    margin: 4px 0 10px 0 !important;
    padding: 12px !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    background: rgba(148, 163, 184, 0.02);
}

.accordion-content.expanded.theme-save {
    max-height: 2000px;
    opacity: 1;
    margin: 4px 0 10px 0 !important;
    padding: 12px !important;
    border: 1px solid rgba(224, 64, 251, 0.15) !important;
    background: rgba(224, 64, 251, 0.02);
}

/* Futuristic Startup Welcome Overlay */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(15, 17, 21, 0.98) 30%, #07080a 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 10000;
    /* Framed above everything else */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.welcome-overlay.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.welcome-card {
    background: rgba(15, 17, 21, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    max-width: 900px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Beautiful neon glows wrapping the panel */
.welcome-card::before {
    content: '';
    position: absolute;
    top: -150px;
    left: -150px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
    pointer-events: none;
}

.welcome-card::after {
    content: '';
    position: absolute;
    bottom: -150px;
    right: -150px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(45, 212, 191, 0.15), transparent 70%);
    pointer-events: none;
}

.welcome-header h1 {
    font-size: 38px;
    font-weight: 900;
    letter-spacing: 6px;
    color: #fff;
    text-transform: uppercase;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, rgba(255, 255, 255, 0.6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.welcome-header p {
    font-size: 11px;
    font-family: 'Share Tech Mono';
    font-weight: 800;
    color: var(--cyan-glow);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.welcome-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 10px 0;
}

.welcome-option-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
}

.welcome-option-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.04);
}

/* Blue 2D Card */
.welcome-option-card.opt-2d:hover {
    border-color: var(--blue-glow);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15),
        0 0 15px rgba(99, 102, 241, 0.1);
}

.welcome-option-card.opt-2d .card-icon {
    color: var(--blue-glow);
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* Cyan 3D Card */
.welcome-option-card.opt-3d:hover {
    border-color: var(--cyan-glow);
    box-shadow: 0 12px 30px rgba(45, 212, 191, 0.15),
        0 0 15px rgba(45, 212, 191, 0.1);
}

.welcome-option-card.opt-3d .card-icon {
    color: var(--cyan-glow);
    text-shadow: 0 0 15px rgba(45, 212, 191, 0.3);
}

/* Magenta Import Card */
.welcome-option-card.opt-import:hover {
    border-color: #e040fb;
    box-shadow: 0 12px 30px rgba(224, 64, 251, 0.15),
        0 0 15px rgba(224, 64, 251, 0.1);
}

.welcome-option-card.opt-import .card-icon {
    color: #e040fb;
    text-shadow: 0 0 15px rgba(224, 64, 251, 0.3);
}

.card-icon {
    font-size: 42px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.welcome-option-card:hover .card-icon {
    transform: scale(1.1);
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
}

.card-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.6;
    text-align: center;
    margin-top: 4px;
}

.welcome-footer {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Share Tech Mono';
    letter-spacing: 1px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .welcome-options {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .welcome-card {
        padding: 30px 20px;
        gap: 24px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .welcome-header h1 {
        font-size: 28px;
        letter-spacing: 4px;
    }

    .welcome-option-card {
        padding: 20px;
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 16px;
    }

    .welcome-option-card .card-desc {
        text-align: left;
        margin-top: 2px;
    }

    .welcome-option-card .card-icon {
        font-size: 32px;
        min-width: 40px;
        text-align: center;
    }

    .welcome-option-card div {
        display: flex;
        flex-direction: column;
    }
}

/* --- Studio Button Pulse: fires when a preset 2D avatar is loaded --- */
@keyframes studioBtnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 240, 255, 0);
        border-color: rgba(148, 163, 184, 0.35);
    }

    30% {
        box-shadow: 0 0 0 6px rgba(0, 240, 255, 0.35);
        border-color: #00f0ff;
    }

    60% {
        box-shadow: 0 0 0 10px rgba(0, 240, 255, 0.1);
        border-color: rgba(0, 240, 255, 0.7);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 240, 255, 0);
        border-color: rgba(148, 163, 184, 0.35);
    }
}

.studio-btn-pulse {
    animation: studioBtnPulse 1.4s ease-out 3;
}

/* Force all studio panels to be hidden by default on startup */
[id$="-studio-panel"] {
    display: none;
}

/* --- Persistent Power Saver Status Indicator (HUD) --- */
.power-saver-status-indicator {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 9999;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(16, 185, 129, 0.35); /* Emerald accent */
    border-radius: 12px;
    padding: 8px 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 
                0 0 20px rgba(16, 185, 129, 0.15);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    pointer-events: auto;
}

.power-saver-status-indicator.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.power-saver-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.power-saver-icon {
    font-size: 18px;
    animation: battery-pulse 2s infinite alternate;
}

@keyframes battery-pulse {
    0% { opacity: 0.6; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1.05); }
}

.power-saver-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.power-saver-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: 800;
    color: #10b981; /* Emerald green */
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.power-saver-desc {
    font-size: 9px;
    font-weight: 500;
    color: rgba(248, 250, 252, 0.7);
    white-space: nowrap;
}

.power-saver-disable-btn {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
}

.power-saver-disable-btn:hover {
    background: #10b981;
    color: #0b0f19;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
    border-color: #10b981;
}

.power-saver-disable-btn:active {
    transform: scale(0.95);
}

/* Hide when UI is toggled off */
body.ui-hidden #power-saver-status-indicator {
    display: none !important;
}

@media (max-width: 600px) {
    .power-saver-status-indicator {
        width: calc(100% - 32px);
        box-sizing: border-box;
    }
    .power-saver-desc {
        white-space: normal;
        font-size: 8px;
    }
}