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

/* Prevent horizontal overflow globally */
html {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Theme Variables */
:root {
    /* Silver Theme (default) */
    --accent-primary: #e8e8e8;
    --accent-secondary: #b8b8b8;
    --accent-glow: rgba(232, 232, 232, 0.3);
    --accent-glow-hover: rgba(232, 232, 232, 0.1);
    --accent-bg-primary: rgba(232, 232, 232, 0.1);
    --accent-bg-secondary: rgba(232, 232, 232, 0.06);
    --accent-bg-tertiary: rgba(232, 232, 232, 0.03);
    --accent-border: rgba(232, 232, 232, 0.22);
    --accent-inset: rgba(232, 232, 232, 0.18);
    --accent-inset-hover: rgba(232, 232, 232, 0.25);
    --accent-muted: rgba(232, 232, 232, 0.7);
    --accent-placeholder: rgba(232, 232, 232, 0.45);
    --particle-glow-1: rgba(232, 232, 232, 0.6);
    --particle-glow-2: rgba(232, 232, 232, 0.4);
    
    /* Fullscreen layout adjustments */
    --fullscreen-top-offset: 80px;  /* Mobile: Adjust this value to fine-tune vertical position */
    --fullscreen-edge-padding: 12px; /* Mobile: Extra padding for curved screen edges */
    --desktop-fullscreen-top-offset: 70px; /* Desktop: Browser chrome offset (URL bar + tabs) */
    
    /* Desktop container width limits */
    --desktop-container-max-width: 900px; /* Max width for content on desktop */
}

/* Gold Theme */
[data-theme="gold"] {
    --accent-primary: #d4af37;
    --accent-secondary: #c9a961;
    --accent-glow: rgba(212, 175, 55, 0.3);
    --accent-glow-hover: rgba(212, 175, 55, 0.1);
    --accent-bg-primary: rgba(212, 175, 55, 0.1);
    --accent-bg-secondary: rgba(212, 175, 55, 0.06);
    --accent-bg-tertiary: rgba(212, 175, 55, 0.03);
    --accent-border: rgba(212, 175, 55, 0.22);
    --accent-inset: rgba(212, 175, 55, 0.18);
    --accent-inset-hover: rgba(212, 175, 55, 0.25);
    --accent-muted: rgba(212, 175, 55, 0.7);
    --accent-placeholder: rgba(212, 175, 55, 0.45);
    --particle-glow-1: rgba(212, 175, 55, 0.6);
    --particle-glow-2: rgba(212, 175, 55, 0.4);
}

/* Cyan Theme */
[data-theme="cyan"] {
    --accent-primary: #00d9ff;
    --accent-secondary: #00b8d4;
    --accent-glow: rgba(0, 217, 255, 0.3);
    --accent-glow-hover: rgba(0, 217, 255, 0.1);
    --accent-bg-primary: rgba(0, 217, 255, 0.1);
    --accent-bg-secondary: rgba(0, 217, 255, 0.06);
    --accent-bg-tertiary: rgba(0, 217, 255, 0.03);
    --accent-border: rgba(0, 217, 255, 0.22);
    --accent-inset: rgba(0, 217, 255, 0.18);
    --accent-inset-hover: rgba(0, 217, 255, 0.25);
    --accent-muted: rgba(0, 217, 255, 0.65);
    --accent-placeholder: rgba(0, 217, 255, 0.4);
    --particle-glow-1: rgba(0, 217, 255, 0.6);
    --particle-glow-2: rgba(0, 217, 255, 0.4);
}

/* Amber Theme */
[data-theme="amber"] {
    --accent-primary: #ffb000;
    --accent-secondary: #ff8c00;
    --accent-glow: rgba(255, 176, 0, 0.3);
    --accent-glow-hover: rgba(255, 176, 0, 0.1);
    --accent-bg-primary: rgba(255, 176, 0, 0.1);
    --accent-bg-secondary: rgba(255, 176, 0, 0.06);
    --accent-bg-tertiary: rgba(255, 176, 0, 0.03);
    --accent-border: rgba(255, 176, 0, 0.22);
    --accent-inset: rgba(255, 176, 0, 0.18);
    --accent-inset-hover: rgba(255, 176, 0, 0.25);
    --accent-muted: rgba(255, 176, 0, 0.65);
    --accent-placeholder: rgba(255, 176, 0, 0.4);
    --particle-glow-1: rgba(255, 176, 0, 0.6);
    --particle-glow-2: rgba(255, 176, 0, 0.4);
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #000000;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 40px 20px;
    color: #f5f5f5;
    position: relative;
    overflow-x: hidden;
    
    /* Prevent mobile browser from responding to touch gestures for chrome UI manipulation */
    /* This prevents swipe-to-show/hide URL bar and other browser UI gestures */
    touch-action: none; /* Disable all default touch behaviors */
    -webkit-user-select: none; /* Prevent text selection on iOS */
    user-select: none;
    overscroll-behavior: none; /* Prevent pull-to-refresh and overscroll effects */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS when needed */
}

/* Fullscreen mode styles - Mobile */
body.is-fullscreen {
    /* Account for browser chrome space + camera cutout + extra breathing room */
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--fullscreen-top-offset));
    padding-left: max(10px, env(safe-area-inset-left, 10px));
    padding-right: max(10px, env(safe-area-inset-right, 10px));
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
}

/* Fake fullscreen fallback */
body.fake-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    /* Same padding strategy as fullscreen */
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--fullscreen-top-offset));
    padding-left: max(10px, env(safe-area-inset-left, 10px));
    padding-right: max(10px, env(safe-area-inset-right, 10px));
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
}

/* Desktop fullscreen: Shift down to compensate for lost browser chrome */
@media (min-width: 769px) {
    body.is-fullscreen,
    body.fake-fullscreen {
        /* Browser chrome (URL bar + tabs) is typically 70-80px on desktop */
        padding-top: calc(20px + var(--desktop-fullscreen-top-offset));
        padding-left: 20px;
        padding-right: 20px;
        padding-bottom: 20px;
    }
}

/* Mobile immersive mode - hide header when scrolling down */
body.scrolling-down .header {
    transform: translateY(-120%);
    transition: transform 0.3s ease-out;
}

.header {
    transition: transform 0.3s ease-out;
}

/* iOS/Mobile safe area support for normal (non-fullscreen) mode */
@supports (padding: env(safe-area-inset-top)) {
    /* Only apply safe area to mobile devices */
    @media (max-width: 768px) {
        body {
            padding-top: max(40px, env(safe-area-inset-top));
            padding-left: max(20px, env(safe-area-inset-left));
            padding-right: max(20px, env(safe-area-inset-right));
            padding-bottom: max(20px, env(safe-area-inset-bottom));
        }
        
        /* In fullscreen, override with more aggressive padding for curved screens */
        body.is-fullscreen,
        body.fake-fullscreen {
            /* Browser chrome space + safe area + breathing room for curved edges */
            padding-top: calc(env(safe-area-inset-top) + var(--fullscreen-top-offset));
            /* Extra horizontal padding for curved screen edges */
            padding-left: calc(env(safe-area-inset-left) + var(--fullscreen-edge-padding));
            padding-right: calc(env(safe-area-inset-right) + var(--fullscreen-edge-padding));
        }
    }
}

/* 3D Starfield Canvas */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    display: block;
    /* Force GPU compositing on separate layer */
    transform: translateZ(0);
    will-change: contents;
    backface-visibility: hidden;
    /* Allow canvas to capture touch events for particle interaction */
    touch-action: none;
}

#starfield.hidden {
    display: none;
}

/* CSS Particles Container */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Falling snow particles (CSS-based) */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 
        0 0 8px var(--particle-glow-1),
        0 0 16px var(--particle-glow-2);
    animation: fallSnow 12s linear infinite;
}

/* Varying sizes for depth perception */
.particle:nth-child(2n) { 
    width: 3px; 
    height: 3px;
    box-shadow: 
        0 0 6px var(--particle-glow-1),
        0 0 12px var(--particle-glow-2);
}
.particle:nth-child(3n) { 
    width: 1.5px; 
    height: 1.5px;
    box-shadow: 
        0 0 3px var(--particle-glow-1),
        0 0 6px var(--particle-glow-2);
}
.particle:nth-child(5n) { 
    width: 4px; 
    height: 4px;
    box-shadow: 
        0 0 8px var(--particle-glow-1),
        0 0 16px var(--particle-glow-2);
}

/* Distribute particles across screen - falling snow effect */
.particle:nth-child(1) { left: 5%; animation-delay: 0s; animation-duration: 11s; }
.particle:nth-child(2) { left: 15%; animation-delay: 0.3s; animation-duration: 13s; }
.particle:nth-child(3) { left: 25%; animation-delay: 0.6s; animation-duration: 12s; }
.particle:nth-child(4) { left: 35%; animation-delay: 0.9s; animation-duration: 14s; }
.particle:nth-child(5) { left: 45%; animation-delay: 1.2s; animation-duration: 10s; }
.particle:nth-child(6) { left: 55%; animation-delay: 1.5s; animation-duration: 13s; }
.particle:nth-child(7) { left: 65%; animation-delay: 1.8s; animation-duration: 11s; }
.particle:nth-child(8) { left: 75%; animation-delay: 2.1s; animation-duration: 12s; }
.particle:nth-child(9) { left: 85%; animation-delay: 2.4s; animation-duration: 14s; }
.particle:nth-child(10) { left: 95%; animation-delay: 2.7s; animation-duration: 10s; }
.particle:nth-child(11) { left: 10%; animation-delay: 3s; animation-duration: 13s; }
.particle:nth-child(12) { left: 20%; animation-delay: 3.3s; animation-duration: 11s; }
.particle:nth-child(13) { left: 30%; animation-delay: 3.6s; animation-duration: 12s; }
.particle:nth-child(14) { left: 40%; animation-delay: 3.9s; animation-duration: 14s; }
.particle:nth-child(15) { left: 50%; animation-delay: 4.2s; animation-duration: 10s; }
.particle:nth-child(16) { left: 60%; animation-delay: 4.5s; animation-duration: 13s; }
.particle:nth-child(17) { left: 70%; animation-delay: 4.8s; animation-duration: 11s; }
.particle:nth-child(18) { left: 80%; animation-delay: 5.1s; animation-duration: 12s; }
.particle:nth-child(19) { left: 90%; animation-delay: 5.4s; animation-duration: 14s; }
.particle:nth-child(20) { left: 8%; animation-delay: 5.7s; animation-duration: 10s; }
.particle:nth-child(21) { left: 18%; animation-delay: 6s; animation-duration: 13s; }
.particle:nth-child(22) { left: 28%; animation-delay: 6.3s; animation-duration: 11s; }
.particle:nth-child(23) { left: 38%; animation-delay: 6.6s; animation-duration: 12s; }
.particle:nth-child(24) { left: 48%; animation-delay: 6.9s; animation-duration: 14s; }
.particle:nth-child(25) { left: 58%; animation-delay: 7.2s; animation-duration: 10s; }
.particle:nth-child(26) { left: 68%; animation-delay: 7.5s; animation-duration: 13s; }
.particle:nth-child(27) { left: 78%; animation-delay: 7.8s; animation-duration: 11s; }
.particle:nth-child(28) { left: 88%; animation-delay: 8.1s; animation-duration: 12s; }
.particle:nth-child(29) { left: 12%; animation-delay: 8.4s; animation-duration: 14s; }
.particle:nth-child(30) { left: 22%; animation-delay: 8.7s; animation-duration: 10s; }
.particle:nth-child(31) { left: 32%; animation-delay: 9s; animation-duration: 13s; }
.particle:nth-child(32) { left: 42%; animation-delay: 9.3s; animation-duration: 11s; }
.particle:nth-child(33) { left: 52%; animation-delay: 9.6s; animation-duration: 12s; }
.particle:nth-child(34) { left: 62%; animation-delay: 9.9s; animation-duration: 14s; }
.particle:nth-child(35) { left: 72%; animation-delay: 10.2s; animation-duration: 10s; }
.particle:nth-child(36) { left: 82%; animation-delay: 10.5s; animation-duration: 13s; }
.particle:nth-child(37) { left: 92%; animation-delay: 10.8s; animation-duration: 11s; }
.particle:nth-child(38) { left: 7%; animation-delay: 11.1s; animation-duration: 12s; }
.particle:nth-child(39) { left: 17%; animation-delay: 11.4s; animation-duration: 14s; }
.particle:nth-child(40) { left: 27%; animation-delay: 11.7s; animation-duration: 10s; }

/* Falling snow animation */
@keyframes fallSnow {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(0);
        opacity: 0;
    }
    5% {
        opacity: 0.7;
        transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    }
    95% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(100vh) translateX(-30px) rotate(180deg) scale(1);
        opacity: 0;
    }
}

.container {
    max-width: var(--desktop-container-max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
    /* Prevent touch gestures on container from reaching browser chrome */
    touch-action: none;
    overscroll-behavior: contain;
}

/* Desktop fullscreen: Keep same width, don't expand */
@media (min-width: 769px) {
    body.is-fullscreen .container,
    body.fake-fullscreen .container {
        max-width: var(--desktop-container-max-width);
    }
}

/* Mobile fullscreen: tighter container for curved screens */
@media (max-width: 768px) {
    body.is-fullscreen .container,
    body.fake-fullscreen .container {
        max-width: calc(100vw - 40px);
    }
}

/* Header - Glassmorphism with luxury touches */
.header {
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.5) 0%, rgba(8, 8, 8, 0.4) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: clamp(20px, 5vw, 32px); /* Fluid border radius */
    padding: clamp(24px, 5vw, 48px); /* Fluid padding */
    margin-bottom: clamp(16px, 4vw, 30px); /* Fluid margin */
    border: 1px solid var(--accent-border);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.8),
        0 0 20px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset),
        8px 8px 16px rgba(0, 0, 0, 0.3),
        -8px -8px 16px rgba(255, 255, 255, 0.008);
    position: relative;
    overflow: hidden;
    transition: background 0.5s ease-in-out, 
                backdrop-filter 0.5s ease-in-out, 
                border 0.5s ease-in-out, 
                box-shadow 0.5s ease-in-out,
                transform 0.3s ease-out;
}

/* Immersive mode: Fade out header container background and styling */
body.immersive-mode .header {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid transparent;
    box-shadow: none;
    pointer-events: none; /* Prevent interaction with header area when hidden */
}

/* Immersive mode: Hide header elements AND content sections */
body.immersive-mode .header-left,
body.immersive-mode .icon-button:not(#fullscreenButton):not(#settingsButton),
body.immersive-mode .section,
body.immersive-mode .wizard-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
}

/* Immersive mode: Buttons hidden by default, shown on interaction */
body.immersive-mode #fullscreenButton,
body.immersive-mode #settingsButton {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
}

/* When controls are explicitly visible in immersive mode (mouse over zone) */
body.immersive-mode.immersive-controls-visible #fullscreenButton,
body.immersive-mode.immersive-controls-visible #settingsButton {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition: opacity 0.5s ease-in-out;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-left {
    flex: 1;
}

.header h1 {
    font-size: clamp(1.5rem, 6vw, 3rem); /* Fluid: 1.5rem min → 3rem max */
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 50%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 40px var(--accent-glow);
}

.user-email {
    font-size: 0.9rem;
    color: var(--accent-primary);
    opacity: 0.8;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

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

/* Icon Buttons */
.icon-button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-bg-tertiary) 0%, var(--accent-bg-secondary) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 var(--accent-inset),
        4px 4px 8px rgba(0, 0, 0, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.008);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    opacity: 0.5; /* Dimmed default state */
}

@media (hover: hover) and (pointer: fine) {
    .icon-button:hover {
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.6),
            0 0 18px var(--accent-glow-hover),
            inset 0 1px 0 var(--accent-inset-hover),
            6px 6px 12px rgba(0, 0, 0, 0.4),
            -6px -6px 12px rgba(255, 255, 255, 0.01);
        opacity: 0.7; /* Slightly brighter on hover */
    }

    .icon-button:hover svg {
        transform: scale(1.1);
    }
}

.icon-button svg {
    width: 22px;
    height: 22px;
    fill: var(--accent-primary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state for icon buttons - matches device selection brightness */
.icon-button.active {
    opacity: 1; /* Full brightness when active */
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 20px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover),
        10px 10px 20px rgba(0, 0, 0, 0.4),
        -10px -10px 20px rgba(255, 255, 255, 0.01);
}

.icon-button.active svg {
    fill: var(--accent-primary);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.settings-button:hover svg {
    transform: rotate(90deg);
}

/* Overlay for modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.overlay.active {
    display: flex;
}

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

/* Modal Panel */
.modal-panel {
    background: linear-gradient(135deg, rgba(8, 8, 8, 0.5) 0%, rgba(6, 6, 6, 0.4) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--accent-border);
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.9),
        0 0 40px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-panel.large {
    max-width: 700px;
}

.modal-panel.small {
    max-width: 450px;
}

/* Confirmation Modal Styles */
.confirm-message {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin: 20px 0;
    text-align: center;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.modal-btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid;
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border-color: var(--accent-border);
    color: var(--accent-primary);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 var(--accent-inset);
}

.modal-btn.primary:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.4),
        0 0 12px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

.modal-btn.secondary {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.3) 0%, rgba(30, 30, 30, 0.2) 100%);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-btn.secondary:hover {
    background: linear-gradient(135deg, rgba(50, 50, 50, 0.4) 0%, rgba(40, 40, 40, 0.3) 100%);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--accent-primary);
    font-size: 24px;
    line-height: 1;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
}

/* Settings Modal Specific */
.setting-group {
    margin-bottom: 28px;
}

.setting-label {
    font-size: 0.9rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
}

.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.toggle-button {
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(128, 128, 128, 0.1) 0%, rgba(128, 128, 128, 0.06) 100%);
    border: 1px solid rgba(128, 128, 128, 0.22);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.toggle-button:hover {
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Individual theme button colors */
.toggle-button[data-theme="gold"] {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0.06) 100%);
    border-color: rgba(212, 175, 55, 0.22);
    color: #d4af37;
}

.toggle-button[data-theme="gold"]:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.1) 100%);
    border-color: rgba(212, 175, 55, 0.3);
}

.toggle-button[data-theme="gold"].active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0.06) 100%);
    border-color: rgba(212, 175, 55, 0.22);
    color: #d4af37;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(212, 175, 55, 0.1),
        inset 0 1px 0 rgba(212, 175, 55, 0.25),
        10px 10px 20px rgba(0, 0, 0, 0.4),
        -10px -10px 20px rgba(255, 255, 255, 0.01);
}

.toggle-button[data-theme="silver"] {
    background: linear-gradient(135deg, rgba(232, 232, 232, 0.1) 0%, rgba(232, 232, 232, 0.06) 100%);
    border-color: rgba(232, 232, 232, 0.22);
    color: #e8e8e8;
}

.toggle-button[data-theme="silver"]:hover {
    background: linear-gradient(135deg, rgba(232, 232, 232, 0.15) 0%, rgba(232, 232, 232, 0.1) 100%);
    border-color: rgba(232, 232, 232, 0.3);
}

.toggle-button[data-theme="silver"].active {
    background: linear-gradient(135deg, rgba(232, 232, 232, 0.1) 0%, rgba(232, 232, 232, 0.06) 100%);
    border-color: rgba(232, 232, 232, 0.22);
    color: #e8e8e8;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(232, 232, 232, 0.1),
        inset 0 1px 0 rgba(232, 232, 232, 0.25),
        10px 10px 20px rgba(0, 0, 0, 0.4),
        -10px -10px 20px rgba(255, 255, 255, 0.01);
}

.toggle-button[data-theme="cyan"] {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1) 0%, rgba(0, 217, 255, 0.06) 100%);
    border-color: rgba(0, 217, 255, 0.22);
    color: #00d9ff;
}

.toggle-button[data-theme="cyan"]:hover {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.15) 0%, rgba(0, 217, 255, 0.1) 100%);
    border-color: rgba(0, 217, 255, 0.3);
}

.toggle-button[data-theme="cyan"].active {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1) 0%, rgba(0, 217, 255, 0.06) 100%);
    border-color: rgba(0, 217, 255, 0.22);
    color: #00d9ff;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(0, 217, 255, 0.1),
        inset 0 1px 0 rgba(0, 217, 255, 0.25),
        10px 10px 20px rgba(0, 0, 0, 0.4),
        -10px -10px 20px rgba(255, 255, 255, 0.01);
}

.toggle-button[data-theme="amber"] {
    background: linear-gradient(135deg, rgba(255, 176, 0, 0.1) 0%, rgba(255, 176, 0, 0.06) 100%);
    border-color: rgba(255, 176, 0, 0.22);
    color: #ffb000;
}

.toggle-button[data-theme="amber"]:hover {
    background: linear-gradient(135deg, rgba(255, 176, 0, 0.15) 0%, rgba(255, 176, 0, 0.1) 100%);
    border-color: rgba(255, 176, 0, 0.3);
}

.toggle-button[data-theme="amber"].active {
    background: linear-gradient(135deg, rgba(255, 176, 0, 0.1) 0%, rgba(255, 176, 0, 0.06) 100%);
    border-color: rgba(255, 176, 0, 0.22);
    color: #ffb000;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(255, 176, 0, 0.1),
        inset 0 1px 0 rgba(255, 176, 0, 0.25),
        10px 10px 20px rgba(0, 0, 0, 0.4),
        -10px -10px 20px rgba(255, 255, 255, 0.01);
}

/* Particle effect buttons - default state */
.toggle-button[data-particles] {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid var(--accent-border);
    color: var(--accent-primary);
}

.toggle-button[data-particles]:hover {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 12px var(--accent-glow-hover);
}

/* Particle effect buttons active state - EXACT same as device item selected */
.toggle-button[data-particles].active {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border-color: var(--accent-border);
    color: var(--accent-primary);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 20px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover),
        10px 10px 20px rgba(0, 0, 0, 0.4),
        -10px -10px 20px rgba(255, 255, 255, 0.01);
}

/* Admin Mode Toggle Button */
.admin-mode-button {
    display: inline-block;
    padding: 12px 20px;
    margin-top: 8px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    color: var(--accent-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 var(--accent-inset);
}

.admin-mode-button:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

.admin-mode-button.active {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    color: var(--accent-primary);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

/* Hidden admin button (shown only for admins) */
.admin-mode-button.hidden {
    display: none !important;
}

/* Demo Mode Toggle Button (same styling as admin button) */
.demo-mode-button {
    display: inline-block;
    padding: 12px 20px;
    margin-top: 8px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    color: var(--accent-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 var(--accent-inset);
}

.demo-mode-button:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

.demo-mode-button.active {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    color: var(--accent-primary);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

/* Hidden demo button (shown only in demo mode) */
.demo-mode-button.hidden {
    display: none !important;
}

/* Logout Button */
.logout-button {
    display: inline-block;
    padding: 12px 20px;
    margin-top: 24px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    color: var(--accent-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 var(--accent-inset);
}

.logout-button:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

/* Section - Deep luxury glass */
.section {
    background: linear-gradient(135deg, rgba(8, 8, 8, 0.5) 0%, rgba(6, 6, 6, 0.4) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: clamp(20px, 5vw, 32px); /* Fluid border radius */
    padding: clamp(24px, 5vw, 40px); /* Fluid padding */
    margin-bottom: clamp(16px, 4vw, 30px); /* Fluid margin */
    border: 1px solid var(--accent-border);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.8),
        0 0 20px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset),
        8px 8px 16px rgba(0, 0, 0, 0.3),
        -8px -8px 16px rgba(255, 255, 255, 0.008);
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

/* Hidden state for devices section */
.section.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

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

.section-title {
    font-size: clamp(1.2rem, 4vw, 1.75rem); /* Fluid section title */
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 16px); /* Fluid gap */
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.subsection-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 16px;
    margin-top: 20px;
    text-transform: uppercase;
    flex-shrink: 0;
    letter-spacing: 1px;
    opacity: 0.9;
}

.subsection-title:first-child {
    margin-top: 0;
}

.section-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    border: 1px solid var(--accent-border);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 12px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset),
        6px 6px 12px rgba(0, 0, 0, 0.3),
        -6px -6px 12px rgba(255, 255, 255, 0.008);
}

/* Device List */
.device-list {
    display: grid;
    gap: 20px;
}

.device-item {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--accent-border);
    border-radius: 24px;
    padding: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 var(--accent-inset),
        6px 6px 12px rgba(0, 0, 0, 0.3),
        -6px -6px 12px rgba(255, 255, 255, 0.008);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
}

/* Desktop: pointer cursor since clicking opens page */
@media (hover: hover) and (pointer: fine) {
    .device-item {
        cursor: pointer;
    }
}

/* Mobile: default cursor since clicking selects */
@media (max-width: 768px) {
    .device-item {
        cursor: default;
    }
}

/* Device item edit/delete panels - hidden by default */
.device-edit-panel,
.device-delete-panel {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Show edit panel when in editing mode */
.device-item.editing .device-edit-panel {
    opacity: 1;
    pointer-events: all;
}

/* Show delete panel when in deleting mode */
.device-item.deleting .device-delete-panel {
    opacity: 1;
    pointer-events: all;
}

/* Hide metrics when editing or deleting */
.device-item.editing .device-metrics,
.device-item.deleting .device-metrics {
    opacity: 0;
    pointer-events: none;
}

/* Hide action buttons when editing or deleting (both desktop and mobile) */
.device-item.editing .device-actions,
.device-item.deleting .device-actions {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Mobile: Keep device selected/highlighted during edit/delete */
@media (max-width: 768px) {
    .device-item.editing,
    .device-item.deleting {
        background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
        border-color: var(--accent-border);
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.7),
            0 0 20px var(--accent-glow-hover),
            inset 0 1px 0 var(--accent-inset-hover),
            10px 10px 20px rgba(0, 0, 0, 0.4),
            -10px -10px 20px rgba(255, 255, 255, 0.01);
    }
}

/* Edit/Delete input fields */
.edit-input,
.delete-input {
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: all 0.3s ease;
    min-width: 200px;
}

.edit-input:focus,
.delete-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow-hover);
    background: rgba(0, 0, 0, 0.6);
}

.edit-input::placeholder,
.delete-input::placeholder {
    color: var(--accent-placeholder);
}

/* Edit buttons (save/cancel/delete) */
.edit-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.edit-btn:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    box-shadow: 0 0 12px var(--accent-glow-hover);
}

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

.edit-btn.delete-confirm-btn {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border-color: var(--accent-border);
    color: var(--accent-primary);
}

.edit-btn.delete-confirm-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    box-shadow: 0 0 12px var(--accent-glow-hover);
}

/* Delete warning text */
.delete-warning {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 8px;
}

/* Desktop: hover shows highlight (no selection state) */
@media (hover: hover) and (pointer: fine) {
    .device-item:hover {
        background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
        border-color: var(--accent-border);
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.7),
            0 0 20px var(--accent-glow-hover),
            inset 0 1px 0 var(--accent-inset-hover),
            10px 10px 20px rgba(0, 0, 0, 0.4),
            -10px -10px 20px rgba(255, 255, 255, 0.01);
    }
}

/* Mobile: selected state shows highlight */
@media (max-width: 768px) {
    .device-item.selected {
        background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
        border-color: var(--accent-border);
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.7),
            0 0 20px var(--accent-glow-hover),
            inset 0 1px 0 var(--accent-inset-hover),
            10px 10px 20px rgba(0, 0, 0, 0.4),
            -10px -10px 20px rgba(255, 255, 255, 0.01);
    }
}

.device-info {
    flex: 1;
    z-index: 1;
}

.device-name {
    font-size: clamp(1rem, 4vw, 1.5rem); /* Fluid device name */
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    position: relative;
}

/* Desktop: Clickable device name hover effect */
@media (min-width: 769px) {
    .device-name[style*="cursor: pointer"]:hover {
        filter: brightness(1.4);
    }
}

.device-status {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-bg-primary);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
    transition: all 0.3s ease;
}

/* Inline metrics with glass effect */
.device-metrics {
    display: flex;
    gap: 16px;
    align-items: center;
    z-index: 1;
    margin-right: 24px;
    border-radius: 18px;
    padding: 4px;
    margin: -4px 24px -4px -4px;
    transition: all 0.3s ease;
}

.metric {
    text-align: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--accent-border);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 var(--accent-inset),
        4px 4px 8px rgba(0, 0, 0, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.008);
    transition: all 0.3s ease;
    min-width: 110px;
}

.metric-value {
    font-size: clamp(0.95rem, 3.5vw, 1.5rem); /* Fluid metric value */
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    margin-bottom: 4px;
    line-height: 1;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--accent-primary);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Device Actions - Icons that appear on hover */
.device-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    min-width: 50px;
    flex-shrink: 0;
}

/* Desktop: Show action buttons on hover only */
@media (hover: hover) and (pointer: fine) {
    .device-item:hover .device-actions {
        opacity: 1;
        pointer-events: all;
    }
}

/* Mobile: Show action buttons on selection */
@media (max-width: 768px) {
    .device-item.selected .device-actions {
        opacity: 1;
        pointer-events: all;
    }
}

.action-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 var(--accent-inset);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-icon:hover {
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.6),
        0 0 12px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover);
}

.action-icon svg {
    width: 18px;
    height: 18px;
    fill: var(--accent-primary);
}

.action-icon.danger:hover {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2) 0%, rgba(200, 35, 51, 0.1) 100%);
    border-color: rgba(220, 53, 69, 0.4);
}

.action-icon.danger svg {
    fill: #dc3545;
}

/* Open Device Page Button (Mobile Only) */
.open-device-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 var(--accent-inset),
        4px 4px 8px rgba(0, 0, 0, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.008);
    background-clip: padding-box;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.open-device-btn .btn-icon {
    width: 16px;
    height: 16px;
    fill: var(--accent-primary);
}

/* Active state when device is selected */
.open-device-btn.active {
    opacity: 1;
    cursor: pointer;
    pointer-events: all;
}

.open-device-btn.active:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.6),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover),
        6px 6px 12px rgba(0, 0, 0, 0.4),
        -6px -6px 12px rgba(255, 255, 255, 0.01);
}

/* Hide on desktop - mobile only */
@media (min-width: 769px) {
    .open-device-btn.mobile-only {
        display: none;
    }
}

/* Add Device Button */
.add-device-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 var(--accent-inset),
        4px 4px 8px rgba(0, 0, 0, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.008);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-clip: padding-box;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

.add-device-btn:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    border-color: var(--accent-border);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.6),
        0 0 18px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset-hover),
        6px 6px 12px rgba(0, 0, 0, 0.4),
        -6px -6px 12px rgba(255, 255, 255, 0.01);
}

/* Wizard Content */
.wizard-content {
    margin-top: 20px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.wizard-step h3 {
    font-size: 1.3rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-weight: 600;
}

.device-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.device-type-card {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-type-card:hover:not(.disabled) {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 12px var(--accent-glow-hover);
}

.device-type-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.device-type-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-type-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--accent-primary);
    filter: drop-shadow(0 0 8px var(--accent-glow));
    transition: all 0.3s ease;
}

.device-type-card:hover .device-type-icon svg {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px var(--accent-glow-hover));
}

.device-type-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.device-type-description {
    font-size: 0.85rem;
    color: var(--accent-muted);
}

.device-type-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: var(--accent-bg-primary);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.hardware-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.hardware-card {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hardware-card:hover:not(.disabled) {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.5),
        0 0 12px var(--accent-glow-hover);
}

.hardware-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.hardware-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 6px;
}

.hardware-specs {
    font-size: 0.85rem;
    color: var(--accent-muted);
}

.instruction-text {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    line-height: 1.8;
    color: var(--accent-primary);
}

.instruction-text ol {
    margin-left: 20px;
}

.instruction-text li {
    margin-bottom: 12px;
}

.instruction-text strong {
    color: var(--accent-primary);
}

.token-display {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 2px dashed var(--accent-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.token-label {
    font-size: 0.9rem;
    color: var(--accent-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.token-value {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 8px;
    word-break: break-all;
    cursor: pointer;
    transition: all 0.3s ease;
}

.token-value:hover {
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 12px var(--accent-glow-hover);
}

.token-hint {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--accent-muted);
}

.wizard-nav {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 24px;
}

.wizard-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wizard-btn:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.4),
        0 0 12px var(--accent-glow-hover);
}

.wizard-btn.secondary {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border-color: var(--accent-border);
    color: var(--accent-muted);
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
    flex: 1;
    user-select: none;
}

.custom-select-trigger {
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.custom-select-trigger:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.4);
}

.custom-select.active .custom-select-trigger {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow-hover);
    background: rgba(0, 0, 0, 0.5);
}

.custom-select-value {
    flex: 1;
    color: var(--accent-primary);
}

.custom-select-value.placeholder {
    color: var(--accent-placeholder);
}

.custom-select-arrow {
    width: 20px;
    height: 20px;
    fill: var(--accent-primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.custom-select.active .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.98) 0%, rgba(10, 10, 10, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.9),
        0 0 20px var(--accent-glow-hover),
        inset 0 1px 0 var(--accent-inset);
}

.custom-select.active .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 12px 16px;
    color: var(--accent-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    background: transparent;
}

.custom-select-option:hover {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    color: var(--accent-primary);
}

.custom-select-option.selected {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    color: var(--accent-primary);
    font-weight: 600;
}

.custom-select-option.selected:hover {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
}

/* Custom scrollbar for dropdown */
.custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--accent-bg-primary);
    border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--accent-bg-secondary);
}

/* Sharing Modal Specific */
.sharing-section {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.sharing-section:last-child {
    margin-bottom: 0;
}

.sharing-subsection-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
    opacity: 0.9;
}

.sharing-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.sharing-item {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.sharing-item:hover {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 12px var(--accent-glow-hover);
}

.sharing-info {
    flex: 1;
}

.sharing-email, .sharing-device-name {
    font-size: 0.95rem;
    color: var(--accent-primary);
    margin-bottom: 4px;
    font-weight: 500;
}

.sharing-detail {
    font-size: 0.8rem;
    color: var(--accent-muted);
    font-family: 'Courier New', monospace;
}

.sharing-permission {
    padding: 6px 12px;
    background: var(--accent-bg-primary);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
    margin-right: 12px;
}

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

/* Edit mode for sharing items */
.sharing-item.editing {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    padding: 20px;
}

.sharing-edit-controls {
    display: none;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
}

.sharing-item.editing .sharing-edit-controls {
    display: flex;
}

.sharing-item.editing .sharing-permission {
    display: none;
}

.sharing-item.editing .sharing-actions {
    display: none;
}

.edit-permission-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-permission-toggle .toggle-label {
    font-size: 0.8rem;
    color: var(--accent-muted);
}

.edit-permission-toggle .toggle-label.active {
    color: var(--accent-primary);
    font-weight: 600;
}

.edit-permission-toggle .toggle-switch {
    width: 44px;
    height: 24px;
}

.edit-permission-toggle .toggle-thumb {
    width: 18px;
    height: 18px;
}

.edit-permission-toggle .toggle-switch.active .toggle-thumb {
    left: 22px;
}

.edit-save-btn, .edit-cancel-btn {
    padding: 8px 16px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-save-btn {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    color: var(--accent-primary);
}

.edit-save-btn:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    box-shadow: 0 0 12px var(--accent-glow-hover);
}

.edit-cancel-btn {
    background: linear-gradient(135deg, rgba(128, 128, 128, 0.1) 0%, rgba(128, 128, 128, 0.06) 100%);
    border-color: rgba(128, 128, 128, 0.22);
    color: rgba(255, 255, 255, 0.6);
}

.edit-cancel-btn:hover {
    background: linear-gradient(135deg, rgba(128, 128, 128, 0.15) 0%, rgba(128, 128, 128, 0.1) 100%);
}

.add-sharing-form {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-input, .form-select {
    flex: 1;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow-hover);
}

.form-input::placeholder {
    color: var(--accent-placeholder);
}

.form-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.toggle-switch {
    width: 50px;
    height: 26px;
    background: var(--accent-bg-secondary);
    border: 1px solid var(--accent-border);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-glow-hover);
}

.toggle-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.toggle-switch.active .toggle-thumb {
    left: 26px;
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--accent-muted);
}

.toggle-label.active {
    color: var(--accent-primary);
    font-weight: 600;
}

.form-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-bg-primary) 0%, var(--accent-bg-secondary) 100%);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    color: var(--accent-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-button:hover {
    background: linear-gradient(135deg, var(--accent-bg-secondary) 0%, var(--accent-bg-primary) 100%);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.4),
        0 0 12px var(--accent-glow-hover);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--accent-primary); /* Theme color instead of gray */
    font-style: italic;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 20px 12px;
    }

    .header, .section {
        padding: 24px 16px;
        border-radius: 24px;
    }

    .header h1 {
        font-size: 2rem;
    }

    /* Keep header buttons on same row but compact */
    .header-content {
        gap: 16px;
    }

    .icon-button {
        width: 44px;
        height: 44px;
    }

    .icon-button svg {
        width: 20px;
        height: 20px;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Button group wraps on mobile if needed */
    .section-header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Keep buttons sized to content, not full width */
    .add-device-btn,
    .open-device-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Device items: compact 2-row layout on mobile */
    .device-item {
        padding: 18px;
        flex-wrap: wrap;
        gap: 14px;
        align-items: center;
    }
    
    /* On mobile, completely hide metrics/actions when in edit/delete mode (not just opacity) */
    .device-item.editing .device-metrics,
    .device-item.deleting .device-metrics,
    .device-item.editing .device-actions,
    .device-item.deleting .device-actions {
        display: none !important;
    }
    
    /* Edit/Delete panels on mobile - inline where metrics were */
    .device-item.editing .device-edit-panel,
    .device-item.deleting .device-delete-panel {
        position: static;
        transform: none;
        flex: 1;
        min-width: 0;
    }
    
    /* Keep panels absolutely positioned when not active to prevent space */
    .device-edit-panel,
    .device-delete-panel {
        position: absolute;
    }
    
    .edit-input {
        flex: 1;
        min-width: 100px;
    }
    
    /* Delete panel layout - compact inline on mobile */
    .device-item.deleting .device-delete-panel {
        gap: 8px;
    }
    
    .delete-input {
        flex: 0 0 auto;
        width: 120px;
        min-width: unset;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* Hide the warning text on mobile to save space */
    .delete-warning {
        display: none;
    }
    
    /* Compact buttons on mobile */
    .device-delete-panel .edit-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .device-info {
        flex: 1;
        min-width: 0;
    }

    .device-name {
        font-size: 1.2rem;
    }

    .device-status {
        font-size: 0.7rem;
        padding: 3px 10px;
    }

    /* Metrics and actions on same row (second row) */
    .device-metrics {
        display: flex;
        flex-direction: row;
        gap: 6px;
        flex-wrap: nowrap;
        margin: 0;
        padding: 0;
        flex: 1;
        min-width: 0;
    }

    .metric {
        padding: 8px 10px;
        min-width: 70px;
        flex: 1;
    }

    .metric-value {
        font-size: 1.1rem;
    }

    .metric-label {
        font-size: 0.6rem;
    }

    /* No arrow on mobile - use vertical stacking instead */
    .device-metrics::after {
        display: none;
    }

    /* Device actions - vertical on right side of second row */
    .device-actions {
        display: flex;
        flex-direction: column;
        gap: 6px;
        /* Inherit opacity behavior - only show when selected */
        min-width: auto;
        margin-left: 12px;
    }

    /* On mobile, show actions when device is selected */
    .device-item.selected .device-actions {
        opacity: 1;
        pointer-events: all;
    }

    .action-icon {
        width: 36px;
        height: 36px;
    }

    .action-icon svg {
        width: 16px;
        height: 16px;
    }

    /* Wizard and modals */
    .device-type-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-row {
        flex-direction: column;
    }

    .modal-panel {
        padding: 24px 20px;
        max-height: 90vh;
    }

    .modal-title {
        font-size: 1.5rem;
    }
}

/* Small phones (iPhone 14 = 390px, iPhone SE = 375px, etc.) */
@media (max-width: 414px) {
    body {
        padding: 16px 8px;
    }

    /* Ensure container doesn't overflow on small screens */
    .container {
        max-width: calc(100vw - 16px);
        width: 100%;
    }

    .header, .section {
        padding: 16px 12px;
        border-radius: 20px;
        max-width: 100%;
        overflow: hidden;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    /* ========================================
       HEADER: 3-row layout on small phones
       Row 1: Title (Dashboard)
       Row 2: User email
       Row 3: Toggle buttons
       ======================================== */
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-left {
        width: 100%;
        text-align: center;
    }

    .header-buttons {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .icon-button {
        width: 40px;
        height: 40px;
    }

    .icon-button svg {
        width: 18px;
        height: 18px;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    /* ========================================
       DEVICE CARDS: 2-row layout on small phones
       Row 1: Device name + status badge (full width)
       Row 2: Metrics + action buttons (same row)
       ======================================== */
    .device-item {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 12px;
        gap: 8px;
    }

    /* Row 1: Device info takes full width to force new line after */
    .device-info {
        width: 100%;
        flex: 0 0 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .device-name {
        font-size: 0.95rem;
        flex: 1;
        min-width: 0;
        word-break: break-word;
    }

    .device-status {
        font-size: 0.6rem;
        padding: 2px 6px;
        flex-shrink: 0;
    }

    /* Row 2: Metrics - takes available space */
    .device-metrics {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex: 1;
        margin: 0;
        padding: 0;
    }

    .metric {
        padding: 6px 8px;
        min-width: auto;
        flex: 0 1 auto;
    }

    .metric-value {
        font-size: 0.85rem;
    }

    .metric-label {
        font-size: 0.5rem;
    }

    /* Row 2: Action buttons at end of same row as metrics */
    .device-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    .device-item.selected .device-actions {
        opacity: 1;
        pointer-events: all;
    }

    .action-icon {
        width: 32px;
        height: 32px;
    }

    .action-icon svg {
        width: 14px;
        height: 14px;
    }

    /* Edit/Delete panels - keep absolute positioned until active */
    .device-edit-panel,
    .device-delete-panel {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

    /* Only make panels static (take space) when actively editing/deleting */
    .device-item.editing .device-edit-panel,
    .device-item.deleting .device-delete-panel {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
        gap: 8px;
    }

    /* Buttons */
    .add-device-btn,
    .open-device-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* Modal adjustments */
    .modal-panel {
        padding: 24px 16px;
        width: 95%;
        max-height: 90vh;
    }
}

/* Animation */
@keyframes fadeInLuxury {
    from {
        opacity: 0;
        transform: translateY(40px);
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        backdrop-filter: blur(40px);
    }
}

.header, .section {
    animation: fadeInLuxury 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom scrollbar for modals */
.modal-panel::-webkit-scrollbar {
    width: 8px;
}

.modal-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.modal-panel::-webkit-scrollbar-thumb {
    background: var(--accent-bg-primary);
    border-radius: 4px;
}

.modal-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-bg-secondary);
}

/* Mobile Portrait Mode Enforcement */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body > * {
        display: none !important;
    }
    
    body::before {
        content: "Please rotate your device to portrait mode";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #000000;
        color: var(--accent-primary, #e8e8e8);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 99999;
        font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        text-align: center;
        padding: 20px;
        font-size: 1.2rem;
        font-weight: 500;
        background-image: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0) 70%);
    }
}

