/* ==========================================================================
   ARIANA COMPANION — 3D character, fixed bottom-right
   ========================================================================== */

.ariana-companion {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 50;
    width: 260px;
    height: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s var(--ease-out-expo);
    pointer-events: none;
}

.ariana-companion--loaded {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

#ariana-canvas {
    width: 260px;
    height: 340px;
    display: block;
    cursor: grab;
    -webkit-mask-image: radial-gradient(ellipse 75% 80% at 50% 55%, black 40%, transparent 78%);
    mask-image: radial-gradient(ellipse 75% 80% at 50% 55%, black 40%, transparent 78%);
}

#ariana-canvas:active {
    cursor: grabbing;
}


@media (max-width: 600px) {
    .ariana-companion {
        display: none;
    }

    #ariana-canvas {
        display: none;
    }
}

/* ==========================================================================
   ARIANA CHAT PANEL
   ========================================================================== */

.ariana-chat {
    position: fixed;
    bottom: 320px;
    right: 16px;
    z-index: 51;
    width: 420px;
    height: calc(100vh - 340px);
    background: linear-gradient(165deg, rgba(8, 18, 38, 0.92) 0%, rgba(2, 10, 24, 0.95) 100%);
    border: 1px solid rgba(0, 180, 255, 0.18);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(32px) saturate(1.4);
    -webkit-backdrop-filter: blur(32px) saturate(1.4);
    box-shadow:
        0 0 0 1px rgba(0, 180, 255, 0.06),
        0 0 80px rgba(0, 140, 255, 0.08),
        0 24px 60px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.4s var(--ease-out-expo);
    overflow: hidden;
}

.ariana-chat--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* --- Header --- */
.ariana-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.1);
    background: linear-gradient(180deg, rgba(0, 120, 255, 0.06) 0%, transparent 100%);
    flex-shrink: 0;
}

.ariana-chat__title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(120, 220, 255, 1);
    text-shadow: 0 0 20px rgba(0, 180, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ariana-chat__title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 255, 180, 0.9);
    box-shadow: 0 0 8px rgba(0, 255, 180, 0.6);
    animation: ariana-status-pulse 2s ease-in-out infinite;
}

@keyframes ariana-status-pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(0, 255, 180, 0.6);
    }

    50% {
        opacity: 0.5;
        box-shadow: 0 0 4px rgba(0, 255, 180, 0.3);
    }
}

.ariana-chat__header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ariana-chat__reset,
.ariana-chat__close {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.ariana-chat__reset {
    font-size: 1rem;
}

.ariana-chat__reset:hover {
    color: rgba(100, 220, 255, 1);
    background: rgba(0, 160, 255, 0.12);
    border-color: rgba(0, 180, 255, 0.25);
}

.ariana-chat__close:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* --- Messages area --- */
.ariana-chat__messages {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 18px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 80px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 180, 255, 0.18) transparent;
}

.ariana-chat__messages::-webkit-scrollbar {
    width: 4px;
}

.ariana-chat__messages::-webkit-scrollbar-track {
    background: transparent;
}

.ariana-chat__messages::-webkit-scrollbar-thumb {
    background: rgba(0, 180, 255, 0.2);
    border-radius: 4px;
}

/* --- Message bubbles --- */
.ariana-chat__msg {
    display: flex;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.65;
    max-width: 85%;
    animation: ariana-msg-in 0.3s ease both;
}

@keyframes ariana-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.ariana-chat__msg--aria {
    align-self: flex-start;
    color: rgba(220, 235, 255, 0.95);
}

.ariana-chat__msg--aria span {
    background: linear-gradient(135deg, rgba(0, 120, 200, 0.12) 0%, rgba(0, 80, 160, 0.08) 100%);
    border: 1px solid rgba(0, 180, 255, 0.15);
    border-radius: 4px 16px 16px 16px;
    padding: 12px 16px;
    position: relative;
}

.ariana-chat__msg--aria span::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(0, 200, 255, 0.6);
    box-shadow: 0 0 6px rgba(0, 200, 255, 0.4);
}

.ariana-chat__msg--user {
    align-self: flex-end;
    color: rgba(255, 255, 255, 0.95);
}

.ariana-chat__msg--user span {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px 4px 16px 16px;
    padding: 12px 16px;
}

.ariana-chat__msg--thinking span {
    color: rgba(80, 200, 255, 0.6);
    font-style: italic;
    animation: ariana-thinking-pulse 1.2s ease-in-out infinite;
}

@keyframes ariana-thinking-pulse {

    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 1;
    }
}

/* --- Suggestion chips --- */
.ariana-chat__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 18px 6px;
    border-top: 1px solid rgba(0, 180, 255, 0.08);
    flex-shrink: 0;
}

.ariana-chat__chip {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(100, 210, 255, 0.85);
    background: rgba(0, 140, 255, 0.06);
    border: 1px solid rgba(0, 180, 255, 0.18);
    border-radius: 24px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.ariana-chat__chip:hover {
    background: rgba(0, 160, 255, 0.15);
    border-color: rgba(0, 220, 255, 0.45);
    color: rgba(160, 240, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 140, 255, 0.15);
}

.ariana-chat__chips--hidden {
    display: none;
}

/* --- Input row --- */
.ariana-chat__input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 14px;
    border-top: 1px solid rgba(0, 180, 255, 0.08);
    background: rgba(0, 20, 50, 0.3);
    flex-shrink: 0;
}

.ariana-chat__input {
    flex: 1;
    background: rgba(0, 30, 60, 0.5);
    border: 1px solid rgba(0, 160, 255, 0.15);
    border-radius: 24px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 10px 18px;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.ariana-chat__input:focus {
    border-color: rgba(0, 200, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.08);
}

.ariana-chat__input::placeholder {
    color: rgba(100, 200, 255, 0.25);
    font-size: 0.8rem;
}

.ariana-chat__send {
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.2) 0%, rgba(0, 140, 200, 0.15) 100%);
    border: 1px solid rgba(0, 200, 255, 0.3);
    border-radius: 50%;
    color: rgba(80, 220, 255, 1);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.ariana-chat__send:hover {
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.35) 0%, rgba(0, 140, 200, 0.25) 100%);
    border-color: rgba(0, 220, 255, 0.55);
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(0, 180, 255, 0.2);
}

.ariana-chat__send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .ariana-chat {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 300px;
        height: calc(100vh - 316px);
    }
}

@media (max-width: 600px) {
    .ariana-chat {
        display: none;
    }
}