/* ==========================================================================
   NEURO-LAPIN (Unit XX-7) - Biomechanical AI System Helper
   Lower-Right Floating Pod & Cybernetic Bio-Terminal HUD
   ========================================================================== */

:root {
    --nl-primary: #00ffd5;
    --nl-primary-glow: rgba(0, 255, 213, 0.4);
    --nl-secondary: #ff0055;
    --nl-secondary-glow: rgba(255, 0, 85, 0.4);
    --nl-amber: #ffb700;
    --nl-dark-bg: rgba(6, 9, 15, 0.88);
    --nl-card-bg: rgba(14, 20, 32, 0.94);
    --nl-border: rgba(0, 255, 213, 0.25);
    --nl-border-active: rgba(0, 255, 213, 0.7);
    --nl-font-mono: 'Space Mono', 'Consolas', 'Courier New', monospace;
    --nl-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --------------------------------------------------------------------------
   1. Main Container & Dock (Lower-Right)
   -------------------------------------------------------------------------- */

#neuro-lapin-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: var(--nl-font-mono);
    color: #e0f8f4;
    user-select: none;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   2. Floating Containment Capsule (Trigger Button)
   -------------------------------------------------------------------------- */

.nl-capsule-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #1a2638, #05080e 90%);
    border: 2px solid var(--nl-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7),
                0 0 20px var(--nl-primary-glow),
                inset 0 0 15px rgba(0, 255, 213, 0.15);
    cursor: pointer;
    position: relative;
    padding: 0;
    margin: 0;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
    overflow: hidden;
}

.nl-capsule-btn:hover {
    transform: scale(1.08);
    border-color: var(--nl-primary);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8),
                0 0 30px var(--nl-primary-glow),
                inset 0 0 20px rgba(0, 255, 213, 0.3);
}

.nl-capsule-btn:active {
    transform: scale(0.96);
}

/* Holographic Rotating Rings around capsule */
.nl-capsule-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1px dashed rgba(0, 255, 213, 0.5);
    animation: nl-spin-slow 16s linear infinite;
    pointer-events: none;
}

.nl-capsule-btn::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px solid rgba(255, 0, 85, 0.3);
    animation: nl-spin-rev 12s linear infinite;
    pointer-events: none;
}

/* Canvas embedded in capsule */
.nl-avatar-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

/* Pulse badge on top right of capsule */
.nl-status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--nl-primary);
    box-shadow: 0 0 8px var(--nl-primary);
    animation: nl-pulse-glow 2s ease-in-out infinite;
    z-index: 10;
}

.nl-status-dot.nl-status-speaking {
    background: var(--nl-secondary);
    box-shadow: 0 0 12px var(--nl-secondary);
    animation: nl-pulse-rapid 0.4s ease-in-out infinite;
}

/* Audio waveform activity meter bar */
.nl-audio-wave-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    height: 8px;
    align-items: flex-end;
    z-index: 10;
    pointer-events: none;
}

.nl-audio-bar {
    width: 2px;
    height: 3px;
    background: var(--nl-primary);
    border-radius: 1px;
    transition: height 0.1s ease;
}

/* --------------------------------------------------------------------------
   3. Expanded Bio-Terminal Communicator Window
   -------------------------------------------------------------------------- */

.nl-terminal-window {
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--nl-dark-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--nl-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85),
                0 0 30px rgba(0, 255, 213, 0.12),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.35s;
    user-select: text;
}

.nl-terminal-window.nl-collapsed {
    transform: scale(0.7) translateY(40px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Header bar */
.nl-terminal-header {
    padding: 12px 16px;
    background: rgba(14, 22, 36, 0.85);
    border-bottom: 1px solid var(--nl-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    user-select: none;
}

.nl-header-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nl-header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--nl-primary);
    background: #090e18;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nl-header-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--nl-primary);
    text-shadow: 0 0 10px var(--nl-primary-glow);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nl-header-unit-tag {
    font-size: 9px;
    background: rgba(0, 255, 213, 0.15);
    border: 1px solid rgba(0, 255, 213, 0.3);
    color: var(--nl-primary);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: var(--nl-font-mono);
}

.nl-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nl-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a0b8cc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    padding: 0;
}

.nl-icon-btn:hover {
    background: rgba(0, 255, 213, 0.15);
    border-color: var(--nl-primary);
    color: var(--nl-primary);
    box-shadow: 0 0 8px var(--nl-primary-glow);
}

.nl-icon-btn.nl-btn-muted {
    color: var(--nl-secondary);
    border-color: rgba(255, 0, 85, 0.3);
}

.nl-icon-btn.nl-btn-loading {
    border-color: var(--nl-primary);
    box-shadow: 0 0 10px var(--nl-primary-glow);
    cursor: wait;
}

.nl-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 255, 213, 0.2);
    border-top: 2px solid var(--nl-primary);
    border-radius: 50%;
    animation: nl-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes nl-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   4. Live Creature Viewport inside Terminal
   -------------------------------------------------------------------------- */

.nl-creature-viewport {
    height: 140px;
    background: radial-gradient(ellipse at 50% 60%, rgba(0, 255, 213, 0.06), #04070d 80%);
    position: relative;
    border-bottom: 1px solid var(--nl-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.nl-creature-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.nl-telemetry-badge {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 9px;
    color: #5d7d9a;
    font-family: var(--nl-font-mono);
    line-height: 1.4;
    pointer-events: none;
}

.nl-telemetry-badge span {
    color: var(--nl-primary);
}

.nl-poke-btn {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 10px;
    background: rgba(255, 0, 85, 0.12);
    border: 1px solid rgba(255, 0, 85, 0.3);
    color: #ff6699;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--nl-font-mono);
    transition: all 0.2s ease;
}

.nl-poke-btn:hover {
    background: rgba(255, 0, 85, 0.25);
    border-color: var(--nl-secondary);
    box-shadow: 0 0 10px var(--nl-secondary-glow);
    color: #fff;
}

/* --------------------------------------------------------------------------
   5. Dialogue & Message Log
   -------------------------------------------------------------------------- */

.nl-dialogue-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
    line-height: 1.5;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 213, 0.3) transparent;
}

.nl-dialogue-feed::-webkit-scrollbar {
    width: 4px;
}

.nl-dialogue-feed::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 213, 0.3);
    border-radius: 2px;
}

.nl-message {
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    max-width: 88%;
    word-break: break-word;
    animation: nl-msg-slide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nl-message-agent {
    align-self: flex-start;
    background: rgba(14, 24, 38, 0.9);
    border: 1px solid rgba(0, 255, 213, 0.2);
    border-left: 3px solid var(--nl-primary);
    color: #d8f5ef;
}

.nl-message-user {
    align-self: flex-end;
    background: rgba(26, 16, 32, 0.9);
    border: 1px solid rgba(255, 0, 85, 0.25);
    border-right: 3px solid var(--nl-secondary);
    color: #fce8f0;
}

.nl-message-action {
    align-self: center;
    background: rgba(255, 183, 0, 0.1);
    border: 1px dashed rgba(255, 183, 0, 0.4);
    color: #ffd066;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    text-align: center;
    max-width: 95%;
}

.nl-msg-author {
    font-size: 9px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.nl-message-agent .nl-msg-author {
    color: var(--nl-primary);
}

.nl-message-user .nl-msg-author {
    color: var(--nl-secondary);
}

/* --------------------------------------------------------------------------
   6. Suggested Prompt Chips & Command Input
   -------------------------------------------------------------------------- */

.nl-chips-strip {
    padding: 6px 12px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    background: rgba(9, 14, 24, 0.7);
    border-top: 1px solid rgba(0, 255, 213, 0.1);
    scrollbar-width: none;
}

.nl-chips-strip::-webkit-scrollbar {
    display: none;
}

.nl-chip-btn {
    font-size: 10px;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 12px;
    background: rgba(0, 255, 213, 0.08);
    border: 1px solid rgba(0, 255, 213, 0.25);
    color: #a8ece1;
    cursor: pointer;
    font-family: var(--nl-font-mono);
    transition: all 0.2s ease;
}

.nl-chip-btn:hover {
    background: rgba(0, 255, 213, 0.2);
    border-color: var(--nl-primary);
    color: #ffffff;
    box-shadow: 0 0 8px var(--nl-primary-glow);
}

.nl-input-bar {
    padding: 10px 12px;
    background: rgba(10, 16, 28, 0.95);
    border-top: 1px solid var(--nl-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nl-chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 213, 0.25);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0f8f4;
    font-family: var(--nl-font-mono);
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.nl-chat-input:focus {
    border-color: var(--nl-primary);
    box-shadow: 0 0 10px var(--nl-primary-glow);
    background: rgba(0, 0, 0, 0.6);
}

.nl-send-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(0, 255, 213, 0.25), rgba(0, 180, 150, 0.4));
    border: 1px solid var(--nl-primary);
    border-radius: 8px;
    color: #ffffff;
    font-family: var(--nl-font-mono);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nl-send-btn:hover {
    background: var(--nl-primary);
    color: #05080e;
    box-shadow: 0 0 15px var(--nl-primary);
}

/* --------------------------------------------------------------------------
   7. Page Reality Glitch Effect (Triggerable by AI Agency)
   -------------------------------------------------------------------------- */

body.nl-glitch-active {
    animation: nl-screen-tear 0.15s infinite;
}

@keyframes nl-screen-tear {
    0% { transform: translate(0, 0); filter: hue-rotate(0deg); }
    20% { transform: translate(-3px, 2px); filter: contrast(150%) hue-rotate(45deg); }
    40% { transform: translate(3px, -1px); filter: invert(10%); }
    60% { transform: translate(-2px, -2px); filter: hue-rotate(-45deg); }
    80% { transform: translate(2px, 3px); filter: saturate(200%); }
    100% { transform: translate(0, 0); filter: hue-rotate(0deg); }
}

/* --------------------------------------------------------------------------
   8. Keyframe Animations
   -------------------------------------------------------------------------- */

@keyframes nl-spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes nl-spin-rev {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes nl-pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
}

@keyframes nl-pulse-rapid {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.5); opacity: 1; }
}

@keyframes nl-msg-slide {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustment for small screens */
@media (max-width: 480px) {
    #neuro-lapin-root {
        bottom: 16px;
        right: 16px;
    }
    .nl-terminal-window {
        width: calc(100vw - 32px);
        height: 480px;
    }
}

/* --------------------------------------------------------------------------
   9. Ghost Radio Transceiver Deck (SDR Console HUD)
   -------------------------------------------------------------------------- */

.nl-radio-deck {
    background: rgba(4, 7, 14, 0.96);
    border-bottom: 1px solid var(--nl-border);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.nl-radio-deck.nl-radio-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-bottom-width: 0;
    pointer-events: none;
}

.nl-radio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nl-radio-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.nl-freq-val {
    font-size: 17px;
    font-weight: 700;
    color: var(--nl-primary);
    text-shadow: 0 0 10px var(--nl-primary-glow);
    letter-spacing: 1px;
}

.nl-freq-unit {
    font-size: 10px;
    color: #72a89f;
    letter-spacing: 0.5px;
}

.nl-s-meter-badge {
    font-size: 9px;
    background: rgba(0, 255, 213, 0.12);
    border: 1px solid rgba(0, 255, 213, 0.3);
    color: var(--nl-primary);
    padding: 1px 5px;
    border-radius: 3px;
}

.nl-radio-station-title {
    font-size: 10px;
    color: #ffb700;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    letter-spacing: 0.5px;
}

.nl-radio-scope-wrap {
    width: 100%;
    height: 42px;
    background: #020408;
    border: 1px solid rgba(0, 255, 213, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.nl-radio-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.nl-radio-tuner-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nl-step-btn {
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 255, 213, 0.25);
    border-radius: 4px;
    color: #92d8cc;
    font-family: var(--nl-font-mono);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nl-step-btn:hover {
    background: var(--nl-primary);
    color: #04070e;
    border-color: var(--nl-primary);
}

.nl-radio-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #0b1322;
    border: 1px solid rgba(0, 255, 213, 0.3);
    border-radius: 3px;
    outline: none;
}

.nl-radio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--nl-primary);
    box-shadow: 0 0 8px var(--nl-primary);
    cursor: pointer;
    border: none;
}

.nl-radio-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--nl-primary);
    box-shadow: 0 0 8px var(--nl-primary);
    cursor: pointer;
    border: none;
}

.nl-radio-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nl-radio-preset {
    padding: 2px 7px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 213, 0.2);
    border-radius: 4px;
    color: #8be0d4;
    font-family: var(--nl-font-mono);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nl-radio-preset:hover,
.nl-radio-preset.active {
    background: rgba(0, 255, 213, 0.25);
    border-color: var(--nl-primary);
    color: #ffffff;
    box-shadow: 0 0 6px var(--nl-primary-glow);
}

/* --------------------------------------------------------------------------
   10. Screen Poltergeist Mode & Runic Chewing Effects
   -------------------------------------------------------------------------- */

.nl-poltergeist-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99998;
    display: block;
}

.nl-poltergeist-canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: auto;
    cursor: crosshair;
}

/* Floating Recall Unit Badge */
.nl-recall-badge {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 8px 18px;
    background: rgba(8, 12, 22, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #ff0055;
    box-shadow: 0 0 25px rgba(255, 0, 85, 0.5), 0 4px 20px rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    color: #ffffff;
    font-family: var(--nl-font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    animation: nl-recall-float 2.5s ease-in-out infinite;
}

.nl-recall-badge:hover {
    background: #ff0055;
    color: #04070e;
    box-shadow: 0 0 35px #ff0055;
    transform: translateX(-50%) scale(1.05);
}

.nl-recall-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff0055;
    box-shadow: 0 0 8px #ff0055;
    animation: nl-pulse-rapid 0.6s infinite;
}

@keyframes nl-recall-float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

/* Chewed Runic Text Effect */
.nl-chewed-runes {
    color: #00ffd5 !important;
    text-shadow: 0 0 10px rgba(0, 255, 213, 0.8), 0 0 20px rgba(0, 255, 213, 0.4) !important;
    letter-spacing: 2px !important;
    font-family: 'Cinzel', serif, monospace !important;
    font-weight: 900 !important;
    animation: nl-rune-shimmer 0.4s ease-in-out infinite alternate;
    display: inline-block;
}

@keyframes nl-rune-shimmer {
    from { filter: brightness(100%) hue-rotate(0deg); }
    to { filter: brightness(140%) hue-rotate(25deg); }
}

