/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
    --topbar-h: 64px;
    --bg: #F5F8F3;
    --surface: rgba(255, 255, 255, 0.76);
    --surface-solid: #FFFFFF;
    --surface-sunken: rgba(29, 64, 33, 0.04);
    --border: rgba(29, 64, 33, 0.09);
    --border-strong: rgba(29, 64, 33, 0.16);
    --text: #14241A;
    --text-muted: #55625A;
    --text-faint: #87938B;

    /* Palette from karavdina.com */
    --forest: #1D4021;
    --teal: #296569;
    --green: #318161;
    --lime: #DEFFBA;
    --accent: #318161;
    --accent-rgb: 49, 129, 97;
    --gradient: linear-gradient(120deg, var(--forest) 0%, var(--teal) 45%, var(--green) 100%);
    --gradient-text: var(--gradient);

    --blob-1: rgba(49, 129, 97, 0.30);
    --blob-2: rgba(222, 255, 186, 0.75);
    --blob-3: rgba(41, 101, 105, 0.22);
    --grid-line: rgba(29, 64, 33, 0.05);

    --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.8) inset,
                    0 30px 80px -20px rgba(20, 50, 30, 0.22),
                    0 8px 24px -8px rgba(20, 50, 30, 0.10);
    --shadow-soft: 0 6px 20px -8px rgba(20, 50, 30, 0.18);

    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0A130E;
        --surface: rgba(18, 32, 24, 0.68);
        --surface-solid: #12211A;
        --surface-sunken: rgba(255, 255, 255, 0.04);
        --border: rgba(255, 255, 255, 0.08);
        --border-strong: rgba(255, 255, 255, 0.16);
        --text: #EEF4EF;
        --text-muted: #A6B5AB;
        --text-faint: #6F8076;
        --accent: #91D6A7;
        --accent-rgb: 145, 214, 167;
        --gradient-text: linear-gradient(120deg, #91D6A7 0%, #DEFFBA 100%);
        --blob-1: rgba(49, 129, 97, 0.32);
        --blob-2: rgba(41, 101, 105, 0.26);
        --blob-3: rgba(145, 214, 167, 0.12);
        --grid-line: rgba(255, 255, 255, 0.04);
        --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.06) inset,
                        0 30px 80px -20px rgba(0, 0, 0, 0.6),
                        0 8px 24px -8px rgba(0, 0, 0, 0.4);
        --shadow-soft: 0 6px 20px -8px rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0A130E;
    --surface: rgba(18, 32, 24, 0.68);
    --surface-solid: #12211A;
    --surface-sunken: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #EEF4EF;
    --text-muted: #A6B5AB;
    --text-faint: #6F8076;
    --accent: #91D6A7;
    --accent-rgb: 145, 214, 167;
    --gradient-text: linear-gradient(120deg, #91D6A7 0%, #DEFFBA 100%);
    --blob-1: rgba(49, 129, 97, 0.32);
    --blob-2: rgba(41, 101, 105, 0.26);
    --blob-3: rgba(145, 214, 167, 0.12);
    --grid-line: rgba(255, 255, 255, 0.04);
    --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.06) inset,
                    0 30px 80px -20px rgba(0, 0, 0, 0.6),
                    0 8px 24px -8px rgba(0, 0, 0, 0.4);
    --shadow-soft: 0 6px 20px -8px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Ambient aurora background
   ========================================================================== */
.aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    will-change: transform;
}

.blob-1 {
    width: 52vw;
    height: 52vw;
    max-width: 720px;
    max-height: 720px;
    top: -18%;
    left: -10%;
    background: radial-gradient(circle, var(--blob-1), transparent 65%);
    animation: drift-1 26s ease-in-out infinite alternate;
}

.blob-2 {
    width: 46vw;
    height: 46vw;
    max-width: 640px;
    max-height: 640px;
    top: 4%;
    right: -14%;
    background: radial-gradient(circle, var(--blob-2), transparent 65%);
    animation: drift-2 32s ease-in-out infinite alternate;
}

.blob-3 {
    width: 60vw;
    height: 60vw;
    max-width: 820px;
    max-height: 820px;
    bottom: -30%;
    left: 20%;
    background: radial-gradient(circle, var(--blob-3), transparent 65%);
    animation: drift-3 38s ease-in-out infinite alternate;
}

.grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 30%, transparent 75%);
}

@keyframes drift-1 {
    to { transform: translate3d(12vw, 10vh, 0) scale(1.15); }
}

@keyframes drift-2 {
    to { transform: translate3d(-14vw, 14vh, 0) scale(0.9); }
}

@keyframes drift-3 {
    to { transform: translate3d(-10vw, -12vh, 0) scale(1.1); }
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding: 0 24px;
    padding-top: env(safe-area-inset-top, 0px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--gradient);
    box-shadow: 0 4px 14px -4px rgba(var(--accent-rgb), 0.6);
    position: relative;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.92);
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.topbar-link i {
    font-size: 11px;
    transition: transform 0.25s var(--ease-spring);
}

.topbar-link:hover {
    border-color: var(--accent);
}

.topbar-link:hover i {
    transform: translateX(3px);
}

/* ==========================================================================
   Layout + hero
   ========================================================================== */
.container {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 4px 24px 48px;
    padding-bottom: max(48px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Hero + chat fill exactly one screen, so the input is visible without scrolling */
.stage {
    display: flex;
    flex-direction: column;
    gap: 22px;
    height: calc(100vh - var(--topbar-h) - 24px);
    height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - 24px);
    min-height: 460px;
}

.hero {
    flex-shrink: 0;
    max-height: 420px;
    overflow: hidden;
    text-align: center;
    animation: rise 0.9s var(--ease-spring) both;
    transition: max-height 0.6s var(--ease-spring), opacity 0.3s ease, margin 0.6s var(--ease-spring);
}

/* After the first message the hero folds away and the chat takes its space */
.chat-started .hero {
    max-height: 0;
    opacity: 0;
    margin-bottom: -22px;
    animation: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 22px;
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #44C26D;
    box-shadow: 0 0 0 0 rgba(68, 194, 109, 0.5);
    animation: pulse 2.4s ease-out infinite;
}

.hero h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(38px, 6.4vw, 68px);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
    text-wrap: balance;
}

.hero h1 em {
    font-style: italic;
    white-space: nowrap;
    background: var(--gradient-text);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-right: 0.06em;
    animation: shimmer 8s ease-in-out infinite alternate;
}

.lede {
    max-width: 540px;
    margin: 0 auto;
    font-size: clamp(15px, 2.2vw, 17px);
    line-height: 1.6;
    color: var(--text-muted);
}

/* ==========================================================================
   Chat panel
   ========================================================================== */
.chat-container {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 340px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    backdrop-filter: blur(24px) saturate(1.4);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
    animation: rise 1s 0.1s var(--ease-spring) both;
}

/* Hairline gradient along the top edge */
.chat-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--gradient);
    opacity: 0.7;
}

.chat-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}

/* Describes the selected coaching style; spans the full header width */
.persona-hint {
    flex: 1 1 220px;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--text-muted);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.persona-hint.is-changing {
    opacity: 0;
    transform: translateY(-2px);
}

.chat-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #44C26D;
    box-shadow: 0 0 0 3px rgba(68, 194, 109, 0.18);
}

/* Persona segmented control (a styled checkbox) */
.persona-toggle {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.persona-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.persona-option {
    position: relative;
    z-index: 1;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    color: var(--text-muted);
    transition: color 0.25s;
}

.persona-thumb {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 999px;
    background: var(--surface-solid);
    box-shadow: var(--shadow-soft), 0 0 0 1px var(--border);
    transition: transform 0.4s var(--ease-spring), background 0.3s;
}

.persona-toggle input:not(:checked) ~ .persona-off,
.persona-toggle input:checked ~ .persona-on {
    color: var(--text);
}

.persona-toggle input:checked ~ .persona-on {
    color: #FFFFFF;
}

.persona-toggle input:checked ~ .persona-thumb {
    transform: translateX(100%);
    background: var(--gradient);
}

.persona-toggle:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Messages
   ========================================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 22px 12px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    animation: message-in 0.55s var(--ease-spring) both;
}

.bot-message,
.assistant-message {
    align-self: flex-start;
    position: relative;
    width: 100%;
}

.user-message {
    align-self: flex-end;
    max-width: 82%;
}

.message-content {
    position: relative;
}

.bot-message .message-content,
.assistant-message .message-content {
    color: var(--text);
}

.user-message .message-content {
    padding: 12px 16px;
    border-radius: 20px 20px 6px 20px;
    background: var(--gradient);
    color: #FFFFFF;
    box-shadow: 0 10px 28px -12px rgba(var(--accent-rgb), 0.65);
}

.message-content p {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.7;
    word-break: break-word;
}

/* Structured replies: paragraphs, "## " headings and lists */
/* .message-content scope beats ".message-content p { margin: 0 }" so blocks stay spaced */
.message-content .message-text > * + * {
    margin-top: 14px;
}

.message-text .message-heading {
    margin-top: 22px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.message-text .message-heading + ul,
.message-text .message-heading + ol {
    margin-top: 8px;
}

.message-text ul,
.message-text ol {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 0;
    list-style: none;
}

.message-text li {
    position: relative;
    padding-left: 20px;
    font-size: 15.5px;
    line-height: 1.6;
}

.message-text ul > li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.68em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gradient);
}

.message-text ol {
    counter-reset: item;
}

.message-text ol > li {
    counter-increment: item;
    padding-left: 24px;
}

.message-text ol > li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0.2em;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.message-text strong {
    font-weight: 600;
    color: var(--text);
}

/* Single highlighted tip / reality check ("> " line) */
.message-text .message-tip {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
    background: var(--surface-sunken);
    font-size: 15px;
    line-height: 1.6;
}

.link-arrow {
    display: inline-block;
    margin-left: 3px;
    font-size: 0.85em;
    text-decoration: none;
}

.inline-link,
.message-content a:not(.learn-more) {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.user-message .message-content a {
    color: #FFFFFF;
}

/* Reactions */
.reaction-buttons {
    display: flex;
    gap: 2px;
    margin-top: 6px;
    margin-left: -8px;
    opacity: 0.55;
    transition: opacity 0.2s;
}

.message:hover .reaction-buttons,
.reaction-buttons:focus-within {
    opacity: 1;
}

.reaction-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-faint);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, transform 0.3s var(--ease-spring);
}

.reaction-btn:hover {
    color: var(--text);
    background: var(--surface-sunken);
}

.reaction-btn.active {
    color: var(--accent);
}

.reaction-btn.pop {
    transform: scale(1.3);
}

/* ==========================================================================
   Role cards
   ========================================================================== */
.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.role-card {
    --mx: 50%;
    --my: 0%;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.35s var(--ease-spring), box-shadow 0.3s, border-color 0.3s;
    animation: message-in 0.6s var(--ease-spring) both;
}

.role-card:nth-child(2) { animation-delay: 0.08s; }
.role-card:nth-child(3) { animation-delay: 0.16s; }
.role-card:nth-child(4) { animation-delay: 0.24s; }

/* Cursor-following spotlight */
.role-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(260px circle at var(--mx) var(--my), rgba(var(--accent-rgb), 0.13), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

/* Gradient border on hover */
.role-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--gradient);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.role-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    border-color: transparent;
}

.role-card:hover::before,
.role-card:hover::after {
    opacity: 1;
}

.role-card h4 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

.role-card p {
    font-size: 13.5px !important;
    line-height: 1.55 !important;
    color: var(--text-muted);
    flex: 1;
}

.role-card .learn-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.role-card .learn-more::after {
    content: "→";
    transition: transform 0.25s var(--ease-spring);
}

.role-card:hover .learn-more::after {
    transform: translateX(4px);
}

/* ==========================================================================
   Typing indicator
   ========================================================================== */
.typing-indicator {
    padding: 4px 22px 10px 64px;
    position: relative;
    align-items: center;
    gap: 10px;
}

.typing-indicator[style*="block"] {
    display: flex !important;
}

.typing-indicator::before {
    content: "";
    position: absolute;
    left: 22px;
    top: 50%;
    width: 28px;
    height: 28px;
    margin-top: -17px;
    border-radius: 50%;
    background: var(--gradient);
    animation: breathe 1.6s ease-in-out infinite;
}

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

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

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

.typing-label {
    font-size: 13.5px;
    font-weight: 500;
    background: linear-gradient(90deg, var(--text-faint) 0%, var(--text) 50%, var(--text-faint) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: sweep 1.8s linear infinite;
}

/* ==========================================================================
   Composer
   ========================================================================== */
.message-input-container {
    padding: 12px 16px 16px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 18px;
    border-radius: 999px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-soft);
    transition: border-color 0.2s, box-shadow 0.3s;
}

/* Gradient glow when focused */
.input-wrapper::before {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background: var(--gradient);
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.35s;
}

.input-wrapper:focus-within {
    border-color: transparent;
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.55);
}

.input-wrapper:focus-within::before {
    opacity: 0.35;
}

#messageInput {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    padding: 10px 0;
}

#messageInput::placeholder {
    color: var(--text-faint);
}

#messageInput:disabled {
    opacity: 0.6;
}

#sendButton {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--gradient);
    background-size: 160% 100%;
    color: #FFFFFF;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px -8px rgba(var(--accent-rgb), 0.8);
    transition: transform 0.3s var(--ease-spring), background-position 0.4s, opacity 0.2s;
}

#sendButton:hover {
    transform: scale(1.06) rotate(-8deg);
    background-position: 100% 0;
}

#sendButton:active {
    transform: scale(0.94);
}

#sendButton:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Scroll-to-bottom
   ========================================================================== */
.scroll-to-bottom-btn {
    position: absolute;
    right: 20px;
    bottom: 96px;
    z-index: 5;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--surface-solid);
    color: var(--text);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    animation: message-in 0.4s var(--ease-spring) both;
    transition: transform 0.25s var(--ease-spring), border-color 0.2s;
}

.scroll-to-bottom-btn:hover {
    transform: translateY(2px);
    border-color: var(--accent);
}

/* ==========================================================================
   Mentor CTA
   ========================================================================== */
.mentor-cta {
    display: flex;
    justify-content: center;
    animation: rise 1s 0.2s var(--ease-spring) both;
}

.mentor-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    padding: 14px 18px 14px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    text-align: left;
    cursor: pointer;
    transition: transform 0.35s var(--ease-spring), border-color 0.25s, box-shadow 0.3s;
}

.mentor-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-soft);
}

.mentor-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    color: #FFFFFF;
    font-size: 16px;
}

.mentor-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mentor-text strong {
    font-size: 14.5px;
    font-weight: 600;
}

.mentor-text span {
    font-size: 13px;
    color: var(--text-muted);
}

.mentor-arrow {
    color: var(--text-faint);
    transition: transform 0.3s var(--ease-spring), color 0.2s;
}

.mentor-btn:hover .mentor-arrow {
    color: var(--accent);
    transform: translateX(4px);
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

@keyframes shimmer {
    from { background-position: 0% 50%; }
    to { background-position: 100% 50%; }
}

@keyframes sweep {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(68, 194, 109, 0.5); }
    70%, 100% { box-shadow: 0 0 0 8px rgba(68, 194, 109, 0); }
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes breathe {
    0%, 100% { transform: scale(0.88); opacity: 0.7; }
    50% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    .topbar {
        padding: 0 16px;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .topbar-link {
        padding: 8px 12px;
        font-size: 12.5px;
    }

    .container {
        padding: 4px 12px 28px;
        padding-bottom: max(28px, env(safe-area-inset-bottom));
        gap: 20px;
    }

    .hero h1 {
        margin-bottom: 12px;
    }

    .eyebrow {
        margin-bottom: 16px;
    }

    .lede {
        padding: 0 4px;
    }

    .chat-container {
        border-radius: 22px;
    }

    .stage {
        gap: 16px;
    }

    .chat-started .hero {
        margin-bottom: -16px;
    }

    .persona-hint {
        flex-basis: 100%;
    }

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

    .persona-hint {
        font-size: 12px;
    }

    .persona-option {
        padding: 6px 11px;
        font-size: 12px;
    }

    .chat-messages {
        padding: 18px 14px 10px;
        gap: 18px;
    }

    .user-message {
        max-width: 90%;
    }

    .message-content p,
    .message-text li {
        font-size: 15px;
    }

    .role-cards {
        grid-template-columns: 1fr;
    }

    .typing-indicator {
        padding: 4px 14px 8px 48px;
    }

    .typing-indicator::before {
        left: 14px;
        width: 24px;
        height: 24px;
        margin-top: -15px;
    }

    .message-input-container {
        padding: 10px 10px 12px;
    }

    .scroll-to-bottom-btn {
        right: 14px;
        bottom: 84px;
    }
}

@media (max-width: 360px) {
    .brand-name {
        display: none;
    }
}

/* Short screens: trim the hero so the chat keeps enough room */
@media (max-height: 820px) {
    .lede {
        display: none;
    }
}

@media (max-height: 680px) {
    .eyebrow {
        display: none;
    }
}

@media (max-width: 640px) {
    :root {
        --topbar-h: 56px;
    }
}
