/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loading-logo {
    height: 120px;
    width: auto;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
    opacity: 0.9;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: textPulse 2s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

.loading-text.updating {
    opacity: 0.6;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.loading-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.9));
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: progressGlow 2s ease-in-out infinite, progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.4);
    }
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 1;
    }
}

.loading-percentage {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-top: 0.5rem;
    opacity: 0.8;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.loading-percentage.updating {
    transform: scale(1.1);
    opacity: 1;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes textPulse {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 0.6;
    }
}

/* Mobile adjustments for loading screen */
@media (max-width: 768px) {
    .loading-logo {
        height: 80px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-content {
        gap: 1.5rem;
    }
}

:root {
    /* Apple-inspired Color Palette */
    --primary-color: #007aff;
    --primary-hover: #0056d6;
    --secondary-color: #5856d6;
    --accent-color: #ff9500;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-light: #86868b;
    --bg-primary: #ffffff;
    --bg-secondary: #fbfbfd;
    --bg-tertiary: #f5f5f7;
    --border-color: #d2d2d7;
    
    /* Apple-style Shadows */
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.1), 0 8px 32px rgba(0, 0, 0, 0.06);
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    position: relative;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* NoScript Warning */
.noscript-warning {
    background: #f44336;
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: bold;
}

/* Enhanced Focus Indicators for Accessibility */
.keypad-btn:focus {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(0, 122, 255, 0.4), 0 8px 25px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
    z-index: 10;
    position: relative;
}

.keypad-btn:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(0, 122, 255, 0.4), 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Focus indicators for different button types */
.keypad-btn--up:focus {
    box-shadow: 0 0 0 6px rgba(100, 255, 150, 0.6), 0 8px 25px rgba(0, 0, 0, 0.4);
}

.keypad-btn--down:focus {
    box-shadow: 0 0 0 6px rgba(100, 150, 255, 0.6), 0 8px 25px rgba(0, 0, 0, 0.4);
}

.keypad-btn--left:focus {
    box-shadow: 0 0 0 6px rgba(255, 180, 100, 0.6), 0 8px 25px rgba(0, 0, 0, 0.4);
}

.keypad-btn--right:focus {
    box-shadow: 0 0 0 6px rgba(255, 120, 120, 0.6), 0 8px 25px rgba(0, 0, 0, 0.4);
}

.keypad-btn--center:focus {
    box-shadow: 0 0 0 6px rgba(220, 150, 255, 0.6), 0 8px 25px rgba(0, 0, 0, 0.4);
}

.keypad-btn--back:focus {
    box-shadow: 0 0 0 6px rgba(255, 220, 100, 0.6), 0 8px 25px rgba(0, 0, 0, 0.4);
}

body::before {
    content: '';
    position: fixed;
    top: 100px;
    left: 0;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.03) 50%, transparent 70%);
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    transition: background 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Color-responsive shimmer based on active face */
body:has(.cube.show-front)::before {
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.04) 50%, transparent 70%);
}

body:has(.cube.show-right)::before {
    background: linear-gradient(45deg, transparent 30%, rgba(255, 200, 200, 0.03) 50%, transparent 70%);
}

body:has(.cube.show-back)::before {
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 200, 0.03) 50%, transparent 70%);
}

body:has(.cube.show-left)::before {
    background: linear-gradient(45deg, transparent 30%, rgba(255, 220, 180, 0.03) 50%, transparent 70%);
}

body:has(.cube.show-top)::before {
    background: linear-gradient(45deg, transparent 30%, rgba(200, 255, 220, 0.03) 50%, transparent 70%);
}

body:has(.cube.show-bottom)::before {
    background: linear-gradient(45deg, transparent 30%, rgba(200, 220, 255, 0.03) 50%, transparent 70%);
}

/* Dynamic background colors based on active face */
body:has(.cube.show-front) {
    background: linear-gradient(135deg, #8a60c8 0%, #a870d0 100%);
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1);
}

body:has(.cube.show-right) {
    background: linear-gradient(135deg, #8b5a5a 0%, #a85050 100%);
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1);
}

body:has(.cube.show-back) {
    background: linear-gradient(135deg, #a08840 0%, #b89530 100%);
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1);
}

body:has(.cube.show-left) {
    background: linear-gradient(135deg, #b8754a 0%, #c8824a 100%);
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1);
}

body:has(.cube.show-top) {
    background: linear-gradient(135deg, #4a8b60 0%, #5a9b70 100%);
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1);
}

body:has(.cube.show-bottom) {
    background: linear-gradient(135deg, #4a6b8b 0%, #507ba8 100%);
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1);
}


/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    z-index: 1001;
    transition: all 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 5px var(--space-16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: breathe 4s ease-in-out infinite;
    position: absolute;
    left: 20px;
    top: 20px;
}

.logo-img {
    height: 80px;
    width: auto;
    transition: filter 2s ease, transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
    filter: brightness(1.1) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

/* Logo stays clean and consistent - no additional styles needed */

/* Logo breathing animation */
@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Hamburger Menu */
.hamburger-menu {
    display: flex;
    align-items: center;
    position: absolute;
    right: 20px;
    top: 20px;
}

.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 1003;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.hamburger-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hamburger-btn:hover .hamburger-line {
    height: 2.5px;
}

.hamburger-btn:active {
    transform: scale(0.95);
}

.hamburger-btn:focus {
    outline: 2px solid #007aff;
    outline-offset: 2px;
    background: rgba(0, 122, 255, 0.1);
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.hamburger-btn.active {
    background: rgba(0, 122, 255, 0.1);
    transform: rotate(90deg);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    background: rgba(0, 0, 0, 0.3);
}

.menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.9), rgba(20, 20, 40, 0.95));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    padding: 2.5rem 2rem;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0;
    transform: translateX(100%) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    overflow-y: auto;
}

/* Color-responsive menu content based on active face */
body:has(.cube.show-front) .menu-content {
    background: linear-gradient(135deg, rgba(120, 40, 140, 0.98), rgba(90, 30, 110, 0.99));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(180, 60, 200, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

body:has(.cube.show-right) .menu-content {
    background: linear-gradient(135deg, rgba(170, 20, 20, 0.98), rgba(130, 15, 15, 0.99));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(200, 40, 40, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

body:has(.cube.show-back) .menu-content {
    background: linear-gradient(135deg, rgba(200, 160, 0, 0.98), rgba(160, 120, 0, 0.99));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(220, 180, 20, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

body:has(.cube.show-left) .menu-content {
    background: linear-gradient(135deg, rgba(200, 90, 0, 0.98), rgba(160, 70, 0, 0.99));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(220, 110, 20, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

body:has(.cube.show-top) .menu-content {
    background: linear-gradient(135deg, rgba(0, 120, 40, 0.98), rgba(0, 90, 30, 0.99));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(20, 140, 60, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

body:has(.cube.show-bottom) .menu-content {
    background: linear-gradient(135deg, rgba(0, 60, 150, 0.98), rgba(0, 40, 120, 0.99));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(20, 80, 170, 0.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}

.menu-overlay.active .menu-content {
    transform: translateX(0) scale(1);
    box-shadow: -25px 0 70px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.menu-header h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.02em;
}

.menu-logo {
    height: 40px;
    width: auto;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.menu-logo:hover {
    opacity: 1;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
}

.menu-item {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-overlay.active .menu-item {
    opacity: 1;
    transform: translateX(0);
}

.menu-overlay.active .menu-item:nth-child(1) { transition-delay: 0.1s; }
.menu-overlay.active .menu-item:nth-child(2) { transition-delay: 0.15s; }
.menu-overlay.active .menu-item:nth-child(3) { transition-delay: 0.2s; }
.menu-overlay.active .menu-item:nth-child(4) { transition-delay: 0.25s; }
.menu-overlay.active .menu-item:nth-child(5) { transition-delay: 0.3s; }
.menu-overlay.active .menu-item:nth-child(6) { transition-delay: 0.35s; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    font-weight: 600;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    transform: translateX(12px) scale(1.03);
    border-color: rgba(255, 255, 255, 0.6);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
    transition: background 1s ease, color 1s ease;
    text-shadow: none;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Color-responsive active menu item based on active face */
body:has(.cube.show-front) .menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #2d1f3d;
}

body:has(.cube.show-right) .menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #4a1a1a;
}

body:has(.cube.show-back) .menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #4a3d00;
}

body:has(.cube.show-left) .menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #4a2600;
}

body:has(.cube.show-top) .menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #003d1a;
}

body:has(.cube.show-bottom) .menu-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: #001a4a;
}

.menu-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.menu-text {
    font-size: 1rem;
}

.menu-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
}

.menu-footer p {
    font-size: 0.85rem;
    color: #ffffff;
    margin: 0;
    font-style: italic;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.01em;
    opacity: 0.9;
}

/* Mobile adjustments for hamburger menu */
@media (max-width: 768px) {
    .menu-content {
        width: 300px;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .menu-content {
        width: 280px;
        padding: 1rem;
    }
    
    .menu-header h3 {
        font-size: 1.1rem;
    }
    
    .menu-item {
        padding: 0.6rem 0.8rem;
        gap: 0.8rem;
    }
    
    .menu-icon {
        font-size: 1.1rem;
        width: 20px;
    }
    
    .menu-text {
        font-size: 0.9rem;
    }
}

/* 3D Cube Scene */
.scene {
    width: 100vw;
    height: 100vh;
    margin: 0;
    perspective: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    transition: opacity 1s ease, visibility 1s ease;
    z-index: 10;
}

.cube {
    width: 120vmax;
    height: 120vmax;
    position: absolute;
    transform-style: preserve-3d;
    transform: translateZ(-60vmax);
    left: 50%;
    top: 50%;
    margin-left: -60vmax;
    margin-top: -60vmax;
    transition: transform 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Cube Rotations */
.cube.show-front  { transform: translateZ(-60vmax) rotateY(   0deg); }
.cube.show-right  { transform: translateZ(-60vmax) rotateY( -90deg); }
.cube.show-back   { transform: translateZ(-60vmax) rotateY(-180deg); }
.cube.show-left   { transform: translateZ(-60vmax) rotateY(  90deg); }
.cube.show-top    { transform: translateZ(-60vmax) rotateX( -90deg); }
.cube.show-bottom { transform: translateZ(-60vmax) rotateX(  90deg); }

/* Active face border pulse effect */
.cube.show-front .cube__face--front,
.cube.show-right .cube__face--right,
.cube.show-back .cube__face--back,
.cube.show-left .cube__face--left,
.cube.show-top .cube__face--top,
.cube.show-bottom .cube__face--bottom {
    animation: activeFacePulse 3s ease-in-out infinite;
}

@keyframes activeFacePulse {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 60px rgba(255, 255, 255, 0.05);
    }
    50% {
        border-color: rgba(255, 255, 255, 0.5);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.3), inset 0 0 80px rgba(255, 255, 255, 0.08);
    }
}

/* Cube Faces */
.cube__face {
    position: absolute;
    width: 120vmax;
    height: 120vmax;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Interactive center cube response to face hover */
.cube__face:hover ~ .center-cube {
    animation-play-state: paused;
    transform: translate(-50%, -50%) translateZ(0) scale(1.1);
    transition: transform 0.3s ease;
}

/* Face Colors - Rubik's Cube Style (Darker) */
.cube__face--front  { 
    background: linear-gradient(135deg, rgba(120, 40, 140, 0.7), rgba(180, 60, 200, 0.8));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(120, 40, 140, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: rotateY(0deg) translateZ(60vmax);
    opacity: 0.9 !important;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.cube__face--front:hover { 
    opacity: 0.95 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    box-shadow: 0 8px 32px rgba(120, 40, 140, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 0 60px rgba(255, 255, 255, 0.08);
}
.cube__face--right  { 
    background: linear-gradient(135deg, rgba(170, 20, 20, 0.6), rgba(140, 10, 10, 0.6));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: rotateY(90deg) translateZ(60vmax);
    opacity: 0.85 !important;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.cube__face--right:hover { 
    opacity: 0.95 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
}
.cube__face--back   { 
    background: linear-gradient(135deg, rgba(200, 160, 0, 0.6), rgba(170, 130, 0, 0.6));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: rotateY(180deg) translateZ(60vmax);
    opacity: 0.85 !important;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.cube__face--back:hover { 
    opacity: 0.95 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
}
.cube__face--left   { 
    background: linear-gradient(135deg, rgba(200, 90, 0, 0.6), rgba(170, 70, 0, 0.6));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: rotateY(-90deg) translateZ(60vmax);
    opacity: 0.85 !important;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.cube__face--left:hover { 
    opacity: 0.95 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
}
.cube__face--top    { 
    background: linear-gradient(135deg, rgba(0, 120, 40, 0.6), rgba(0, 90, 30, 0.6));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: rotateX(90deg) translateZ(60vmax);
    opacity: 0.85 !important;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.cube__face--top:hover { 
    opacity: 0.95 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
}
.cube__face--bottom { 
    background: linear-gradient(135deg, rgba(0, 60, 150, 0.6), rgba(0, 40, 120, 0.6));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: rotateX(-90deg) translateZ(60vmax);
    opacity: 0.85 !important;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.cube__face--bottom:hover { 
    opacity: 0.95 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
}

/* Face Content */
.face-content {
    padding: 4vmin;
    max-width: 80vmin;
    max-height: 90vh;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease-out 0.3s forwards;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.face-content::-webkit-scrollbar {
    width: 6px;
}

.face-content::-webkit-scrollbar-track {
    background: transparent;
}

.face-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.face-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.face-content h1,
.face-content h2,
.face-content h3,
.face-content h4,
.face-content h5,
.face-content h6 {
    font-size: clamp(1.5rem, 5vmin, 3rem);
    font-weight: 800;
    margin-bottom: 2vmin;
    line-height: 1.1;
    opacity: 0;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: typeIn 1.2s ease-out 0.6s forwards, textGlow 3s ease-in-out 2s infinite;
}

.face-content p {
    font-size: clamp(0.9rem, 2.5vmin, 1.25rem);
    margin-bottom: 2vmin;
    opacity: 0;
    line-height: 1.4;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.8s ease-out 0.7s forwards;
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
    }
    50% {
        text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 255, 255, 0.1);
    }
}

@keyframes buttonGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 122, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 122, 255, 0.6);
    }
}

@keyframes buttonBreathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18), 0 6px 15px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.1);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }
    50% {
        transform: translateX(0%) translateY(0%);
    }
    100% {
        transform: translateX(100%) translateY(100%);
    }
}

/* Problem Badge */
.problem-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1vmin 2vmin;
    border-radius: var(--border-radius);
    font-size: clamp(0.75rem, 2vmin, 1rem);
    font-weight: 600;
    margin-bottom: 2vmin;
}

/* Tools List */
.tools-list {
    display: flex;
    flex-direction: column;
    gap: 1.5vmin;
    max-height: 50vh;
    overflow: hidden;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 2vmin;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2vmin;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tool-icon {
    font-size: clamp(1rem, 3vmin, 2rem);
    width: 6vmin;
    height: 6vmin;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 1.5vmin;
    max-height: 50vh;
    overflow: hidden;
}

.feature {
    display: flex;
    align-items: center;
    gap: 2vmin;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2vmin;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: clamp(1rem, 3vmin, 2rem);
    width: 6vmin;
    height: 6vmin;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2vmin;
    margin-top: 2vmin;
    max-width: 100%;
}

.stat {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2vmin;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
    font-size: clamp(1rem, 3vmin, 2rem);
    font-weight: 800;
    margin-bottom: 1vmin;
    color: white;
}

.stat-label {
    font-size: clamp(0.75rem, 2vmin, 1rem);
    opacity: 0.8;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 1vmin;
    padding: 2vmin 3vmin;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: clamp(0.9rem, 2.5vmin, 1.1rem);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-family);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 1s forwards;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 25px rgba(0, 122, 255, 0.4);
    letter-spacing: 0.02em;
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.1s ease;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 15px rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.1s ease;
}

.hero-buttons {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.hero-buttons .btn:nth-child(1) {
    animation-delay: 0.3s;
}

.hero-buttons .btn:nth-child(2) {
    animation-delay: 0.4s;
}

.contact-buttons {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
}

.contact-buttons .btn:nth-child(1) {
    animation-delay: 1s;
}

.contact-buttons .btn:nth-child(2) {
    animation-delay: 1.2s;
}

/* Game Keypad Controller */
.game-keypad-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 1s ease-out 2s forwards, gentlePulse 4s ease-in-out 3s infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
}

@keyframes gentlePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1);
    }
}

.game-keypad-container:hover {
    animation: fadeIn 1s ease-out 2s forwards;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.keypad-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, filter 0.15s ease-out;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -webkit-user-select: none;
    user-select: none;
    transform: translate3d(0, 0, 0);
    will-change: auto;
    overflow: hidden;
    backface-visibility: hidden;
    contain: layout style paint;
    isolation: isolate;
    transform-style: preserve-3d;
    perspective: 1000px;
    pointer-events: auto;
    image-rendering: optimizeSpeed;
}

.keypad-btn:hover,
.keypad-btn:active,
.keypad-btn.active {
    will-change: transform;
}

.keypad-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 40%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.5s ease-out;
    opacity: 0;
    pointer-events: none;
}

/* Color-specific ripple effects */
.keypad-btn--up::before {
    background: radial-gradient(circle, rgba(100, 255, 150, 0.8) 0%, rgba(50, 200, 100, 0.4) 40%, transparent 70%);
}

.keypad-btn--down::before {
    background: radial-gradient(circle, rgba(100, 150, 255, 0.8) 0%, rgba(50, 100, 200, 0.4) 40%, transparent 70%);
}

.keypad-btn--left::before {
    background: radial-gradient(circle, rgba(255, 180, 100, 0.8) 0%, rgba(200, 140, 50, 0.4) 40%, transparent 70%);
}

.keypad-btn--right::before {
    background: radial-gradient(circle, rgba(255, 120, 120, 0.8) 0%, rgba(200, 80, 80, 0.4) 40%, transparent 70%);
}

.keypad-btn--center::before {
    background: radial-gradient(circle, rgba(220, 150, 255, 0.8) 0%, rgba(180, 100, 220, 0.4) 40%, transparent 70%);
}

.keypad-btn--back::before {
    background: radial-gradient(circle, rgba(255, 220, 100, 0.8) 0%, rgba(220, 180, 50, 0.4) 40%, transparent 70%);
}

.keypad-btn.ripple::before {
    width: 80px;
    height: 80px;
    opacity: 1;
    animation: enhancedRippleEffect 0.4s ease-out forwards;
}

@keyframes enhancedRippleEffect {
    0% {
        width: 0;
        height: 0;
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        width: 60px;
        height: 60px;
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        width: 80px;
        height: 80px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.keypad-btn--empty {
    opacity: 0;
    pointer-events: none;
    border: none;
    background: transparent;
}

/* Directional buttons */
.keypad-btn--up {
    background: linear-gradient(135deg, rgba(0, 120, 40, 0.7), rgba(0, 90, 30, 0.8));
    box-shadow: 0 4px 12px rgba(0, 120, 40, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.keypad-btn--down {
    background: linear-gradient(135deg, rgba(0, 60, 150, 0.7), rgba(0, 40, 120, 0.8));
    box-shadow: 0 4px 12px rgba(0, 60, 150, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.keypad-btn--left {
    background: linear-gradient(135deg, rgba(200, 90, 0, 0.7), rgba(170, 70, 0, 0.8));
    box-shadow: 0 4px 12px rgba(200, 90, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.keypad-btn--right {
    background: linear-gradient(135deg, rgba(170, 20, 20, 0.7), rgba(140, 10, 10, 0.8));
    box-shadow: 0 4px 12px rgba(170, 20, 20, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.keypad-btn--center {
    background: linear-gradient(135deg, rgba(120, 40, 140, 0.8), rgba(180, 60, 200, 0.9));
    box-shadow: 0 4px 12px rgba(120, 40, 140, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.keypad-btn--back {
    background: linear-gradient(135deg, rgba(200, 160, 0, 0.7), rgba(170, 130, 0, 0.8));
    box-shadow: 0 4px 12px rgba(200, 160, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Hover effects */
.keypad-btn:not(.keypad-btn--empty):hover {
    transform: translate3d(0, -2px, 0) scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 
                0 0 20px rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    filter: brightness(1.1) saturate(1.1);
}

/* Active/pressed effects */
.keypad-btn:not(.keypad-btn--empty):active {
    transform: translate3d(0, 0, 0) scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 
                inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Active state for current section */
.keypad-btn.active {
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 
                0 0 25px rgba(255, 255, 255, 0.4), 
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    animation: smoothGlow 3s ease-in-out infinite;
}

@keyframes smoothGlow {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 
                    0 0 25px rgba(255, 255, 255, 0.4), 
                    inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 
                    0 0 30px rgba(255, 255, 255, 0.5), 
                    inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
}

.keypad-btn.active .keypad-icon {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.keypad-icon {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}


/* Gaming-style glow effect */
@keyframes keypadGlow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 15px rgba(255, 255, 255, 0.3);
    }
}

.keypad-btn.active {
    animation: keypadGlow 2s ease-in-out infinite;
}

/* iOS-specific optimizations */
@supports (-webkit-touch-callout: none) {
    .keypad-btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        transform: translateZ(0);
        will-change: auto;
        backface-visibility: hidden;
        perspective: none;
        transform-style: flat;
    }
    
    .keypad-grid {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .game-keypad-container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Mobile adjustments for game keypad */
@media (max-width: 768px) {
    .game-keypad-container {
        bottom: 20px;
        right: 20px;
        gap: 8px;
    }
    
    .keypad-grid {
        gap: 3px;
        padding: 6px;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    .keypad-btn {
        width: 35px;
        height: 35px;
        border-radius: 6px;
        transition: transform 0.1s ease;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform-style: flat;
        perspective: none;
        contain: layout;
        -webkit-tap-highlight-color: transparent;
    }
    
    .keypad-btn:hover,
    .keypad-btn:active,
    .keypad-btn.active {
        will-change: auto;
    }
    
    .keypad-btn:active {
        transform: scale(0.95);
    }
    
    .keypad-icon {
        font-size: 16px;
    }
    
    .keypad-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .game-keypad-container {
        bottom: 15px;
        right: 15px;
        gap: 6px;
    }
    
    .keypad-grid {
        gap: 2px;
        padding: 4px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(0, 0, 0, 0.4);
    }
    
    .keypad-btn {
        width: 30px;
        height: 30px;
        border-radius: 5px;
        transition: transform 0.08s ease;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform-style: flat;
        perspective: none;
        contain: layout;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
    
    .keypad-btn:hover,
    .keypad-btn:active,
    .keypad-btn.active {
        will-change: auto;
    }
    
    .keypad-btn:active {
        transform: scale(0.9);
    }
    
    .keypad-btn:hover {
        transform: none;
        filter: none;
    }
    
    .keypad-icon {
        font-size: 14px;
    }
    
    .keypad-label {
        font-size: 9px;
    }
}


/* Center Rotating Cube */
.center-cube {
    position: absolute;
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    transform-style: preserve-3d;
    animation: centerCubeRotate 20s linear infinite;
    z-index: 1;
    pointer-events: none;
}

.center-cube__face {
    position: absolute;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.8), rgba(20, 20, 40, 0.9));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    opacity: 0.9 !important;
    transition: background 1s ease, border-color 1s ease, box-shadow 1s ease, opacity 0.3s ease;
}

.center-cube__face:hover {
    opacity: 1 !important;
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Dynamic center cube colors based on active face */
.cube.show-front .center-cube__face {
    background: linear-gradient(135deg, rgba(80, 20, 100, 0.85), rgba(120, 40, 140, 0.9));
    border-color: rgba(120, 40, 140, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(80, 20, 100, 0.3);
}

.cube.show-right .center-cube__face {
    background: linear-gradient(135deg, rgba(120, 10, 10, 0.85), rgba(100, 5, 5, 0.9));
    border-color: rgba(120, 10, 10, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(120, 10, 10, 0.3);
}

.cube.show-back .center-cube__face {
    background: linear-gradient(135deg, rgba(140, 110, 0, 0.85), rgba(120, 90, 0, 0.9));
    border-color: rgba(140, 110, 0, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(140, 110, 0, 0.3);
}

.cube.show-left .center-cube__face {
    background: linear-gradient(135deg, rgba(140, 60, 0, 0.85), rgba(120, 50, 0, 0.9));
    border-color: rgba(140, 60, 0, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(140, 60, 0, 0.3);
}

.cube.show-top .center-cube__face {
    background: linear-gradient(135deg, rgba(0, 80, 20, 0.85), rgba(0, 60, 15, 0.9));
    border-color: rgba(0, 80, 20, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(0, 80, 20, 0.3);
}

.cube.show-bottom .center-cube__face {
    background: linear-gradient(135deg, rgba(0, 40, 100, 0.85), rgba(0, 30, 80, 0.9));
    border-color: rgba(0, 40, 100, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(0, 40, 100, 0.3);
}

.center-cube__face--front  { transform: rotateY(0deg) translateZ(200px); }
.center-cube__face--back   { transform: rotateY(180deg) translateZ(200px); }
.center-cube__face--right  { transform: rotateY(90deg) translateZ(200px); }
.center-cube__face--left   { transform: rotateY(-90deg) translateZ(200px); }
.center-cube__face--top    { transform: rotateX(90deg) translateZ(200px); }
.center-cube__face--bottom { transform: rotateX(-90deg) translateZ(200px); }

@keyframes centerCubeRotate {
    0% {
        transform: translate(-50%, -50%) translateZ(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    25% {
        transform: translate(-50%, -50%) translateZ(0) rotateX(90deg) rotateY(90deg) rotateZ(0deg);
    }
    50% {
        transform: translate(-50%, -50%) translateZ(0) rotateX(180deg) rotateY(180deg) rotateZ(90deg);
    }
    75% {
        transform: translate(-50%, -50%) translateZ(0) rotateX(270deg) rotateY(270deg) rotateZ(180deg);
    }
    100% {
        transform: translate(-50%, -50%) translateZ(0) rotateX(360deg) rotateY(360deg) rotateZ(270deg);
    }
}

/* Mobile adjustments for center cube */
@media (max-width: 768px) {
    .center-cube {
        width: 200px;
        height: 200px;
    }
    
    .center-cube__face {
        width: 200px;
        height: 200px;
    }
    
    .center-cube__face--front, .center-cube__face--back,
    .center-cube__face--right, .center-cube__face--left,
    .center-cube__face--top, .center-cube__face--bottom {
        transform-origin: center;
    }
    
    .center-cube__face--front  { transform: rotateY(0deg) translateZ(100px); }
    .center-cube__face--back   { transform: rotateY(180deg) translateZ(100px); }
    .center-cube__face--right  { transform: rotateY(90deg) translateZ(100px); }
    .center-cube__face--left   { transform: rotateY(-90deg) translateZ(100px); }
    .center-cube__face--top    { transform: rotateX(90deg) translateZ(100px); }
    .center-cube__face--bottom { transform: rotateX(-90deg) translateZ(100px); }
}

/* High Contrast Mode Support for Accessibility */
@media (prefers-contrast: high) {
    body {
        background: #000000 !important;
    }
    
    body::before {
        display: none !important;
    }
    
    .cube__face {
        background: #000000 !important;
        border: 3px solid #ffffff !important;
    }
    
    .face-content h1,
    .face-content h2,
    .face-content h3,
    .face-content p {
        color: #ffffff !important;
        text-shadow: none !important;
    }
    
    .btn-primary {
        background: #ffffff !important;
        color: #000000 !important;
        border: 2px solid #ffffff !important;
    }
    
    .btn-secondary {
        background: #000000 !important;
        color: #ffffff !important;
        border: 2px solid #ffffff !important;
    }
    
    .menu-content {
        background: #000000 !important;
        border: 3px solid #ffffff !important;
    }
    
    .menu-item {
        color: #ffffff !important;
    }
    
    .menu-item.active {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .nav-dot {
        background: #ffffff !important;
        border: 2px solid #ffffff !important;
    }
    
    .hamburger-line {
        background: #ffffff !important;
    }
    
    .navbar {
        background: #000000 !important;
        border-bottom: 2px solid #ffffff !important;
    }
}

/* Reduced Motion Support for Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .cube {
        transition: none !important;
    }
    
    .center-cube {
        animation: none !important;
    }
    
    .scroll-hint {
        animation: none !important;
    }
    
    .nav-dot.active {
        animation: none !important;
    }
    
    .cube__face--front:hover,
    .cube__face--right:hover,
    .cube__face--back:hover,
    .cube__face--left:hover,
    .cube__face--top:hover,
    .cube__face--bottom:hover {
        backdrop-filter: blur(30px) !important;
        -webkit-backdrop-filter: blur(30px) !important;
    }
    
    body::before {
        animation: none !important;
    }
}


/* Responsive Design */
@media (max-width: 768px) {
    .face-content {
        padding: 4vmin;
        max-width: 70vmin;
    }
    
    .face-content h1 {
        font-size: 6vmin;
    }
    
    .face-content h2 {
        font-size: 5vmin;
    }
    
    .face-content h3 {
        font-size: 4vmin;
    }
    
    .face-content p {
        font-size: 3.5vmin;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 3vmin;
    }
    
    .tool-item, .feature {
        padding: 3vmin;
        gap: 3vmin;
    }
    
    .tool-icon, .feature-icon {
        width: 8vmin;
        height: 8vmin;
        font-size: 4vmin;
    }
}

@media (max-width: 480px) {
    .face-content {
        padding: 3vmin;
        max-width: 75vmin;
    }
    
    .face-content h1 {
        font-size: 5vmin;
    }
    
    .face-content h2 {
        font-size: 4.5vmin;
    }
    
    .face-content h3 {
        font-size: 3.5vmin;
    }
    
    .face-content p {
        font-size: 3vmin;
    }
    
    .btn {
        padding: 2vmin 4vmin;
        font-size: 3vmin;
    }
}
