/* PrivyChat - Nearby WiFi & Bluetooth Tactical Mesh CSS */
:root {
    --bg-primary: #070b12;
    --bg-secondary: #0d1524;
    --bg-tertiary: #131f36;
    --panel-bg: rgba(13, 21, 36, 0.75);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-border-focus: rgba(34, 197, 94, 0.4);
    
    --neon-green: #22c55e;
    --neon-green-glow: rgba(34, 197, 94, 0.35);
    --neon-cyan: #06b6d4;
    --neon-cyan-glow: rgba(6, 182, 212, 0.35);
    --neon-amber: #f59e0b;
    --neon-red: #ef4444;
    --neon-purple: #a855f7;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(34, 197, 94, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

.font-mono {
    font-family: 'Courier Prime', monospace;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 197, 94, 0.4);
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.6);
}

.glass-card {
    background: rgba(19, 31, 54, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
}

.glass-card:hover {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(25, 41, 71, 0.8);
    transform: translateY(-2px);
}

/* Top HUD Navigation */
.hud-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(7, 11, 18, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.hud-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.hud-logo-badge {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(34, 197, 94, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green-glow);
}

/* Main Layout Grid */
.nearby-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 20px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
}

@media (max-width: 1024px) {
    .nearby-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Left Panel: Scanner & Controls */
.scanner-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

/* Radar Container */
.radar-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 280px;
    margin: 0 auto;
    background: radial-gradient(circle, rgba(7, 26, 16, 0.8) 0%, rgba(3, 12, 8, 0.95) 100%);
    border: 2px solid rgba(34, 197, 94, 0.35);
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.15), inset 0 0 30px rgba(34, 197, 94, 0.2);
}

#radarCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.radar-overlay-badge {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: var(--radius-full);
    font-size: 11px;
    color: var(--neon-green);
    letter-spacing: 1px;
    font-family: 'Courier Prime', monospace;
    pointer-events: none;
    z-index: 10;
}

/* Mode Switcher Tabs */
.mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
}

.mode-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.mode-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.mode-tab-btn:active {
    transform: scale(0.96);
}

.mode-tab-btn.active {
    background: rgba(34, 197, 94, 0.18);
    color: var(--neon-green);
    border: 1px solid rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.25);
}

/* Profile Card */
.profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(19, 31, 54, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
}

.profile-avatar-btn {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.profile-nickname-input {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: border 0.2s;
    width: 140px;
}

.profile-nickname-input:focus {
    border-color: var(--neon-green);
    background: rgba(0, 0, 0, 0.3);
}

/* Discovered Peers Section */
.peer-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.peer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.peer-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(19, 31, 54, 0.5);
    border: 1px solid var(--panel-border);
    transition: all 0.2s ease;
}

.peer-card:hover {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(25, 41, 71, 0.7);
}

.peer-connect-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #22c55e, #10b981);
    color: #000;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.peer-connect-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 0 12px var(--neon-green-glow);
}

/* Right Panel: Chat Terminal */
.terminal-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Terminal Header */
.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(13, 21, 36, 0.85);
}

/* Message Stream Viewport */
.terminal-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Message Balloons */
.msg-row {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    position: relative;
    animation: msgIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-row.sent {
    align-self: flex-end;
}

.msg-row.received {
    align-self: flex-start;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14.5px;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.msg-row.sent .msg-bubble {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(16, 185, 129, 0.15));
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #f0fdf4;
    border-bottom-right-radius: 4px;
}

.msg-row.received .msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

/* Ghost Mode Blur */
.ghost-blur {
    filter: blur(6px);
    transition: filter 0.25s ease;
    user-select: none;
}

.ghost-blur:hover, .ghost-blur:active {
    filter: blur(0px);
    user-select: text;
}

/* Ephemeral Self-Destruct Timer Badge */
.burn-timer-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    animation: burnPulse 1s infinite alternate;
}

@keyframes burnPulse {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

/* Action Bar Input */
.terminal-action-bar {
    padding: 16px 20px;
    border-top: 1px solid var(--panel-border);
    background: rgba(13, 21, 36, 0.9);
    display: flex;
    align-items: center;
    gap: 10px;
}

.msg-input-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    resize: none;
    height: 46px;
    max-height: 120px;
    transition: border 0.2s, box-shadow 0.2s;
}

.msg-input-box:focus {
    border-color: var(--neon-green);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.action-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.send-btn {
    background: linear-gradient(135deg, #22c55e, #059669);
    border: none;
    color: #000;
    font-weight: bold;
}

.action-btn.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--neon-green-glow);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 90%;
    max-width: 540px;
    background: var(--bg-secondary);
    border: 1px solid var(--panel-border-focus);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px var(--neon-green-glow);
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-box {
    transform: scale(1);
}

/* QR Canvas Container */
.qr-display-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #ffffff;
    border-radius: var(--radius-md);
    margin: 16px auto;
    width: 240px;
    height: 240px;
}

#qrCanvas {
    width: 100% !important;
    height: 100% !important;
}

/* Camera Video View */
#qrScannerVideo {
    width: 100%;
    max-height: 240px;
    border-radius: var(--radius-md);
    background: #000;
    object-fit: cover;
}

/* Voice Visualizer Waveform */
.voice-wave-container {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.voice-wave-bar {
    width: 3px;
    background: var(--neon-green);
    border-radius: 2px;
    animation: wavePulse 0.5s ease-in-out infinite alternate;
}

@keyframes wavePulse {
    0% { height: 4px; }
    100% { height: 22px; }
}

/* Panic Screen */
.panic-active {
    filter: invert(1) contrast(200%);
    opacity: 0;
    transition: opacity 0.2s;
}

/* Active Full-Screen Clean Chat Mode (Mobile & Desktop) */
body.chat-active-view .scanner-panel {
    display: none !important;
}

body.chat-active-view .nearby-grid {
    grid-template-columns: 1fr !important;
    max-width: 960px;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
    padding: 10px 16px 16px 16px;
}

body.chat-active-view .terminal-panel {
    border-radius: var(--radius-lg);
    background: rgba(10, 16, 28, 0.85);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(34, 197, 94, 0.25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(34, 197, 94, 0.15);
    height: 100%;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
    .hud-nav {
        padding: 10px 14px;
    }
    .nearby-grid {
        padding: 12px;
        gap: 14px;
        height: auto;
    }
    .scanner-panel {
        padding: 14px;
        max-height: 480px;
    }
    .radar-box {
        max-height: 220px;
    }
    .terminal-header {
        padding: 10px 12px;
        gap: 8px;
    }
    .terminal-action-bar {
        padding: 8px 10px;
        gap: 6px;
    }
    .msg-row {
        max-width: 88%;
    }
    .modal-box {
        padding: 18px;
        width: 95%;
    }
    body.chat-active-view .nearby-grid {
        padding: 0;
        height: calc(100vh - 58px);
        height: calc(100dvh - 58px);
    }
    body.chat-active-view .terminal-panel {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    #meshStatusPill {
        display: none !important;
    }
    .hud-brand div div {
        font-size: 14px !important;
    }
    .mode-tab-btn {
        font-size: 11px;
        padding: 6px 2px;
    }
    .profile-nickname-input {
        width: 105px;
        font-size: 13px;
    }
    .terminal-header {
        padding: 8px 10px;
    }
    #burnTimerSelect {
        padding: 0 4px;
        font-size: 10px;
    }
}

/* ================================================================
   CONNECTION PROGRESS MODAL
   ================================================================ */
.conn-progress-box {
    max-width: 460px;
}

/* Spinning animated ring */
.conn-prog-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(34, 197, 94, 0.18);
    border-top-color: var(--neon-green);
    border-right-color: rgba(6, 182, 212, 0.7);
    animation: connSpin 0.85s linear infinite;
    flex-shrink: 0;
    transition: border-top-color 0.3s ease;
}

.conn-prog-ring.done {
    border-top-color: var(--neon-green);
    border-right-color: var(--neon-green);
    border-bottom-color: var(--neon-green);
    border-left-color: var(--neon-green);
    animation: none;
}

.conn-prog-ring.error {
    border-top-color: var(--neon-red);
    border-right-color: var(--neon-red);
    animation: connShake 0.4s ease;
}

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

@keyframes connShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Step rows */
.conn-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.35s ease, border-color 0.35s ease, transform 0.2s ease;
}

.conn-step.active {
    background: rgba(34, 197, 94, 0.07);
    border-color: rgba(34, 197, 94, 0.28);
    transform: translateX(2px);
}

.conn-step.done {
    background: rgba(34, 197, 94, 0.04);
    border-color: rgba(34, 197, 94, 0.15);
}

.conn-step.error {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.28);
}

/* Step dot indicator */
.conn-step-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.conn-step-dot.pending { background: rgba(255,255,255,0.18); }
.conn-step-dot.active  {
    background: var(--neon-green);
    box-shadow: 0 0 10px var(--neon-green);
    animation: dotPulse 0.7s ease-in-out infinite alternate;
}
.conn-step-dot.done    { background: var(--neon-green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.conn-step-dot.error   { background: var(--neon-red); }

@keyframes dotPulse {
    from { transform: scale(1); opacity: 0.8; }
    to   { transform: scale(1.6); opacity: 1; }
}

.conn-step-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #f1f5f9;
}

.conn-step-desc {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'Courier Prime', monospace;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Step status badge */
.conn-step-badge {
    font-size: 9px;
    font-family: 'Courier Prime', monospace;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.conn-step-badge.pending {
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.08);
}

.conn-step-badge.active {
    background: rgba(34,197,94,0.15);
    color: var(--neon-green);
    border: 1px solid rgba(34,197,94,0.4);
    animation: badgeFlash 1s ease-in-out infinite alternate;
}

@keyframes badgeFlash {
    from { opacity: 0.65; }
    to   { opacity: 1; }
}

.conn-step-badge.done {
    background: rgba(34,197,94,0.12);
    color: var(--neon-green);
    border: 1px solid rgba(34,197,94,0.25);
}

.conn-step-badge.error {
    background: rgba(239,68,68,0.12);
    color: var(--neon-red);
    border: 1px solid rgba(239,68,68,0.3);
}

/* ================================================================
   SMOOTH UI STATE TRANSITIONS
   ================================================================ */

/* Fade transition for standby ↔ active chat */
#standbyScreen {
    transition: opacity 0.28s ease;
}

#activeChatHUD {
    transition: opacity 0.32s ease;
}

/* Smooth chat-active-view layout switch */
body.chat-active-view .terminal-panel {
    animation: panelSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Message bubble enter animation */
.msg-row {
    animation: msgFadeIn 0.22s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Peer card hover smoothness */
.peer-card {
    transition: all 0.22s ease;
}

/* Smooth connect button transitions */
.peer-connect-btn {
    transition: all 0.2s ease, opacity 0.2s ease !important;
}

.peer-connect-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Cancel button hover */
#cancelConnBtn:hover {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

/* Modal entrance animation */
.modal-backdrop.active .modal-box {
    animation: modalPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ================================================================
   2-WAY OPTICAL QR MESH HUD
   ================================================================ */
.optical-mesh-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.optical-hud-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.optical-transmitter,
.optical-receiver {
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(34, 197, 94, .28);
    border-radius: 12px;
    background: rgba(2, 6, 23, .62);
}

.optical-panel-title {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 8px;
    color: #d1fae5;
    font: 700 10px 'Courier Prime', monospace;
    letter-spacing: .6px;
}

.optical-panel-title span {
    color: var(--neon-cyan);
    font-weight: 400;
}

.optical-qr-frame,
.optical-video-frame {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 190px;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
}

.optical-qr-frame img,
.optical-qr-frame canvas {
    width: min(100%, 220px);
    height: auto;
    image-rendering: pixelated;
}

.optical-video-frame {
    background: #000;
}

.optical-video-frame video {
    display: block;
    width: 100%;
    min-height: 190px;
    object-fit: cover;
}

.optical-scan-reticle {
    position: absolute;
    inset: 18%;
    border: 2px solid rgba(34, 197, 94, .75);
    border-radius: 12px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .16), 0 0 22px rgba(34, 197, 94, .32);
    pointer-events: none;
}

.optical-status {
    min-height: 30px;
    margin-top: 7px;
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.35;
}

.optical-key-row,
.optical-compose {
    display: flex;
    align-items: center;
    gap: 8px;
}

.optical-key-row button {
    flex: 1;
    min-height: 38px;
    font-size: 11px;
}

.optical-chat-log {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 120px;
    overflow: auto;
    padding: 7px;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 9px;
    background: rgba(0, 0, 0, .2);
    color: #d1fae5;
    font-size: 12px;
}

.optical-chat-line {
    padding: 6px 8px;
    border-radius: 7px;
    background: rgba(34, 197, 94, .1);
}

.optical-chat-line.received {
    background: rgba(6, 182, 212, .1);
}

.optical-compose textarea {
    flex: 1;
    min-width: 0;
    resize: vertical;
    padding: 9px 11px;
    border: 1px solid rgba(34, 197, 94, .3);
    border-radius: 9px;
    background: rgba(2, 6, 23, .8);
    color: #f8fafc;
    font: 12px 'Courier Prime', monospace;
}

.optical-compose button.recording {
    color: #fff;
    background: rgba(239, 68, 68, .22);
    border-color: rgba(239, 68, 68, .65);
    animation: offlinePulse 1s ease-in-out infinite alternate;
}

body.offline-mesh #meshStatusPill {
    animation: offlinePulse 1.8s ease-in-out infinite alternate;
}

@keyframes offlinePulse {
    from { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
    to { box-shadow: 0 0 18px rgba(245, 158, 11, .24); }
}

@media (max-width: 680px) {
    .optical-hud-grid { grid-template-columns: 1fr; }
    .optical-key-row { flex-wrap: wrap; }
    .optical-key-row button { min-width: calc(50% - 4px); }
}
