* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --goh-cream: #f0ebe3;
    --goh-gold: #d6a86c;
    --goh-terracotta: #c47a52;
    --goh-teal: #3d6178;
    --goh-charcoal: #2a2725;
}
body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f0ebe3 0%, #f7f3ec 50%, rgba(214,168,108,0.18) 100%);
    min-height: 100vh; display: flex; flex-direction: column; line-height: 1.6; color: #2a2725;
}
.header { text-align: center; padding: 24px 24px 16px; background: rgba(247,243,236,0.6); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(209,213,219,0.4); }
.header-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 4px; }
.header-logo { width: 40px; height: 40px; border-radius: 50%; }
.header-title { font-family: 'Lora', Georgia, serif; font-size: 1.75rem; font-weight: 600; color: #2a2725; letter-spacing: 0.02em; }
.header-subtitle { font-size: 0.95rem; color: #5a5550; font-style: italic; max-width: 600px; margin: 0 auto 12px; }
.header-tagline { font-size: 0.8rem; color: #9a918a; }
.user-bar { display: none; justify-content: flex-end; align-items: center; gap: 12px; padding: 6px 24px; background: rgba(247,243,236,0.3); font-size: 0.8rem; color: #7a7570; }
.user-bar.visible { display: flex; }
.user-bar button { background: none; border: 1px solid rgba(156,163,175,0.4); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 0.75rem; color: #7a7570; }
.ecosystem-nav { display: flex; justify-content: center; gap: 10px; padding: 12px 20px; background: rgba(247,243,236,0.3); flex-wrap: wrap; }
.ecosystem-btn { display: inline-block; padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; color: #5a5550; background: rgba(247,243,236,0.5); border: 1px solid rgba(209,213,219,0.4); text-decoration: none; cursor: pointer; transition: all 0.25s ease; }
.ecosystem-btn:hover { background: rgba(255,255,255,0.8); border-color: rgba(61,97,120,0.3); }
.ecosystem-btn.current { background: linear-gradient(135deg, #3d6178 0%, #3d6178 100%); color: white; border-color: transparent; cursor: default; }

/* ── Conversations Panel ── */
.conversations-panel { display: none; max-width: 768px; width: 100%; margin: 0 auto; }
.conversations-panel.visible { display: block; }
.conversations-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 20px; cursor: pointer; font-size: 0.85rem; color: #7a7570; background: rgba(247,243,236,0.3); border: none; width: 100%; transition: background 0.2s ease; font-family: 'Source Sans 3', sans-serif; }
.conversations-toggle:hover { background: rgba(247,243,236,0.5); }
.conversations-toggle .toggle-arrow { transition: transform 0.2s ease; font-size: 0.7rem; }
.conversations-toggle.open .toggle-arrow { transform: rotate(180deg); }
.conversations-list { display: none; max-height: 240px; overflow-y: auto; padding: 8px 16px 12px; background: rgba(247,243,236,0.4); border-bottom: 1px solid rgba(209,213,219,0.3); }
.conversations-list.open { display: block; }
.conversations-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.new-conversation-btn { font-size: 0.8rem; padding: 5px 14px; border-radius: 16px; border: 1px solid rgba(61,97,120,0.3); background: rgba(255,255,255,0.8); color: #3d6178; cursor: pointer; font-family: 'Source Sans 3', sans-serif; transition: all 0.2s ease; }
.new-conversation-btn:hover { background: #3d6178; color: white; }
.conversation-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 8px; cursor: pointer; transition: background 0.15s ease; gap: 8px; border: 1px solid transparent; }
.conversation-item:hover { background: rgba(247,243,236,0.6); }
.conversation-item.active { background: rgba(61,97,120,0.08); border-color: rgba(61,97,120,0.15); }
.conversation-info { flex: 1; min-width: 0; }
.conversation-title { font-size: 0.88rem; font-weight: 500; color: #3e3b38; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta { font-size: 0.75rem; color: #9a918a; }
.conversation-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s ease; }
.conversation-item:hover .conversation-actions { opacity: 1; }
.conv-action-btn { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 0.75rem; color: #9a918a; transition: all 0.15s ease; }
.conv-action-btn:hover { background: rgba(0,0,0,0.05); color: #7a7570; }
.conv-action-btn.delete:hover { color: #dc2626; }
.conversations-empty { text-align: center; padding: 16px; font-size: 0.85rem; color: #9a918a; font-style: italic; }
.rename-input { font-family: 'Source Sans 3', sans-serif; font-size: 0.88rem; padding: 2px 6px; border: 1px solid rgba(61,97,120,0.4); border-radius: 4px; outline: none; width: 100%; background: white; }

/* ── Auth screen ── */
.auth-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-screen.hidden { display: none; }
.auth-title { font-family: 'Lora', Georgia, serif; font-size: 1.5rem; font-weight: 600; color: #2a2725; margin: 16px 0 8px; }
.auth-text { font-size: 0.95rem; color: #7a7570; max-width: 400px; text-align: center; margin-bottom: 24px; line-height: 1.7; }
.auth-btn { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-radius: 10px; border: 1px solid rgba(209,213,219,0.6); background: rgba(255,255,255,0.9); cursor: pointer; font-size: 1rem; color: #3e3b38; transition: all 0.25s ease; font-family: 'Source Sans 3', sans-serif; }
.auth-btn:hover { background: white; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.auth-btn svg { width: 20px; height: 20px; }
.auth-note { margin-top: 16px; font-size: 0.8rem; color: #9a918a; }

/* ── Chat ── */
.chat-container { flex: 1; display: flex; flex-direction: column; max-width: 768px; width: 100%; margin: 0 auto; min-height: 0; }
.chat-container.hidden { display: none; }
.messages-area { flex: 1; overflow-y: auto; padding: 20px 16px; }
.welcome-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px; }
.welcome-title { font-family: 'Lora', Georgia, serif; font-size: 1.3rem; font-weight: 500; color: #3e3b38; margin-bottom: 12px; max-width: 540px; line-height: 1.6; }
.welcome-text { font-size: 0.95rem; color: #7a7570; max-width: 500px; line-height: 1.7; margin-bottom: 28px; }
.welcome-starters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 560px; }
.starter-btn { background: rgba(255,255,255,0.85); border: 1px solid rgba(209,213,219,0.6); border-radius: 10px; padding: 12px 18px; cursor: pointer; font-size: 0.9rem; color: #3e3b38; text-align: left; transition: all 0.25s ease; font-family: 'Source Sans 3', sans-serif; line-height: 1.5; }
.starter-btn:hover { background: rgba(255,255,255,1); border-color: rgba(61,97,120,0.4); box-shadow: 0 2px 8px rgba(61,97,120,0.1); transform: translateY(-1px); }

/* ── Messages ── */
.message { display: flex; gap: 10px; margin-bottom: 16px; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }
.message-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Lora', serif; font-size: 12px; flex-shrink: 0; }
.message.assistant .message-avatar { background: linear-gradient(135deg, rgba(61,97,120,0.08) 0%, rgba(61,97,120,0.18) 100%); border: 1px solid rgba(61,97,120,0.2); color: #3d6178; }
.message.user .message-avatar { background: linear-gradient(135deg, rgba(61,97,120,0.12) 0%, rgba(61,97,120,0.22) 100%); border: 1px solid rgba(61,97,120,0.25); color: #3d6178; }
.message-content { max-width: 80%; padding: 14px 18px; border-radius: 14px; line-height: 1.7; font-size: 0.95rem; }
.message-content p { margin-bottom: 12px; }
.message-content p:last-child { margin-bottom: 0; }
.message.assistant .message-content { background: rgba(255,255,255,0.85); border: 1px solid rgba(209,213,219,0.3); border-top-left-radius: 4px; }
.message.user .message-content { background: rgba(61,97,120,0.08); border: 1px solid rgba(61,97,120,0.2); border-top-right-radius: 4px; }
.species-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; background: rgba(16,185,129,0.1); color: #345568; border: 1px solid rgba(16,185,129,0.2); margin: 0 4px 8px 0; }

/* ── Typing ── */
.typing-indicator { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.typing-dots { display: flex; gap: 4px; padding: 10px 14px; background: rgba(255,255,255,0.7); border-radius: 14px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; animation: typingBounce 1.4s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ── Input ── */
.input-area { padding: 12px 16px 16px; background: rgba(247,243,236,0.4); backdrop-filter: blur(12px); border-top: 1px solid rgba(209,213,219,0.3); }
.input-wrapper { display: flex; gap: 8px; align-items: flex-end; }
.chat-input { flex: 1; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(209,213,219,0.6); background: rgba(255,255,255,0.9); font-size: 0.95rem; line-height: 1.5; resize: none; font-family: 'Source Sans 3', sans-serif; outline: none; transition: border-color 0.2s ease; min-height: 46px; max-height: 120px; }
.chat-input:focus { border-color: rgba(61,97,120,0.4); box-shadow: 0 0 0 3px rgba(61,97,120,0.15); }
.send-btn { width: 46px; height: 46px; border-radius: 12px; border: none; background: linear-gradient(135deg, #3d6178 0%, #3d6178 100%); color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.25s ease; flex-shrink: 0; }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn svg { width: 18px; height: 18px; }
.disclaimer { text-align: center; font-size: 0.72rem; color: #9a918a; margin-top: 8px; line-height: 1.4; }

/* ── Framework Guide Modal ── */
.guide-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; justify-content: center; align-items: center; padding: 24px; }
.guide-backdrop.open { display: flex; }
.guide-modal { background: #fff; border-radius: 16px; max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,0.18); position: relative; }
.guide-close { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 16px 20px 0; background: linear-gradient(to bottom, #fff 80%, transparent); z-index: 1; }
.guide-close button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(209,213,219,0.5); background: rgba(255,255,255,0.9); cursor: pointer; font-size: 1.1rem; color: #7a7570; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.guide-close button:hover { background: #f3f4f6; color: #3e3b38; }
.guide-content { padding: 8px 36px 40px; }
.guide-title { font-family: 'Lora', Georgia, serif; font-size: 1.6rem; font-weight: 600; color: #2a2725; margin-bottom: 6px; }
.guide-tagline { font-size: 0.9rem; color: #9a918a; margin-bottom: 28px; font-style: italic; }
.guide-section { margin-bottom: 28px; }
.guide-section h3 { font-family: 'Lora', Georgia, serif; font-size: 1.1rem; font-weight: 600; color: #3e3b38; margin-bottom: 10px; }
.guide-section p { font-size: 0.92rem; color: #5a5550; line-height: 1.75; margin-bottom: 10px; }
.guide-section a { color: #3d6178; text-decoration: none; }
.guide-section a:hover { text-decoration: underline; }
.guide-dimension { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
.guide-dim-label { font-weight: 600; font-size: 0.88rem; min-width: 72px; padding: 3px 0; }
.guide-dim-label.perceive { color: #3d6178; }
.guide-dim-label.relate { color: #3d6178; }
.guide-dim-label.apply { color: #d6a86c; }
.guide-dim-text { font-size: 0.88rem; color: #5a5550; line-height: 1.65; }
.guide-disclosure { background: rgba(243,244,246,0.7); border-radius: 10px; padding: 16px 18px; margin-top: 12px; }
.guide-disclosure p { font-size: 0.85rem; color: #7a7570; line-height: 1.7; margin-bottom: 6px; }
.guide-disclosure p:last-child { margin-bottom: 0; }
.guide-links { display: flex; flex-direction: column; gap: 8px; }
.guide-links a { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; padding: 8px 14px; border-radius: 8px; background: rgba(243,244,246,0.6); color: #3e3b38; text-decoration: none; transition: all 0.2s ease; }
.guide-links a:hover { background: rgba(61,97,120,0.06); color: #3d6178; }
.guide-links .link-desc { font-size: 0.78rem; color: #9a918a; }
.guide-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid rgba(209,213,219,0.4); text-align: center; }
.guide-footer p { font-size: 0.8rem; color: #9a918a; line-height: 1.6; }
@media (max-width: 768px) {
    .guide-backdrop { padding: 12px; }
    .guide-content { padding: 8px 20px 32px; }
    .guide-title { font-size: 1.35rem; }
}

/* ── Footer info button ── */
.footer-info-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(156,163,175,0.4); background: transparent; color: #9a918a; font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; font-family: 'Lora', Georgia, serif; vertical-align: middle; margin-left: 4px; }
.footer-info-btn:hover { background: rgba(61,97,120,0.08); border-color: rgba(61,97,120,0.3); color: #3d6178; }

/* ── Footer ── */
.footer { text-align: center; padding: 32px 24px; background: rgba(247,243,236,0.3); border-top: 1px solid rgba(209,213,219,0.3); }
.footer-brand { font-family: 'Lora', Georgia, serif; font-size: 1.1rem; font-weight: 600; color: #3e3b38; margin-bottom: 4px; }
.footer-framework { font-size: 0.85rem; color: #7a7570; margin-bottom: 12px; }
.footer-attribution { font-size: 0.8rem; color: #9a918a; max-width: 500px; margin: 0 auto 12px; line-height: 1.6; }
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 12px; }
.footer-links a { color: #7a7570; text-decoration: none; font-size: 0.8rem; }
.footer-links a:hover { color: #3d6178; }
.footer-copyright { font-size: 0.72rem; color: rgba(42,39,37,0.15); }
.hidden { display: none !important; }

@media (max-width: 768px) {
    .header { padding: 16px 16px 12px; } .header-title { font-size: 1.4rem; }
    .ecosystem-nav { gap: 8px; padding: 10px 16px; } .ecosystem-btn { padding: 6px 12px; font-size: 12px; }
    .chat-container { padding: 0; } .welcome-state { padding: 24px 12px; }
    .welcome-starters { grid-template-columns: 1fr; } .message-content { padding: 12px 14px; }
    .conversations-list { max-height: 180px; }
}
.messages-area::-webkit-scrollbar, .conversations-list::-webkit-scrollbar { width: 6px; }
.messages-area::-webkit-scrollbar-track, .conversations-list::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb, .conversations-list::-webkit-scrollbar-thumb { background: rgba(156,163,175,0.3); border-radius: 3px; }
.error-message { background: rgba(254,226,226,0.9); border: 1px solid rgba(252,165,165,0.5); color: #991b1b; border-radius: 10px; padding: 12px 16px; font-size: 0.85rem; line-height: 1.5; }
/* ====== EMAIL LINK AUTH ====== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    width: 100%;
    max-width: 320px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(209, 213, 219, 0.6);
}
.auth-divider span {
    font-size: 0.85em;
    color: #9a918a;
}
.email-signin-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}
.email-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(209, 213, 219, 0.6);
    background: rgba(255, 255, 255, 0.9);
    color: #3e3b38;
    font-size: 1em;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}
.email-input:focus {
    border-color: rgba(61,97,120,0.4);
    box-shadow: 0 0 0 3px rgba(61,97,120,0.15);
}
.email-input::placeholder {
    color: #9a918a;
}
.email-signin-btn {
    width: 100%;
    padding: 14px 32px;
    border-radius: 12px;
    border: 1px solid rgba(209, 213, 219, 0.6);
    background: rgba(255, 255, 255, 0.9);
    color: #3e3b38;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}
.email-signin-btn:hover {
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
.email-signin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.email-status {
    font-size: 0.85em;
    color: #3d6178;
    text-align: center;
    max-width: 320px;
    line-height: 1.5;
}
.email-status.error {
    color: #dc2626;
}

/* ── Logo Transition Overlay ── */
/* Shown briefly during sign-in transition while we check disclaimer status */
.logo-transition-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #f0ebe3 0%, #f7f3ec 50%, rgba(214,168,108,0.18) 100%);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}
.logo-transition-overlay.active {
    display: flex;
}
.logo-transition-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    animation: logo-fade 2s ease-in-out;
}
@keyframes logo-fade {
    0%   { opacity: 0; transform: scale(0.8); }
    50%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

/* ── Consent Modal ── */
/* Shown after sign-in if user has not yet acknowledged current disclaimer version */
/* Sits on top of the chat screen so the user feels held by PRAcel's space while reading */
.consent-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(42, 39, 37, 0.45);
    backdrop-filter: blur(4px);
    z-index: 9500;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: contentFadeIn 0.6s ease-out;
}
.consent-backdrop.active {
    display: flex;
}
@keyframes contentFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.consent-modal {
    background: #f7f3ec;
    border: 1px solid rgba(214, 168, 108, 0.3);
    border-radius: 16px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(42, 39, 37, 0.25);
    animation: contentFadeIn 0.8s ease-out;
}
.consent-content {
    padding: 40px 44px 36px;
}
.consent-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: #2a2725;
    margin-bottom: 24px;
    letter-spacing: 0.01em;
}
.consent-paragraph {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #3e3b38;
    margin-bottom: 16px;
}
.consent-paragraph:last-of-type {
    margin-bottom: 28px;
}
.consent-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(61, 97, 120, 0.2);
    border-radius: 10px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.consent-checkbox-row:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(61, 97, 120, 0.35);
}
.consent-checkbox {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3d6178;
    flex-shrink: 0;
}
.consent-checkbox-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #3e3b38;
}
.consent-error {
    font-size: 0.85rem;
    color: #991b1b;
    background: rgba(254, 226, 226, 0.7);
    border: 1px solid rgba(252, 165, 165, 0.5);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.consent-continue-btn {
    width: 100%;
    padding: 14px 32px;
    border-radius: 12px;
    border: none;
    background: #3d6178;
    color: white;
    font-size: 1rem;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}
.consent-continue-btn:hover:not(:disabled) {
    background: #4a7188;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(61, 97, 120, 0.25);
}
.consent-continue-btn:disabled {
    background: rgba(61, 97, 120, 0.35);
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.85);
}
@media (max-width: 600px) {
    .consent-content { padding: 32px 28px 28px; }
    .consent-title { font-size: 1.4rem; }
    .consent-paragraph { font-size: 0.9rem; }
    .logo-transition-img { width: 140px; height: 140px; }
}