:root {
    /* Brand Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #a855f7;
    --accent: #f093fb;

    /* Background & Surfaces */
    --bg-dark: #0f172a;
    --app-bg: #0f172a;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --surface: rgba(30, 41, 59, 0.7);
    --surface-elevated: rgba(30, 41, 59, 0.9);
    --border: rgba(255, 255, 255, 0.1);

    /* Layout */
    --header-height: 70px;
    --dock-height: 85px;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);

    /* Typography */
    --app-font: 'Outfit', sans-serif;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 28px;

    /* Spacing (4px base unit) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Border Radius */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    /* Shadows (Mobile Elevation) */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.18), 0 6px 12px rgba(0, 0, 0, 0.12);

    /* Animation Timing */
    --duration-fast: 150ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 400ms;
    --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0.0, 1, 1);
    --ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Touch Targets */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-notification: 30000;
    --z-chat: 20000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

html {
    font-size: 16px;
    height: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: #fff;
    min-height: 100%;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior-y: none;
    /* Prevent pull-to-refresh on body */
}

.mobile-app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height, 70px);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 5000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-global-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--dock-height, 85px) + env(safe-area-inset-bottom));
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding-top: 12px;
    z-index: 5000;
}

.dock-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #64748b;
    text-decoration: none;
    transition: color 0.3s ease;
}

.dock-link.active {
    color: var(--primary);
}

.dock-link i {
    font-size: 1.5rem;
}

.dock-link span {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-main-content {
    padding-top: var(--header-height, 70px);
    padding-bottom: 0;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-main-container {
    padding: 1.5rem 1rem;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 1024px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: flex !important;
    }
}

@media (max-width: 1023px) {
    .mobile-only {
        display: flex !important;
    }

    .desktop-only {
        display: none !important;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.app-auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), var(--app-bg));
}

.app-auth-card {
    width: 100%;
    max-width: 450px;
    padding: 2.5rem 1.75rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.8s ease-out;
}

.app-input-group {
    margin-bottom: 1.5rem;
}

.app-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 500;
}

.app-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.app-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

.app-btn-full {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
    cursor: pointer;
    border: none;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.app-btn-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.app-btn-full:active {
    transform: translateY(0);
}

.error-bubble {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* ========================================
   PREMIUM NOTIFICATIONS & ALERTS
   ======================================== */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: var(--z-notification);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    width: calc(100% - 48px);
}

.toast-item {
    padding: 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.toast-item.success .toast-icon {
    background: #10b981;
    color: white;
}

.toast-item.error .toast-icon {
    background: #ef4444;
    color: white;
}

.toast-item.warning .toast-icon {
    background: #f59e0b;
    color: white;
}

.toast-item.info .toast-icon {
    background: #3b82f6;
    color: white;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast-close {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
}

/* Alert Modals */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.alert-modal {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.alert-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 20px;
}

.alert-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.alert-message {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.alert-actions {
    display: flex;
    gap: 12px;
}

.alert-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.alert-btn-confirm {
    background: var(--primary, #6366f1);
    color: white;
}

.alert-btn-cancel {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
}

.alert-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ========================================
   PREMIUM ICON ENHANCEMENTS & ANIMATIONS
   ======================================== */
.icon-animated {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.icon-animated:hover {
    transform: scale(1.2);
}

.icon-pulse {
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

.icon-spin-slow {
    animation: iconSpin 8s linear infinite;
}

@keyframes iconSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.icon-bounce {
    animation: iconBounce 2s infinite;
}

@keyframes iconBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

.icon-shimmer {
    position: relative;
    overflow: hidden;
}

.icon-shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 45%,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 255, 255, 0.1) 55%,
            transparent 100%);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

/* ========================================
   GLOBAL CONTROL DOCK (Mobile-First)
   ======================================== */
.control-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 0;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 6000;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    height: auto;
}

.control-btn {
    background: transparent;
    border: none;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    width: 64px;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
}

.control-btn i {
    font-size: 1.5rem;
    margin-bottom: 2px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #94a3b8;
}

.control-btn.active {
    color: white;
}

.control-btn.active i {
    color: var(--primary);
    transform: translateY(-3px) scale(1.1);
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.4));
}

@media (min-width: 1024px) {
    .control-bar {
        left: 50%;
        transform: translateX(-50%);
        width: 600px;
        bottom: 20px;
        border-radius: 24px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        padding: 12px 24px;
    }
}

/* Voice Message Styles */
.voice-message-bubble {
    transition: all 0.3s ease;
}

.voice-message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.play-voice-btn:hover {
    transform: scale(1.1);
}

.play-voice-btn:active {
    transform: scale(0.95);
}

.voice-progress {
    position: relative;
    overflow: hidden;
}

.voice-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

#record-voice-btn.recording {
    animation: pulse-red 1.5s infinite;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ========================================
   CONSOLIDATED CHAT STYLES (Restored)
   ======================================== */

/* Chat Overlay */
.chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 4999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-overlay[style*="display: block"] {
    opacity: 1;
}

/* Private Chat Modal Transitions */
#private-chat-modal {
    transition: opacity 0.3s ease;
}

#private-chat-modal .modal-content {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Ensure modal is strictly fixed and top-level */
.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 50000 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   MOBILE-FIRST CORE LAYOUT
   ======================================== */

/* Sidebar Drawer (Mobile Bottom Sheet) */
.chat-sidebar {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: -100%;
    top: auto;
    width: 100%;
    max-width: 100%;
    height: 70vh;
    max-height: 70vh;
    z-index: 20000 !important;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(25px) saturate(160%);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.chat-sidebar::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.chat-sidebar.active {
    bottom: var(--dock-height);
}

/* Room/Main Container (Mobile Default) */
.room-container {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    padding-bottom: 0;
    /* Room for dock removed */
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.room-container>div {
    flex: 1;
    height: 100%;
    overflow: hidden;
}

#lab-view iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-dark);
}



/* ========================================
   DESKTOP ENHANCEMENTS (>= 1024px)
   ======================================== */
@media (min-width: 1024px) {
    .room-container {
        margin-right: 340px;
        padding: 1.5rem;
        height: calc(100vh - var(--header-height) - var(--dock-height) - 40px);
    }

    .chat-sidebar {
        top: 0;
        bottom: 0;
        right: -360px;
        /* Hidden by default off-screen */
        width: 340px;
        height: 100vh;
        max-height: 100vh;
        transform: none;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .chat-sidebar.active {
        right: 0;
        bottom: 0;
        /* Slide in */
    }


}

/* ========================================
   NATIVE-STYLE MOBILE COMPONENTS
   ======================================== */

.app-horizontal-scroll {
    display: flex;
    overflow-x: auto;
    gap: 1.2rem;
    padding: 0.5rem 1rem 2rem 1rem;
    margin: 0 -1rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.app-horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.app-scroll-card {
    flex: 0 0 85%;
    scroll-snap-align: center;
    border-radius: 24px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-native-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-native-list-item {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: white;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-native-list-item:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.1);
}

.list-item-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
}

/* Classroom Specialized Helpers */
.control-btn.action-toggle.mic-off,
.control-btn.action-toggle.cam-off {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
}

.control-btn.action-toggle.mic-on,
.control-btn.action-toggle.cam-on {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #22c55e !important;
}

.btn-danger-icon i,
.btn-danger-icon span {
    color: #ef4444 !important;
}

/* ========================================
   CHAT SIDEBAR & COMPONENTS
   ======================================== */

.chat-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    min-height: 50px;
}

.chat-message-input {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 25px;
    color: white;
    outline: none;
    font-size: 0.95rem;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.4;
    display: block;
}

/* ========================================
   EFFECTS PANEL
   ======================================== */
.effects-panel {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 1.5rem;
    width: 90%;
    max-width: 360px;
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    gap: 1rem;
    z-index: 15000;
}

.effects-panel.active {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 1024px) {
    .effects-panel {
        bottom: 120px;
        right: 360px;
        /* Offset from sidebar */
        left: auto;
        transform: translateY(20px);
    }

    .effects-panel.active {
        transform: translateY(0);
    }
}

.classroom-header-mobile {
    border-left: 5px solid var(--primary);
    border-radius: 20px;
}

/* ========================================
   CODE LAB (lab_programming.html)
   ======================================== */
:root {
    --lab-bg-primary: #0a0a0c;
    --lab-bg-secondary: #141417;
    --lab-bg-tertiary: #1c1c21;
    --lab-accent: #6366f1;
    --lab-sidebar-width: 280px;
}

.lab-action-btn {
    background: var(--lab-bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.lab-select {
    appearance: auto !important;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    color: #fff;
    font-size: 0.8rem;
    outline: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    min-width: 100px;
}

.lab-select.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.lab-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: calc(100vh - 110px);
    /* header + nav */
}

@media (min-width: 1024px) {
    .lab-container {
        display: grid;
        grid-template-columns: var(--lab-sidebar-width) 1fr 350px;
        gap: 1px;
        background: rgba(255, 255, 255, 0.05);
        height: calc(100vh - 70px);
    }
}

.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--lab-bg-primary);
    display: none;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-panel.active {
    display: flex;
}

@media (min-width: 1024px) {
    .view-panel {
        position: relative;
        display: flex !important;
        transform: none !important;
    }
}

/* File Explorer Card */
.file-card {
    background: var(--lab-bg-tertiary);
    margin-bottom: 12px;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.2s;
}

.file-card.active {
    border-color: var(--lab-accent);
    background: rgba(99, 102, 241, 0.1);
}

/* FAB for Code Run */
.run-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border: none;
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    z-index: 2000;
}

@media (min-width: 1024px) {
    .run-fab {
        bottom: 40px;
        right: 300px;
        /* Offset for desktop panel */
    }
}

/* === Mobile Animation Utilities === */
.fade-in {
    animation: fadeIn var(--duration-base) var(--ease-out) forwards;
}

.slide-up {
    animation: slideUp var(--duration-base) var(--ease-out) forwards;
}

.slide-in-right {
    animation: slideInRight var(--duration-base) var(--ease-out) forwards;
}

.scale-in {
    animation: scaleIn var(--duration-base) var(--ease-spring) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* === Advanced Glassmorphism === */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.glass-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 12px 20px;
    color: white;
    font-size: var(--font-size-base);
    transition: all var(--duration-base) var(--ease-out);
}

.glass-input:focus {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* === Mobile Layout Utilities === */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

/* === Mobile Card System === */
.mobile-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
    overflow: hidden;
    position: relative;
}

.mobile-card:active {
    transform: scale(0.98);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: white;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: #94a3b8;
}


/* === Lab Bottom Nav === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom));
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 4000;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.bottom-nav .nav-item.active {
    color: var(--accent);
}

.bottom-nav .nav-item i {
    font-size: 1.25rem;
}

.bottom-nav .nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

/* === Mobile Notifications (Toast) === */
.app-toast {
    position: fixed;
    top: calc(var(--safe-area-top) + 60px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: 90%;
    max-width: 400px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 60000;
    /* Above everything */
    opacity: 0;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.app-toast.success {
    border-left: 4px solid #10b981;
}

.app-toast.error {
    border-left: 4px solid #ef4444;
}

.app-toast.info {
    border-left: 4px solid #3b82f6;
}

.app-toast-icon {
    font-size: 1.2rem;
}

.app-toast.success .app-toast-icon {
    color: #10b981;
}

.app-toast.error .app-toast-icon {
    color: #ef4444;
}

.app-toast.info .app-toast-icon {
    color: #3b82f6;
}

.app-toast-content {
    flex: 1;
}

.app-toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.app-toast-message {
    font-size: 0.8rem;
    color: #cbd5e1;
}

/* Mobile Horizontal Scrolling & Snapping */
.horizontal-scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    padding: 10px 4px;
}

.horizontal-scroll-container::-webkit-scrollbar {
    display: none;
}

.mobile-card {
    scroll-snap-align: center;
    flex-shrink: 0;
}

/* Touch Ripples & Feedbacks */
.touch-ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    background-color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Pull-to-Refresh Styles */
.ptr-container {
    position: relative;
    transition: transform 0.2s ease;
}

.ptr-indicator {
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    opacity: 0;
}

.ptr-indicator i {
    font-size: 1.5rem;
    transition: transform 0.2s;
}

.ptr-pulling .ptr-indicator {
    opacity: 1;
}

/* Page Transition Wrapper */
.app-view-wrapper {
    animation: pageFadeIn 0.4s var(--ease-out);
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}