/* ============================================================
   SignBridge AI Pro – Design System & Styles
   ============================================================ */

/* ===== CSS Variables ===== */
:root {
    --bg-primary: #07060e;
    --bg-secondary: #0d0b1a;
    --bg-card: rgba(16, 14, 35, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    --accent-primary: #6C63FF;
    --accent-secondary: #00D2FF;
    --accent-gradient: linear-gradient(135deg, #6C63FF 0%, #00D2FF 100%);
    --accent-gradient-hover: linear-gradient(135deg, #7B73FF 0%, #1ADDFF 100%);
    --accent-magenta: #FF006E;
    --accent-green: #00E676;
    --accent-amber: #FFD600;
    --accent-orange: #FF6D00;

    --text-primary: #f0f0f5;
    --text-secondary: #9896b0;
    --text-dim: #5c5a72;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.15);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* High contrast mode */
.high-contrast {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: rgba(20, 20, 20, 0.95);
    --border-glass: rgba(255, 255, 255, 0.25);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
}

/* Large text mode */
.large-text {
    font-size: 18px !important;
}

.large-text .panel-title h2 {
    font-size: 1.2rem !important;
}

.large-text .output-text {
    font-size: 1.15rem !important;
}

.large-text textarea {
    font-size: 1.1rem !important;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

::selection {
    background: rgba(108, 99, 255, 0.4);
    color: #fff;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(108, 99, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 99, 255, 0.5);
}

/* ===== Particle Background ===== */
#particleBg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== SPLASH SCREEN ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

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

.splash-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    animation: splashPulse 2s ease-in-out infinite;
}

.splash-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(108, 99, 255, 0.5));
}

@keyframes splashPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

.splash-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.splash-title span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.splash-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 40px;
}

.splash-loader {
    width: 280px;
    margin: 0 auto;
}

.splash-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.splash-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.splash-status {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* ===== HIDDEN UTILITY ===== */
.hidden {
    display: none !important;
}

/* ===== APP LAYOUT ===== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
}

/* ===== HEADER ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(7, 6, 14, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 100;
    min-height: 56px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 99, 255, 0.12);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(108, 99, 255, 0.2);
}

.logo-mark svg {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 0 6px rgba(108, 99, 255, 0.4));
}

.header-title h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.header-title .accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    overflow: hidden;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

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

.mode-btn.active {
    background: rgba(108, 99, 255, 0.15);
    color: var(--text-primary);
}

.mode-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.live-dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

.demo-dot {
    background: var(--accent-amber);
    box-shadow: 0 0 8px rgba(255, 214, 0, 0.5);
}

/* Header Buttons */
.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.icon-btn:hover {
    border-color: var(--border-glass-hover);
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== PIPELINE BAR ===== */
.pipeline-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 24px;
    background: rgba(13, 11, 26, 0.6);
    border-bottom: 1px solid var(--border-glass);
}

.pipeline-stage {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.pipeline-stage.active {
    color: var(--text-primary);
    border-color: rgba(108, 99, 255, 0.4);
    background: rgba(108, 99, 255, 0.1);
}

.pipeline-stage.completed {
    color: var(--accent-green);
    border-color: rgba(0, 230, 118, 0.3);
    background: rgba(0, 230, 118, 0.08);
}

.stage-icon {
    font-size: 0.9rem;
}

.stage-glow {
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.pipeline-stage.active .stage-glow {
    opacity: 0.08;
    animation: glowPulse 1.5s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.05;
    }

    50% {
        opacity: 0.12;
    }
}

.pipeline-arrow {
    color: var(--text-dim);
    font-size: 0.9rem;
    opacity: 0.4;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    gap: 0;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}

/* ===== PANELS ===== */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition-normal);
}

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

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

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.panel-title h2 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Panel Divider */
.panel-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 8px;
    flex-shrink: 0;
}

.divider-line {
    width: 2px;
    flex: 1;
    background: linear-gradient(to bottom, transparent, var(--border-glass), transparent);
}

.divider-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ===== CAMERA CONTAINER ===== */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    max-height: 280px;
    background: #0a0917;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1);
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-normal);
    background: radial-gradient(ellipse at center, rgba(108, 99, 255, 0.05), transparent);
}

.camera-placeholder:hover {
    background: radial-gradient(ellipse at center, rgba(108, 99, 255, 0.1), transparent);
}

.camera-placeholder-icon {
    width: 64px;
    height: 64px;
    color: var(--text-dim);
    opacity: 0.6;
    transition: var(--transition-normal);
}

.camera-placeholder:hover .camera-placeholder-icon {
    opacity: 1;
    color: var(--accent-primary);
    transform: scale(1.1);
}

.camera-placeholder-icon svg {
    width: 100%;
    height: 100%;
}

.camera-placeholder p {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.camera-hint {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* Detection Overlay */
.detection-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.detection-box {
    position: absolute;
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.25), inset 0 0 15px rgba(0, 230, 118, 0.05);
    transition: all 0.3s ease;
    /* Will be positioned dynamically */
    top: 15%;
    left: 20%;
    width: 60%;
    height: 65%;
}

.detection-label {
    position: absolute;
    top: -28px;
    left: 0;
    background: var(--accent-green);
    color: #000;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-family: var(--font-mono);
}

/* Camera Controls */
.camera-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

.cam-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.cam-btn:hover {
    background: rgba(108, 99, 255, 0.3);
    border-color: var(--accent-primary);
}

.cam-btn svg {
    width: 16px;
    height: 16px;
}

/* Confidence Badge */
.confidence-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 230, 118, 0.3);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    text-align: center;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s;
}

.confidence-badge.visible {
    opacity: 1;
}

.conf-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-mono);
}

.conf-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ===== RECOGNITION FEED ===== */
.recognition-feed {
    flex-shrink: 0;
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.feed-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clear-btn {
    font-size: 0.7rem;
    color: var(--text-dim);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    transition: color 0.2s;
}

.clear-btn:hover {
    color: var(--accent-magenta);
}

.feed-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 36px;
}

.feed-empty {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.feed-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    animation: feedIn 0.3s ease;
}

@keyframes feedIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.feed-item .fi-conf {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--accent-green);
}

/* ===== OUTPUT PANEL ===== */
.output-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px;
    flex-shrink: 0;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.output-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.output-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.action-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-glass-hover);
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.speak-btn:hover {
    color: var(--accent-secondary);
    border-color: rgba(0, 210, 255, 0.3);
}

.speak-btn.speaking {
    color: var(--accent-secondary);
    border-color: rgba(0, 210, 255, 0.5);
    background: rgba(0, 210, 255, 0.1);
    animation: speakPulse 0.8s ease-in-out infinite;
}

@keyframes speakPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.2);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(0, 210, 255, 0);
    }
}

.output-text {
    font-size: 1rem;
    line-height: 1.6;
    min-height: 40px;
    color: var(--text-primary);
}

.output-placeholder {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.85rem;
}

/* ===== INPUT AREA ===== */
.input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.input-wrapper {
    position: relative;
}

.input-wrapper textarea {
    width: 100%;
    padding: 12px;
    padding-right: 80px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    resize: none;
    transition: var(--transition-normal);
    outline: none;
}

.input-wrapper textarea:focus {
    border-color: rgba(108, 99, 255, 0.4);
    background: rgba(108, 99, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.08);
}

.input-wrapper textarea::placeholder {
    color: var(--text-dim);
}

.input-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.char-count {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
}

.mic-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.mic-btn:hover {
    background: rgba(255, 0, 110, 0.1);
    border-color: rgba(255, 0, 110, 0.3);
    color: var(--accent-magenta);
}

.mic-btn.recording {
    background: rgba(255, 0, 110, 0.2);
    border-color: var(--accent-magenta);
    color: var(--accent-magenta);
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 110, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 0, 110, 0);
    }
}

.mic-btn svg {
    width: 16px;
    height: 16px;
}

/* Translate Button */
.translate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}

.translate-btn:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3);
}

.translate-btn:active {
    transform: translateY(0);
}

.translate-icon {
    font-size: 1rem;
    transition: transform 0.5s;
}

.translate-btn:hover .translate-icon {
    transform: rotate(180deg);
}

.btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

/* ===== ISL STRUCTURE ===== */
.isl-structure {
    flex-shrink: 0;
}

.isl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.isl-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.isl-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--accent-amber);
    background: rgba(255, 214, 0, 0.1);
    border: 1px solid rgba(255, 214, 0, 0.2);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    cursor: help;
}

.isl-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.isl-token {
    padding: 5px 12px;
    background: rgba(0, 210, 255, 0.08);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent-secondary);
    animation: tokenIn 0.3s ease;
    animation-fill-mode: both;
}

.isl-token.active {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--accent-secondary);
    color: #fff;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
}

@keyframes tokenIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== AVATAR CONTAINER ===== */
.avatar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #08071a;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    overflow: hidden;
    min-height: 200px;
    position: relative;
}

#avatarCanvas {
    width: 100%;
    flex: 1;
    display: block;
}

.avatar-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--border-glass);
}

.current-sign {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-secondary);
}

/* Avatar Controls */
.avatar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-glass);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: help;
}

.speed-control label {
    font-size: 0.72rem;
    color: var(--text-dim);
}

#speedSlider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

#speedSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
}

#speedValue {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--accent-secondary);
    min-width: 24px;
}

.avatar-actions {
    display: flex;
    gap: 4px;
}

.av-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.av-btn:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.av-btn svg {
    width: 14px;
    height: 14px;
}

/* ===== STATUS BAR ===== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: rgba(7, 6, 14, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    font-size: 0.72rem;
    z-index: 100;
    min-height: 40px;
}

.status-left,
.status-center,
.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.pulse-ring {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    position: relative;
}

.pulse-ring::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent-green);
    animation: ringPulse 2s ease-out infinite;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.status-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.status-metric {
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-label {
    color: var(--text-dim);
}

.metric-value {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-weight: 500;
}

.env-badges {
    display: flex;
    gap: 6px;
}

.env-badge {
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    color: var(--text-dim);
    cursor: help;
    transition: var(--transition-normal);
}

.env-badge:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.env-badge.active {
    border-color: rgba(108, 99, 255, 0.3);
    color: var(--accent-primary);
    background: rgba(108, 99, 255, 0.06);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
    padding: 24px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    z-index: 1;
}

.modal-close:hover {
    background: rgba(255, 0, 110, 0.15);
    border-color: rgba(255, 0, 110, 0.3);
    color: var(--accent-magenta);
}

.modal-header {
    padding: 24px 24px 12px;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-body {
    padding: 12px 24px 24px;
}

/* Impact Modal */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.impact-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: var(--transition-normal);
}

.impact-card:hover {
    border-color: rgba(108, 99, 255, 0.3);
    background: rgba(108, 99, 255, 0.05);
    transform: translateY(-2px);
}

.impact-number {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.impact-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.impact-source {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-style: italic;
}

.impact-scenarios {
    margin-top: 16px;
}

.impact-scenarios h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.scenario {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--accent-primary);
}

.scenario-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.scenario div {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.scenario strong {
    color: var(--text-primary);
}

.impact-footer {
    margin-top: 20px;
    padding: 16px;
    background: rgba(108, 99, 255, 0.05);
    border: 1px solid rgba(108, 99, 255, 0.15);
    border-radius: var(--radius-md);
    text-align: center;
}

.impact-footer p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.impact-footer strong {
    color: var(--text-primary);
}

.impact-footer em {
    color: var(--accent-secondary);
    font-style: normal;
    font-weight: 600;
}

/* Settings Modal */
.settings-group {
    margin-bottom: 20px;
}

.settings-group h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-glass);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

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

.setting-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.setting-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: var(--transition-normal);
}

.toggle input:checked+.toggle-slider {
    background: var(--accent-gradient);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

/* Select */
.setting-select {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

.setting-select:focus {
    border-color: rgba(108, 99, 255, 0.4);
}

.setting-select option {
    background: var(--bg-secondary);
}

/* Range */
.setting-range {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.setting-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
}

/* Architecture Modal */
.arch-diagram {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    white-space: pre;
}

/* ===== DEMO MODE OVERLAY ===== */
.demo-overlay {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.demo-spotlight {
    position: absolute;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--accent-amber);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 214, 0, 0.3);
    z-index: 8001;
}

.demo-tooltip {
    position: absolute;
    z-index: 8002;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    animation: demoTooltipIn 0.4s ease;
}

@keyframes demoTooltipIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.demo-step-counter {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--accent-amber);
    margin-bottom: 8px;
}

.demo-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.demo-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.demo-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.demo-btn-secondary {
    padding: 6px 16px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
}

.demo-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.demo-btn-primary {
    padding: 6px 20px;
    border: none;
    background: var(--accent-gradient);
    color: #fff;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
}

.demo-btn-primary:hover {
    filter: brightness(1.1);
}

/* ===== TOOLTIP SYSTEM ===== */
.app-tooltip {
    position: fixed;
    z-index: 9000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    max-width: 260px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    pointer-events: none;
    animation: tooltipIn 0.2s ease;
}

@keyframes tooltipIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-arrow {
    position: absolute;
    top: -5px;
    left: 20px;
    width: 10px;
    height: 10px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    border-top: 1px solid var(--border-glass);
    transform: rotate(45deg);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 60px;
    right: 24px;
    z-index: 9500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 0.82rem;
    min-width: 260px;
    animation: toastIn 0.4s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-msg {
    color: var(--text-secondary);
    line-height: 1.3;
}

.toast.success {
    border-left: 3px solid var(--accent-green);
}

.toast.info {
    border-left: 3px solid var(--accent-secondary);
}

.toast.warning {
    border-left: 3px solid var(--accent-amber);
}

/* Sentence highlight animation */
.sentence-highlight {
    animation: sentenceGlow 1.5s ease-out;
}

@keyframes sentenceGlow {
    0% {
        background: rgba(0, 230, 118, 0.15);
        box-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
    }

    100% {
        background: transparent;
        box-shadow: none;
    }
}

/* ===== LOW LIGHT MODE FILTER ===== */
.camera-container.low-light video {
    filter: brightness(1.5) contrast(1.2);
}

.camera-container.low-light::after {
    content: '🌙 Low Light Enhanced';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.65rem;
    color: var(--accent-amber);
    background: rgba(0, 0, 0, 0.6);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    z-index: 5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    .app {
        height: auto;
        min-height: 100vh;
    }

    .main-content {
        flex-direction: column;
        overflow-y: visible;
        overflow-x: hidden;
        padding: 12px;
    }

    .panel {
        min-height: auto;
        overflow: visible;
    }

    .panel-divider {
        flex-direction: row;
        padding: 8px 0;
    }

    .divider-line {
        width: auto;
        height: 2px;
        flex: 1;
    }

    .pipeline-bar {
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 8px 12px;
        gap: 6px;
    }

    .pipeline-bar::-webkit-scrollbar {
        display: none;
    }

    .pipeline-stage {
        white-space: nowrap;
        padding: 4px 10px;
        font-size: 0.72rem;
    }

    .status-bar {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
        padding: 8px 12px;
    }

    .status-center {
        order: -1;
    }

    .status-left,
    .status-center,
    .status-right {
        gap: 8px;
        flex-wrap: wrap;
    }

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

    .camera-container {
        max-height: 260px;
        aspect-ratio: 4/3;
    }

    .header-center {
        display: none;
    }

    .avatar-container {
        min-height: 280px;
    }

    #avatarCanvas {
        min-height: 240px;
    }

    .modal {
        max-height: 90vh;
        margin: 12px;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 14px;
    }

    .app-header {
        padding: 8px 12px;
        min-height: 48px;
    }

    .main-content {
        padding: 8px;
        gap: 0;
    }

    .panel {
        padding: 12px;
        border-radius: var(--radius-md);
        gap: 10px;
    }

    .header-title h1 {
        font-size: 0.95rem;
    }

    .header-badge {
        display: none;
    }

    .panel-title h2 {
        font-size: 0.82rem;
    }

    .panel-icon {
        font-size: 1rem;
    }

    .camera-container {
        max-height: 220px;
    }

    .translate-btn {
        padding: 14px;
        font-size: 0.95rem;
    }

    .mic-btn {
        width: 40px;
        height: 40px;
    }

    .mic-btn svg {
        width: 20px;
        height: 20px;
    }

    .icon-btn {
        width: 38px;
        height: 38px;
    }

    .cam-btn {
        width: 38px;
        height: 38px;
    }

    .feed-item {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .input-wrapper textarea {
        font-size: 1rem;
        padding: 14px;
        padding-right: 90px;
    }

    .toast-container {
        bottom: 50px;
        right: 8px;
        left: 8px;
    }

    .toast {
        min-width: auto;
        width: 100%;
        font-size: 0.78rem;
    }

    .env-badges {
        flex-wrap: wrap;
        gap: 4px;
    }

    .env-badge {
        font-size: 0.62rem;
        padding: 2px 6px;
    }

    .status-metric {
        font-size: 0.65rem;
    }

    .modal {
        max-width: none;
        margin: 8px;
        border-radius: var(--radius-md);
    }

    .modal-overlay {
        padding: 8px;
    }

    .arch-diagram {
        font-size: 0.55rem;
    }

    .setting-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .setting-select {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .app-header {
        padding: 6px 8px;
    }

    .logo-mark {
        width: 30px;
        height: 30px;
    }

    .logo-mark svg {
        width: 20px;
        height: 20px;
    }

    .header-right {
        gap: 4px;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
    }

    .panel {
        padding: 10px;
    }

    .camera-container {
        max-height: 180px;
    }

    .divider-icon {
        width: 28px;
        height: 28px;
    }

    .speed-control label {
        font-size: 0.65rem;
    }

    .avatar-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 6px 8px;
    }
}

/* Touch-friendly overrides */
@media (hover: none) and (pointer: coarse) {

    .cam-btn,
    .icon-btn,
    .av-btn,
    .action-btn,
    .mic-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .mode-btn {
        padding: 8px 14px;
    }

    .translate-btn {
        padding: 16px;
    }

    .setting-row {
        padding: 14px 0;
    }

    .toggle {
        width: 48px;
        height: 26px;
    }

    .toggle-slider::before {
        width: 22px;
        height: 22px;
    }
}

/* ===== UTILITY ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-in {
    animation: fadeInUp 0.5s ease both;
}