/* ===== Landing V2 ===== */

/* Video background — inside hero, scrolls with page */
.v2-video-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.v2-video-bg.v2-fading {
    opacity: 0;
    pointer-events: none;
}

.v2-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transform: scale(1.15);
}

.v2-video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

/* Hide sky shader on V2 — we use video throughout */
.v2-sky-hidden {
    display: none;
}

.v2-app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Below-fold content flows normally after the hero */

.v2-hero-state {
    position: relative;
    overflow: hidden;
}

/* State containers */
.v2-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ===== HERO ===== */
.v2-logo {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 2;
    width: 150px;
    opacity: 0.9;
}

.v2-hero-content {
    position: relative;
    z-index: 2;
    max-width: 620px;
    width: 100%;
    text-align: center;
    margin-top: 20vh;
    margin-bottom: auto;
}

.v2-hero-footer {
    position: relative;
    z-index: 2;
}

/* Word fade animation for hero text */
[data-v2-word-fade] .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
}

[data-v2-word-fade].animate .word {
    animation: v2WordFadeIn 0.5s ease forwards;
}

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

.v2-hero-title {
    font-family: var(--font-heading, 'Instrument Sans', sans-serif);
    font-size: var(--font-size-title);
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin: 0 0 0.75rem;
}

.v2-hero-sub {
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--font-size-body);
    margin: 0 0 2rem;
    line-height: 1.6;
}

.v2-prompt {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #fff;
    padding: 1rem;
    font-family: inherit;
    font-size: var(--font-size-body);
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.v2-prompt:focus {
    border-color: rgba(140, 120, 200, 0.5);
}

.v2-prompt::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Hero Connect button constraint */
.v2-hero-content .btn-filled {
    max-width: 280px;
    margin: 1rem auto 0;
}

.v2-consent {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-caption);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.v2-consent a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: underline;
}

.v2-consent a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.v2-hero-note {
    color: rgba(255, 255, 255, 0.3);
    font-size: var(--font-size-secondary);
    margin-top: 1rem;
}

.v2-hero-footer {
    margin-top: auto;
    padding: 1rem;
}

.v2-footer-link {
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    font-size: var(--font-size-secondary);
}

.v2-footer-link:hover {
    color: rgba(255, 255, 255, 0.6);
}

/* ===== SEARCHING ===== */
.v2-searching-content {
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.v2-searching-title {
    font-family: var(--font-heading, 'Instrument Sans', sans-serif);
    font-size: var(--font-size-headline);
    font-weight: 600;
    margin: 0 0 1rem;
    background: linear-gradient(
        90deg,
        var(--text-secondary) 0%,
        var(--text-secondary) 35%,
        var(--text-primary) 50%,
        var(--text-secondary) 65%,
        var(--text-secondary) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: v2-shimmer 3s ease-in-out infinite;
}

@keyframes v2-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.v2-active-users {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--font-size-secondary);
    margin-bottom: 1.5rem;
}

.v2-active-users .active-dot {
    position: relative;
}

.v2-active-users .active-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #2ecc71;
    transform: translate(-50%, -50%);
    animation: v2-dot-pulse 2s ease-out infinite;
}

@keyframes v2-dot-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

.v2-identity-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.v2-identity-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.25rem;
}

.v2-identity-hint {
    color: rgba(255, 255, 255, 0.3);
    font-size: var(--font-size-secondary);
    margin: 0 0 1rem;
    font-style: italic;
}

.v2-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.v2-avatar-wrap {
    position: relative;
    width: 80px;
    height: 80px;
}

.v2-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.v2-avatar-edit {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(140, 120, 200, 0.6);
    border: 2px solid rgba(30, 30, 35, 0.9);
    color: #fff;
    font-size: var(--font-size-caption);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v2-identity-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.v2-handle {
    color: var(--text-primary, #fff);
    font-size: var(--font-size-heading);
    font-weight: 500;
}

.v2-handle-regen {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-headline);
    cursor: pointer;
    padding: 4px;
}

.v2-handle-regen:hover {
    color: rgba(255, 255, 255, 0.7);
}

.v2-searching-summary {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-secondary);
    font-style: italic;
    margin: 0;
}

/* Avatar picker */
.v2-avatar-picker {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem;
}

.v2-avatar-picker .btn-filled {
    margin-top: 1rem;
    width: auto;
    display: inline-block;
    padding: 0.5rem 1.5rem;
}

.v2-popover .btn-filled {
    margin-top: 1rem;
}

.v2-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 0.5rem;
}

.v2-avatar-option {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 44px;
    min-height: 44px;
}

.v2-avatar-option:hover {
    border-color: rgba(140, 120, 200, 0.5);
}

.v2-avatar-option img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}


/* ===== CONNECTION TRANSITION ===== */
.v2-transition-content {
    text-align: center;
}

.v2-transition-circles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: gap 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.v2-transition-circles.apart {
    gap: 80px;
}

.v2-transition-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transition: transform 0.6s ease, opacity 0.4s ease;
}

.v2-transition-me {
    transform: translateX(20px);
    z-index: 2;
}

.v2-transition-other {
    transform: translateX(-20px);
    z-index: 1;
    opacity: 0;
}

.v2-transition-circles.apart .v2-transition-me {
    transform: translateX(0);
}

.v2-transition-circles.apart .v2-transition-other {
    transform: translateX(0);
    opacity: 1;
}

.v2-transition-line {
    width: 0;
    height: 2px;
    background: rgba(140, 120, 200, 0.5);
    margin: -2px auto 0;
    transition: width 0.6s ease 0.4s;
    border-radius: 1px;
}

.v2-transition-circles.apart ~ .v2-transition-line {
    width: 80px;
}

.v2-transition-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-heading);
    font-weight: 500;
    letter-spacing: 0.1em;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease 0.8s, transform 0.5s ease 0.8s;
}

.v2-transition-circles.apart ~ .v2-transition-text {
    opacity: 1;
    transform: translateY(0);
}

/* ===== CHAT ===== */
.v2-chat-state {
    padding: 0;
    justify-content: flex-start;
}

.v2-chat-layout {
    display: flex;
    width: 100%;
    height: 100%;
    flex: 1;
}

.v2-chat-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.v2-chat-profile-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.v2-chat-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: rgba(13, 10, 16, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.v2-chat-sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .v2-chat-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .v2-chat-sidebar.is-open {
        transform: translateX(0);
    }

    .v2-chat-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .v2-chat-sidebar-overlay.is-visible {
        display: block;
    }
}

.v2-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.v2-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.v2-chat-handle {
    color: var(--text-primary, #fff);
    font-weight: 500;
}

.v2-chat-status {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-secondary);
    margin-left: auto;
}

.v2-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.v2-chat-input-bar {
    position: relative;
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    flex-wrap: wrap;
    overflow: visible;
}

.v2-chat-input-bar .btn-filled {
    width: auto;
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: var(--font-size-secondary);
}

#v2-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    padding: 0.75rem 1rem;
    font-size: var(--font-size-body);
    outline: none;
}

.v2-chat-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.v2-chat-me-avatar-btn,
.v2-chat-me-handle-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 3px 6px;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.v2-chat-me-avatar-btn:hover,
.v2-chat-me-handle-btn:hover {
    border-color: rgba(140, 120, 200, 0.3);
    background: rgba(140, 120, 200, 0.1);
}

.v2-chat-me-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.v2-chat-me-handle-btn span {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-secondary);
}

/* Popovers */
.v2-popover {
    position: absolute;
    bottom: 100%;
    margin-bottom: 12px;
    z-index: 50;
}

.v2-popover-avatar {
    left: 0;
}

.v2-popover-handle {
    left: 40px;
}

.v2-popover-content {
    background: rgba(20, 18, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 1.25rem;
    min-width: 200px;
}

.v2-popover-arrow {
    position: absolute;
    bottom: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background: rgba(20, 18, 25, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    transform: rotate(45deg);
}

.v2-popover-handle .v2-popover-arrow {
    left: 30px;
}

.v2-popover-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-caption);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.75rem;
}

.v2-popover-handle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.v2-popover-handle-text {
    color: #fff;
    font-size: var(--font-size-heading);
    font-weight: 600;
}

.v2-popover-handle-regen {
    background: rgba(140, 120, 200, 0.2);
    border: 1px solid rgba(140, 120, 200, 0.3);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-secondary);
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.v2-popover-handle-regen:hover {
    background: rgba(140, 120, 200, 0.35);
}

.v2-popover .v2-avatar-grid {
    grid-template-columns: repeat(7, 1fr);
    max-width: 380px;
}



/* ===== GATE ===== */
.v2-gate {
    padding: 1.5rem;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.v2-gate-card {
    background: rgba(140, 120, 200, 0.08);
    border: 1px solid rgba(140, 120, 200, 0.25);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
}

.v2-gate-card h3 {
    color: var(--text-primary, #fff);
    margin: 0 0 0.5rem;
    font-size: var(--font-size-heading);
}

.v2-gate-card p {
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--font-size-body);
    margin: 0 0 1.5rem;
}

.v2-gate-input {
    width: 100%;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    padding: 0.75rem 1rem;
    font-size: var(--font-size-body);
    text-align: center;
    outline: none;
    margin-bottom: 1rem;
}

.v2-gate-btn {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 0.8rem;
    background: rgba(140, 120, 200, 0.35);
    border: 1px solid rgba(140, 120, 200, 0.5);
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    font-size: var(--font-size-body);
    cursor: pointer;
}

.v2-gate-error {
    color: #e74c3c;
    font-size: var(--font-size-secondary);
    margin-top: 0.75rem;
}

/* ===== CONVERTED CTA ===== */
.v2-converted-cta {
    padding: 1rem 1.5rem;
    text-align: center;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.v2-new-connection-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: 8px;
    color: #2ecc71;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-body);
    transition: background 0.2s;
}

.v2-new-connection-btn:hover {
    background: rgba(46, 204, 113, 0.25);
}

/* ===== POST-ACTION SIGNUP ===== */
.v2-signup-content {
    text-align: center;
    max-width: 480px;
    width: 100%;
}
.v2-signup-logo {
    width: 140px;
    margin-bottom: 2rem;
    opacity: 0.9;
}
.v2-signup-avatar-block { margin-bottom: 1.5rem; }
.v2-signup-avatar-block img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}
.v2-signup-handle {
    color: var(--text-primary);
    font-weight: 500;
    margin: 0;
}
.v2-signup-content .v2-gate-input { max-width: 360px; }
.v2-signup-content .btn-filled { max-width: 360px; margin: 1rem auto 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .v2-logo {
        width: 120px;
        top: 1rem;
        left: 1rem;
    }

    .v2-hero-title {
        font-size: var(--font-size-headline);
    }

.v2-chat-header,
    .v2-chat-messages,
    .v2-chat-input-bar,
    .v2-gate,
    .v2-converted-cta {
        max-width: 100%;
    }

    .v2-chat-me {
        width: 100%;
    }

    .v2-chat-input-bar #v2-chat-input {
        min-width: 0;
    }

    .v2-chat-send-btn {
        flex-shrink: 0;
    }
}

/* ── Button Spinner ────────────────────────────────────────────── */
.btn-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ── Prompt Validation ────────────────────────────────────────── */
.v2-prompt-error {
    color: #e74c3c;
    font-size: var(--font-size-secondary);
    text-align: center;
    margin: 8px 0 0;
}

.v2-vague-suggestions {
    margin: 12px 0 0;
    text-align: center;
}
.v2-vague-msg {
    color: var(--text-secondary);
    font-size: var(--font-size-secondary);
    margin-bottom: 10px;
}
.v2-suggestion-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.v2-suggestion-chip {
    background: rgba(124, 108, 175, 0.15);
    border: 1px solid rgba(124, 108, 175, 0.35);
    color: var(--text-primary);
    font-size: var(--font-size-secondary);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}
.v2-suggestion-chip:hover {
    background: rgba(124, 108, 175, 0.3);
    border-color: rgba(124, 108, 175, 0.6);
}
.v2-connect-anyway {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-secondary);
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    padding: 4px;
}
.v2-connect-anyway:hover {
    color: var(--text-secondary);
}

/* Self-harm resources screen */
.v2-selfharm-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 24px;
}
.v2-selfharm-content {
    width: 100%;
    max-width: 90vw;
    padding: 40px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.v2-selfharm-content .v2-selfharm-resources {
    width: 100%;
}
.v2-selfharm-content .btn-filled {
    width: 100%;
    align-self: stretch;
}
.v2-selfharm-title {
    font-size: var(--font-size-headline);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.v2-selfharm-body {
    color: var(--text-secondary);
    font-size: var(--font-size-body);
    line-height: 1.6;
    margin-bottom: 28px;
}
.v2-selfharm-resources {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
    width: 100%;
    align-self: stretch;
}
.v2-resource-card {
    background: rgba(124, 108, 175, 0.12);
    border: 1px solid rgba(124, 108, 175, 0.25);
    border-radius: 10px;
    padding: 16px 20px;
    text-align: left;
}
.v2-resource-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-body);
    margin: 0 0 4px;
}
.v2-resource-action {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-body);
    margin: 0 0 2px;
}
.v2-resource-avail {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-caption);
    margin: 0;
}
