/* ==========================================================================
   Sign Language Studio - Research Lab Design System (v5.0)
   Visual Benchmark: KaptaanLM Research Labs (Pitch-Black Luxury & Metallic Silver)
   Typography: Plus Jakarta Sans (Display) + Inter (Body) + JetBrains Mono (Telemetry)
   Restraint: Zero Pill Boxes · Zero Neon Blurs · Sub-pixel Borders · Micro-spring Motion
   ========================================================================== */

:root {
    /* --- Canvas & Surfaces (True Pitch Black & Dark Charcoal) --- */
    --bg-primary: #000000;
    --bg-secondary: #08080a;
    --bg-tertiary: #0e0e12;
    --bg-surface: #121216;
    --bg-surface-elevated: #16161c;
    --bg-card: rgba(255, 255, 255, 0.022);
    --bg-card-hover: rgba(255, 255, 255, 0.045);
    --bg-card-active: rgba(255, 255, 255, 0.07);
    --bg-canvas: #000000;
    --bg-surface-1: #08080a;
    --bg-surface-2: #0e0e12;
    --bg-surface-3: #141418;

    /* --- Sub-pixel & Metallic Silver Borders --- */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-metallic: rgba(255, 255, 255, 0.22);
    --border-focus: rgba(255, 255, 255, 0.35);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.24);
    --panel-border: var(--border);

    /* --- Typography Colors --- */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;
    --text-dim: #3f3f46;

    /* --- Refined Metallic & Semantic Accents --- */
    --accent-titanium: #e4e4e7;
    --accent-silver: #f4f4f5;
    --accent-zinc: #a1a1aa;
    --accent-cool: #d4d4d8;
    --accent-emerald: #10b981;
    --accent-emerald-hover: #34d399;
    --accent-emerald-subtle: rgba(16, 185, 129, 0.10);
    --accent-emerald-border: rgba(16, 185, 129, 0.28);
    --accent-amber: #f59e0b;
    --accent-amber-subtle: rgba(245, 158, 11, 0.10);
    --accent-amber-border: rgba(245, 158, 11, 0.28);
    --accent-rose: #f43f5e;
    --accent-rose-subtle: rgba(244, 63, 94, 0.10);
    --accent-rose-border: rgba(244, 63, 94, 0.28);

    /* Clean Brand & Neutral Accents (Monochromatic Linear/Vercel standard) */
    --accent-primary: #f4f4f5;
    --accent-primary-hover: #ffffff;
    --accent-primary-light: #ffffff;
    --accent-primary-deep: #a1a1aa;
    --accent-primary-subtle: rgba(255, 255, 255, 0.05);

    /* Compatibility Aliases for Runtime JS */
    --primary-color: var(--accent-silver);
    --primary-glow: transparent;
    --accent-color: var(--accent-emerald);
    --danger-color: var(--accent-rose);
    --danger-glow: transparent;
    --warning-color: var(--accent-amber);
    --accent-success: var(--accent-emerald);
    --glow-color: transparent;

    /* Typography Fleet */
    --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, ui-monospace, monospace;

    /* Refined Architectural Radii (No Squarish Boxiness, No Cheap Pill Boxes) */
    --radius-xs: 6px;
    --radius-sm: 9px;
    --radius-md: 13px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Transitions & Shadows */
    --transition-fast: 130ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-base: 220ms cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.6);
    --shadow-raised: 0 16px 48px rgba(0, 0, 0, 0.85);
    --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.7);

    /* Layout Spacing */
    --container-max: 1320px;
}

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

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    scroll-behavior: smooth;
}

body {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 255, 255, 0.04) 0%, transparent 65%),
        radial-gradient(ellipse 50% 30% at 85% 95%, rgba(255, 255, 255, 0.015) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

::selection {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

button, select, textarea, input {
    font: inherit;
    color: inherit;
    background: transparent;
    border: none;
    outline: none;
}

button, select {
    cursor: pointer;
}

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

/* Minimalist Dark Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

.hidden {
    display: none !important;
}

.mono-code {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent-titanium);
}

kbd {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 2px 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent-silver);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Base Layout Container */
.app-container {
    width: min(calc(100% - 36px), 1340px);
    margin: 0 auto;
    padding: clamp(10px, 1.4vh, 14px) 0 clamp(12px, 1.8vh, 18px);
}

/* Unified Surface Panel */
.glass-panel {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.glass-panel:hover {
    border-color: var(--border-hover);
}

/* ==================== UNIFIED STUDIO HEADER ==================== */
.app-header, header.glass-panel, .minimal-header {
    min-height: 52px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    background: rgba(8, 8, 10, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin-bottom: 14px;
}

.header-inner, .header-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-left, .logo, .brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.brand-link:hover .brand-mark {
    border-color: var(--border-hover);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: var(--accent-silver);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.brand-mark svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.1;
}

.brand-badge {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: var(--accent-silver);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.brand-title, .header-titles h1, .header-content h1 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.brand-title-accent, .header-titles .highlight, .header-content .highlight {
    color: var(--text-secondary);
    font-weight: 600;
}

.engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

.engine-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-emerald);
}

.brand-caption, .header-titles p {
    margin: 0;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.version-pill {
    display: none;
}

/* Studio Navigation Bar */
.nav-menu, .nav-minimal {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    max-width: 100%;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.nav-link svg {
    display: block;
    width: 13px;
    height: 13px;
    stroke-width: 2;
    opacity: 0.75;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

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

.nav-link:hover svg {
    opacity: 1;
}

.nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.4);
    font-weight: 600;
}

.nav-link.active svg {
    opacity: 1;
    color: #ffffff;
}

.nav-btn-modal {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
}

/* ==================== BUTTONS & INTERACTIVE CONTROLS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 550;
    line-height: 1.2;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn svg {
    width: 13px;
    height: 13px;
    stroke-width: 2;
    flex-shrink: 0;
}

.btn.sm {
    padding: 5px 10px;
    font-size: 0.72rem;
}

/* Primary Button (Linear / Vercel Metallic Highlight) */
.btn.primary {
    color: #000000;
    background: var(--accent-silver);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn.primary:hover {
    background: #ffffff;
    border-color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.btn.primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Secondary Button */
.btn.secondary {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-hover);
    color: #ffffff;
}

.btn.secondary:active {
    background: rgba(255, 255, 255, 0.05);
}

/* Success Button */
.btn.success {
    color: #ffffff;
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--accent-emerald-border);
}

.btn.success:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--accent-emerald);
}

/* Danger Button */
.btn.danger {
    color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.08);
    border-color: var(--accent-rose-border);
}

.btn.danger:hover {
    background: rgba(244, 63, 94, 0.14);
    border-color: var(--accent-rose);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==================== MAIN VISION WORKSPACE GRID ==================== */
.vision-container {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.95fr);
    gap: 14px;
    align-items: start;
}

.left-column, .side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* ==================== CAMERA VIEWPORT & HUD ==================== */
.camera-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #040406;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.camera-wrapper.detecting {
    border-color: rgba(16, 185, 129, 0.35);
}

#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.output_canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: none;
}

/* Camera Telemetry Header Overlay */
.camera-status-bar {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.camera-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    color: var(--text-secondary);
    background: rgba(4, 4, 6, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-weight: 500;
}

.camera-badge .dot, .dot-indicator {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.dot-indicator.disconnected {
    background: var(--text-muted);
    box-shadow: none;
}

#fps-badge {
    color: var(--text-tertiary);
}

.camera-perf-select {
    padding: 4px 8px;
    background: rgba(4, 4, 6, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color var(--transition-fast);
}

.camera-perf-select:hover, .camera-perf-select:focus {
    border-color: var(--border-hover);
}

.camera-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(4, 4, 6, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-fast);
}

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

.camera-ctrl-btn.active {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
}

/* Loading & Initializing Overlay */
.status-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(4, 4, 6, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.status-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader {
    width: 26px;
    height: 26px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-silver);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
}

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

#status-text {
    max-width: 80%;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
}

/* Visibility Utilities */
.hidden {
    display: none !important;
}

/* Camera Error & Diagnostic Overlay */
.camera-error-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 4, 6, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-align: center;
}

.camera-error-overlay.hidden {
    display: none !important;
}

/* OS Controls Companion Setup Overlay (Camera Area) */
.os-companion-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 4, 8, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    text-align: center;
    overflow-y: auto;
    max-height: 100%;
    box-sizing: border-box;
    animation: fadeInOverlay 0.22s ease-out;
}

.os-companion-overlay.hidden {
    display: none !important;
}

@keyframes fadeInOverlay {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.os-companion-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: var(--accent-cyan);
    margin-bottom: 12px;
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.2);
}

.os-companion-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.os-companion-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    max-width: 440px;
    margin: 0 0 12px;
    line-height: 1.5;
}

.os-compatibility-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: var(--radius-xs);
    font-size: 0.73rem;
    color: #fbbf24;
    max-width: 460px;
    margin-bottom: 12px;
    line-height: 1.45;
    text-align: left;
}

.os-compatibility-badge svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.os-compatibility-badge strong {
    color: #fef08a;
}

.os-companion-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    max-width: 460px;
    text-align: left;
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.os-companion-card strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 6px;
}

.os-companion-card ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.6;
}

.os-companion-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.camera-error-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid var(--accent-rose-border);
    color: var(--accent-rose);
    margin-bottom: 10px;
}

.camera-error-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.camera-error-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 0 12px;
}

.camera-error-troubleshoot {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    max-width: 420px;
    text-align: left;
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.camera-error-troubleshoot strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.camera-error-troubleshoot ul {
    margin: 0;
    padding-left: 16px;
    line-height: 1.5;
}

.camera-error-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Gesture Hold Mode-Switch Overlay Indicator */
.gesture-hold-indicator {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(6, 6, 8, 0.9);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(12px);
    z-index: 6;
}

.gesture-hold-indicator.active {
    display: flex;
}

.hold-meter-track {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.hold-meter-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-emerald);
    transition: width 80ms linear;
}

.gesture-hold-text {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* ==================== QUIZ TARGET SIGN & POSE HUD ==================== */
.quiz-target-hud {
    display: grid;
    grid-template-columns: 136px 1fr;
    gap: 18px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    align-items: center;
}

.quiz-target-card {
    position: relative;
    width: 136px;
    height: 136px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.quiz-target-card.matched {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.2), inset 0 1px 0 rgba(16, 185, 129, 0.3);
}

.quiz-target-card.mismatched {
    border-color: rgba(244, 63, 94, 0.5);
    box-shadow: 0 0 24px rgba(244, 63, 94, 0.2), inset 0 1px 0 rgba(244, 63, 94, 0.3);
    animation: quizShakeCard 0.32s ease;
}

@keyframes quizShakeCard {
    0%, 100% { transform: translateX(0); }
    25%, 75% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
}

.target-badge {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.target-glyph {
    font-size: 3.6rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    transition: transform var(--transition-fast), color var(--transition-fast);
    user-select: none;
}

.target-glyph.target-change-anim {
    animation: targetEntrance 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes targetEntrance {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.quiz-target-card.matched .target-glyph {
    color: var(--accent-emerald);
    transform: scale(1.05);
}

.quiz-target-card.mismatched .target-glyph {
    color: var(--accent-rose);
}

.target-subtext {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
    font-family: var(--font-sans);
    max-width: 90%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Circular Hold Confirmation Ring */
.hold-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.hold-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 4;
}

.hold-ring-progress {
    fill: none;
    stroke: var(--accent-emerald);
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-dasharray: 402.12; /* 2 * PI * 64 */
    stroke-dashoffset: 402.12;
    transition: stroke-dashoffset 80ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hold-ring-progress.mismatched {
    stroke: var(--accent-rose);
}

.target-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.target-instructions-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
}

.target-instructions-title svg {
    color: var(--accent-silver);
}

.target-instructions-text {
    font-size: 0.84rem;
    color: var(--text-primary);
    line-height: 1.5;
    font-weight: 400;
}

.target-meta-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
    flex-wrap: wrap;
}

.target-hints-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-weight: 500;
}

/* ==================== QUIZ TELEMETRY DECK ==================== */
.telemetry-deck {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.section-title svg {
    color: var(--text-secondary);
}

.status-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.status-badge.connected {
    color: var(--accent-emerald);
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.08);
}

.status-badge.disconnected {
    color: var(--text-tertiary);
}

/* Live Stats Grid */
.quiz-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.quiz-stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quiz-stat-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.quiz-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.quiz-stat-value.highlight-green {
    color: var(--accent-emerald);
}

.quiz-stat-value.acc-high {
    color: var(--accent-emerald);
}
.quiz-stat-value.acc-mid {
    color: var(--accent-amber);
}
.quiz-stat-value.acc-low {
    color: var(--accent-rose);
}

.streak-container {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.flame-icon {
    color: var(--accent-amber);
}

/* Speed Run Timer */
.quiz-timer-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timer-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.timer-value {
    font-weight: 600;
    color: var(--text-primary);
}

.timer-track-quiz {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.timer-fill-quiz {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f4f4f5, #10b981);
    border-radius: var(--radius-full);
    transition: width 1s linear;
}

.timer-fill-quiz.urgent {
    background: var(--accent-rose);
}

/* Primary Action Controls */
.sentence-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sentence-controls .btn {
    flex: 1;
}

.telemetry-section-divider {
    height: 1px;
    background: var(--border);
    margin: 1px 0;
}

/* Segmented Challenge Setup */
.quiz-config-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-label {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 2px;
    gap: 2px;
    width: 100%;
}

.segmented-control .pill-btn {
    flex: 1;
    text-align: center;
    padding: 5px 6px;
    border: 0;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.74rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.segmented-control .pill-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.segmented-control .pill-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.09);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Personal Records Section */
.records-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.records-section .data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.records-section .data-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.records-section .data-label {
    font-size: 0.62rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.records-section .data-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Simulation & Testing Deck */
.sim-utility-deck {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sim-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.sim-shortcut-badge {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.sim-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.sim-correct-action {
    border-color: rgba(16, 185, 129, 0.22) !important;
    color: var(--accent-emerald) !important;
}

.sim-correct-action:hover {
    background: rgba(16, 185, 129, 0.08) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

.sim-wrong-action {
    border-color: rgba(244, 63, 94, 0.22) !important;
    color: var(--accent-rose) !important;
}

.sim-wrong-action:hover {
    background: rgba(244, 63, 94, 0.08) !important;
    border-color: rgba(244, 63, 94, 0.4) !important;
}

/* ==================== ROUND SUMMARY MODAL ==================== */
.quiz-summary-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.quiz-summary-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.summary-card {
    width: min(90vw, 400px);
    background: #09090c;
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: modalPop 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.summary-trophy {
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-metallic);
    color: var(--accent-silver);
    display: grid;
    place-items: center;
}

.summary-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.02em;
}

.summary-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 4px 0;
}

.summary-metric {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px;
    text-align: center;
}

.summary-metric-val {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-mono);
}

.summary-metric-lbl {
    font-size: 0.62rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
    margin-top: 2px;
}

.summary-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* ==================== MAIN DETECTOR WORKSPACE (index.html) ==================== */
.mode-selector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.mode-pills {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.mode-btn svg {
    width: 13px;
    height: 13px;
    stroke-width: 2;
    opacity: 0.7;
}

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

.mode-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

.mode-btn.active svg {
    opacity: 1;
}

.gesture-switch-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    padding-right: 6px;
}

/* Detection Strip & Output HUD */
.result-panel {
    display: grid;
    grid-template-columns: 68px 1fr;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.letter-display {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: border-color var(--transition-fast);
}

.letter-display.active {
    border-color: rgba(16, 185, 129, 0.5);
}

.letter-display.transitioning {
    border-color: var(--border-focus);
}

#detected-letter {
    color: var(--text-primary);
    font-size: 2.3rem;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    font-family: var(--font-display);
}

.letter-display.active #detected-letter {
    color: var(--accent-emerald);
}

.detection-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

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

.confidence-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.confidence-bar {
    flex: 1;
    height: 5px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

.confidence-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-emerald);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.confidence-text {
    min-width: 36px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ==================== SPEECH-TO-SIGN PANEL ==================== */
.speech-to-sign-panel {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.desc {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.speech-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.speed-select {
    padding: 5px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 0.74rem;
    cursor: pointer;
}

.speech-transcript-box {
    min-height: 44px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
}

.transcript-placeholder {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
}

.transcript-text {
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
}

.sign-player-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.active-sign-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.active-sign-visual {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-xs);
}

.active-sign-glyph {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
}

.active-sign-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.active-sign-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
}

.active-sign-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.sign-sequence-timeline {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
}

/* Token stream badges */
.sign-token {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sign-token.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.35);
    color: var(--accent-emerald);
    font-weight: 600;
}

/* ==================== OS GESTURE CONTROLLER HUD ==================== */
.vision-container > .os-control-panel,
.os-control-panel {
    grid-column: 1 / -1;
    width: 100%;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #08080b;
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.2s ease;
}

.os-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.os-bridge-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.os-hud-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.os-hud-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.os-hud-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
}

.os-hud-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-weight: 600;
}

.os-hud-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.os-hud-value.mono {
    font-family: var(--font-mono);
    font-size: 0.92rem;
}

.os-hud-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.meter-bar-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.meter-bar-fill {
    height: 100%;
    background: var(--accent-emerald);
    transition: width 0.15s ease;
}

.os-quick-actions-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 2px;
}

.os-section-subhead {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-weight: 600;
}

.os-quick-btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.os-quick-btn {
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 500;
    gap: 8px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.os-quick-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

.os-settings-drawer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.os-setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.os-setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.os-setting-badge {
    font-family: var(--font-mono);
    color: var(--accent-silver);
    font-weight: 600;
    font-size: 0.74rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.os-range-input {
    width: 100%;
    height: 5px;
    accent-color: var(--accent-silver);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
}

/* ==================== HARDWARE GLOVE BLE PANEL ==================== */
.hardware-panel {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.data-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.data-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.data-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.data-box.small .data-value {
    font-size: 0.88rem;
}

/* ==================== SENTENCE STREAM & PREDICTIVE CHIPS ==================== */
.sentence-panel {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#sentence-display {
    min-height: 52px;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
}

#sentence-display:focus-within {
    border-color: var(--border-hover);
}

#sentence-display .word-tag {
    padding: 2px 6px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 2px solid var(--accent-silver);
    font-size: 0.86rem;
    font-weight: 500;
    border-radius: 2px 2px 0 0;
}

.autocomplete-dropdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-xs);
    animation: fadeIn 120ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

.autocomplete-chip {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.autocomplete-chip:hover, .autocomplete-chip.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-metallic);
    color: #ffffff;
}

.sentence-instructions {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    line-height: 1.45;
}

/* Multi-Language Translation */
.translation-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.translation-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.translation-controls select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.76rem;
    cursor: pointer;
}

#translated-output {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.84rem;
    color: var(--text-primary);
}

/* ==================== CALIBRATION & KNN PANEL ==================== */
.training-panel {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.train-controls {
    display: flex;
    gap: 8px;
}

.train-controls select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.76rem;
}

.stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.storage-controls {
    display: flex;
    gap: 8px;
}

.storage-controls .btn {
    flex: 1;
}

/* ==================== SYSTEM STATUS FOOTER ==================== */
.footer-status {
    margin-top: 14px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(8, 8, 12, 0.82);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-tertiary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.footer-separator {
    width: 1px;
    height: 10px;
    background: var(--border);
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* ==================== SIGN DICTIONARY MODAL ==================== */
.dictionary-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.dictionary-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.dictionary-card {
    width: min(94vw, 1040px);
    max-height: 88vh;
    background: #08080b;
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dict-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
}

.dict-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.dict-subtitle {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 2px 0 0;
}

.btn-close-dict {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-close-dict:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

.dict-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.3);
}

.dict-tabs {
    display: flex;
    gap: 4px;
}

.dict-tab {
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dict-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.dict-tab.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

.dict-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
}

.dict-search-box input {
    font-size: 0.76rem;
    color: var(--text-primary);
    width: 180px;
}

.dict-grid {
    padding: 18px 22px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.dict-sign-card, .dict-item-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-fast);
}

.dict-sign-card:hover, .dict-item-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.dict-card-top {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dict-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dict-badge, .dict-item-badge {
    font-size: 0.62rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-tertiary);
}

.dict-token-id {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-silver);
}

.dict-card-visual, .dict-img-box {
    width: 100%;
    aspect-ratio: 1.1;
    background: #ffffff;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: zoom-in;
    overflow: hidden;
}

.dict-card-visual img, .dict-img-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform var(--transition-fast);
}

.dict-card-visual:hover img {
    transform: scale(1.05);
}

.dict-card-name, .dict-item-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dict-card-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex: 1;
}

.dict-card-tip {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    font-style: italic;
    line-height: 1.35;
}

.btn-try-sign {
    width: 100%;
    margin-top: 4px;
    font-size: 0.72rem;
    padding: 5px 8px;
}

/* Lightbox Modal */
.dict-lightbox-modal,
.dict-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(24px);
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.dict-lightbox-modal.open,
.dict-lightbox.open {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.dict-lightbox-card {
    position: relative;
    width: min(90vw, 400px);
    background: #0a0a0e;
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-xl);
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    animation: modalPop 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dict-lightbox-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dict-lightbox-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.dict-lightbox-img-wrap {
    width: 160px;
    height: 160px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    margin: 4px 0;
}

.dict-lightbox-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.dict-chart-view {
    padding: 20px;
    overflow-y: auto;
}

/* ==================== TWO-WAY COMMUNICATION ROOM MODAL ==================== */
.two-way-card {
    width: min(94vw, 980px);
    max-height: 88vh;
}

.two-way-view {
    padding: 18px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.two-way-role-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.two-way-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--font-mono);
}

.two-way-role-pills {
    display: flex;
    gap: 4px;
}

.two-way-role-btn {
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    font-size: 0.74rem;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.two-way-role-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.two-way-role-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

.two-way-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.two-way-card-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.two-way-box-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.two-way-box-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--accent-silver);
    flex-shrink: 0;
}

.two-way-box-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.two-way-box-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.room-code-badge-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
}

.room-code-label {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.room-code-badge {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.08em;
}

.room-share-actions {
    display: flex;
    gap: 6px;
}

.room-share-actions .btn {
    flex: 1;
}

.room-wait-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.two-way-join-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 2px;
}

.join-input-wrap {
    width: 100%;
    position: relative;
    display: block;
}

.join-code-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.08em;
    display: block;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.join-code-input:focus {
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

#two-way-join-btn {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    display: inline-flex;
    margin: 0;
}

/* Active Two-Way Call View */
.two-way-active-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.two-way-stream-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.two-way-stream-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stream-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stream-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.two-way-message-display {
    min-height: 80px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.84rem;
}

.two-way-voice-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.two-way-text-bar {
    display: flex;
    gap: 6px;
}

.two-way-input {
    flex: 1;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.76rem;
    color: var(--text-primary);
}

.two-way-quick-phrases {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.quick-phrase-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.quick-phrase-chip {
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-phrase-chip:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

/* ==================== OS CHEATSHEET MODAL ==================== */
.os-guide-grid {
    padding: 22px 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (max-width: 680px) {
    .os-guide-grid {
        grid-template-columns: 1fr;
        padding: 14px;
        gap: 10px;
    }
}

.os-guide-card {
    display: flex;
    gap: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.os-guide-card:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.045);
    transform: translateY(-1px);
}

.os-guide-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--accent-silver);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.os-guide-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.os-guide-gesture-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
}

.os-guide-badge {
    align-self: flex-start;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.os-guide-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-top: 2px;
}

.os-guide-tip {
    font-size: 0.68rem;
    color: var(--accent-emerald);
    font-style: italic;
    margin-top: 3px;
}

/* ==================== CHAT ASSISTANT (chat.html) ==================== */
html:has(body.chat-body) {
    height: 100%;
    overflow: hidden;
}

body.chat-body {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-body .app-container {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    padding: 10px 0 10px;
    box-sizing: border-box;
    overflow: hidden;
}

.chat-body .app-header {
    margin-bottom: 10px;
    flex-shrink: 0;
}

.chat-page-minimal {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.chat-container-minimal {
    width: min(100%, 860px);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    gap: 0;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 8px 12px;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.chat-message.ai-message {
    align-self: flex-start;
}

.chat-message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar-minimal {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.ai-avatar-minimal {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--accent-silver);
}

.user-avatar-minimal {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.bubble-minimal {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    line-height: 1.5;
}

.ai-message .bubble-minimal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.user-message .bubble-minimal {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.command-bar-wrapper {
    flex-shrink: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 75%, transparent);
    padding: 12px 0 8px;
    margin-top: auto;
}

.command-bar-minimal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
    transition: border-color var(--transition-fast);
}

.command-bar-minimal:focus-within {
    border-color: var(--border-focus);
}

.command-bar-minimal textarea {
    flex: 1;
    font-size: 0.84rem;
    color: var(--text-primary);
    resize: none;
    line-height: 1.4;
    padding: 4px 0;
    max-height: 120px;
}

.command-bar-minimal textarea::placeholder {
    color: var(--text-muted);
}

.icon-btn-minimal {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.send-active {
    color: #000000;
    background: var(--accent-silver);
}

.send-active:hover {
    background: #ffffff;
    color: #000000;
}

.attachment-card-minimal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    align-self: flex-start;
}

.attachment-image-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
}

.attachment-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn-minimal {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.attachment-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.ai-disclaimer-minimal {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
}

.nav-signout, .btn-signout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-signout svg, .btn-signout svg {
    display: block;
    width: 14px;
    height: 14px;
    stroke-width: 2;
    opacity: 0.7;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.nav-signout:hover, .btn-signout:hover {
    color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.2);
}

.nav-signout:hover svg, .btn-signout:hover svg {
    opacity: 1;
}

/* ==================== ACCESSIBILITY & FOCUS MANAGEMENT ==================== */
a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
    outline: 2px solid var(--border-focus) !important;
    outline-offset: 2px !important;
}

/* ==================== RESPONSIVE BREAKPOINTS (TABLETS & MOBILE) ==================== */
@media (max-width: 1140px) {
    .header-titles .brand-caption {
        display: none !important;
    }
}

@media (max-width: 960px) {
    .engine-badge {
        display: none !important;
    }
}

@media (max-width: 1100px) and (min-width: 861px) {
    .vision-container {
        grid-template-columns: minmax(0, 1.3fr) minmax(310px, 0.9fr);
        gap: 12px;
    }
    .os-hud-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 860px) {
    .vision-container {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .os-hud-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .os-settings-drawer {
        grid-template-columns: 1fr;
    }

    .app-header, header.glass-panel, .minimal-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px 12px;
    }

    .header-inner, .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .header-left, .logo, .brand-link {
        justify-content: space-between;
        width: 100%;
    }

    .nav-menu, .nav-minimal {
        width: 100%;
        justify-content: flex-start;
        padding: 3px;
        gap: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-menu::-webkit-scrollbar, .nav-minimal::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        padding: 5px 8px;
        font-size: 0.73rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        width: calc(100% - 20px);
        padding: 8px 0 16px;
    }

    .quiz-target-hud {
        grid-template-columns: 120px 1fr;
        gap: 14px;
        padding: 12px 14px;
    }

    .quiz-target-card {
        width: 120px;
        height: 120px;
    }

    .two-way-setup-grid, .two-way-stream-grid {
        grid-template-columns: 1fr;
    }

    .footer-status {
        gap: 8px 12px;
        padding: 8px 12px;
        margin-top: 12px;
    }
}

@media (max-width: 540px) {
    .quiz-target-hud {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 12px;
        padding: 14px 12px;
    }

    .target-details {
        align-items: center;
        text-align: center;
    }

    .target-meta-row {
        justify-content: center;
    }

    .quiz-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .quiz-stat-card {
        padding: 6px 8px;
    }

    .quiz-stat-value {
        font-size: 1.15rem;
    }

    .sentence-controls {
        flex-direction: column;
    }

    .sim-btn-row {
        grid-template-columns: 1fr;
    }

    .footer-status {
        flex-direction: row;
        justify-content: center;
        gap: 6px 10px;
    }

    .footer-separator {
        display: none;
    }
}

/* ==================== B2B SAAS SINGLE-PAGE LANDING (landing.html) ==================== */
.landing-body {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    overflow: hidden;
    position: relative;
    background-color: #000000;
}

#neural-bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.landing-grid-overlay {
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.05) 0%, transparent 55%),
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 100% 100%, 48px 48px, 48px 48px;
    pointer-events: none;
    z-index: 1;
}

.landing-viewport {
    position: relative;
    z-index: 2;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(8px, 1.4vh, 16px) 0 clamp(8px, 1.4vh, 14px);
    width: min(calc(100% - 36px), 1340px);
    margin: 0 auto;
    box-sizing: border-box;
}

.landing-header {
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

.landing-hero-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.88fr);
    gap: clamp(16px, 2.8vw, 36px);
    align-items: center;
    flex: 1;
    min-height: 0;
    padding: 0;
}

.landing-left {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.4vh, 14px);
    max-width: 620px;
}

.landing-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 11px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.landing-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.2vw, 3.1rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.035em;
    color: var(--text-primary);
    margin: 0;
}

.text-gradient-silver {
    background: linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-subtitle {
    font-size: clamp(0.82rem, 1vw, 0.96rem);
    line-height: 1.46;
    color: var(--text-secondary);
    margin: 0;
    max-width: 560px;
}

.landing-cta-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.landing-cta-group .btn {
    padding: clamp(7px, 1.1vh, 10px) 18px;
    font-size: 0.84rem;
}

.landing-specs-row {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2vw, 24px);
    padding-top: clamp(6px, 1vh, 10px);
    border-top: 1px solid var(--border-subtle);
    margin-top: 2px;
}

.landing-spec-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.landing-spec-val {
    font-family: var(--font-mono);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    font-weight: 700;
    color: var(--accent-silver);
}

.landing-spec-lbl {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.landing-right {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.landing-showcase-card {
    background: rgba(10, 10, 14, 0.88);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    width: 100%;
    max-width: 430px;
    padding: clamp(12px, 1.6vh, 16px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.2vh, 12px);
    position: relative;
}

.landing-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.landing-card-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-titanium);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.landing-hand-canvas-wrap {
    position: relative;
    width: 100%;
    height: clamp(110px, 17vh, 155px);
    background: #050507;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.landing-hand-svg {
    width: 80%;
    height: 80%;
    overflow: visible;
}

.landing-features-matrix {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.landing-matrix-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.landing-matrix-label {
    font-size: 0.64rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.landing-matrix-value {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
}

.landing-card-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--accent-silver);
    font-size: 0.72rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.landing-card-action:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
    color: #ffffff;
}

.landing-footer-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: clamp(6px, 1vh, 8px);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.7rem;
    color: var(--text-tertiary);
    min-height: 22px;
    flex-shrink: 0;
}

.landing-footer-chips {
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-footer-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
}

@media (max-width: 1024px) {
    .landing-hero-stage {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
        gap: 18px;
    }
    .landing-showcase-card {
        max-width: 380px;
    }
    .landing-hand-canvas-wrap {
        height: clamp(100px, 14vh, 130px);
    }
}

@media (max-width: 820px) {
    .landing-hero-stage {
        grid-template-columns: 1fr;
        gap: 12px;
        align-content: center;
    }
    .landing-right {
        display: none;
    }
    .landing-footer-chips {
        gap: 8px;
        font-size: 0.66rem;
    }
}

/* ==================== ABOUT & RESEARCH DOSSIER (about.html) ==================== */
.about-body {
    min-height: 100vh;
    overflow-x: hidden;
    background-color: #000000;
    position: relative;
}

.about-viewport {
    position: relative;
    z-index: 2;
    width: min(calc(100% - 48px), 1340px);
    margin: 0 auto;
    padding: 16px 0 28px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: space-between;
}

.about-content-wrap {
    display: flex;
    flex-direction: column;
    gap: 34px;
    padding: 16px 0;
}

.about-hero-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 820px;
}

.about-pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.about-card {
    background: rgba(10, 10, 14, 0.88);
    border: 1px solid var(--border-metallic);
    border-radius: var(--radius-xl);
    padding: 24px 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.about-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.about-card-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-titanium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.about-card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.about-card-text {
    font-size: 0.86rem;
    line-height: 1.62;
    color: var(--text-secondary);
    margin: 0;
    flex: 1;
}

.about-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.about-notes-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
}

.about-notice-box {
    background: rgba(14, 14, 18, 0.82);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.about-notice-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-notice-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.about-notice-text {
    font-size: 0.83rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.about-notice-text strong {
    color: var(--accent-silver);
}

.about-specs-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.about-specs-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.about-specs-lbl {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.about-specs-val {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.about-specs-val:hover {
    color: var(--accent-silver);
}

.about-cta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* Prefers-Reduced-Motion Policy */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
        transform: none !important;
    }
}
