/* ===== REGISTER CSS PROPERTIES (enables smooth color transitions) ===== */
@property --bg {
    syntax: '<color>';
    inherits: true;
    initial-value: #0D0F14;
}
@property --surface {
    syntax: '<color>';
    inherits: true;
    initial-value: #141720;
}
@property --surface-elevated {
    syntax: '<color>';
    inherits: true;
    initial-value: #1C2030;
}
@property --border {
    syntax: '<color>';
    inherits: true;
    initial-value: #252A3A;
}
@property --primary {
    syntax: '<color>';
    inherits: true;
    initial-value: #7B5EA7;
}
@property --primary-hover {
    syntax: '<color>';
    inherits: true;
    initial-value: #8E6FBA;
}
@property --secondary {
    syntax: '<color>';
    inherits: true;
    initial-value: #9D6E8A;
}
@property --received-bg {
    syntax: '<color>';
    inherits: true;
    initial-value: #1C2030;
}
@property --text {
    syntax: '<color>';
    inherits: true;
    initial-value: #F0EEE9;
}
@property --text-secondary {
    syntax: '<color>';
    inherits: true;
    initial-value: #A8A8B3;
}
@property --text-muted {
    syntax: '<color>';
    inherits: true;
    initial-value: #6B6B7B;
}

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

:root {
    --bg: #0D0F14;
    --surface: #141720;
    --surface-elevated: #1C2030;
    --border: #252A3A;
    --primary: #7B5EA7;
    --primary-hover: #8E6FBA;
    --secondary: #9D6E8A;
    --sent-gradient: linear-gradient(135deg, #4C1D95, #7B5EA7);
    --received-bg: #1C2030;
    --text: #F0EEE9;
    --text-secondary: #A8A8B3;
    --text-muted: #6B6B7B;
    --error: #E54D4D;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    height: 100%;
    height: 100dvh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* Smooth mood theme transitions — on html so all children inherit */
html {
    transition: --bg 1s ease, --surface 1s ease, --surface-elevated 1s ease,
                --border 0.8s ease, --primary 1s ease, --primary-hover 1s ease,
                --secondary 1s ease, --received-bg 1s ease,
                --text 0.8s ease, --text-secondary 0.8s ease, --text-muted 0.8s ease;
}

/* Prevent body scroll only on chat page (JS adds this class) */
body.chat-active {
    overflow: hidden;
}

input, button, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

.hidden {
    display: none !important;
}


/* ===== AUTH PAGE ===== */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(123, 94, 167, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(157, 110, 138, 0.06) 0%, transparent 50%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 32px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--sent-gradient);
}

.auth-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(123, 94, 167, 0.4);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary);
}

.input-group select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B6B7B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.input-group select option {
    background: var(--surface);
    color: var(--text);
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--sent-gradient);
    color: white;
    width: 100%;
    margin-top: 6px;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch .btn-link {
    margin-left: 4px;
}

.error-msg {
    background: rgba(229, 77, 77, 0.1);
    border: 1px solid rgba(229, 77, 77, 0.3);
    color: #F87171;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}


/* ===== ONBOARDING PAGE ===== */
.onboarding-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(123, 94, 167, 0.1) 0%, transparent 60%),
        var(--bg);
}

.onboarding-card {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 32px;
}

/* Progress bar */
.progress-bar-wrap {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--sent-gradient);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-bar-fill.usage-warn {
    background: linear-gradient(135deg, #D4365C, #FF6B6B);
}

/* --- Usage section in stats modal --- */
.usage-section {
    margin-top: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.usage-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.usage-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.usage-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-tier-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(123, 94, 167, 0.15);
    color: #7B5EA7;
    margin-left: 6px;
    vertical-align: middle;
}

.step-counter {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* Legacy dots (kept for compat) */
.progress-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 36px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px rgba(123, 94, 167, 0.4);
}

.step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.step.active {
    display: block;
}

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

.step h2 {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}

.step-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

.step .input-group {
    margin-bottom: 20px;
}

.interests-group {
    margin-bottom: 24px;
}

.interests-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.multi-hint {
    font-size: 12px;
    opacity: 0.6;
    font-style: italic;
}

.interest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    cursor: pointer;
}

.chip input {
    display: none;
}

.chip span {
    display: inline-block;
    padding: 10px 18px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.chip input:checked + span {
    background: rgba(123, 94, 167, 0.2);
    border-color: var(--primary);
    color: var(--text);
}

.chip:hover span {
    border-color: var(--text-muted);
}

.step-buttons {
    display: flex;
    gap: 12px;
}

.step-buttons .btn-ghost {
    flex: 0 0 auto;
    padding: 14px 20px;
}

.step-buttons .btn-primary {
    flex: 1;
    margin-top: 0;
}

/* Step emoji */
.step-emoji {
    text-align: center;
    font-size: 40px;
    margin-bottom: 12px;
    animation: bounceIn 0.4s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Vibe select group */
.vibe-select-group {
    margin-bottom: 8px;
}

/* Vibe cards */
.vibe-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.vibe-card {
    cursor: pointer;
}

.vibe-card input {
    display: none;
}

.vibe-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 10px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: all 0.2s;
    gap: 4px;
}

.vibe-card input:checked + .vibe-card-inner {
    background: rgba(123, 94, 167, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(123, 94, 167, 0.2);
}

.vibe-card:hover .vibe-card-inner {
    border-color: var(--text-muted);
}

.vibe-icon {
    font-size: 28px;
    margin-bottom: 2px;
}

.vibe-card-inner strong {
    font-size: 13px;
    color: var(--text);
}

.vibe-card-inner .vibe-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Name suggestion tags */
.name-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 20px;
}

.name-tag {
    padding: 8px 16px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.name-tag:hover {
    border-color: var(--primary);
    color: var(--text);
    background: rgba(123, 94, 167, 0.1);
}


/* ===== CHAT PAGE ===== */
.chat-page {
    height: 100vh;
    height: 100dvh; /* dynamic viewport height — respects mobile address bar */
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(123, 94, 167, 0.04) 0%, transparent 50%),
        var(--bg);
    overflow: hidden;
    /* Safe area insets for notch phones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

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

.avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

img.avatar-small, img.avatar-tiny, img.modal-avatar {
    object-fit: cover;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
}

.header-info h2 {
    font-size: 16px;
    font-weight: 600;
}

.online-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ADE80;
    display: inline-block;
}

.header-right {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--surface-elevated);
    color: var(--text);
}


/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0; /* critical for flex child scrolling */
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 2px;
    animation: msgIn 0.25s ease;
}

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

.message-row.sent {
    justify-content: flex-end;
}

.message-row.received {
    justify-content: flex-start;
}

.avatar-tiny {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--sent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    color: white;
    flex-shrink: 0;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-row.sent .message-bubble {
    background: var(--sent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-row.received .message-bubble {
    background: var(--received-bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}


/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 4px 20px 10px;
    animation: fadeSlideIn 0.3s ease;
}

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

.typing-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--received-bg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.typing-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* Header status when typing */
.online-status.offline {
    color: var(--text-muted);
}

.online-status.offline .status-dot {
    background: #888;
}

.online-status.typing {
    color: var(--primary);
}

.online-status.typing .status-dot {
    background: var(--primary);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}


/* Input bar */
.chat-input-bar {
    position: relative;
    padding: 12px 16px 16px;
    background: rgba(20, 23, 32, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input-bar form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-bar input {
    flex: 1;
    min-width: 0; /* critical — prevents input from pushing buttons off screen */
    padding: 14px 18px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-bar input::placeholder {
    color: var(--text-muted);
}

.chat-input-bar input:focus {
    border-color: var(--primary);
}

.btn-send {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--sent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    opacity: 0.9;
    transform: scale(1.04);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* ===== CALL MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 300px;
    width: 90%;
}

.modal-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--sent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
    color: white;
    margin: 0 auto 16px;
}

.modal-card h3 {
    font-size: 20px;
    margin-bottom: 6px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}


/* ===== MIC BUTTON & VOICE RECORDING ===== */
.btn-mic {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    flex-shrink: 0;
}

.btn-mic:hover {
    color: var(--text-secondary);
    background: var(--surface-elevated);
}

.btn-mic.recording {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
    animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.mic-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Mic device picker dropdown */
.mic-devices {
    position: absolute;
    bottom: 50px;
    right: 0;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    z-index: 60;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.15s ease;
}

.mic-devices-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.mic-device-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mic-device-option:hover {
    background: var(--surface-elevated);
    color: var(--text);
}

.mic-device-option.active {
    background: rgba(123, 94, 167, 0.15);
    border-color: var(--primary);
    color: var(--text);
}

/* Recording overlay bar */
.voice-recording {
    position: absolute;
    bottom: 70px;
    left: 16px;
    right: 16px;
    z-index: 55;
    animation: fadeSlideIn 0.2s ease;
}

.voice-recording-inner {
    background: var(--surface);
    border: 1px solid #EF4444;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.15);
}

.voice-waves {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.voice-waves span {
    width: 3px;
    height: 8px;
    background: #EF4444;
    border-radius: 3px;
    animation: waveBar 0.8s infinite ease-in-out;
}

.voice-waves span:nth-child(1) { animation-delay: 0s; height: 10px; }
.voice-waves span:nth-child(2) { animation-delay: 0.1s; height: 18px; }
.voice-waves span:nth-child(3) { animation-delay: 0.2s; height: 24px; }
.voice-waves span:nth-child(4) { animation-delay: 0.3s; height: 16px; }
.voice-waves span:nth-child(5) { animation-delay: 0.4s; height: 12px; }

@keyframes waveBar {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

.voice-timer {
    font-size: 18px;
    font-weight: 600;
    color: #EF4444;
    font-variant-numeric: tabular-nums;
    min-width: 40px;
}

.voice-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Voice message bubble */
.voice-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    padding: 10px 14px;
}

.voice-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.message-row.received .voice-play-btn {
    background: rgba(123, 94, 167, 0.2);
    color: var(--primary);
}

.message-row.received .voice-play-btn:hover {
    background: rgba(123, 94, 167, 0.3);
}

.voice-play-btn .play-icon {
    margin-left: 2px;
}

.voice-msg-track {
    flex: 1;
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border-radius: 4px;
}

.voice-msg-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: width 0.1s linear;
    z-index: 0;
}

.message-row.received .voice-msg-progress {
    background: rgba(123, 94, 167, 0.15);
}

.voice-msg-waves {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.voice-msg-waves span {
    width: 2.5px;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.voice-bubble.playing .voice-msg-waves span {
    animation: wavePlay 0.6s infinite ease-in-out alternate;
}

.voice-msg-waves span:nth-child(1)  { height: 6px;  animation-delay: 0s; }
.voice-msg-waves span:nth-child(2)  { height: 12px; animation-delay: 0.05s; }
.voice-msg-waves span:nth-child(3)  { height: 18px; animation-delay: 0.1s; }
.voice-msg-waves span:nth-child(4)  { height: 10px; animation-delay: 0.15s; }
.voice-msg-waves span:nth-child(5)  { height: 16px; animation-delay: 0.2s; }
.voice-msg-waves span:nth-child(6)  { height: 8px;  animation-delay: 0.25s; }
.voice-msg-waves span:nth-child(7)  { height: 14px; animation-delay: 0.3s; }
.voice-msg-waves span:nth-child(8)  { height: 6px;  animation-delay: 0.35s; }
.voice-msg-waves span:nth-child(9)  { height: 12px; animation-delay: 0.4s; }
.voice-msg-waves span:nth-child(10) { height: 16px; animation-delay: 0.45s; }
.voice-msg-waves span:nth-child(11) { height: 8px;  animation-delay: 0.5s; }
.voice-msg-waves span:nth-child(12) { height: 10px; animation-delay: 0.55s; }

@keyframes wavePlay {
    0%   { opacity: 0.3; transform: scaleY(0.6); }
    100% { opacity: 0.8; transform: scaleY(1.2); }
}

.voice-msg-duration {
    font-size: 12px;
    opacity: 0.7;
    flex-shrink: 0;
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Hide the <audio> element */
.message-row audio {
    display: none;
}

.voice-transcript {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    padding: 2px 4px 0;
    max-width: 70%;
}

.message-row.sent .voice-transcript {
    text-align: right;
}


/* ===== EMOJI PICKER ===== */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 16px;
    width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    z-index: 50;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.15s ease;
}

.emoji-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.emoji-tab {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 18px;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.emoji-tab:hover {
    background: var(--surface-elevated);
}

.emoji-tab.active {
    background: rgba(123, 94, 167, 0.2);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-grid::-webkit-scrollbar {
    width: 4px;
}

.emoji-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.emoji-item {
    background: transparent;
    border: none;
    font-size: 22px;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.emoji-item:hover {
    background: var(--surface-elevated);
    transform: scale(1.2);
}

.btn-emoji {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    flex-shrink: 0;
}

.btn-emoji:hover {
    color: var(--text-secondary);
    background: var(--surface-elevated);
}


/* ===== SEEN / UNSEEN TICKS ===== */
.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 0 4px;
}

.message-row.sent .message-meta {
    justify-content: flex-end;
}

.message-row.received .message-meta {
    margin-left: 36px;
}

.seen-icon {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: -3px;
    font-weight: 700;
}

.seen-icon.seen {
    color: #60A5FA;
}


/* ===== THEME VARIANTS ===== */

/* Midnight Blue */
[data-theme="midnight-blue"] {
    --bg: #0A0E1A;
    --surface: #101828;
    --surface-elevated: #182035;
    --border: #1E2A45;
    --primary: #3B82F6;
    --primary-hover: #60A5FA;
    --secondary: #6366F1;
    --sent-gradient: linear-gradient(135deg, #1E3A8A, #3B82F6);
    --received-bg: #182035;
    --text: #E8ECF4;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
}

/* Rose Gold */
[data-theme="rose-gold"] {
    --bg: #140C10;
    --surface: #1C1216;
    --surface-elevated: #2A1A20;
    --border: #3D2530;
    --primary: #E11D48;
    --primary-hover: #F43F5E;
    --secondary: #FB7185;
    --sent-gradient: linear-gradient(135deg, #881337, #E11D48);
    --received-bg: #2A1A20;
    --text: #FDE8EE;
    --text-secondary: #CBA0AE;
    --text-muted: #8B5E6E;
}

/* Light */
[data-theme="light"] {
    --bg: #F5F3F0;
    --surface: #FFFFFF;
    --surface-elevated: #F0EDE8;
    --border: #E0DDD6;
    --primary: #7B5EA7;
    --primary-hover: #8E6FBA;
    --secondary: #9D6E8A;
    --sent-gradient: linear-gradient(135deg, #4C1D95, #7B5EA7);
    --received-bg: #F0EDE8;
    --text: #1A1A1A;
    --text-secondary: #5A5A5A;
    --text-muted: #9A9A9A;
}

[data-theme="light"] .chat-input-bar {
    background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}


/* ===== MOOD-BASED DYNAMIC THEMES ===== */
/* These override static themes when mood auto-theme is active */

/* Happy — Warm peach-coral */
[data-mood-theme="happy"] {
    --bg: #14100E;
    --surface: #1C1512;
    --surface-elevated: #261C18;
    --border: #3D2A22;
    --primary: #E0826A;
    --primary-hover: #E8957F;
    --secondary: #D09080;
    --sent-gradient: linear-gradient(135deg, #7A3828, #E0826A);
    --received-bg: #1C1512;
    --text: #F5E5DD;
    --text-secondary: #C8A898;
    --text-muted: #8A6858;
}

/* Romantic — Soft rose */
[data-mood-theme="romantic"] {
    --bg: #140D12;
    --surface: #1C1018;
    --surface-elevated: #281620;
    --border: #3D2030;
    --primary: #D4365C;
    --primary-hover: #E04A6E;
    --secondary: #C04870;
    --sent-gradient: linear-gradient(135deg, #7A1A35, #D4365C);
    --received-bg: #1C1018;
    --text: #F5DDE5;
    --text-secondary: #C8A0B0;
    --text-muted: #8A5E70;
}

/* Melancholic — Muted indigo */
[data-mood-theme="melancholic"] {
    --bg: #0D0E16;
    --surface: #12131E;
    --surface-elevated: #1A1B2A;
    --border: #282A40;
    --primary: #7B7FE0;
    --primary-hover: #9094E8;
    --secondary: #6A6EC0;
    --sent-gradient: linear-gradient(135deg, #3A3C70, #7B7FE0);
    --received-bg: #12131E;
    --text: #CDCEE8;
    --text-secondary: #9A9BB8;
    --text-muted: #5E5F7A;
}

/* Energetic — Teal-emerald */
[data-mood-theme="energetic"] {
    --bg: #0B1210;
    --surface: #0F1A16;
    --surface-elevated: #152420;
    --border: #1E3830;
    --primary: #0FA678;
    --primary-hover: #18C08A;
    --secondary: #10B880;
    --sent-gradient: linear-gradient(135deg, #065038, #0FA678);
    --received-bg: #0F1A16;
    --text: #CCF0E0;
    --text-secondary: #90C4AA;
    --text-muted: #4E8A6E;
}

/* Calm — Digital lavender */
[data-mood-theme="calm"] {
    --bg: #0E0D14;
    --surface: #14121E;
    --surface-elevated: #1C1A2A;
    --border: #2A2840;
    --primary: #9B7FE6;
    --primary-hover: #AE96EE;
    --secondary: #8A70D0;
    --sent-gradient: linear-gradient(135deg, #4A3A80, #9B7FE6);
    --received-bg: #14121E;
    --text: #E0D9F0;
    --text-secondary: #A8A0C0;
    --text-muted: #6A6080;
}

/* Flirty — Warm pink */
[data-mood-theme="flirty"] {
    --bg: #140D11;
    --surface: #1C1016;
    --surface-elevated: #281620;
    --border: #3D2030;
    --primary: #E06090;
    --primary-hover: #E878A0;
    --secondary: #D05080;
    --sent-gradient: linear-gradient(135deg, #802848, #E06090);
    --received-bg: #1C1016;
    --text: #F5DDE8;
    --text-secondary: #C8A0B4;
    --text-muted: #8A5E70;
}

/* Mood toggle button */
.mood-toggle-btn {
    position: relative;
}

.mood-toggle-btn.active {
    color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(123, 94, 167, 0.3), 0 0 8px rgba(123, 94, 167, 0.15);
    background: rgba(123, 94, 167, 0.1);
}


/* ===== TOAST NOTIFICATIONS ===== */
.toast-error {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1C1012;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #FCA5A5;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 440px;
    width: 90%;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.3s ease;
}

.toast-error svg {
    flex-shrink: 0;
    color: #EF4444;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast-fade {
    opacity: 0;
    transition: opacity 0.3s;
}

[data-theme="light"] .toast-error {
    background: #FEF2F2;
    border-color: rgba(239, 68, 68, 0.3);
    color: #991B1B;
}

/* ===== ERROR BUBBLE (rate limit, API errors) ===== */
.error-bubble {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #FCA5A5 !important;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: errorShake 0.4s ease-out;
}

.error-bubble-icon {
    flex-shrink: 0;
    color: #EF4444;
    margin-top: 1px;
}

.error-bubble span {
    font-size: 13px;
    line-height: 1.4;
}

[data-theme="light"] .error-bubble {
    background: #FEF2F2 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #991B1B !important;
}

[data-theme="light"] .error-bubble-icon {
    color: #DC2626;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}



/* ===== PIN / REMEMBER BUTTON ===== */
.btn-pin {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.message-row:hover .btn-pin {
    opacity: 0.6;
}

.btn-pin:hover {
    opacity: 1 !important;
    color: var(--primary);
    background: rgba(123, 94, 167, 0.1);
}

.btn-pin.pinned {
    opacity: 1 !important;
    color: var(--primary);
}

.btn-pin:disabled {
    cursor: default;
}


/* ===== PROACTIVE MESSAGE ANIMATION ===== */
.proactive-fade-in {
    animation: proactiveFadeIn 0.6s ease-out;
}

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


/* ===== VOICE CALL OVERLAY ===== */
.call-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(13, 15, 20, 0.97) 0%, rgba(20, 12, 30, 0.98) 100%);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.call-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    gap: 8px;
}

.call-avatar-wrap {
    margin-bottom: 16px;
}

.call-avatar-ring {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
}

.call-avatar-ring::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.call-avatar-ring.speaking::before {
    border-color: var(--primary);
    animation: pulse-ring 1.5s ease-in-out infinite;
}

.call-avatar-ring.listening::before {
    border-color: rgba(74, 222, 128, 0.4);
    animation: pulse-ring 2s ease-in-out infinite;
}

.call-avatar-ring.user-speaking::before {
    border-color: rgba(96, 165, 250, 0.6);
    animation: pulse-ring 0.8s ease-in-out infinite;
}

.call-avatar-ring.processing::before {
    border-color: rgba(245, 158, 11, 0.5);
    animation: pulse-ring 0.6s ease-in-out infinite;
}

.call-avatar-ring.thinking::before {
    border-color: rgba(167, 139, 250, 0.5);
    animation: pulse-ring 1s ease-in-out infinite;
}

@keyframes pulse-ring {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
}

.call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.call-avatar-fallback {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--sent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 48px;
    color: white;
}

.call-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
}

/* Status row with state indicator */
.call-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 24px;
}

.call-state-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.call-state-icon.connecting {
    background: #FBBF24;
    animation: blink 1s ease-in-out infinite;
}

.call-state-icon.connected,
.call-state-icon.listening {
    background: #4ADE80;
    animation: blink 2s ease-in-out infinite;
}

.call-state-icon.user-speaking {
    background: #60A5FA;
    animation: blink 0.5s ease-in-out infinite;
}

.call-state-icon.processing {
    background: #F59E0B;
    animation: blink 0.6s ease-in-out infinite;
}

.call-state-icon.thinking {
    background: #A78BFA;
    animation: blink 0.8s ease-in-out infinite;
}

.call-state-icon.ai-speaking {
    background: var(--primary);
    animation: blink 0.4s ease-in-out infinite;
}

.call-state-icon.error {
    background: #EF4444;
}

.call-state-icon.muted {
    background: var(--text-muted);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.call-status {
    font-size: 14px;
    color: var(--text-secondary);
    min-height: 20px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.call-timer {
    font-size: 16px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-bottom: 32px;
}

.call-controls {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-top: 20px;
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--surface-elevated);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.call-btn:hover {
    background: var(--border);
    transform: scale(1.05);
}

.call-btn.muted {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.call-btn-end {
    width: 64px;
    height: 64px;
    background: #EF4444;
    color: white;
}

.call-btn-end:hover {
    background: #DC2626;
}


/* ===== RESPONSIVE — MOBILE ===== */

/* Tablets and small screens */
@media (max-width: 768px) {
    .chat-messages {
        padding: 12px;
    }

    .message-bubble {
        max-width: 80%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .chat-header {
        padding: 10px 14px;
    }

    .header-info h2 {
        font-size: 15px;
    }

    .modal-card {
        max-width: 90vw;
        padding: 28px 20px;
    }

    .emoji-picker {
        width: calc(100% - 24px);
        left: 12px;
        right: 12px;
    }
}

/* Phones */
@media (max-width: 480px) {
    .auth-page {
        padding: 12px;
    }

    .auth-card,
    .onboarding-card {
        padding: 24px 16px;
        border-radius: 14px;
        max-width: 100%;
        width: 100%;
    }

    /* Chat header — compact */
    .chat-header {
        padding: 8px 10px;
        gap: 6px;
    }

    .header-left {
        gap: 8px;
        min-width: 0; /* allow text truncation */
        flex: 1;
    }

    .avatar-small {
        width: 36px;
        height: 36px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .header-info {
        min-width: 0; /* allow text truncation */
    }

    .header-info h2 {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .online-status {
        font-size: 11px;
    }

    .header-right {
        gap: 2px;
        flex-shrink: 0;
    }

    .btn-icon {
        padding: 6px;
    }

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

    /* Chat messages */
    .chat-messages {
        padding: 8px 10px;
        gap: 2px;
    }

    .message-bubble {
        max-width: 85%;
        padding: 9px 12px;
        font-size: 13.5px;
        border-radius: 14px;
    }

    .message-row {
        gap: 6px;
    }

    .avatar-tiny {
        width: 24px;
        height: 24px;
        font-size: 10px;
        flex-shrink: 0;
    }

    .message-time {
        font-size: 10px;
    }

    .message-meta {
        gap: 4px;
    }

    .message-row.received .message-meta {
        margin-left: 30px;
    }

    /* Input bar — compact */
    .chat-input-bar {
        padding: 8px 10px 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .chat-input-bar form {
        gap: 6px;
    }

    .chat-input-bar input {
        padding: 11px 14px;
        font-size: 14px;
        border-radius: 12px;
    }

    .btn-send {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

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

    .btn-emoji {
        padding: 6px;
    }

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

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

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

    /* Typing indicator */
    .typing-indicator {
        padding: 4px 10px 8px;
    }

    /* Voice message */
    .voice-recording {
        bottom: 62px;
        left: 10px;
        right: 10px;
    }

    .voice-recording-inner {
        padding: 12px 16px;
    }

    /* Emoji picker */
    .emoji-picker {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        bottom: 62px;
        max-height: 220px;
    }

    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }

    .emoji-grid button {
        font-size: 20px;
        padding: 4px;
    }

    /* Modals */
    .modal-card {
        max-width: calc(100vw - 32px);
        padding: 24px 16px;
        border-radius: 16px;
    }

    .modal-avatar {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    /* Voice bubble compact */
    .voice-bubble {
        min-width: 180px;
        padding: 8px 12px;
        gap: 8px;
    }

    .voice-play-btn {
        width: 30px;
        height: 30px;
    }

    .voice-msg-duration {
        font-size: 11px;
    }

    /* Onboarding */
    .step-emoji {
        font-size: 36px;
    }

    .step h2 {
        font-size: 20px;
    }

    .step-subtitle {
        font-size: 13px;
    }

    .vibe-cards {
        gap: 8px;
    }

    .vibe-card-inner {
        padding: 12px;
    }

    .name-suggestions {
        gap: 6px;
    }
}

/* Very small phones (iPhone SE, Galaxy S series mini) */
@media (max-width: 375px) {
    .chat-header {
        padding: 6px 8px;
    }

    .avatar-small {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .header-info h2 {
        font-size: 13px;
    }

    .chat-messages {
        padding: 6px 8px;
    }

    .message-bubble {
        max-width: 88%;
        padding: 8px 10px;
        font-size: 13px;
        border-radius: 12px;
    }

    .avatar-tiny {
        width: 22px;
        height: 22px;
        font-size: 9px;
    }

    .chat-input-bar {
        padding: 6px 8px 8px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .chat-input-bar input {
        padding: 10px 12px;
        font-size: 13px;
    }

    .btn-send {
        width: 36px;
        height: 36px;
    }

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

    .header-right {
        gap: 0;
    }

    .btn-icon {
        padding: 5px;
    }

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

/* Fix keyboard pushing layout on mobile */
@media (max-height: 500px) {
    .chat-messages {
        padding: 6px 10px;
    }

    .chat-header {
        padding: 6px 10px;
    }

    .typing-indicator {
        padding: 2px 10px 4px;
    }
}

/* ===== AVATAR GRID (onboarding + chat picker) ===== */

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 16px auto 0;
}

.avatar-option {
    cursor: pointer;
    position: relative;
}

.avatar-option input[type="radio"] {
    display: none;
}

.avatar-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    transition: all 0.2s ease;
    background: var(--card-bg);
}

.avatar-option input[type="radio"]:checked + .avatar-preview,
.avatar-option-chat.selected .avatar-preview {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 94, 167, 0.3);
    transform: scale(1.05);
}

.avatar-option:hover .avatar-preview,
.avatar-option-chat:hover .avatar-preview {
    border-color: var(--primary);
    transform: scale(1.05);
}

.avatar-option-chat {
    cursor: pointer;
}

/* Avatar modal — wider than default modal-card */
#avatarModal .modal-card {
    max-width: 420px;
    padding: 28px;
}

#avatarModal .avatar-grid {
    max-width: 100%;
    gap: 10px;
}

#avatarModal .avatar-preview {
    width: 100%;
    height: auto;
}

@media (max-width: 480px) {
    .avatar-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
        max-width: 100%;
    }

    .avatar-preview {
        border-width: 2px;
    }

    #avatarModal .modal-card {
        max-width: calc(100vw - 24px);
        padding: 20px 14px;
    }

    #avatarModal .avatar-preview {
        width: 100%;
        height: auto;
    }
}

@media (max-width: 375px) {
    .avatar-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
}


/* ===== STATS MODAL ===== */
.modal-card-wide {
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.streak-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.streak-fire {
    font-size: 28px;
}

.streak-number {
    font-size: 36px;
    font-weight: 700;
    background: var(--sent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-label {
    font-size: 14px;
    color: var(--text-muted);
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.stage-display {
    text-align: center;
    padding: 12px;
    background: var(--surface-elevated);
    border-radius: 12px;
    margin-bottom: 8px;
}

.stage-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.milestone-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.milestone-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--surface-elevated);
    border-radius: 10px;
    text-align: center;
}

.milestone-icon {
    font-size: 18px;
}

.milestone-title {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}


/* ===== MEMORY ALBUM ===== */
.album-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.album-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.album-tab:hover {
    background: var(--surface-elevated);
    color: var(--text-secondary);
}

.album-tab.active {
    background: rgba(123, 94, 167, 0.2);
    color: var(--primary);
}

.album-content {
    max-height: 45vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.album-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-elevated);
    border-radius: 10px;
    animation: fadeIn 0.2s ease;
}

.album-item.pinned {
    border-left: 3px solid #F97316;
}

.album-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

.album-text {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}

.album-intensity {
    font-size: 10px;
    flex-shrink: 0;
}

.album-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.album-action-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.album-action-btn:hover {
    opacity: 1;
}


/* ===== DIARY ===== */
.diary-content {
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diary-entry {
    padding: 14px;
    background: var(--surface-elevated);
    border-radius: 12px;
    border-left: 3px solid var(--primary);
}

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

.diary-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.diary-mood {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 8px;
}

.diary-avatar {
    margin-bottom: 6px;
}

.diary-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    font-style: italic;
}


/* ===== SCENARIO MODE ===== */
.scenario-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(123, 94, 167, 0.15);
    border-bottom: 1px solid rgba(123, 94, 167, 0.3);
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}

.scenario-banner-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
}

.scenario-banner-exit {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-banner-exit:hover {
    background: var(--primary);
    color: white;
}

.scenario-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50vh;
    overflow-y: auto;
}

.scenario-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-card:hover {
    border-color: var(--primary);
    background: rgba(123, 94, 167, 0.1);
}

.scenario-emoji {
    font-size: 28px;
    flex-shrink: 0;
}

.scenario-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.scenario-info p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.scenario-active-info {
    text-align: center;
    padding: 16px;
    background: var(--surface-elevated);
    border-radius: 12px;
}


/* ===== IMAGE MESSAGES (Selfies) ===== */
.image-bubble {
    padding: 4px !important;
    cursor: pointer;
    max-width: 240px !important;
}

.chat-image {
    width: 100%;
    border-radius: 12px;
    display: block;
    max-height: 300px;
    object-fit: cover;
}

.image-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

.image-viewer img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    object-fit: contain;
}


/* ===== RESPONSIVE TWEAKS FOR NEW FEATURES ===== */
@media (max-width: 480px) {
    .modal-card-wide {
        max-width: calc(100vw - 24px);
        padding: 20px 14px;
    }

    .milestone-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .milestone-badge {
        padding: 8px 4px;
    }

    .milestone-title {
        font-size: 10px;
    }

    .stats-row {
        gap: 20px;
    }

    .streak-number {
        font-size: 28px;
    }

    .scenario-card {
        padding: 10px;
        gap: 10px;
    }

    .scenario-emoji {
        font-size: 24px;
    }
}


/* =============================================================
   LANDING PAGE
   ============================================================= */

.landing {
    min-height: 100vh;
    background: #0D0F14;
    color: #F0EEE9;
    overflow-x: hidden;
}

/* ===== HERO ===== */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 80px 40px 60px;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(123, 94, 167, 0.15) 0%, rgba(123, 94, 167, 0.05) 40%, transparent 70%);
    pointer-events: none;
}

/* ===== LANDING NAV ===== */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: rgba(13, 15, 20, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(37, 42, 58, 0.5);
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 15px rgba(123, 94, 167, 0.4);
}

.nav-name {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #7B5EA7, #D4365C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-cta {
    padding: 8px 20px;
    background: linear-gradient(135deg, #4C1D95, #7B5EA7);
    color: white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(123, 94, 167, 0.3);
}

.hero-content {
    max-width: 520px;
    z-index: 1;
}

.hero-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #7B5EA7;
    background: rgba(123, 94, 167, 0.12);
    border: 1px solid rgba(123, 94, 167, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 24px;
}

.hero-title {
    font-size: 52px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.gradient-text {
    background: linear-gradient(135deg, #7B5EA7, #D4365C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 17px;
    line-height: 1.7;
    color: #A8A8B3;
    margin-bottom: 36px;
}

.hero-buttons {
    display: flex;
    gap: 14px;
}

.btn-hero-primary {
    display: inline-block;
    padding: 15px 32px;
    background: linear-gradient(135deg, #4C1D95, #7B5EA7);
    color: white;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(123, 94, 167, 0.35);
}

.btn-hero-ghost {
    display: inline-block;
    padding: 15px 32px;
    background: transparent;
    color: #A8A8B3;
    border: 1px solid #252A3A;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-hero-ghost:hover {
    border-color: #7B5EA7;
    color: #F0EEE9;
}

/* ===== HERO MOCKUP ===== */
.hero-mockup {
    width: 340px;
    background: #141720;
    border: 1px solid #252A3A;
    border-radius: 24px;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(123, 94, 167, 0.08);
    animation: mockupFloat 6s ease-in-out infinite;
}

.mockup-inner {
    border-radius: 24px;
    overflow: hidden;
}

@keyframes mockupFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.mockup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #141720;
    border-bottom: 1px solid #252A3A;
}

/* Notification popup */
.mockup-notification {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #1C2030;
    border: 1px solid #252A3A;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    animation: notifSlide 1.5s ease 2s both, notifFade 1s ease 6s both;
    opacity: 0;
    z-index: 2;
}

@keyframes notifSlide {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes notifFade {
    to { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

.notif-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-body strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 1px;
}

.notif-body p {
    font-size: 12px;
    color: #A8A8B3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    font-size: 11px;
    color: #6B6B7B;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

.mockup-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mockup-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4C1D95, #7B5EA7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.mockup-name {
    font-size: 14px;
    font-weight: 600;
}

.mockup-status {
    font-size: 11px;
    color: #6B6B7B;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mockup-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ADE80;
    display: inline-block;
}

.mockup-messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 240px;
}

.mockup-msg {
    display: flex;
}

.mockup-msg.sent {
    justify-content: flex-end;
}

.mockup-bubble-recv {
    background: #1C2030;
    padding: 10px 14px;
    border-radius: 14px 14px 14px 4px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 80%;
    color: #F0EEE9;
}

.mockup-bubble-sent {
    background: linear-gradient(135deg, #4C1D95, #7B5EA7);
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 80%;
    color: white;
}

.mockup-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.mockup-play {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(123, 94, 167, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #7B5EA7;
    flex-shrink: 0;
}

.mockup-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.mockup-waveform span {
    width: 3px;
    border-radius: 2px;
    background: #7B5EA7;
    opacity: 0.4;
}

.mockup-waveform span:nth-child(1) { height: 6px; }
.mockup-waveform span:nth-child(2) { height: 14px; }
.mockup-waveform span:nth-child(3) { height: 10px; }
.mockup-waveform span:nth-child(4) { height: 18px; }
.mockup-waveform span:nth-child(5) { height: 8px; }
.mockup-waveform span:nth-child(6) { height: 14px; }
.mockup-waveform span:nth-child(7) { height: 6px; }
.mockup-waveform span:nth-child(8) { height: 10px; }

.mockup-voice span:last-child {
    font-size: 11px;
    color: #6B6B7B;
    flex-shrink: 0;
}

/* ===== TRUST BAR ===== */
.trust-bar {
    border-top: 1px solid #1C2030;
    border-bottom: 1px solid #1C2030;
    padding: 28px 40px;
    background: rgba(20, 23, 32, 0.5);
}

.trust-items {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    max-width: 700px;
    margin: 0 auto;
}

.trust-item {
    text-align: center;
}

.trust-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #7B5EA7, #D4365C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.trust-label {
    font-size: 12px;
    color: #6B6B7B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.trust-divider {
    width: 1px;
    height: 36px;
    background: #252A3A;
}

/* ===== SECTION SHARED ===== */
.section-title {
    font-size: 38px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    letter-spacing: -0.5px;
    margin-bottom: 14px;
}

.section-sub {
    text-align: center;
    font-size: 16px;
    color: #A8A8B3;
    max-width: 560px;
    margin: 0 auto 48px;
    line-height: 1.6;
}

/* ===== FEATURES GRID ===== */
.features-section {
    padding: 100px 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 960px;
    margin: 0 auto;
}

.feature-card {
    background: #141720;
    border: 1px solid #252A3A;
    border-radius: 20px;
    padding: 32px 28px;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: rgba(123, 94, 167, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.feature-large {
    grid-column: span 3;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.feature-large .feature-icon {
    flex-shrink: 0;
}

.feature-large h3 {
    margin-bottom: 6px;
}

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(123, 94, 167, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: #7B5EA7;
}

.feature-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: #A8A8B3;
    line-height: 1.6;
}

/* ===== PERSONALITY GRID ===== */
.personality-section {
    padding: 100px 40px;
    background: rgba(20, 23, 32, 0.4);
}

.personality-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.personality-card {
    background: #141720;
    border: 1px solid #252A3A;
    border-radius: 18px;
    padding: 28px 20px;
    text-align: center;
    transition: all 0.3s;
}

.personality-card:hover {
    border-color: rgba(123, 94, 167, 0.4);
    transform: translateY(-4px);
}

.personality-emoji {
    font-size: 36px;
    margin-bottom: 12px;
}

.personality-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.personality-card p {
    font-size: 13px;
    color: #A8A8B3;
    line-height: 1.5;
}

/* ===== JOURNEY TIMELINE ===== */
.journey-section {
    padding: 100px 40px;
}

.journey-timeline {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.journey-stage {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.journey-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #252A3A;
    border: 3px solid #141720;
    flex-shrink: 0;
    margin-top: 3px;
    transition: all 0.3s;
    box-shadow: 0 0 0 2px #252A3A;
}

.journey-dot.active {
    background: #7B5EA7;
    box-shadow: 0 0 0 2px #7B5EA7, 0 0 12px rgba(123, 94, 167, 0.4);
}

.journey-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.journey-content p {
    font-size: 14px;
    color: #A8A8B3;
    line-height: 1.5;
}

.journey-line {
    width: 2px;
    height: 32px;
    background: #252A3A;
    margin-left: 7px;
}

/* ===== EXTRAS GRID ===== */
.extras-section {
    padding: 100px 40px;
    background: rgba(20, 23, 32, 0.4);
}

.extras-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 700px;
    margin: 0 auto;
}

.extra-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    background: #141720;
    border: 1px solid #1C2030;
    border-radius: 14px;
    transition: all 0.3s;
}

.extra-item:hover {
    border-color: #252A3A;
}

.extra-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.extra-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
}

.extra-item p {
    font-size: 13px;
    color: #6B6B7B;
    line-height: 1.4;
}

/* ===== PRICING ===== */
.pricing-section {
    padding: 80px 40px;
    text-align: center;
}

.pricing-grid {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 48px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.pricing-card {
    position: relative;
    flex: 1;
    max-width: 320px;
    background: #141720;
    border: 1px solid #252A3A;
    border-radius: 20px;
    padding: 36px 28px;
    text-align: left;
}

.pricing-card.pricing-featured {
    border-color: #7B5EA7;
    box-shadow: 0 0 30px rgba(123, 94, 167, 0.15);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4C1D95, #7B5EA7);
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 4px 16px;
    border-radius: 20px;
}

.pricing-tier {
    font-size: 18px;
    font-weight: 600;
    color: #F0EEE9;
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 42px;
    font-weight: 700;
    color: #F0EEE9;
    margin-bottom: 24px;
}

.pricing-period {
    font-size: 15px;
    font-weight: 400;
    color: #A8A8B3;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px 0;
}

.pricing-features li {
    font-size: 14px;
    color: #A8A8B3;
    padding: 8px 0;
    border-bottom: 1px solid rgba(37, 42, 58, 0.5);
}

.pricing-features li::before {
    content: "\2713";
    color: #7B5EA7;
    font-weight: 700;
    margin-right: 10px;
}

.pricing-features li:last-child {
    border-bottom: none;
}

.btn-pricing {
    display: block;
    text-align: center;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    color: #A8A8B3;
    border: 1px solid #252A3A;
    background: transparent;
}

.btn-pricing:hover {
    border-color: #7B5EA7;
    color: #F0EEE9;
}

.btn-pricing-primary {
    background: linear-gradient(135deg, #4C1D95, #7B5EA7);
    color: white;
    border: none;
}

.btn-pricing-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 94, 167, 0.3);
}

@media (max-width: 600px) {
    .pricing-grid {
        flex-direction: column;
        align-items: center;
    }
    .pricing-card {
        max-width: 100%;
        width: 100%;
    }
}

/* ===== CTA ===== */
.cta-section {
    position: relative;
    text-align: center;
    padding: 100px 40px;
    overflow: hidden;
}

.cta-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(123, 94, 167, 0.12) 0%, transparent 65%);
    pointer-events: none;
}

.cta-title {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
}

.cta-sub {
    font-size: 16px;
    color: #A8A8B3;
    margin-bottom: 32px;
    position: relative;
}

.cta-section .btn-hero-primary {
    position: relative;
    font-size: 16px;
    padding: 16px 40px;
}

/* ===== FOOTER ===== */
.landing-footer {
    text-align: center;
    padding: 24px 40px;
    border-top: 1px solid #1C2030;
    font-size: 13px;
    color: #6B6B7B;
}

/* ===== SCROLL REVEAL ===== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.features-grid .reveal-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.features-grid .reveal-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.features-grid .reveal-on-scroll:nth-child(4) { transition-delay: 0.15s; }
.features-grid .reveal-on-scroll:nth-child(5) { transition-delay: 0.25s; }
.features-grid .reveal-on-scroll:nth-child(6) { transition-delay: 0.2s; }

.personality-grid .reveal-on-scroll:nth-child(2) { transition-delay: 0.08s; }
.personality-grid .reveal-on-scroll:nth-child(3) { transition-delay: 0.16s; }
.personality-grid .reveal-on-scroll:nth-child(4) { transition-delay: 0.24s; }

.extras-grid .reveal-on-scroll:nth-child(2) { transition-delay: 0.06s; }
.extras-grid .reveal-on-scroll:nth-child(3) { transition-delay: 0.12s; }
.extras-grid .reveal-on-scroll:nth-child(4) { transition-delay: 0.18s; }
.extras-grid .reveal-on-scroll:nth-child(5) { transition-delay: 0.24s; }
.extras-grid .reveal-on-scroll:nth-child(6) { transition-delay: 0.3s; }
.extras-grid .reveal-on-scroll:nth-child(7) { transition-delay: 0.36s; }
.extras-grid .reveal-on-scroll:nth-child(8) { transition-delay: 0.42s; }

/* ===== LANDING RESPONSIVE ===== */
@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 80px 24px 60px;
        gap: 40px;
    }

    .hero-title {
        font-size: 38px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-mockup {
        width: 300px;
    }

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

    .feature-large {
        grid-column: span 1;
        flex-direction: column;
    }

    .personality-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-title {
        font-size: 30px;
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 90px 18px 40px;
        min-height: auto;
    }

    .landing-footer {
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 16px));
    }

    .hero-title {
        font-size: 30px;
    }

    .hero-sub {
        font-size: 15px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-mockup {
        width: 100%;
        max-width: 320px;
    }

    .trust-items {
        flex-wrap: wrap;
        gap: 20px;
    }

    .trust-divider {
        display: none;
    }

    .trust-item {
        flex: 0 0 40%;
    }

    .features-section,
    .personality-section,
    .journey-section,
    .extras-section,
    .cta-section {
        padding: 60px 18px;
    }

    .personality-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .personality-card {
        padding: 20px 14px;
    }

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

    .section-title {
        font-size: 26px;
    }

    .section-sub {
        font-size: 14px;
    }

    .cta-title {
        font-size: 28px;
    }

    .feature-card {
        padding: 24px 20px;
    }
}


/* =============================================================
   CREDITS PAGE
   ============================================================= */

.credits-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.credits-back {
    display: inline-block;
    color: #A8A8B3;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 40px;
    transition: color 0.2s;
}

.credits-back:hover {
    color: #F0EEE9;
}

.credits-hero {
    text-align: center;
    margin-bottom: 60px;
}

.credits-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #252A3A;
    margin-bottom: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.credits-name {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
}

.credits-role {
    font-size: 16px;
    color: #7B5EA7;
    font-weight: 500;
    margin-bottom: 12px;
}

.credits-bio {
    font-size: 15px;
    color: #A8A8B3;
    font-style: italic;
    margin-bottom: 8px;
}

.credits-location {
    font-size: 13px;
    color: #6B6B7B;
    margin-bottom: 4px;
}

.credits-university {
    font-size: 13px;
    color: #6B6B7B;
    margin-bottom: 24px;
}

.credits-links {
    display: flex;
    justify-content: center;
    gap: 14px;
}

.credits-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #141720;
    border: 1px solid #252A3A;
    border-radius: 12px;
    color: #A8A8B3;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.credits-link:hover {
    border-color: #7B5EA7;
    color: #F0EEE9;
    transform: translateY(-2px);
}

.credits-section {
    margin-bottom: 48px;
}

.credits-section h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1C2030;
}

.credits-section > p {
    font-size: 15px;
    color: #A8A8B3;
    line-height: 1.7;
}

.credits-contributions {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.credits-contrib {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    background: #141720;
    border: 1px solid #1C2030;
    border-radius: 14px;
    transition: border-color 0.3s;
}

.credits-contrib:hover {
    border-color: #252A3A;
}

.contrib-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(123, 94, 167, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7B5EA7;
    flex-shrink: 0;
}

.credits-contrib strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.credits-contrib p {
    font-size: 13px;
    color: #A8A8B3;
    line-height: 1.5;
}

.credits-tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-badge {
    padding: 8px 16px;
    background: #141720;
    border: 1px solid #252A3A;
    border-radius: 20px;
    font-size: 13px;
    color: #A8A8B3;
    font-weight: 500;
}

.credits-footer-cta {
    text-align: center;
    margin-top: 60px;
}

.footer-link {
    color: #7B5EA7;
    text-decoration: none;
    margin-left: 6px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #8E6FBA;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .credits-page {
        padding: 24px 16px 60px;
    }

    .credits-name {
        font-size: 26px;
    }

    .credits-avatar {
        width: 96px;
        height: 96px;
    }

    .credits-links {
        flex-direction: column;
        align-items: center;
    }

    .credits-contrib {
        flex-direction: column;
        gap: 10px;
    }
}


/* ===== PUSH NOTIFICATION BANNER ===== */
.push-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    background: var(--surface-elevated, #1C2030);
    border: 1px solid var(--border, #252A3A);
    border-radius: 14px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 380px;
    width: calc(100% - 32px);
}

.push-banner.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.push-banner-text {
    flex: 1;
    font-size: 13px;
    color: var(--text, #F0EEE9);
    line-height: 1.3;
}

.push-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.push-banner-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.push-banner-btn.push-yes {
    background: var(--primary, #7B5EA7);
    color: #fff;
}

.push-banner-btn.push-yes:hover {
    background: var(--primary-hover, #8E6FBA);
}

.push-banner-btn.push-no {
    background: transparent;
    color: var(--text-secondary, #A8A8B3);
    border: 1px solid var(--border, #252A3A);
}

.push-banner-btn.push-no:hover {
    background: var(--surface, #141720);
}
