/* Anomaly CSS: High Fidelity Cinematic & Glassmorphic UI */

:root {
    --bg-dark: #020203;
    --neon-green: #00ff88;
    --neon-cyan: #00f0ff;
    --neon-amber: #ffaa00;
    --glass-bg: rgba(10, 10, 12, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-glow: rgba(0, 240, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);
    --font-ui: 'Space Grotesk', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --font-logo: 'Syne', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-ui);
    color: var(--text-primary);
    user-select: none;
}

a, a:visited {
    color: inherit;
    text-decoration: none;
}

/* ── Container Layout ────────────────────────────────────── */

.container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

/* Mirror the webcam, tracking canvas, and WebGL canvas identically */
#webcam {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 2;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
    z-index: 3;
}

#three-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
    z-index: 4;
}

/* ── Loader ──────────────────────────────────────────────── */

#loader {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 999;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 11px;
    letter-spacing: 0.25em;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}



/* ── Futuristic Top-Left Dropdown Menu ───────────────────── */

.ui-header-menu {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 200px;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: 20px;
    backdrop-filter: blur(16px);
    cursor: pointer;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.custom-select-trigger:hover,
.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--neon-cyan);
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.15);
}

.select-label {
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    font-size: 11px;
    margin-right: 6px;
    letter-spacing: 0.05em;
}

#selected-reality-label {
    font-weight: 600;
    color: var(--text-primary);
    flex-grow: 1;
}

.custom-select-trigger .arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.3s;
    margin-left: 10px;
}

.custom-select-wrapper.open .custom-select-trigger .arrow {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 101;
}

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

.option-group-title {
    padding: 12px 16px 6px 16px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--neon-cyan);
    opacity: 0.45;
    text-transform: uppercase;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.custom-option {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    text-align: left;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background: rgba(0, 240, 255, 0.08);
    color: var(--neon-cyan);
    padding-left: 20px; /* Subtle indent effect */
}

.custom-option.selected {
    color: var(--text-primary);
    background: rgba(0, 240, 255, 0.12);
    border-left: 3px solid var(--neon-cyan);
}

/* ── Top-Right Status Panel ─────────────────────────────── */

.ui-status-panel {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10;
    pointer-events: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-amber);
    box-shadow: 0 0 8px var(--neon-amber);
    transition: background 0.3s, box-shadow 0.3s;
}

.status-dot.active {
    background: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
}

.status-dot.pulsing {
    animation: pulseGlow 1.5s infinite;
}

.status-text {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.subtitle-text {
    margin: 4px 0 0 0;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

@keyframes pulseGlow {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* ── UI Controls Pill (Cycle Filters) ───────────────────── */

.ui-controls-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    padding: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.ui-controls-bar:hover {
    border-color: var(--glass-border-glow);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 240, 255, 0.08);
}

.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

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

.nav-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.filter-display {
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    min-width: 140px;
    justify-content: center;
}

.filter-index {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.filter-name {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

/* ── Interactive Hands Hint ─────────────────────────────── */

#hands-hint {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 24px;
    border-radius: 30px;
    backdrop-filter: blur(12px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#hands-hint.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.hint-text {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Info Button & Popup overlay ────────────────────────── */

#info-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    font-size: 16px;
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#info-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

#info-popup {
    position: fixed;
    bottom: 78px;
    right: 24px;
    z-index: 100;
    width: 280px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(24px);
    padding: 20px;
    display: none;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#info-popup.visible {
    display: block;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.info-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.info-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.info-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.info-bio {
    margin: 0;
    font-size: 11px;
    color: var(--text-muted);
}

.info-links {
    display: flex;
    gap: 8px;
}

.info-links a,
.info-links a:visited {
    color: var(--neon-cyan) !important;
    font-size: 11px;
    text-decoration: none;
    padding: 3px 10px;
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 20px;
    transition: all 0.2s;
    font-family: inherit;
}

.info-links a:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.info-divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 16px 0;
}

.info-desc {
    margin: 0 0 16px 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.instruction-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.instruction-row span:first-child {
    font-family: inherit;
    font-weight: 600; /* Bold step numbers for clear visual hierarchy */
    color: var(--neon-cyan);
}

.instruction-row span:last-child {
    color: var(--text-secondary);
}

.instruction-row:last-child {
    border-bottom: none;
}
