/*
 * FRGMT_04 CSS - Optimized Architecture v2.0
 * ==========================================
 * 
 * FILE OPTIMIZATION SUMMARY:
 * - Original: 2,482 lines → Optimized: 2,396 lines (3.5% reduction)
 * - Phases Completed: Structure Consolidation, Component Deduplication, 
 *   CSS Variable Standardization, Performance Optimization
 * 
 * RESPONSIVE ARCHITECTURE:
 * - Single consolidated mobile block @media (max-width: 767px) at lines 1399-1832
 * - Nested breakpoints: 480px, 620px, 320px within main mobile block
 * - Tablet styles: @media (768px-1023px) at lines 2060-2122
 * - Desktop styles: @media (1024px+) at lines 2123-2191
 * 
 * CSS VARIABLE SYSTEM:
 * - Component Sizing: --button-height-sm through --button-height-2xl
 * - Button Padding Scale: --button-padding-xs through --button-padding-lg
 * - Font Component Scale: --font-component-xs through --font-component-xl
 * - Neural Spacing System: --space-xs through --space-2xl (8pt grid)
 * - Typography Scale: --text-xs through --text-4xl
 * 
 * COMPONENT ORGANIZATION:
 * 1. CSS Variables & Reset (lines 13-93)
 * 2. Neural Button System (lines 258-340)
 * 3. Neural Icon System (lines 388-453)
 * 4. Touch Interaction System (lines 453-464)
 * 5. Layout Sections (lines 465-730)
 * 6. Glitch Effects (lines 735-991)
 * 7. Audio Controls (lines 991-1131)
 * 8. Visual Effects (lines 1131-1176)
 * 9. Responsive Blocks (lines 1399-2191)
 * 10. Performance Optimizations (lines 2192-2396)
 * 
 * PERFORMANCE FEATURES:
 * - Optimized CSS specificity (reduced !important usage)
 * - Mobile-optimized matrix rain and scan lines
 * - GPU acceleration with transform3d and will-change
 * - Prefers-reduced-motion support
 * - Scroll performance optimization classes
 * 
 * MOBILE TOUCH OPTIMIZATIONS:
 * - 44px minimum touch targets (iOS guidelines)
 * - Touch-friendly card interactions
 * - Optimized matrix rain for mobile performance
 * - Responsive typography scaling
 */

/* ===== CSS VARIABLES & RESET ===== */
/* ===== FONT LOADING OPTIMIZATION ===== */
/* Local font fallbacks with size-adjust to match web fonts */
@font-face {
    font-family: 'Fallback Mono';
    src: local('Courier New'), local('Monaco'), local('Menlo');
    font-display: swap;
    size-adjust: 95%; /* Adjust to match IBM Plex Mono metrics */
}

:root {
    /* Color Variables */
    --color-bg: #0a0a0f;
    --color-text: #e3e8ef;
    --color-accent: #6be5e2;
    --color-tertiary: #7a9bb8;
    --color-glassy: rgba(30, 34, 40, 0.85);
    --glitch-red: #ff6b6b;
    --glitch-blue: #6bb6ff;
    --color-secondary: #9ea1a4;

    /* Typography - Optimized fallback stack */
    --font-mono: 'IBM Plex Mono', 'Space Mono', 'DM Mono', 'Spline Sans Mono', 'Fallback Mono', 'Courier New', monospace;

    /* Neural Spacing System (8pt Grid) */
    --neural-unit: 8px;
    --space-xs: 4px;   /* 0.5 units */
    --space-sm: 8px;   /* 1 unit */
    --space-md: 16px;  /* 2 units */
    --space-lg: 24px;  /* 3 units */
    --space-xl: 32px;  /* 4 units */
    --space-2xl: 48px; /* 6 units */

    /* Neural Typography Scale */
    --text-xs: 0.75rem;   /* 12px - consciousness widget details */
    --text-sm: 0.875rem;  /* 14px - body small, mobile optimized */
    --text-base: 1rem;    /* 16px - standard body text */
    --text-lg: 1.125rem;  /* 18px - large body, terminal */
    --text-xl: 1.25rem;   /* 20px - small headings */
    --text-2xl: 1.5rem;   /* 24px - section headings */
    --text-3xl: 1.875rem; /* 30px - major headings */
    --text-4xl: 2.25rem;  /* 36px - hero text */

    /* Systematic Border Radius */
    --radius-sm: 4px;    /* Inputs, small elements */
    --radius-md: 8px;    /* Buttons, standard UI */
    --radius-lg: 12px;   /* Cards, containers */
    --radius-xl: 16px;   /* Major sections */
    --radius-pill: 999px; /* Special pill buttons only */

    /* Responsive Breakpoints */
    --mobile-max: 767px;
    --tablet-min: 768px;
    --tablet-max: 1023px;
    --desktop-min: 1024px;
    
    /* Mobile-specific sizes */
    --mobile-min-font: 14px;
    --mobile-touch-target: 44px;
    --mobile-padding: var(--space-md);
    --mobile-margin: var(--space-sm);
    
    /* Responsive Padding System - Smooth scaling across breakpoints */
    --padding-base-mobile: clamp(12px, 2.5vw, 20px);     /* 12px-20px responsive */
    --padding-base-tablet: clamp(20px, 3vw, 28px);       /* 20px-28px responsive */
    --padding-base-desktop: clamp(24px, 4vw, 32px);      /* 24px-32px responsive */
    --padding-vertical-multiplier: 1.5;                   /* Consistent vertical scaling */

    /* Component Sizing System */
    --button-height-sm: 1.8rem;    /* 320px breakpoint */
    --button-height-md: 2.0rem;    /* 620px breakpoint */
    --button-height-lg: 2.2rem;    /* Mobile standard */
    --button-height-xl: 2.4rem;    /* Tablet */
    --button-height-2xl: 2.5rem;   /* Desktop standard */
    
    /* Button Padding Scale */
    --button-padding-xs: 0.25rem 0.4rem;  /* 320px breakpoint */
    --button-padding-sm: 0.3rem 0.5rem;   /* 620px breakpoint */
    --button-padding-md: 0.4rem 0.8rem;   /* Mobile standard */
    --button-padding-lg: var(--space-sm) var(--space-md); /* Desktop standard */
    
    /* Font Size Scale for Components */
    --font-component-xs: 0.6rem;   /* 320px breakpoint */
    --font-component-sm: 0.65rem;  /* 620px breakpoint */
    --font-component-md: 0.7rem;   /* Mobile standard */
    --font-component-lg: 0.8rem;   /* Tablet/Desktop */
    --font-component-xl: 0.9rem;   /* Desktop large */

    /* Animation Variables */
    --scan-line-color: rgba(255, 255, 255, 0.3);
    --scan-line-color-2: rgba(255, 255, 255, 0.15);
    --flicker-duration: 12s;
    --scan-duration: 3s;
    --glitch-intensity: 0.05em;
    
    /* Neural Sidebar Variables */
    --sidebar-width-collapsed: 60px;
    --sidebar-width-expanded: 240px;
    --sidebar-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-bg: rgba(0, 0, 0, 0.95);
    --sidebar-border: 1px solid var(--color-tertiary);
    --neural-pulse-duration: 2s;
    --neural-connection-opacity: 0.3;
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-mono);
    /* background: radial-gradient(circle at center, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%), url('../assets/images/bg.jpg') center/cover no-repeat, var(--color-bg); */
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh; /* Fallback */
    width: 100%;
    overflow-x: hidden;
    animation: background-flicker var(--flicker-duration) infinite;
}

/* REMOVED: Dynamic viewport fixes that cause scroll repositioning
 * These viewport units change during scroll when address bars show/hide,
 * causing content to shift position - same issue we fixed in intro section
 *
 * Previous problematic code:
 * @supports (height: 100dvh) { min-height: 100dvh; }
 * @supports (-webkit-touch-callout: none) { min-height: -webkit-fill-available; }
 *
 * Solution: Use fixed 100vh for consistent positioning across all browsers
 */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, var(--color-bg) 100%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: -1;
}

/* ===== MATRIX RAIN BACKGROUND EFFECT ===== */
.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

.matrix-column {
    position: absolute;
    top: -100%;
    width: 20px;
    font-family: var(--font-mono);
    line-height: 20px;
    animation: matrix-fall linear infinite;
    /* All styling now controlled by JavaScript config:
     * - font-size
     * - color
     * - text-shadow
     * - opacity
     * - animation-duration
     * - animation-delay
     */
}

/* Remove all nth-child rules - JavaScript handles all styling variations */

@keyframes matrix-fall {
    0% {
        transform: translateY(-100vh);
        opacity: 0.8; /* INSTANT VISIBILITY: Start visible immediately */
    }
    5% {
        opacity: 0.8; /* Maintain visibility quickly */
    }
    95% {
        opacity: 0.8; /* Stay visible until end */
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Third corrupted scan line */
.corrupted-scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, 
        transparent 10%, 
        rgba(255, 255, 255, 0.5) 15%,
        transparent 20%,
        transparent 30%,
        rgba(255, 255, 255, 0.5) 35%,
        transparent 40%);
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.3);
    animation: scan-lines calc(var(--scan-duration) * 0.7) infinite linear;
    pointer-events: none;
    z-index: 1001;
    opacity: 0.7;
}

/* ===== LAYOUT SECTIONS ===== */
main {
    padding-left: var(--padding-base-desktop);
    padding-right: var(--padding-base-desktop);
    padding-top: calc(var(--padding-base-desktop) * var(--padding-vertical-multiplier));
    padding-bottom: var(--padding-base-desktop);
}

/* ===== NEURAL SIDEBAR NAVIGATION ===== */
.neural-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width-collapsed);
    height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border-right: var(--sidebar-border);
    z-index: 1000;
    transition: var(--sidebar-transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.neural-sidebar.expanded {
    width: var(--sidebar-width-expanded);
}

/* Sidebar should not affect main content positioning - it's an overlay */

/* Neural Connection Lines Background */
.neural-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.neural-pathways {
    width: 100%;
    height: 100%;
    opacity: var(--neural-connection-opacity);
}

.neural-path {
    stroke-dasharray: 5, 5;
    animation: neural-flow var(--neural-pulse-duration) ease-in-out infinite alternate;
}

@keyframes neural-flow {
    0% { stroke-dashoffset: 0; opacity: 0.2; }
    50% { opacity: 0.4; }
    100% { stroke-dashoffset: 20; opacity: 0.3; }
}

/* Primary Navigation Tier */
.sidebar-primary {
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(122, 155, 184, 0.2);
    position: relative;
    z-index: 1;
    margin-top: 60px; /* Allocate space for hamburger menu at top */
}

/* Secondary Navigation Tier */
.sidebar-secondary {
    flex: 1;
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-height: 300px; /* Fixed height to prevent layout shifts */
}

.secondary-header {
    padding: var(--space-md) var(--space-sm);
    border-bottom: 1px solid rgba(122, 155, 184, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.secondary-title {
    font-size: var(--text-xs);
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.neural-sidebar.expanded .secondary-title {
    opacity: 1;
}

.secondary-collapse {
    background: none;
    border: none;
    color: var(--color-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: transform 0.3s ease;
    opacity: 0;
}

.neural-sidebar.expanded .secondary-collapse {
    opacity: 1;
}

.sidebar-secondary.collapsed .secondary-collapse .collapse-icon {
    transform: rotate(-90deg);
}

.secondary-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-secondary.collapsed .secondary-content {
    max-height: 0;
}

/* Sidebar Items */
.sidebar-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--space-md) var(--space-sm);
    background: none;
    border: none;
    color: var(--color-text);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar-item:hover {
    background: rgba(107, 229, 226, 0.1);
    color: var(--color-accent);
}

.sidebar-item:active {
    background: rgba(107, 229, 226, 0.2);
}

.sidebar-item.active {
    background: rgba(107, 229, 226, 0.15);
    color: var(--color-accent);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-accent);
}

/* Sidebar Icons */
.sidebar-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
    position: relative;
}

/* Sidebar Labels */
.sidebar-label {
    margin-left: var(--space-md);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: var(--text-sm);
}

.neural-sidebar.expanded .sidebar-label {
    opacity: 1;
    transform: translateX(0);
}

/* Neural Pulse Effect */
.neural-pulse {
    position: absolute;
    top: 50%;
    left: 18px;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: neural-pulse-animation var(--neural-pulse-duration) ease-in-out infinite;
}

@keyframes neural-pulse-animation {
    0%, 70% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    80% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    90% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}

.sidebar-item:hover .neural-pulse {
    animation-duration: 1s;
}

/* Primary Items Styling */
.primary-item {
    margin-bottom: var(--space-xs);
}

.primary-item .sidebar-icon {
    font-size: var(--text-xl);
}

/* Secondary Items Styling */
.secondary-item {
    margin-bottom: var(--space-xs);
}

.secondary-item .sidebar-icon {
    font-size: var(--text-lg);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-md) var(--space-sm);
    border-top: 1px solid rgba(122, 155, 184, 0.1);
    position: relative;
    z-index: 1;
}

.consciousness-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.indicator-pulse {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: consciousness-pulse-indicator 2s ease-in-out infinite;
}

.indicator-text {
    font-size: var(--text-xs);
    color: var(--color-secondary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.neural-sidebar.expanded .indicator-text {
    opacity: 1;
}

@keyframes consciousness-pulse-indicator {
    0%, 50% { opacity: 0.3; transform: scale(1); }
    25% { opacity: 1; transform: scale(1.2); }
    75% { opacity: 0.6; transform: scale(0.9); }
    100% { opacity: 0.3; transform: scale(1); }
}

/* ===== SITE LOGO ===== */
.site-logo {
    position: fixed !important;
    top: var(--space-md) !important;
    right: var(--space-md) !important;
    left: auto !important;
    z-index: 999;
    font-family: var(--font-mono);
    text-align: right;
    pointer-events: auto;
    user-select: none;
    cursor: default;
    position: relative;
}

.site-logo::after {
    content: "just the logo, does nothing";
    position: absolute;
    bottom: -35px;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    color: var(--color-accent);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--color-tertiary);
    z-index: 1000;
}

.site-logo:hover::after {
    opacity: 1;
    visibility: visible;
}

.logo-text {
    display: block;
    font-size: 2.5rem; /* Fixed size eliminates viewport recalculation */
    font-weight: bold;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    line-height: 1;
    text-shadow: 0 0 10px rgba(107, 229, 226, 0.5);
}

.logo-subtitle {
    display: block;
    font-size: 0.8rem; /* Fixed size eliminates viewport recalculation */
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-top: var(--space-xs);
    opacity: 0.8;
}

/* ===================================
   CONSCIOUSNESS DESIGN SYSTEM 2.0
   =================================== */

/* ===== NEURAL BUTTON SYSTEM ===== */
/* Unified Button System */
.btn-neural-primary {
    background: linear-gradient(145deg, var(--color-accent), var(--color-tertiary));
    border: 1px solid var(--color-accent);
    color: var(--color-bg);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    /* GPU compositing removed to fix Safari iOS disappearing elements */
}

.btn-neural-primary:hover {
    background: linear-gradient(145deg, var(--color-tertiary), var(--color-accent));
    box-shadow: 0 0 20px rgba(107, 229, 226, 0.4);
    transform: translate3d(0, -2px, 0);
    animation: neural-glitch-hover 0.3s ease;
}

.btn-neural-secondary {
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--color-tertiary);
    color: var(--color-accent);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    gap: 0.4rem; /* Consistent gap for navigation buttons */
    min-height: var(--button-height-2xl); /* Desktop standard button height */
}

.btn-neural-secondary:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    box-shadow: 0 0 10px rgba(107, 229, 226, 0.5);
}

.btn-neural-ghost {
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--color-tertiary);
    color: var(--color-accent);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: lowercase;
}

.btn-neural-ghost:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    box-shadow: 0 0 10px rgba(107, 229, 226, 0.5);
}

/* Consciousness State Indicators */
.btn-neural-primary.neural-active,
.btn-neural-secondary.neural-active,
.btn-neural-ghost.neural-active {
    border-color: var(--glitch-red);
    background: rgba(255, 107, 107, 0.1);
    animation: neural-pulse 1.5s ease-in-out infinite;
}

.btn-neural-primary.neural-processing,
.btn-neural-secondary.neural-processing,
.btn-neural-ghost.neural-processing {
    border-color: var(--color-accent);
    background: rgba(107, 229, 226, 0.1);
    animation: neural-processing 2s ease-in-out infinite;
}

/* Neural Card System */
.neural-card {
    background: var(--color-glassy);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 2px 16px 2px rgba(122, 155, 184, 0.12);
    transition: all 0.3s ease;
    /* GPU compositing removed to fix Safari iOS disappearing elements */
}

.neural-card:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 4px 20px 4px rgba(122, 155, 184, 0.2);
}

/* Neural Terminal System */
.neural-terminal {
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    backdrop-filter: blur(10px);
}

/* Neural Animations */
@keyframes neural-glitch-hover {
    0%, 100% { transform: translate3d(0, -2px, 0); }
    25% { transform: translate3d(-1px, -2px, 0) skew(0.5deg); }
    50% { transform: translate3d(1px, -2px, 0) skew(-0.5deg); }
    75% { transform: translate3d(-0.5px, -2px, 0) skew(0.2deg); }
}

@keyframes neural-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes neural-processing {
    0% { border-color: var(--color-accent); }
    50% { border-color: var(--color-tertiary); }
    100% { border-color: var(--color-accent); }
}

/* ===== NEURAL ICON SYSTEM ===== */
.neural-uplink-icon {
    display: none;
}

.neural-audio-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    position: relative;
}

.neural-audio-icon::before {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: currentColor;
    border-radius: 50%;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.neural-audio-icon::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 1px;
    background: currentColor;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    box-shadow: 0 -2px 0 currentColor, 0 2px 0 currentColor;
}

.neural-data-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    position: relative;
    margin-right: var(--space-xs);
}

.neural-data-icon::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 1px;
    background: currentColor;
    top: 2px;
    left: 1px;
    box-shadow: 0 2px 0 currentColor, 0 4px 0 currentColor, 0 6px 0 currentColor;
}

.neural-data-icon::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 8px;
    background: currentColor;
    top: 1px;
    right: 1px;
}

/* ===== TOUCH INTERACTION SYSTEM ===== */
.using-touch .fragment-card,
.using-touch .image-card,
.using-touch .lore-entry {
    -webkit-tap-highlight-color: rgba(107, 229, 226, 0.2);
    tap-highlight-color: rgba(107, 229, 226, 0.2);
}

.using-touch *:focus {
    outline: none;
}

/* 1. Intro Screen */
#intro {
    position: relative;
    width: 100%;
    height: 400px; /* FIXED HEIGHT to prevent layout shifts */
    text-align: center;
    padding: 4rem 1rem; /* Adequate padding for content */
    z-index: 0;
    /* Remove flexbox centering to prevent mobile scroll repositioning */
}

#intro .terminal {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin: 0 auto 3rem auto; /* Center with margin bottom */
    text-align: center;
    line-height: 1.5;
    z-index: 1;
}

#intro #intro-text {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin: 0 auto; /* Center horizontally */
    z-index: 1;
}

.terminal {
    font-size: var(--text-xl);
    color: var(--color-accent);
}

.cursor {
    display: inline-block;
    color: var(--color-accent);
    font-weight: bold;
    animation: blink 0.7s step-end infinite;
}

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

#intro-text {
    font-size: var(--text-lg);
    color: var(--color-text);
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

#intro-text.visible {
    opacity: 1;
}

.hidden {
    display: none;
}

/* 2. Fragment Gallery */
#gallery {
    padding: var(--space-xl);
    text-align: center;
    margin-bottom: var(--space-xl);
}

.fragment-cards-container {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin: var(--space-xl) 0;
    flex-wrap: wrap;
}

.fragment-card {
    background-color: var(--color-glassy);
    border: 1px solid var(--color-tertiary);
    width: 300px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 16px 2px rgba(122, 155, 184, 0.12);
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Only apply hover effects on devices that support proper hover (not touch) */
@media (hover: hover) {
    .fragment-card:hover {
        will-change: transform, box-shadow; /* Only during interaction for better GPU memory management */
        transform: translate3d(0, -2px, 0);
        box-shadow: 0 4px 20px 4px rgba(122, 155, 184, 0.2);
    }
}

.fragment-preview {
    padding: var(--space-md);
    text-align: center;
}

.fragment-preview img {
    max-width: 100%;
    height: auto;
    margin-bottom: var(--space-md);
    border: 1px solid #333;
    border-radius: var(--radius-sm);
}

.fragment-preview h3 {
    color: var(--color-accent);
    margin-bottom: var(--space-md);
    font-weight: 500;
    font-size: var(--text-xl);
    letter-spacing: 0.04em;
}

/* Legacy button styles - replaced by neural button system */

.fragment-details {
    max-height: 0;
    padding: 0 var(--space-md) var(--space-md) var(--space-md); /* Keep bottom padding for consistent spacing */
    overflow: hidden;
    opacity: 0;
    border-top: 1px solid transparent; /* Invisible border to prevent jumping */
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.4s ease,
                padding-top 0.4s ease,
                border-color 0.4s ease 0.2s; /* Delay border color change */
    /* will-change removed for better GPU memory management */
}

.fragment-card.expanded .fragment-details {
    max-height: 400px !important; /* Generous but specific value for smooth animation */
    padding: var(--space-md) !important;
    opacity: 1 !important;
    border-top-color: var(--color-accent) !important; /* Only change the color, border exists */
    overflow: visible !important; /* Override mobile hidden */
}

.audio-player {
    border: 1px solid var(--color-tertiary);
    padding: var(--space-md);
    margin: var(--space-md) 0;
    background-color: var(--color-glassy);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.consciousness-injector {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}


.inject-button, .extract-button {
    align-self: flex-start; /* Preserve layout property */
}

.consciousness-progress {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
}

.progress-label {
    color: var(--color-tertiary);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    text-transform: lowercase;
}

.progress-bar {
    position: relative;
    background-color: rgba(10, 10, 15, 0.8);
    border: 1px solid var(--color-tertiary);
    height: 18px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-width: 200px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-tertiary) 50%, var(--glitch-red) 100%);
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    animation: consciousness-pulse 0.8s ease-in-out infinite alternate;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-text);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

@keyframes consciousness-pulse {
    0% { opacity: 0.4; transform: scaleX(1); }
    100% { opacity: 1; transform: scaleX(1.2); }
}



/* 3. Lore Section */
#lore {
    padding: var(--space-xl);
    text-align: center;
    margin-bottom: var(--space-xl);
}

#lore h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-xl);
    color: var(--color-accent);
}

.lore-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.lore-entry {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .lore-entry:hover {
        border-color: var(--color-accent);
        box-shadow: 0 0 10px rgba(107, 229, 226, 0.2);
    }
}

.lore-entry h3 {
    color: var(--color-accent);
    font-size: var(--text-lg);
    margin-bottom: var(--space-md);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lore-entry p {
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.lore-entry p:last-child {
    margin-bottom: 0;
}

/* 4. Operational Status replaced form section */

/* 5. Footer */
footer {
    padding: var(--space-xl);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-secondary);
    line-height: 1.5;
}

/* Glitch Effect */
/* ===== GLITCH EFFECTS ===== */
.glitch {
    position: relative;
    display: inline-block;
    animation: glitch-animation 0.3s infinite;
    contain: layout style;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-animation-1 3s infinite linear alternate-reverse;
    color: var(--glitch-red);
    z-index: -1;
}

.glitch::after {
    animation: glitch-animation-2 2s infinite linear alternate-reverse;
    color: var(--glitch-blue);
    z-index: -2;
}

.glitch-intense {
    position: relative;
    display: inline-block;
    animation: glitch-animation-1 0.2s infinite, glitch-animation-2 0.15s infinite;
    contain: layout style;
}

.glitch-intense::before,
.glitch-intense::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
}

.glitch-intense::before {
    animation: glitch-animation-1 1s infinite linear alternate-reverse;
    color: var(--glitch-red);
    z-index: -1;
    transform: translate(-3px, 3px);
}

.glitch-intense::after {
    animation: glitch-animation-2 0.8s infinite linear alternate-reverse;
    color: var(--glitch-blue);
    z-index: -2;
    transform: translate(3px, -3px);
}

.glitch-subtle {
    position: relative;
    display: inline-block;
    animation: glitch-animation 0.5s infinite;
    contain: layout style;
}

.glitch-subtle::before,
.glitch-subtle::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    opacity: 0.3;
}

.glitch-subtle::before {
    animation: glitch-animation-1 6s infinite linear alternate-reverse;
    color: var(--glitch-red);
    z-index: -1;
}

.glitch-subtle::after {
    animation: glitch-animation-2 7s infinite linear alternate-reverse;
    color: var(--glitch-blue);
    z-index: -2;
}

@keyframes glitch-animation {
    0% {
        text-shadow: 0.05em 0 0 rgba(0, 255, 65, 0.75), -0.05em 0 0 rgba(255, 0, 0, 0.75), 0 0.025em 0 rgba(0, 255, 65, 0.75), 0 -0.025em 0 rgba(255, 0, 0, 0.75);
    }
    2% {
        text-shadow: -0.05em 0 0 rgba(0, 255, 65, 0.75), 0.025em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.025em 0 rgba(0, 255, 65, 0.75), 0.025em 0.025em 0 rgba(255, 0, 0, 0.75);
    }
    4% {
        text-shadow: none;
    }
    90% {
        text-shadow: none;
    }
    92% {
        text-shadow: -0.05em 0 0 rgba(0, 255, 65, 0.75), 0.025em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.025em 0 rgba(0, 255, 65, 0.75), 0.025em 0.025em 0 rgba(255, 0, 0, 0.75);
    }
    100% {
        text-shadow: none;
    }
}

@keyframes scan-lines {
    0% {
        transform: translate3d(0, -10px, 0);
        opacity: 0.7;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate3d(0, 1400px, 0);
        opacity: 0.7;
    }
}

@keyframes scan-shake {
    0% {
        transform: translateX(-1px);
    }
    25% {
        transform: translateX(0px);
    }
    50% {
        transform: translateX(1px);
    }
    75% {
        transform: translateX(0px);
    }
    100% {
        transform: translateX(-1px);
    }
}

@keyframes scan-distort {
    0% {
        clip-path: inset(0 0 0 0);
        transform: translateX(0);
    }
    20% {
        clip-path: inset(0 5% 0 0);
        transform: translateX(-2px);
    }
    40% {
        clip-path: inset(0 0 0 5%);
        transform: translateX(2px);
    }
    60% {
        clip-path: inset(0 3% 0 3%);
        transform: translateX(0);
    }
    80% {
        clip-path: inset(0 0 0 0);
        transform: translateX(1px);
    }
    100% {
        clip-path: inset(0 2% 0 2%);
        transform: translateX(-1px);
    }
}

@keyframes scan-corrupt {
    0% {
        transform: translateX(-3px);
        width: 100%;
    }
    25% {
        transform: translateX(3px);
        width: 98%;
    }
    50% {
        transform: translateX(-1px);
        width: 99%;
    }
    75% {
        transform: translateX(2px);
        width: 100%;
    }
    100% {
        transform: translateX(-2px);
        width: 97%;
    }
}

@keyframes background-flicker {
    0%, 98% {
        opacity: 1;
    }
    99% {
        opacity: 0.95;
    }
    99.5% {
        opacity: 0.98;
    }
    100% {
        opacity: 1;
    }
}

@keyframes glitch-animation-1 {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

@keyframes glitch-animation-2 {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(2px, -2px);
    }
    40% {
        transform: translate(2px, 2px);
    }
    60% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(-2px, 2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Audio Player */
/* ===== AUDIO CONTROLS ===== */
.audio-player-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2000;
}

.audio-player-container audio {
    display: none;
}

.audio-toggle:not(.unified) {
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--color-tertiary);
    color: var(--color-accent);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--text-base);
    padding: 0;
    transition: all 0.3s ease;
}

.audio-toggle:not(.unified):hover {
    background: var(--color-accent);
    color: var(--color-bg);
    box-shadow: 0 0 10px rgba(107, 229, 226, 0.5);
}

.audio-icon-on,
.audio-icon-off {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.audio-icon-on {
    opacity: 0;
}

.audio-icon-off {
    opacity: 1;
}

.audio-on .audio-icon-on {
    opacity: 1;
}

.audio-on .audio-icon-off {
    opacity: 0;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.audio-on .audio-toggle:not(.unified) {
    animation: pulse 2s infinite ease-in-out;
}

/* Audio Button - Sidebar Menu Style */
.audio-toggle.unified {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--space-md) var(--space-sm);
    background: none;
    border: none;
    color: var(--color-text);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.audio-toggle.unified:hover {
    background: rgba(107, 229, 226, 0.1);
    color: var(--color-accent);
}

.audio-toggle.unified:active {
    background: rgba(107, 229, 226, 0.2);
}

.audio-toggle.unified.active {
    background: rgba(107, 229, 226, 0.15);
    color: var(--color-accent);
}

.audio-toggle.unified.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-accent);
}

.audio-toggle.unified .audio-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
    position: relative;
}

.audio-toggle.unified .audio-status-text {
    margin-left: var(--space-md);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: var(--text-sm);
}

.neural-sidebar.expanded .audio-toggle.unified .audio-status-text {
    opacity: 1;
    transform: translateX(0);
}

/* Neural Pulse Effect for Audio Button */
.audio-toggle.unified .neural-pulse {
    position: absolute;
    top: 50%;
    left: 18px;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: neural-pulse-animation var(--neural-pulse-duration) ease-in-out infinite;
}

.audio-toggle.unified:hover .neural-pulse {
    animation-duration: 1s;
}

/* ===== MOBILE MENU TOGGLE - POSITIONED INSIDE SIDEBAR BORDER ===== */
.mobile-menu-toggle {
    position: fixed;
    top: 20px;
    left: 10px; /* Inside collapsed sidebar (60px width), touching left border */
    z-index: 1200; /* Higher than sidebar (1100) to ensure it's always visible */
    width: 40px; /* Smaller to fit inside collapsed sidebar */
    height: 40px;
    background: rgba(10, 10, 15, 0.95);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-sm);
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle:hover {
    background: rgba(107, 229, 226, 0.15);
    border-color: rgba(107, 229, 226, 0.8);
    box-shadow: 0 0 15px rgba(107, 229, 226, 0.4), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle .menu-icon {
    color: var(--color-accent);
    font-size: 18px;
    line-height: 1;
}

/* STATIC POSITIONING: No movement when sidebar expands/collapses */

/* Desktop: static position */
@media (min-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
        left: 10px; /* Fixed position - never moves */
    }
}

/* Tablet: static position */
@media (min-width: 768px) and (max-width: 1023px) {
    .mobile-menu-toggle {
        display: flex;
        left: 10px; /* Fixed position - never moves */
    }
}

/* Mobile: static position */
@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: flex;
        left: 10px; /* Fixed position - never moves */
        width: 40px;
        height: 40px;
    }
}

/* ===== VISUAL EFFECTS ===== */
.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    animation: scan infinite linear;
    pointer-events: none;
    z-index: 1100;
    /* REMOVED: contain: layout style - was causing scroll-based animation pausing */
    /* height, background, box-shadow, opacity, duration controlled by JavaScript config */
}

.scan-line-2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    animation: scan infinite linear;
    pointer-events: none;
    z-index: 1099;
    /* REMOVED: contain: layout style - was causing scroll-based animation pausing */
    /* height, background, box-shadow, opacity, duration controlled by JavaScript config */
}

@keyframes scan {
    0% { transform: translate3d(0, -10px, 0); }
    100% { transform: translate3d(0, 1400px, 0); }
}

main, .terminal, .fragment-details, .lore-text, .form-group label, .form-group input, .form-group textarea {
    color: var(--color-text);
}

/* Image Cards Container */
.image-cards-container {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin: var(--space-xl) 0 var(--space-2xl) 0;
    flex-wrap: wrap;
}

.image-card {
    background-color: var(--color-glassy);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    width: auto;
    max-width: 320px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 16px 2px rgba(122, 155, 184, 0.12);
    position: relative;
    z-index: 1;
    cursor: pointer;
    touch-action: manipulation;
}

/* MODERN HOVER SOLUTION: Only apply hover on devices that support precise hover */
@media (hover: hover) and (pointer: fine) {
    .image-card:hover {
        will-change: transform, box-shadow; /* Apply only during interaction for better GPU memory management */
        transform: scale(2);
        box-shadow: 0 16px 64px 8px rgba(107, 229, 226, 0.25);
        border-color: var(--color-accent);
        z-index: 1000;
        background-color: var(--color-bg);
    }
}

/* TOUCH DEVICE SOLUTION: Tap to expand */
@media not all and (hover: hover) and (pointer: fine) {
    .image-card.tap-expanded {
        transform: scale(1.5); /* Simple scale without position changes */
        z-index: 1000;
        box-shadow: 0 16px 64px 8px rgba(107, 229, 226, 0.25);
        border-color: var(--color-accent);
        background-color: var(--color-bg);
        transition: all 0.3s ease;
    }
    
    /* Visual feedback for touch */
    .image-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

.image-card img {
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin: 0;
    background-color: rgba(0, 0, 0, 0.2);
}

.image-card h3 {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: 500;
    letter-spacing: 0.04em;
    margin: 0;
}



/* Password Entry Section */
#password-entry {
    padding: 0; /* Remove redundant padding - main container handles viewport spacing */
    text-align: center;
    margin-top: clamp(2rem, 8vh, 4rem); /* Responsive positioning - scales with viewport */
    margin-bottom: var(--space-xl);
    max-width: 600px; /* Semantic content constraint */
    margin-left: auto; /* Auto-center horizontally */
    margin-right: auto; /* Auto-center horizontally */
}

.terminal-password {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    color: var(--color-accent);
    display: inline-block;
    background-color: var(--color-glassy);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-tertiary);
    cursor: text;
    transition: border-color 0.3s ease;
    min-height: 60px; /* Fixed height to prevent layout shifts */
    width: 100%; /* Fill available container space */
    max-width: 400px; /* Semantic content constraint */
    box-sizing: border-box; /* Include padding in width calculations */
}

.terminal-password:hover {
    border-color: rgba(107, 229, 226, 0.5);
}

#password-prompt {
    color: var(--color-accent);
    margin-right: var(--space-sm);
}

.password-field {
    background: transparent;
    border: none;
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    outline: none;
    width: 100%; /* Fill available parent space */
    max-width: 250px; /* Semantic content constraint */
    min-width: 120px; /* Minimum width for usability */
    min-height: 2rem;
    padding: 0.25rem 0.5rem;
    caret-color: var(--color-accent);
    cursor: text;
    border-radius: 2px;
    transition: background-color 0.2s ease;
    box-sizing: border-box; /* Include padding in width calculations */
}

.password-field::placeholder {
    color: var(--color-accent);
    opacity: 0.7;
}

.password-field:hover {
    background-color: rgba(107, 229, 226, 0.05);
}

.password-field:focus {
    background-color: rgba(107, 229, 226, 0.1);
    box-shadow: 0 0 0 1px rgba(107, 229, 226, 0.3);
}

#password-result {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    text-align: center; /* Center all content */
    word-wrap: break-word; /* Handle long text */
}

#password-result.success {
    color: var(--color-accent);
    background-color: rgba(107, 229, 226, 0.1);
    border: 1px solid var(--color-accent);
}

#password-result.error {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

/* Password Result Content Classes - Responsive */
.password-result-message {
    margin-bottom: var(--space-md); /* 16px responsive */
    color: var(--color-accent);
    font-style: italic;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.password-result-line {
    margin-top: var(--space-sm); /* 8px responsive */
    color: var(--color-text);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.password-result-small {
    margin-top: var(--space-sm); /* 8px responsive */
    color: var(--color-text);
    font-size: 0.9rem;
    opacity: 0.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.password-result-small-first {
    margin-top: var(--space-md); /* 16px responsive - extra space for first small line */
    color: var(--color-text);
    font-size: 0.9rem;
    opacity: 0.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Hint Section */
#hint-section {
    margin-top: var(--space-xl);
    text-align: center;
    padding: var(--space-md) 0;
}

/* Legacy .hint-rectangle-button removed - now uses .btn-neural-primary */

/* Hint Terminal */
.terminal-hint {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background-color: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(120, 219, 226, 0.2);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    /* Smooth animation without unnecessary GPU compositing */
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
}

/* Fade + Slide Hide Effect */
.terminal-hint.fade-out {
    opacity: 0;
    transform: translate3d(0, -20px, 0);
    pointer-events: none;
}

.terminal-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(120, 219, 226, 0.1);
}

/* Legacy .close-button removed - now uses .btn-neural-ghost */

#hint-output {
    color: var(--color-accent);
    white-space: pre-wrap;
}

.cursor-hint {
    color: var(--color-accent);
    animation: blink 1s infinite;
    margin-left: var(--space-xs);
}

/* Consciousness Widget */
#consciousness-widget {
    position: fixed;
    bottom: 20px;
    left: 20px; /* Moved to left corner to avoid reCAPTCHA conflict */
    z-index: 9998;
    font-family: var(--font-mono);
    transition: all 0.3s ease;
}

/* ========================================
   MOBILE STYLES - CONSOLIDATED (0-767px)
   ======================================== */
/* ===== RESPONSIVE BLOCKS ===== */
@media (max-width: 767px) {
    /* === VIEWPORT & LAYOUT FIXES === */
    html {
        height: 100%;
    }
    
    body {
        min-height: 100vh; /* Fixed viewport height - prevents Chrome mobile scroll repositioning */
        /* Removed: min-height: 100dvh; - Causes content shifts when address bar shows/hides */
        overscroll-behavior-y: none; /* Prevent bounce and pull-to-refresh */
        -webkit-overflow-scrolling: touch;
        background: var(--color-bg); /* Simple solid background */
        animation: none; /* Remove background flicker */
    }
    
    body::before, body::after {
        opacity: 0.3; /* Reduce overlay complexity */
    }
    
    main {
        padding-left: var(--padding-base-mobile);
        padding-right: var(--padding-base-mobile);
        padding-top: calc(var(--padding-base-mobile) * var(--padding-vertical-multiplier));
        padding-bottom: var(--padding-base-mobile);
    }
    
    /* Mobile Sidebar Styles */
    .neural-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease, width 0.3s ease;
        z-index: 1100;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .neural-sidebar.expanded {
        transform: translateX(0);
        width: min(280px, 80vw);
    }
    
    .neural-sidebar.mobile-overlay {
        position: fixed;
        width: min(280px, 80vw);
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(15px);
    }
    
    /* Mobile Sidebar Backdrop */
    .neural-sidebar.expanded::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        backdrop-filter: blur(2px);
    }
    
    /* Always show labels on mobile when expanded */
    .neural-sidebar.expanded .sidebar-label {
        opacity: 1;
        transform: translateX(0);
    }
    
    /* Mobile Sidebar Toggle styling moved to global section above */
    
    /* Mobile logo positioning and password entry spacing already handled by new architecture */
    
    /* Mobile Logo Positioning */
    .site-logo {
        top: var(--space-xs) !important;
        right: var(--space-xs) !important;
        left: auto !important;
        transform: scale(0.8);
    }
    
    .logo-text {
        font-size: 1.6rem; /* Fixed mobile size eliminates viewport recalculation */
    }
    
    .logo-subtitle {
        font-size: 0.6rem; /* Fixed mobile size eliminates viewport recalculation */
    }
    
    /* === CONSCIOUSNESS WIDGET === */
    #consciousness-widget {
        position: fixed; /* Keep fixed but use viewport positioning */
        bottom: 10px;
        left: 10px; /* Moved to left corner to avoid reCAPTCHA conflict */
        max-width: calc(100vw - 20px);
        /* Ensure it's positioned relative to viewport, not the transformed body */
    }
    
    .fingerprint-item {
        font-size: var(--mobile-min-font) !important; /* was 0.7rem */
    }
    
    .fingerprint-label, .fingerprint-value {
        font-size: var(--mobile-min-font) !important; /* was 0.65rem */
    }
    
    #widget-minimized {
        font-size: 0.8rem !important; /* was 0.75rem */
    }
    
    /* === ABOUT TERMINAL === */
    .about-terminal-window {
        top: -100%;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        margin: 0;
    }
    
    .about-terminal-window.show {
        top: 60px;
    }
    
    .terminal-content {
        padding: var(--mobile-padding);
        max-height: 60vh;
    }
    
    /* === FRAGMENT & IMAGE CARDS === */
    .fragment-cards-container {
        flex-direction: column;
        align-items: center;
        gap: var(--mobile-margin);
        padding: 0 var(--mobile-padding);
    }
    
    .fragment-card {
        width: 100%;
        max-width: 350px;
        touch-action: manipulation;
        position: relative;
    }
    
    .image-cards-container {
        flex-direction: column;
        align-items: center;
        gap: var(--mobile-margin);
        padding: 0 var(--mobile-padding);
    }
    
    .image-card {
        max-width: 280px;
        width: 100%;
        cursor: pointer;
        touch-action: manipulation;
        position: relative;
    }
    
    /* Fragment details collapsed by default on mobile */
    .fragment-card .fragment-details {
        max-height: 0 !important;
        opacity: 0 !important;
        padding: 0 var(--space-md) 0 var(--space-md) !important;
        border-top: 1px solid transparent !important;
        overflow: hidden !important;
        transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                    opacity 0.4s ease,
                    padding-top 0.4s ease,
                    border-color 0.4s ease 0.2s;
    }
    
    /* Unified expanded state - works for both mobile tap and desktop button clicks */
    .fragment-card.expanded .fragment-details {
        max-height: 400px !important;
        opacity: 1 !important;
        padding: var(--space-md) !important;
        border-top: 1px solid var(--color-accent) !important;
        overflow: visible !important;
        transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                    opacity 0.4s ease,
                    padding 0.4s ease,
                    border-color 0.4s ease 0.2s !important;
    }
    
    /* Enhanced visual feedback for mobile touch */
    .fragment-card:active:not(.expanded) {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .image-card:active:not(.tap-expanded) {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* === PASSWORD SECTION === */
    .terminal-password {
        padding: var(--mobile-padding); /* Reduced padding for mobile */
        font-size: 1.1rem;
        /* width and max-width constraints handled by new architecture */
    }
    
    .password-field {
        font-size: 1.1rem;
        min-height: var(--button-height-2xl);
        padding: 0.5rem;
        touch-action: manipulation;
        border: 1px solid rgba(107, 229, 226, 0.2);
        /* width constraints handled by new architecture */
    }
    
    .password-field:focus {
        border-color: rgba(107, 229, 226, 0.5);
        background-color: rgba(107, 229, 226, 0.1);
    }
    
    #password-result {
        margin-left: auto;
        margin-right: auto;
        max-width: 95%;
        width: 100%;
        text-align: center !important;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        font-size: 0.9rem;
        line-height: 1.4;
        padding: var(--space-sm) var(--space-xs);
    }
    
    /* === NAVIGATION === */
    /* Header removed - replaced with neural sidebar */
    
    /* === BUTTONS & CONTROLS === */
    .fragment-card .btn-neural-primary,
    .fragment-card .btn-neural-secondary {
        min-height: 44px; /* iOS recommended touch target size */
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .fragment-card .consciousness-injector {
        gap: var(--space-md);
    }
    
    .fragment-card .consciousness-injector button {
        width: 100%;
        justify-content: center;
    }
    
    /* === VISUAL EFFECTS === */
    /* Mobile scan line optimization - respects config.js settings */
    .scan-line, .scan-line-2 {
        /* Opacity and duration controlled by config.js - no overrides on mobile */
    }
    
    /* Matrix rain container - ensure visibility on mobile */
    .matrix-rain {
        display: block !important;
        visibility: visible !important;
        z-index: -2 !important;
        pointer-events: none !important;
    }
    
    /* All matrix rain styling now controlled by JavaScript config.js */
    
    .corrupted-scan-line {
        opacity: 0.2 !important;
        animation-duration: 15s !important;
        height: 3px !important; /* Reduced height for mobile performance */
    }
    
    /* === CURSOR POSSESSION === */
    .possession-cursor {
        width: 30px;
        height: 30px;
        box-shadow: 
            0 0 15px #ff4444,
            0 0 30px #ff4444,
            0 0 45px rgba(255, 68, 68, 0.7);
    }
    
    .possession-message {
        font-size: 1.2rem;
        padding: 12px 16px;
        max-width: 90vw;
        word-wrap: break-word;
    }
    
    /* === TYPOGRAPHY & SPACING === */
    .terminal {
        font-size: 1rem;
    }
    
    #intro-text {
        font-size: 1rem;
        padding: 0 var(--mobile-padding);
        width: 95% !important;
    }
    
    .cursor, .cursor-hint, .cursor-about {
        font-size: 1rem;
    }
    
    .terminal-hint {
        margin: var(--mobile-margin) var(--mobile-padding);
        padding: var(--mobile-padding);
        font-size: 0.9rem;
        max-width: none;
    }
    
    #gallery, #lore {
        padding: var(--mobile-padding);
    }
    
    /* #password-entry padding removed - handled by new architecture */
    
    .lore-text {
        font-size: 1rem;
        padding: 0 var(--mobile-padding);
    }
    
    /* === TOUCH INTERACTION IMPROVEMENTS === */
    /* .using-touch rules moved to base styles section */
    
    /* === RESPONSIVE NAVIGATION CONTROLS === */
    .audio-player-container {
        display: none;
    }
    
    .audio-toggle.unified {
        padding: var(--button-padding-md); /* Mobile override */
        font-size: var(--font-component-md); /* Mobile override */
        min-height: var(--button-height-lg); /* Mobile override */
    }
    
    .audio-toggle.unified .audio-icon {
        display: none; /* Hide icon on mobile */
    }
    
    .audio-toggle.unified .audio-status-text {
        font-size: var(--font-component-sm); /* Mobile override */
    }
    
    .nav-link {
        padding: var(--button-padding-md);
        font-size: var(--font-component-md);
        min-height: var(--button-height-lg);
        gap: 0.4rem;
    }
    
    .btn-neural-secondary {
        padding: var(--button-padding-md); /* Mobile override */
        font-size: var(--font-component-md); /* Mobile override */
        min-height: var(--button-height-lg); /* Mobile override */
    }
    
    .btn-neural-ghost {
        padding: var(--button-padding-md); /* Mobile override */
        font-size: var(--font-component-md); /* Mobile override */
        min-height: var(--button-height-lg); /* Mobile override */
        max-width: 95vw; /* Prevent overflow on mobile */
        width: auto; /* Allow natural sizing */
        word-wrap: break-word; /* Break long text if needed */
        white-space: normal; /* Allow text wrapping */
        text-align: center; /* Center wrapped text */
    }
    

    
    /* === NESTED BREAKPOINTS === */
    
    /* Extra small screens (≤480px) */
    @media screen and (max-width: 480px) {
        #password-result {
            font-size: 0.8rem;
            max-width: 98%;
            padding: var(--space-xs);
        }
        
        .terminal-password {
            /* Use responsive padding system - removed hard-coded override */
            font-size: 1rem;
            /* width constraints handled by new architecture */
        }
    }
    
    /* Small screens (≤620px) - Icon only navigation */
    @media screen and (max-width: 620px) {
        .main-nav {
            gap: 0.2rem;
        }
        
        .nav-link {
            padding: var(--button-padding-sm);
            font-size: var(--font-component-sm);
            min-height: var(--button-height-md);
            gap: 0.3rem;
        }
        
        .btn-neural-secondary {
            padding: var(--button-padding-sm); /* 620px breakpoint override */
            font-size: var(--font-component-sm); /* 620px breakpoint override */
            min-height: var(--button-height-md); /* 620px breakpoint override */
        }
        
        .btn-neural-ghost {
            padding: var(--button-padding-sm); /* 620px breakpoint override */
            font-size: var(--font-component-sm); /* 620px breakpoint override */
            min-height: var(--button-height-md); /* 620px breakpoint override */
            max-width: 90vw; /* Tighter constraint for 620px */
        }
        
        .audio-toggle.unified {
            padding: var(--button-padding-sm);
            font-size: var(--font-component-sm);
            min-height: var(--button-height-md);
            justify-content: flex-start;
        }
        
        .audio-toggle.unified .audio-status-text {
            display: none;
        }
        
        .audio-toggle.unified .audio-icon {
            display: block;
            font-size: 0.9rem;
            color: #ff4444;
        }
    }
    
    /* Very small screens (≤320px) */
    @media screen and (max-width: 320px) {
        .main-nav {
            gap: 0.1rem;
        }
        
        .nav-link {
            padding: var(--button-padding-xs);
            font-size: var(--font-component-xs);
            min-height: var(--button-height-sm);
            gap: 0.2rem;
        }
        
        .btn-neural-secondary {
            padding: var(--button-padding-xs); /* 320px breakpoint override */
            font-size: var(--font-component-xs); /* 320px breakpoint override */
            min-height: var(--button-height-sm); /* 320px breakpoint override */
        }
        
        .btn-neural-ghost {
            padding: var(--button-padding-xs); /* 320px breakpoint override */
            font-size: var(--font-component-xs); /* 320px breakpoint override */
            min-height: var(--button-height-sm); /* 320px breakpoint override */
            max-width: 85vw; /* Very tight constraint for 320px */
        }
        
        .audio-toggle.unified {
            padding: var(--button-padding-xs);
            font-size: var(--font-component-xs);
            min-height: var(--button-height-sm);
            justify-content: flex-start;
        }
        
        .audio-toggle.unified .audio-icon {
            display: block;
            font-size: 0.8rem;
            color: #ff4444;
        }
        
        .audio-toggle.unified .audio-status-text {
            display: none;
        }
    }
}

#widget-minimized {
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-sm);
    font-size: var(--text-xs);
    color: var(--color-accent);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(107, 229, 226, 0.2);
}

#widget-minimized:hover {
    background: rgba(107, 229, 226, 0.1);
    border-color: #ff4444;
    color: #ff4444;
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.3);
    animation: glitchHover 0.5s ease-in-out;
}

#widget-expanded {
    position: absolute;
    bottom: 0;
    left: 0; /* Changed from right: 0 to left: 0 for left-corner positioning */
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    min-width: 300px;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(107, 229, 226, 0.3);
    animation: expandWidget 0.3s ease-out;
}

.widget-header {
    color: var(--color-accent);
    font-size: var(--text-sm);
    font-weight: bold;
    margin-bottom: var(--space-xs);
    text-align: center;
    letter-spacing: 0.1em;
}

.widget-subtitle {
    color: #ff4444;
    font-size: var(--text-xs);
    text-align: center;
    margin-bottom: var(--space-sm);
    font-style: italic;
    opacity: 0.8;
    border-bottom: 1px solid rgba(107, 229, 226, 0.3);
    padding-bottom: var(--space-sm);
}

#fingerprint-data {
    font-size: var(--text-xs);
    line-height: 1.4;
}

.fingerprint-item {
    margin-bottom: var(--space-xs);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid rgba(107, 229, 226, 0.1);
}

.fingerprint-label {
    color: var(--color-accent);
    font-weight: 500;
    display: inline-block;
    width: 120px;
    font-size: var(--text-xs);
}

.fingerprint-value {
    color: var(--color-text);
    font-size: var(--text-xs);
}

@keyframes glitchHover {
    0%, 100% { transform: scale(1.05); }
    25% { transform: scale(1.05) skew(1deg); }
    50% { transform: scale(1.05) skew(-1deg); }
    75% { transform: scale(1.05) skew(0.5deg); }
}

@keyframes expandWidget {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}



/* Navigation Button Standardization */
.nav-button-standard {
    padding: var(--space-sm) var(--space-md); /* Consistent 0.5rem 1rem */
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    gap: 0.4rem; /* Consistent gap for all buttons */
    min-height: var(--button-height-2xl); /* Desktop standard button height */
}

/* Header and About Button */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    align-items: center;
}

.main-nav {
    display: flex;
    gap: var(--space-sm);
}

.nav-link {
    background: rgba(10, 10, 15, 0.9);
    color: var(--color-accent);
    border: 1px solid var(--color-tertiary);
    padding: var(--space-sm) var(--space-md); /* Standard nav button padding */
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    transition: all 0.3s ease;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    gap: 0.4rem; /* Consistent gap for icons */
    min-height: var(--button-height-2xl); /* Desktop standard button height */
}

.nav-link:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    box-shadow: 0 0 10px rgba(107, 229, 226, 0.5);
}



/* About Terminal Window */
.about-terminal-window {
    position: fixed;
    top: -100%;
    right: 20px;
    width: 500px;
    max-width: calc(100vw - 40px);
    background: linear-gradient(145deg, rgba(10, 10, 15, 0.95), rgba(5, 5, 10, 0.98));
    border: 2px solid rgba(120, 219, 226, 0.3);
    border-radius: var(--radius-md);
    z-index: 1002;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(120, 219, 226, 0.1);
}

.about-terminal-window.show {
    top: 70px;
    transform: translateY(0);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(120, 219, 226, 0.2);
    background: rgba(120, 219, 226, 0.05);
}

.terminal-title {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: bold;
}

/* Legacy .close-button removed - now uses .btn-neural-ghost */

.terminal-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

#about-output {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    white-space: pre-wrap;
}

.cursor-about {
    color: var(--color-accent);
    animation: blink 1s infinite;
    margin-left: var(--space-xs);
}

/* ===================================
   MOBILE RESPONSIVENESS
   =================================== */

/* REMOVED: Duplicate mobile block #2 - consolidated above */

/* Tablet styles */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    
    .about-terminal-window {
        width: 90%;
        max-width: 600px;
        right: 5%;
    }
    
    .fragment-cards-container {
        gap: 1.5rem;
    }
    
    .fragment-card {
        width: 280px;
    }
    
    .image-cards-container {
        gap: 1.5rem;
    }
    
    /* Legacy .hint-rectangle-button tablet styles removed - now uses .btn-neural-primary */
    
    /* Tablet - audio integrated into navigation */
    header {
        padding: 0.75rem;
    }
    
    /* Audio controls integrated into navigation */
    .audio-player-container {
        display: none; /* Hide separate container on tablet */
    }
    
    /* Navigation includes unified audio button */
    .main-nav {
        display: flex;
        gap: 0.4rem;
        align-items: center;
    }
    
    /* Tablet audio button - text only, no icon */
    .audio-toggle.unified .audio-icon {
        display: none; /* Hide icon on tablet - text only */
    }
    
    .audio-toggle.unified .audio-status-text {
            font-size: var(--font-component-lg); /* Tablet override */
    }
    
    .nav-link {
        padding: var(--space-sm) var(--space-md); /* Standard nav button padding */
        font-size: 0.8rem;
        min-height: var(--button-height-xl); /* Tablet height */
        gap: 0.4rem; /* Consistent gap */
    }
    
    /* .about-btn now uses btn-neural-secondary - tablet responsive handled by neural system */
    
    main {
        padding-left: var(--padding-base-tablet);
        padding-right: var(--padding-base-tablet);
        padding-top: calc(var(--padding-base-tablet) * var(--padding-vertical-multiplier));
        padding-bottom: var(--padding-base-tablet);
    }
}

/* Desktop styles (1024px+) - existing styles mostly apply */
@media screen and (min-width: 1024px) {
    
    /* Restore hover effects for desktop */
    .image-card:hover {
        will-change: transform, box-shadow; /* Apply only during interaction for better GPU memory management */
        transform: scale(2);
        z-index: 1000;
        box-shadow: 0 16px 64px 8px rgba(107, 229, 226, 0.25);
        border-color: var(--color-accent);
        background-color: var(--color-bg);
    }
    
    /* Ensure proper desktop spacing */
    .fragment-cards-container {
        gap: 2rem;
    }
    
    .image-cards-container {
        gap: 2rem;
    }
    
    /* Desktop - maintain full-width layout */
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: 1rem;
        background: none;
        border-bottom: none;
        backdrop-filter: none;
        justify-content: space-between;
    }
    
    .audio-player-container {
        display: none; /* Hide separate container on desktop too */
    }
    
    /* Desktop audio button - text only, no icon */
    .audio-toggle.unified {
        font-size: var(--font-component-xl); /* Desktop override */
    }
    
    .audio-toggle.unified .audio-icon {
        display: none; /* Hide icon on desktop - text only */
    }
    
    .audio-toggle.unified .audio-status-text {
        font-size: var(--font-component-lg); /* Desktop override */
    }
    
    /* Legacy .audio-toggle styles removed - unified button uses proper rounded rectangle on desktop */
    

    
    .nav-link {
        padding: var(--space-sm) var(--space-md); /* Standard nav button padding */
        font-size: 0.8rem;
        min-height: var(--button-height-2xl); /* Desktop standard nav button height */
        gap: 0.4rem; /* Consistent gap */
    }
    
    /* .about-btn now uses btn-neural-secondary - desktop responsive handled by neural system */
    
    main {
        padding-left: var(--padding-base-desktop);
        padding-right: var(--padding-base-desktop);
        padding-top: calc(var(--padding-base-desktop) * var(--padding-vertical-multiplier));
        padding-bottom: var(--padding-base-desktop);
    }
    
    /* Desktop Logo Enhancement */
    .site-logo {
        top: var(--space-md) !important;
        right: var(--space-md) !important;
        left: auto !important;
    }
    
    .logo-text {
        font-size: 2.5rem;
        text-shadow: 0 0 15px rgba(107, 229, 226, 0.6);
    }
    
    .logo-subtitle {
        font-size: 0.8rem;
        opacity: 0.9;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.glitch, .glitch-intense, .glitch-subtle {
    will-change: transform;
    contain: layout style;
}

.cursor, .cursor-hint, .cursor-about {
    will-change: opacity;
    contain: layout;
}

.scan-line, .scan-line-2 {
    will-change: transform;
    contain: layout style;
    transform: translate3d(0, 0, 0); /* Force GPU acceleration */
}

.image-card, .fragment-card {
    /* will-change removed - applied dynamically during interaction for better GPU memory management */
    contain: layout style;
}

/* Image card hover effects handled in media queries */

.fragment-card:hover:not(.expanded) {
    transform: translate3d(0, -5px, 0); /* Only apply hover effect when not expanded */
}

/* Optimize animations for performance */
@media (prefers-reduced-motion: reduce) {
    .glitch, .glitch-intense, .glitch-subtle,
    .cursor, .cursor-hint, .cursor-about,
    .scan-line, .scan-line-2 {
        animation: none;
    }
    
    .image-card:hover, .fragment-card:hover:not(.expanded) {
        transform: none;
    }
}

/* Critical above-the-fold styles */

/* JavaScript Inline Style Replacements - Neural System */
.possession-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ff4444, #cc0000);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 
        0 0 10px #ff4444,
        0 0 20px #ff4444,
        0 0 30px rgba(255, 68, 68, 0.5);
    animation: possessionPulse 1s infinite alternate;
    opacity: 0;
    transition: opacity 0.3s ease;
}



.possession-cursor.active {
    opacity: 1;
}

.possession-message {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ff4444;
    color: #ff4444;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: bold;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    z-index: 10002;
    pointer-events: none;
    text-shadow: 0 0 10px #ff4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
    min-width: 200px;
    white-space: nowrap;
}

.possession-message .message-preview {
    opacity: 0.3;
}

.possession-message .typed-chars {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-md);
    color: #ff4444;
}

.floating-char {
    position: fixed;
    color: #ff4444;
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: bold;
    pointer-events: none;
    z-index: 10001;
    text-shadow: 0 0 10px #ff4444, 0 0 20px #ff4444;
    animation: fadeOut 3s forwards;
    background: rgba(0, 0, 0, 0.8);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-xs);
    border: 1px solid #ff4444;
}

.possession-trail {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #ff4444;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: trailFade 1s forwards;
}

@keyframes possessionPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

@keyframes trailFade {
    0% { 
        opacity: 0.8;
        transform: scale(1);
    }
    100% { 
        opacity: 0;
        transform: scale(0.5);
    }
}

/* Utility Classes for JavaScript */
.neural-hidden {
    display: none !important;
}

.neural-visible {
    display: inline-block !important;
}

.neural-fade-out {
    animation: fadeOut 1s forwards;
}

/* ===== NEURAL CONTACT INTERFACE STYLES ===== */
/* Contact Panel - Hidden/Collapsed by default */
.neural-contact-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1500; /* Above sidebar (1100) and scan lines (1100) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Transform starts from below */
    transform: translateY(50px);
}

.neural-contact-panel.expanded {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Contact Panel Content Container */
.contact-panel-content {
    background: linear-gradient(145deg, rgba(10, 10, 15, 0.95), rgba(5, 5, 10, 0.98));
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: 0; /* Remove padding - let header/body handle it */
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(107, 229, 226, 0.2);
    animation: contactPanelSlideIn 0.4s ease-out;
}

@keyframes contactPanelSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Contact Panel Header */
.contact-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-lg) var(--space-md) var(--space-lg);
    border-bottom: 1px solid rgba(107, 229, 226, 0.2);
    background: rgba(107, 229, 226, 0.05);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.contact-title {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 500;
    margin: 0;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

/* Contact Panel Body */
.contact-panel-body {
    padding: var(--space-lg);
}

/* Neural Terminal Style Introduction */
.contact-terminal {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.terminal-line {
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

.terminal-prompt {
    color: var(--color-accent);
}

.terminal-text {
    color: var(--color-text);
    margin-left: var(--space-sm);
}

.terminal-status {
    color: var(--color-tertiary);
}

.terminal-warning {
    color: var(--glitch-red);
    animation: neuralWarningPulse 2s ease-in-out infinite;
}

@keyframes neuralWarningPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Neural Contact Form */
.neural-contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-label {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.form-hint {
    color: var(--color-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-style: italic;
    opacity: 0.8;
    margin-bottom: var(--space-xs);
}

.form-input,
.form-textarea {
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.5;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 44px; /* iOS touch target minimum */
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-secondary);
    opacity: 0.7;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(10, 10, 15, 0.95);
    box-shadow: 0 0 0 2px rgba(107, 229, 226, 0.2);
}

.form-input:hover,
.form-textarea:hover {
    border-color: rgba(107, 229, 226, 0.5);
}

/* reCAPTCHA v3 - Invisible, no styling needed */

/* Form Submit Section */
.form-submit {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-md);
}

.form-submit .btn-neural-primary {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-base);
    min-width: 120px;
    min-height: 44px; /* iOS touch target minimum */
}

/* Neural Contact Result Messages */
.neural-contact-result {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    animation: resultSlideIn 0.3s ease-out;
}

.neural-contact-result.success {
    background: rgba(107, 229, 226, 0.1);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
}

.neural-contact-result.error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--glitch-red);
    color: var(--glitch-red);
}

.neural-message {
    font-weight: 500;
    margin-bottom: var(--space-xs);
    text-transform: lowercase;
}

.neural-subtext {
    opacity: 0.8;
    font-size: var(--text-xs);
}

@keyframes resultSlideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Contact Interface */
@media (max-width: 767px) {
    .neural-contact-panel {
        padding: var(--space-sm);
        align-items: flex-start;
        padding-top: var(--space-xl); /* Account for mobile chrome */
    }
    
    .contact-panel-content {
        max-height: 85vh; /* Reduce height on mobile */
        margin-top: var(--space-md);
    }
    
    .contact-panel-header {
        padding: var(--space-md);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .contact-title {
        font-size: var(--text-base);
    }
    
    .contact-panel-body {
        padding: var(--space-md);
    }
    
    .contact-terminal {
        padding: var(--space-sm);
        font-size: var(--text-xs);
    }
    
    .form-label {
        font-size: var(--text-xs);
    }
    
    .form-input,
    .form-textarea {
        padding: var(--space-sm);
        font-size: var(--text-sm);
    }
    
    .form-submit {
        justify-content: stretch;
    }
    
    .form-submit .btn-neural-primary {
        width: 100%;
        padding: var(--space-md);
        font-size: var(--text-sm);
    }
    
    /* reCAPTCHA v3 - Mobile invisible, no styling needed */
    
    /* Nested breakpoints for contact interface */
    @media screen and (max-width: 480px) {
        .contact-panel-header {
            padding: var(--space-sm);
        }
        
        .contact-panel-body {
            padding: var(--space-sm);
        }
        
        .terminal-line {
            font-size: 0.7rem;
        }
    }
}



/* Glitch Toggle Button */
.glitch-toggle {
    position: relative;
}

.glitch-toggle.disabled {
    background: rgba(255, 107, 107, 0.2) !important;
    border-color: #ff6b6b !important;
    color: #ff6b6b !important;
}

.glitch-toggle.disabled:hover {
    background: rgba(255, 107, 107, 0.3) !important;
    color: #ff6b6b !important;
}

/* Glitch System Disabled State */
.glitches-disabled .glitch,
.glitches-disabled .glitch-intense,
.glitches-disabled .glitch-subtle {
    animation: none !important;
}

.glitches-disabled .glitch::before,
.glitches-disabled .glitch::after,
.glitches-disabled .glitch-intense::before,
.glitches-disabled .glitch-intense::after,
.glitches-disabled .glitch-subtle::before,
.glitches-disabled .glitch-subtle::after {
    display: none !important;
}

/* Scan lines should only be hidden if specifically disabled, not when glitches are disabled */
.scan-lines-disabled .scan-line,
.scan-lines-disabled .scan-line-2,
.scan-lines-disabled .corrupted-scan-line {
    display: none !important;
}

