/* ===================================
   GESTURE RING - HCI PROJECT
   Design System & Core Styles
   =================================== */

/* === CSS VARIABLES === */
:root {
    /* Primary Color Palette - Futuristic Blue/Purple */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #a78bfa;
    --accent-bright: #c084fc;
    
    /* Dedicated Theme Accents */
    --accent-blue: #00f3ff;
    --accent-purple: #b533ff;

    /* Neutral Colors - Dark Mode */
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.08);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-tertiary: #6b6b84;
    
    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'Courier New', monospace;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    background-image: 
      radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
      radial-gradient(circle at 85% 30%, rgba(167, 139, 250, 0.1) 0%, transparent 50%),
      radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 30px 30px;
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* === SECTION MANAGEMENT === */
.section {
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-slow);
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.section.active {
    display: block;
    opacity: 1;
    z-index: 10;
}

#landing-page.active {
    display: flex !important;
    overflow-y: auto;
}

/* ===================================
   LANDING PAGE / HERO SECTION
   =================================== */

#landing-page {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Background Animation */
.background-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#particle-canvas {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center,
                rgba(99, 102, 241, 0.1) 0%,
                rgba(10, 10, 15, 1) 70%);
}

/* Hero Content Layout */
.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
    max-width: 1400px;
    padding: var(--spacing-2xl);
    align-items: center;
}

/* Hero Text */
.hero-text {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.title-main {
    display: block;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-bright));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-sub {
    display: block;
    color: var(--text-primary);
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.8;
}

/* Feature Pills */
.hero-features {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

@property --shimmer-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes shimmer-spin {
    0% { --shimmer-angle: 0deg; }
    100% { --shimmer-angle: 360deg; }
}

.feature-pill {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--surface);
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
    color: var(--text-primary);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all var(--transition-fast);
    
    /* MagicUI Shimmer additions */
    --shimmer-color: #ffffff;
    position: relative;
    z-index: 1;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(255,255,255,0.05);
}

.feature-pill::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px; /* Shimmer border thickness */
    background: conic-gradient(
        from var(--shimmer-angle, 0deg),
        rgba(0, 243, 255, 0) 0%,
        rgba(0, 243, 255, 0) 35%,
        var(--accent-blue) 45%,
        var(--shimmer-color) 50%,
        var(--accent-purple) 55%,
        rgba(181, 51, 255, 0) 65%,
        rgba(181, 51, 255, 0) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
    animation: shimmer-spin 3s linear infinite;
    pointer-events: none;
    opacity: 0.9;
}

.feature-pill::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(
        from calc(var(--shimmer-angle, 0deg) + 180deg),
        rgba(0, 243, 255, 0) 0%,
        rgba(0, 243, 255, 0) 35%,
        rgba(0, 243, 255, 0.1) 45%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(181, 51, 255, 0.1) 55%,
        rgba(181, 51, 255, 0) 65%,
        rgba(181, 51, 255, 0) 100%
    );
    z-index: -2;
    animation: shimmer-spin 3s linear infinite;
    pointer-events: none;
}

.feature-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    --shimmer-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.feature-icon {
    font-size: 1.2rem;
}

/* Interactive Hover Button (replaces CTA Button) */
.interactive-hover-btn {
    position: relative;
    width: 250px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 9999px; /* full rounded */
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    padding: 1rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s var(--ease-spring);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-block;
    touch-action: manipulation;
}

.ihb-text-default {
    display: inline-block;
    transition: all 0.3s var(--ease-spring);
    transform: translateX(0.5rem);
    position: relative;
    z-index: 10;
}

.interactive-hover-btn:hover .ihb-text-default {
    transform: translateX(3rem);
    opacity: 0;
}

.ihb-hover-content {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: white; /* Will invert on hover if background matches */
    opacity: 0;
    transform: translateX(3rem);
    transition: all 0.3s var(--ease-spring);
}

.interactive-hover-btn:hover .ihb-hover-content {
    transform: translateX(-0.1rem);
    opacity: 1;
}

.ihb-dot {
    position: absolute;
    top: 50%;
    left: 15%;
    transform: translateY(-50%);
    height: 0.5rem;
    width: 0.5rem;
    border-radius: 9999px;
    background-color: var(--primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.interactive-hover-btn:hover .ihb-dot {
    left: 50%;
    top: 50%;
    height: 300px; /* fills the button */
    width: 300px;
    transform: translate(-50%, -50%) scale(1);
    background-color: var(--primary-light);
}

.interactive-hover-btn:active {
    transform: scale(0.98);
}

/* Hero Visual - 3D Ring Container */
.hero-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

#ring-container-3d {
    width: 100%;
    height: 500px;
    position: relative;
}

/* Gesture Hint */
.gesture-hint {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.hint-pulse {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* HCI Badge */
.hci-badge {
    position: absolute;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-size: 0.85rem;
}

.badge-label {
    color: var(--text-tertiary);
    margin-right: var(--spacing-xs);
}

.badge-value {
    color: var(--primary-light);
    font-weight: 600;
}

/* ===================================
   MAIN INTERFACE
   =================================== */

#main-interface {
    background: var(--bg-secondary);
    padding: 0;
    display: block !important;
    height: 100%;
    overflow-y: auto;
}

/* Top Navigation */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-xl);
    background: rgba(10, 10, 15, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    margin: 1rem auto;
    width: 95%;
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-nav.shrink {
    margin: 0.5rem auto;
    padding: calc(var(--spacing-sm) * 0.7) var(--spacing-xl);
    width: 70%;
    border-radius: 30px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.2rem;
    font-weight: 600;
}

.ring-icon-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    position: relative;
}

.ring-icon-small::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-tab.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Nav Back Button */
.nav-back {
    padding: var(--spacing-sm);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-back:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

/* View Management */
.view {
    display: none;
    padding: 0 var(--spacing-xl) 4rem;
}

.view.active {
    display: block;
}

.view h2 {
    margin-top: 0;
    padding-top: 0;
}

/* ===================================
   LIVE INTERACTION VIEW
   =================================== */

.view-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem; /* widened gap so columns aren't near */
    max-width: 1400px; /* Constrain slightly to force columns apart from edges but keep them elegant */
    margin: 2rem auto 0; /* Add slight top margin to descend from floating header */
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.panel-header {
    margin: 0;
    padding: 0;
}

.panel-header h2 {
    font-size: 1.8rem;
    margin: 0 0 var(--spacing-xs) 0;
    padding: 0;
}

.panel-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.ring-connection-controls {
    margin-top: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.connect-ring-btn {
    border: 1px solid rgba(255,255,255,0.1);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-md);
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

.connect-ring-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.connect-ring-btn:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.connect-ring-btn:hover::after {
    left: 150%;
}

.connect-ring-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Ripple Button Effect for Connect Button */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 600ms linear;
    background-color: rgba(173, 216, 230, 0.7); /* #ADD8E6 */
    pointer-events: none;
    z-index: 10;
}

@keyframes ripple-animation {
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.connection-status {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.connection-status.disconnected {
    color: var(--error);
}

.connection-status.connecting {
    color: var(--warning);
}

.connection-status.connected {
    color: var(--success);
}

/* Live Ring Visualization */
.live-ring-viz {
    background: radial-gradient(circle at center, rgba(30, 30, 40, 0.8), rgba(10, 10, 15, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    height: 300px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Gesture Status */
.gesture-status {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.05);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.status-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.status-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-bright));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    letter-spacing: -0.02em;
}

.status-confidence {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    transition: width var(--transition-normal);
    width: 0%;
}

/* Response Area */
.response-area {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.response-card {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    text-align: center;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.response-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: rgba(99, 102, 241, 0.3);
    filter: blur(80px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.response-card.active {
    border-color: rgba(99, 102, 241, 0.5);
    transform: scale(1.02);
}

.response-card.active::before {
    opacity: 1;
}

.response-icon {
    font-size: 4rem;
    filter: drop-shadow(0 0 15px rgba(255,255,255,0.2));
    animation: float-icon 3s ease-in-out infinite;
}

@keyframes float-icon {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.05);
    }
}

.response-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.response-details {
    display: flex;
    gap: var(--spacing-lg);
    width: 100%;
    justify-content: center;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Feedback Timeline */
.feedback-timeline {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    backdrop-filter: blur(8px);
}

.feedback-timeline h3 {
    font-size: 1.1rem;
    color: var(--primary-light);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-timeline h3::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

.progressive-blur-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.progressive-blur-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: none;
    z-index: 10;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    mask-image: linear-gradient(to bottom, transparent 0%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 100%);
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 12px 16px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    border-left: 2px solid var(--primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.9rem;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.timeline-time {
    color: var(--primary-light);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    min-width: 80px;
    letter-spacing: 0.05em;
}

.timeline-content {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

/* Gesture Simulator */
.gesture-simulator {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.gesture-simulator h3 {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gesture-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.gesture-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
    min-height: 90px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.gesture-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(167, 139, 250, 0.1));
    border-color: rgba(99, 102, 241, 0.4);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2);
}

.gesture-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.1);
}

.gesture-btn.disabled,
.gesture-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    border-color: rgba(255, 255, 255, 0.08);
}

.gesture-emoji {
    font-size: 2rem;
}

/* ===================================
   GESTURE MAPPING VIEW
   =================================== */

.mapping-container {
    max-width: 1400px;
    margin: 0 auto;
}

.mapping-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    margin-top: 0;
}

.mapping-header h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.mapping-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.mapping-card {
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mapping-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

.mapping-visual {
    height: 180px;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0.4) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.mapping-visual::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0px, transparent 1px, transparent 10px);
    opacity: 0.5;
}

.gesture-animation {
    width: 80px;
    height: 80px;
    position: relative;
}

/* Gesture Animation Styles */
.swipe-left-anim,
.swipe-right-anim {
    background: var(--primary);
    border-radius: 50%;
    animation: swipeAnimation 2s infinite;
}

.swipe-left-anim {
    animation-name: swipeLeft;
}

.swipe-right-anim {
    animation-name: swipeRight;
}

@keyframes swipeLeft {
    0%, 100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-30px) scale(0.8);
        opacity: 0.5;
    }
}

@keyframes swipeRight {
    0%, 100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(30px) scale(0.8);
        opacity: 0.5;
    }
}

.tap-anim {
    background: var(--accent);
    border-radius: 50%;
    animation: tapAnimation 1.5s infinite;
}

@keyframes tapAnimation {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
}

.rotate-anim {
    background: var(--accent-bright);
    border-radius: 50%;
    animation: rotateAnimation 3s infinite linear;
}

@keyframes rotateAnimation {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.mapping-content {
    padding: var(--spacing-xl) var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1; /* For equal heights */
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.4) 100%);
}

.mapping-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.mapping-description {
    color: var(--text-tertiary);
    line-height: 1.6;
    font-size: 0.95rem;
    flex-grow: 1; /* Push tags to bottom */
}

.mapping-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.action-tag {
    padding: 6px 12px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 9999px; /* Pill shape like shadcn badges */
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.action-tag:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.6);
    transform: scale(1.05);
}

.hci-note {
    padding: var(--spacing-sm);
    background: rgba(167, 139, 250, 0.1);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.hci-note strong {
    color: var(--accent-bright);
}

/* ===================================
   CONTEXT MODES VIEW
   =================================== */

.contexts-container {
    max-width: 1400px;
    margin: 0 auto;
}

.contexts-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    margin-top: 0;
}

.contexts-header h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.contexts-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.context-selector {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.context-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.context-btn:hover {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.15), rgba(0,0,0,0.2));
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.15);
    color: #fff;
}

.context-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(167, 139, 250, 0.15));
    border-color: var(--primary-light);
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.context-icon {
    font-size: 2rem;
}

.context-content {
    position: relative;
    min-height: 500px;
}

.context-panel {
    display: none;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing-xl);
    background: radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.05), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.context-panel.active {
    display: grid;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.context-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(0,0,0,0.2));
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.mode-illustration {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.presentation-ill::before {
    content: '📊';
    animation: float 3s ease-in-out infinite;
}

.media-ill::before {
    content: '🎵';
    animation: float 3s ease-in-out infinite 0.5s;
}

.accessibility-ill::before {
    content: '♿';
    animation: float 3s ease-in-out infinite 1s;
}

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

.context-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.context-info h3 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.context-desc {
    color: var(--text-tertiary);
    line-height: 1.8;
    font-size: 1.05rem;
}

.context-mappings {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.context-map-item {
    display: grid;
    grid-template-columns: 1.5fr auto 2fr;
    gap: var(--spacing-md);
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.context-map-item:hover {
    transform: translateX(5px);
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.3);
}

.map-gesture {
    color: var(--text-primary);
    font-weight: 600;
}

.map-arrow {
    color: var(--primary);
    font-weight: 700;
}

.map-action {
    color: var(--accent-bright);
}

.hci-insight {
    padding: var(--spacing-md);
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-md);
}

.hci-insight strong {
    color: var(--primary-light);
}

/* ===================================
   HCI RATIONALE VIEW
   =================================== */

.rationale-container {
    max-width: 1400px;
    margin: 0 auto;
}

.rationale-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    margin-top: 0;
}

.rationale-header h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
    margin-top: 0;
}

.rationale-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.rationale-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.rationale-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    transition: all var(--transition-normal);
}

.rationale-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.rationale-icon {
    font-size: 3rem;
    text-align: center;
}

.rationale-card h3 {
    font-size: 1.3rem;
    color: var(--primary-light);
}

.rationale-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.example-tag {
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-align: center;
}

/* Innovation Section */
.innovation-section {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
}

.innovation-section h3 {
    font-size: 1.8rem;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.innovation-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.innovation-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-lg);
    align-items: start;
}

.innovation-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.5;
}

.innovation-content h4 {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.innovation-content p {
    color: var(--text-secondary);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 1200px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding: var(--spacing-xl);
    }

    .hero-text {
        align-items: center;
    }

    .hero-description {
        max-width: 100%;
    }

    .hero-title {
        font-size: 3rem;
    }

    .view-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .context-panel {
        grid-template-columns: 1fr;
    }

    .top-nav {
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

@media (max-width: 768px) {
    .hero-content {
        padding: var(--spacing-md);
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 0.95rem;
    }

    .hero-features {
        flex-direction: column;
        width: 100%;
    }

    .feature-pill {
        width: 100%;
        justify-content: center;
    }

    .interactive-hover-btn {
        width: 100%;
        justify-content: center;
    }

    #ring-container-3d {
        height: 300px;
    }

    .top-nav {
        padding: var(--spacing-sm);
        flex-wrap: wrap;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xs);
        width: 100%;
        order: 3;
        margin-top: var(--spacing-sm);
    }

    .nav-tab {
        font-size: 0.85rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .view {
        padding: 0 var(--spacing-sm) 3rem;
    }

    .ring-connection-controls {
        width: 100%;
    }

    .connect-ring-btn {
        width: 100%;
    }

    .panel-header h2 {
        font-size: 1.4rem;
    }

    .live-ring-viz {
        height: 300px;
    }

    .context-selector {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .context-btn {
        width: 100%;
        padding: var(--spacing-sm);
    }

    .mapping-grid {
        grid-template-columns: 1fr;
    }

    .mapping-header h2,
    .contexts-header h2,
    .rationale-header h2 {
        font-size: 1.8rem;
    }

    .rationale-grid {
        grid-template-columns: 1fr;
    }

    .gesture-buttons {
        grid-template-columns: 1fr;
    }

    .gesture-btn {
        padding: var(--spacing-md);
        font-size: 1rem;
    }

    .hci-badge {
        position: static;
        margin: var(--spacing-md);
        text-align: center;
    }

    .gesture-hint {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .title-main,
    .title-sub {
        display: block;
    }

    .hero-description {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    #ring-container-3d {
        height: 250px;
    }

    .nav-brand span {
        display: none;
    }

    .ring-icon-small {
        width: 28px;
        height: 28px;
    }

    .nav-tabs {
        grid-template-columns: 1fr;
    }

    .panel-header h2 {
        font-size: 1.2rem;
    }

    .status-value {
        font-size: 1.5rem;
    }

    .mapping-header h2,
    .contexts-header h2,
    .rationale-header h2 {
        font-size: 1.5rem;
    }

    .mapping-header p,
    .contexts-header p,
    .rationale-header p {
        font-size: 0.9rem;
    }

    .context-map-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-xs);
    }

    .map-arrow {
        transform: rotate(90deg);
    }
}



/* ===================================
   UTILITY CLASSES
   =================================== */

.text-center {
    text-align: center;
}

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-light), var(--primary-dark));
    border-radius: 5px;
    border: 2px solid rgba(15, 23, 42, 0.5); /* Adds a subtle floating effect against track */
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-bright), var(--primary));
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ===================================
   LAYOUT FIXES (replacing !important block)
   =================================== */

#main-interface { margin-top: 0; padding-top: 0; }
.view { padding-top: 10px; margin-top: 0; }
.panel-header { margin-top: 0; padding-top: 0; }
.panel-header h2 { margin-top: 0; }
.top-nav { margin-bottom: 0; }
.section { padding-top: 0; }

/* ===================================
   LIVE MAPPING BADGES (active mode indicator)
   =================================== */

.live-mapping-section {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.live-mapping-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: 8px;
}

.live-mapping-title {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.live-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.live-mode-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.live-mode-btn.active {
    background: var(--primary);
    color: #fff;
}

.live-mapping-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.live-badge {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

.live-badge-input {
    color: var(--text-secondary);
    font-weight: 500;
}

.live-badge-arrow {
    color: var(--primary);
    font-weight: 700;
    text-align: center;
}

.live-badge-action {
    color: var(--accent-bright);
}

/* ===================================
   GESTURE MAP EDITOR
   =================================== */

.mapping-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.mapping-editor-card {
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.mapping-editor-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

.mapping-editor-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.context-icon-sm { font-size: 1.4rem; filter: drop-shadow(0 0 5px rgba(255,255,255,0.2)); }

.map-editor-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.map-editor-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.map-editor-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.map-editor-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Custom Dropdowns */
.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: inherit;
    z-index: 10;
}

.custom-dropdown-value {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--accent-bright);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
}

.custom-dropdown.open .custom-dropdown-value,
.custom-dropdown-value:hover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.custom-dropdown-value svg {
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.custom-dropdown.open .custom-dropdown-value svg {
    transform: rotate(180deg);
}

.custom-dropdown-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: rgba(15, 15, 26, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 220px;
    overflow-y: auto;
}

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

.custom-dropdown-option {
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.1s ease;
    border-left: 2px solid transparent;
}

.custom-dropdown-option:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.custom-dropdown-option.selected {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-bright);
    font-weight: 600;
    border-left-color: var(--accent-bright);
}

.custom-dropdown-options::-webkit-scrollbar {
    width: 6px;
}
.custom-dropdown-options::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}
.custom-dropdown-options::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

.reset-map-btn {
    margin-top: var(--spacing-sm);
    padding: 6px 16px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.reset-map-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

.mapping-reference-header {
    margin-bottom: var(--spacing-md);
}

.mapping-reference-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

/* ===================================
   RING TESTER (replaces simulate gestures)
   =================================== */

.simulator-header {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.simulator-header h3 {
    font-size: 1.2rem;
    margin: 0;
}

.simulator-note {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ===================================
   BORDER BEAM GLOW EFFECT
   =================================== */

@property --beam-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

.box-with-beam {
    position: relative;
    /* Ensure no visual overflow issues behind the rounded corners if content creeps */
}

/* Creates a clipped pseudo-border matching parent's border radius exactly */
.box-with-beam::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 2px; /* Border thickness */
    pointer-events: none;
    z-index: 10;
    
    /* Rotating conic gradient mimicking the magicUI border beam */
    background: conic-gradient(
        from var(--beam-angle) at 50% 50%,
        transparent 0%,
        transparent 15%,
        rgba(239, 68, 68, 1) 25%, /* Red-500 glow */
        transparent 35%,
        transparent 65%,
        rgba(59, 130, 246, 1) 75%, /* Blue-500 glow */
        transparent 85%,
        transparent 100%
    ) border-box;

    /* Mask to hollow out the inner area */
    mask: 
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;

    /* Fallback support for non Chromium 128+ browsers without @property */
    animation: border-beam-spin 6s linear infinite;
}

/* Subtle single beam for gesture cards (duration 8, size 100) */
.border-beam-subtle {
    position: relative;
}
.border-beam-subtle::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    pointer-events: none;
    z-index: 10;
    
    background: conic-gradient(
        from var(--beam-angle) at 50% 50%,
        transparent 0%,
        transparent 80%,
        rgba(255, 255, 255, 0.8) 95%,
        rgba(255, 255, 255, 0.2) 100%
    ) border-box;

    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;

    animation: border-beam-spin-slow 8s linear infinite;
}

@keyframes border-beam-spin {
    from { --beam-angle: 0deg; }
    to { --beam-angle: 360deg; }
}

@keyframes border-beam-spin-slow {
    from { --beam-angle: 0deg; }
    to { --beam-angle: 360deg; }
}

/* ===================================
   RESPONSIVE: editor grid + tester
   =================================== */

@media (max-width: 900px) {
    .mapping-editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .map-editor-row { grid-template-columns: 1fr; }
    .live-mapping-header { flex-direction: column; align-items: flex-start; }
    .gesture-buttons { grid-template-columns: repeat(2,1fr); }
}

/* ── Connection Cinematic Overlay ─────────────────────── */
#connection-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out, backdrop-filter 0.6s ease-in-out;
    color: var(--text-primary);
}

#connection-overlay.active {
    opacity: 1;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    pointer-events: all;
}

.sync-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.sync-rings {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sync-ring-outer, .sync-ring-inner {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    opacity: 0.5;
}

.sync-ring-outer {
    width: 100%; height: 100%;
    border-top-color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    animation: spin 4s linear infinite;
    filter: drop-shadow(0 0 10px var(--accent-blue));
}

.sync-ring-inner {
    width: 70%; height: 70%;
    border-left-color: var(--accent-purple);
    border-right-color: var(--accent-purple);
    animation: spin 3s linear infinite reverse;
    filter: drop-shadow(0 0 10px var(--accent-purple));
}

.sync-core {
    width: 25%; height: 25%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 50%;
    filter: blur(5px);
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#connection-overlay.calibrating .sync-ring-outer { border-top-color: #00ff88; border-bottom-color: #00ff88; filter: drop-shadow(0 0 20px #00ff88); animation-duration: 2s; }
#connection-overlay.calibrating .sync-ring-inner { border-left-color: #00d2ff; border-right-color: #00d2ff; filter: drop-shadow(0 0 20px #00d2ff); animation-duration: 1.5s; }
#connection-overlay.calibrating .sync-core { background: linear-gradient(135deg, #00ff88, #00d2ff); }

#connection-overlay.success .sync-core.burst {
    transform: scale(25);
    background: #00ff88;
    filter: blur(20px);
    opacity: 0.3;
}

.sync-text-wrapper {
    font-family: var(--font-mono);
    letter-spacing: 2px;
}

#sync-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ffffff, #888888);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#sync-console {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #a0a0a0;
    text-align: left;
    min-width: 400px;
    height: 190px; /* Big enough to fit all visible and invisible log lines */
    position: relative;
}

#sync-console p { margin: 0 0 0.8rem 0; opacity: 1; transition: opacity 0.3s; }
#sync-console p.hidden { opacity: 0; display: none; } /* Added display: none so hidden lines dont take vertical space */
#sync-log-3 { color: #00ff88; font-weight: bold; }

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.3); opacity: 1; } }


/* ── Cinematic Overlay V2: Scanning & Effects ─────────────────────── */
.cyber-grid {
    position: absolute;
    width: 200vw; height: 200vh;
    top: -50vh; left: -50vw;
    background-image: 
        linear-gradient(rgba(0, 210, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 255, 0.08) 1px, transparent 1px);
    background-size: 50px 50px;
    transform-style: preserve-3d;
    transform: perspective(600px) rotateX(60deg) translateZ(-200px);
    animation: grid-move 4s linear infinite;
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
}

@keyframes grid-move { 
    from { background-position: 0 0; } 
    to { background-position: 0 50px; } 
}

.radar-scan {
    position: absolute;
    width: 90%; height: 90%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 70%, rgba(0, 210, 255, 0.4) 100%);
    animation: spin 1.5s linear infinite;
    z-index: 10;
    pointer-events: none;
}

.sync-container { z-index: 10; } /* keep above grid */

#connection-overlay.success .sync-core.burst {
    transform: scale(25);
    background: #00ff88;
    filter: blur(20px);
    opacity: 0.4;
}

/* ERROR STATE */
#connection-overlay.error .sync-ring-outer { border-top-color: #ff3366; border-bottom-color: #ff3366; filter: drop-shadow(0 0 20px #ff3366); animation-duration: 0.5s; background: rgba(255,0,0,0.1); }
#connection-overlay.error .sync-ring-inner { border-left-color: #ff0000; border-right-color: #ff0000; filter: drop-shadow(0 0 20px #ff0000); animation-duration: 0.3s; }
#connection-overlay.error .sync-core { background: radial-gradient(#ff3366, #aa0000); filter: blur(8px); animation: error-shake 0.3s infinite; }
#connection-overlay.error .radar-scan { background: conic-gradient(from 0deg, transparent 70%, rgba(255, 50, 50, 0.6) 100%); }
#sync-log-error { color: #ff3366; font-weight: bold; }

@keyframes error-shake { 
    0%,100%{transform: translateX(0) scale(1.2)} 
    25%{transform: translateX(-10px) scale(1.2)} 
    75%{transform: translateX(10px) scale(1.2)} 
}

/* DISCONNECT STATE */
#connection-overlay.disconnecting .sync-ring-outer { border-top-color: #ffaa00; border-bottom-color: #ffaa00; filter: drop-shadow(0 0 20px #ffaa00); animation-duration: 0.8s; background: rgba(255, 170, 0, 0.05); }
#connection-overlay.disconnecting .sync-ring-inner { border-left-color: #ff5500; border-right-color: #ff5500; filter: drop-shadow(0 0 20px #ff5500); animation-duration: 0.6s; animation-direction: normal; }
#connection-overlay.disconnecting .sync-core { background: radial-gradient(#ffaa00, #ff5500); filter: blur(10px); animation: pulse 0.5s ease-in-out infinite; transform: scale(0.8); }

/* ── Themed Tech Gesture Visuals ────────────────────── */
/* Animated Finger Gestures */
.gesture-sim {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}
.gesture-sim .sim-hand {
    position: absolute;
    bottom: -10px;
    width: 32px;
    height: 32px;
    color: rgba(0, 243, 255, 0.8);
    transform-origin: bottom center;
    transition: color 0.3s ease;
}
.gesture-sim .sim-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 2px dashed rgba(0, 243, 255, 0.4);
    border-radius: 50%;
    opacity: 0;
}
.gesture-sim .sim-tip {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: rgba(0, 243, 255, 0.8);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.8);
}

.gesture-btn:hover .sim-hand, .mapping-card:hover .sim-hand { color: #fff; }

/* Rotations */
.rotate-cw .sim-ring.right { border-right: 2px solid #00f3ff; }
.rotate-ccw .sim-ring.left { border-left: 2px solid #00f3ff; }
.gesture-btn:hover .rotate-cw .sim-hand, .mapping-card:hover .rotate-cw .sim-hand { animation: hand-turn-cw 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
.gesture-btn:hover .rotate-cw .sim-ring, .mapping-card:hover .rotate-cw .sim-ring { opacity: 1; animation: spin-forward 1.5s linear infinite; }
.gesture-btn:hover .rotate-ccw .sim-hand, .mapping-card:hover .rotate-ccw .sim-hand { animation: hand-turn-ccw 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
.gesture-btn:hover .rotate-ccw .sim-ring, .mapping-card:hover .rotate-ccw .sim-ring { opacity: 1; animation: spin-reverse 1.5s linear infinite; }

/* Taps */
.gesture-btn:hover .tap-single .sim-hand, .mapping-card:hover .tap-single .sim-hand { animation: hand-tap 1s ease-in-out infinite; }
.gesture-btn:hover .tap-double .sim-hand, .mapping-card:hover .tap-double .sim-hand { animation: hand-tap-double 1.5s ease-in-out infinite; }
.gesture-btn:hover .tap-triple .sim-hand, .mapping-card:hover .tap-triple .sim-hand { animation: hand-tap-triple 2s ease-in-out infinite; }

/* Long Press */
.gesture-btn:hover .long-press .sim-hand, .mapping-card:hover .long-press .sim-hand { animation: hand-press 2s ease-in-out infinite; }
.gesture-btn:hover .long-press .sim-tip, .mapping-card:hover .long-press .sim-tip { animation: tip-glow 2s ease-in-out infinite; }

@keyframes hand-turn-cw { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(45deg); } }
@keyframes hand-turn-ccw { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-45deg); } }
@keyframes hand-tap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px) scale(0.9); } }
@keyframes hand-tap-double {
    0%, 100% { transform: translateY(0); }
    20% { transform: translateY(-10px) scale(0.9); }
    40% { transform: translateY(0); }
    60% { transform: translateY(-10px) scale(0.9); }
}
@keyframes hand-tap-triple {
    0%, 100% { transform: translateY(0); }
    15% { transform: translateY(-10px) scale(0.9); }
    30% { transform: translateY(0); }
    45% { transform: translateY(-10px) scale(0.9); }
    60% { transform: translateY(0); }
    75% { transform: translateY(-10px) scale(0.9); }
}
@keyframes hand-press {
    0%, 100% { transform: translateY(0) scale(1); }
    20%, 80% { transform: translateY(-10px) scale(0.95); }
}
@keyframes tip-glow {
    0%, 20%, 80%, 100% { opacity: 0; transform: translateX(-50%) scale(1); }
    40%, 60% { opacity: 1; transform: translateX(-50%) scale(2.5); }
}
@keyframes spin-forward { 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes spin-reverse { 100% { transform: translate(-50%, -50%) rotate(-360deg); } }

/* Utility classes to replace inline styles */
.visual-center { justify-content: center; }
.scale-15 { transform: scale(1.5); }

/* Custom log warning/critical colors */
.sync-info { color: #00d2ff; font-weight: bold; }
.sync-warn { color: #ffaa00; font-weight: bold; }
.sync-critical { color: #ff3366; font-weight: bold; }

