/* ==========================================================================
   Bali AI — friendly, minimal chat theme
   --------------------------------------------------------------------------
   Light cream background, big rounded bubbles, generous whitespace.
   Designed to feel approachable to a child or a tired traveller.
   No decorative SVG. No parallax. Tap targets ≥ 44px.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --c-bg:        #fff8ed;
    --c-bg-soft:   #fef3df;
    --c-card:      #ffffff;
    --c-ink:       #2b1d10;
    --c-ink-soft:  #6b594a;
    --c-rule:      rgba(43, 29, 16, 0.10);
    --c-rule-strong: rgba(43, 29, 16, 0.18);
    --c-accent:    #ff8c42;
    --c-accent-strong: #e3702a;
    --c-accent-soft:   #ffe0c8;
    --c-success:   #2d8a5a;
    --c-warn:      #c4612a;

    --r-sm: 0.6rem;
    --r-md: 1rem;
    --r-lg: 1.5rem;
    --r-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(43, 29, 16, 0.06);
    --shadow-md: 0 4px 16px rgba(43, 29, 16, 0.08);

    --tap: 44px;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

/* The HTML `hidden` attribute must always win — author rules with
   non-`none` `display:` (e.g. `.quota-banner { display: flex }`)
   beat the UA `[hidden] { display: none }` on equal specificity, so
   without this `<div hidden>` would render visibly. */
[hidden] { display: none !important; }

a { color: var(--c-accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
}

/* Visually-hidden helper (for honeypot label, screen readers only) */
.sr-only,
.hp-field {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Layout shell
   --------------------------------------------------------------------------
   Two modes:
   - Guest (no sidebar): single centred column, max 760px.
   - Logged-in (`.has-sidebar`): two columns — fixed-width sidebar +
     fluid main shell, max 1200px.
   On mobile the sidebar becomes a slide-in drawer.
   ========================================================================== */
.bali-app {
    min-height: 100vh;
    min-height: 100dvh;
}
/* Guest layout: single column. */
.bali-app:not(.has-sidebar) {
    display: grid;
    grid-template-rows: auto 1fr auto;
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem;
    gap: 1rem;
}
/* Logged-in layout: sidebar + shell. */
.bali-app.has-sidebar {
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1200px;
    margin: 0 auto;
}
.bali-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 1rem;
    gap: 1rem;
    min-height: 0;
    min-width: 0;          /* lets long messages wrap instead of forcing overflow */
}

/* ==========================================================================
   Header
   ========================================================================== */
.bali-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}
.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: var(--r-pill);
    background: var(--c-accent-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.brand em {
    font-style: normal;
    color: var(--c-accent-strong);
    margin-left: 0.1rem;
}

.header-right {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Language switcher — three big tappable pills */
.lang-switcher {
    display: inline-flex;
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-pill);
    padding: 0.2rem;
    box-shadow: var(--shadow-sm);
}
.lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    height: 2rem;
    padding: 0 0.65rem;
    border-radius: var(--r-pill);
    color: var(--c-ink-soft);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    transition: background 0.15s ease, color 0.15s ease;
}
.lang-pill:hover { background: var(--c-bg-soft); text-decoration: none; }
.lang-pill.is-active {
    background: var(--c-accent);
    color: #fff;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-pill);
    padding: 0.2rem 0.5rem 0.2rem 0.2rem;
    box-shadow: var(--shadow-sm);
    min-height: var(--tap);
}
.user-chip-avatar {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}
.user-chip-name {
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-chip-logout {
    margin: 0;
    padding: 0;
    line-height: 0;
}
.user-chip-logout button {
    background: none;
    border: 0;
    color: var(--c-ink-soft);
    width: 1.85rem;
    height: 1.85rem;
    border-radius: var(--r-pill);
    font-size: 1rem;
    transition: background 0.15s ease;
}
.user-chip-logout button:hover { background: var(--c-bg-soft); }

.auth-links {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.auth-link {
    display: inline-flex;
    align-items: center;
    height: var(--tap);
    padding: 0 0.85rem;
    border-radius: var(--r-pill);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--c-ink);
}
.auth-link:hover { background: var(--c-bg-soft); text-decoration: none; }
.auth-link-cta {
    background: var(--c-accent);
    color: #fff;
}
.auth-link-cta:hover { background: var(--c-accent-strong); color: #fff; }

/* ==========================================================================
   Main column
   ========================================================================== */
.bali-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.flash {
    background: #e8f5ed;
    color: #14532d;
    border-radius: var(--r-md);
    padding: 0.7rem 1rem;
    border: 1px solid #b9dec7;
}

/* Quota meter */
.quota-meter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-pill);
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    color: var(--c-ink-soft);
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}
.quota-leaf {
    color: var(--c-accent);
    font-size: 1rem;
    line-height: 0;
}
.quota-meter-low { color: var(--c-warn); }
.quota-meter-low .quota-leaf { color: var(--c-warn); }
.quota-meter-empty { color: #b91c1c; }
.quota-meter-empty .quota-leaf { color: #b91c1c; }
.quota-upgrade {
    margin-left: 0.4rem;
    color: var(--c-accent-strong);
    font-weight: 600;
    font-size: 0.82rem;
}

/* Quota banner (shown on 429) */
.quota-banner {
    background: var(--c-card);
    border: 1px solid var(--c-rule-strong);
    border-radius: var(--r-lg);
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 1rem;
}
.quota-banner-icon {
    color: var(--c-accent);
    flex: 0 0 auto;
    font-size: 2rem;
    line-height: 1;
}
.quota-banner-icon svg { width: 2rem; height: 2rem; }
.quota-banner-title {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    font-weight: 600;
}
.quota-banner-text {
    margin: 0 0 0.85rem;
    color: var(--c-ink-soft);
    font-size: 0.92rem;
}
.quota-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.quota-btn {
    display: inline-flex;
    align-items: center;
    height: var(--tap);
    padding: 0 1rem;
    border-radius: var(--r-pill);
    font-weight: 500;
    background: var(--c-bg-soft);
    color: var(--c-ink);
    border: 1px solid var(--c-rule);
}
.quota-btn:hover { background: var(--c-accent-soft); text-decoration: none; }
.quota-btn-primary {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
}
.quota-btn-primary:hover { background: var(--c-accent-strong); color: #fff; }

/* Intro */
.intro { text-align: center; padding: 0.5rem 0 0; }
.intro-title {
    margin: 0;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.intro-title em {
    font-style: italic;
    color: var(--c-accent-strong);
}
.intro-sub {
    margin: 0.5rem auto 0;
    max-width: 36rem;
    color: var(--c-ink-soft);
    font-size: 1rem;
}

/* Prompt cards (picture cards instead of plain chips) */
.prompt-board {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.prompt-hint {
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    padding-left: 0.25rem;
}
.prompt-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}
.prompt-cards button {
    width: 100%;
    min-height: 5.5rem;
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    text-align: left;
    transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--shadow-sm);
}
.prompt-cards button:hover {
    border-color: var(--c-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.prompt-emoji {
    font-size: 1.6rem;
    line-height: 1;
}
.prompt-text {
    font-size: 0.92rem;
    color: var(--c-ink);
    font-weight: 500;
}

/* ==========================================================================
   Chat log / turns
   ========================================================================== */
.chat-log {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.5rem 0;
}

.turn {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
    animation: turn-in 0.25s ease-out;
}
@keyframes turn-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.turn-avatar {
    flex: 0 0 auto;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: var(--r-pill);
    background: var(--c-accent-soft);
    color: var(--c-accent-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.turn.you .turn-avatar {
    background: var(--c-bg-soft);
    color: var(--c-ink);
}
.turn.system .turn-avatar {
    background: #fde2da;
    color: #b91c1c;
}

.turn-wrap {
    max-width: 78%;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.turn-label {
    font-size: 0.72rem;
    color: var(--c-ink-soft);
    font-weight: 500;
    padding: 0 0.5rem;
}
.turn-body {
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: 1.25rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    box-shadow: var(--shadow-sm);
}

/* User bubble — flipped to the right, accent color, peaked corner */
.turn.you {
    flex-direction: row-reverse;
}
.turn.you .turn-wrap { align-items: flex-end; }
.turn.you .turn-body {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
    border-bottom-right-radius: 0.4rem;
}
.turn.ai .turn-body {
    border-bottom-left-radius: 0.4rem;
}
.turn.system .turn-body {
    background: #fff5f2;
    border-color: #fad2c5;
    color: #7f1d1d;
}

/* Bubble actions (copy / share) — visible on hover */
.turn-actions {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.3rem 0 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.turn:hover .turn-actions,
.turn:focus-within .turn-actions { opacity: 1; }
.turn-action {
    background: transparent;
    border: 1px solid var(--c-rule);
    border-radius: var(--r-pill);
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    color: var(--c-ink-soft);
    transition: background 0.15s ease, color 0.15s ease;
    min-height: 28px;
}
.turn-action:hover { background: var(--c-bg-soft); color: var(--c-ink); }
.turn-action.is-copied { color: var(--c-success); }

/* Follow-up suggestion chips — appear under AI turns */
.followups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0 0;
}
.followup-chip {
    background: var(--c-bg-soft);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-pill);
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    color: var(--c-ink);
    transition: background 0.15s ease, border-color 0.15s ease;
    min-height: 36px;
}
.followup-chip:hover {
    background: var(--c-accent-soft);
    border-color: var(--c-accent);
}

/* Cards (partner recommendations) */
.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.65rem;
}
.card-postcard {
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-md);
    padding: 0.85rem 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 0.75rem;
    align-items: start;
    box-shadow: var(--shadow-sm);
}
.card-name {
    grid-column: 1 / 2;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-ink);
}
.card-title {
    grid-column: 1 / 2;
    margin: 0;
    font-size: 0.85rem;
    color: var(--c-ink-soft);
}
.card-seal {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    text-align: right;
    color: var(--c-accent-strong);
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
}
.seal-amt { font-size: 1.1rem; }
.seal-cur { font-size: 0.7rem; opacity: 0.7; margin-right: 0.15rem; }
.seal-lbl { display: block; font-size: 0.65rem; color: var(--c-ink-soft); font-weight: 400; }
.card-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    font-size: 0.82rem;
    color: var(--c-ink-soft);
}
.card-meta a { color: var(--c-accent-strong); }

/* "AI is thinking" dots */
.thinking {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.15rem 0.1rem;
}
.thinking span {
    width: 0.45rem;
    height: 0.45rem;
    background: var(--c-ink-soft);
    border-radius: var(--r-pill);
    opacity: 0.4;
    animation: blink 1.2s infinite ease-in-out;
}
.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
    40%           { opacity: 1;   transform: scale(1); }
}

/* ==========================================================================
   Composer (input + send)
   ========================================================================== */
.composer {
    position: sticky;
    bottom: 0;
    background: var(--c-bg);
    padding: 0.5rem 0 0.25rem;
    margin-top: auto;
}
.composer-bar {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-pill);
    padding: 0.3rem;
    box-shadow: var(--shadow-md);
}
#chat-input {
    flex: 1 1 auto;
    border: 0;
    background: transparent;
    padding: 0 1rem;
    font-size: 16px;     /* prevents iOS Safari auto-zoom */
    color: var(--c-ink);
    outline: none;
    min-height: var(--tap);
}
#chat-input::placeholder {
    color: var(--c-ink-soft);
    opacity: 0.7;
}
#chat-send {
    flex: 0 0 auto;
    background: var(--c-accent);
    color: #fff;
    border: 0;
    border-radius: var(--r-pill);
    padding: 0 1.25rem;
    min-height: var(--tap);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease, transform 0.1s ease;
}
#chat-send:hover:not(:disabled) {
    background: var(--c-accent-strong);
}
#chat-send:active:not(:disabled) { transform: scale(0.97); }
#chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.send-emoji { font-size: 1.1rem; line-height: 0; }
.send-label { letter-spacing: 0.01em; }

.composer-locked .composer-bar {
    opacity: 0.4;
    pointer-events: none;
}

/* ==========================================================================
   Sidebar (past chats — logged-in only)
   ========================================================================== */
.bali-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--c-card);
    border-right: 1px solid var(--c-rule);
    padding: 0.75rem 0.65rem;
    gap: 0.5rem;
    min-width: 0;
}
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.4rem 0.5rem;
    border-bottom: 1px solid var(--c-rule);
    margin-bottom: 0.25rem;
}
.sidebar-head .brand {
    font-size: 1rem;
}
.sidebar-close {
    background: transparent;
    border: 0;
    width: var(--tap);
    height: var(--tap);
    border-radius: var(--r-pill);
    font-size: 1.4rem;
    line-height: 1;
    color: var(--c-ink-soft);
    display: none;            /* desktop: no close button */
}
.sidebar-close:hover { background: var(--c-bg-soft); color: var(--c-ink); }

.sidebar-newchat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--c-accent);
    color: #fff;
    border: 0;
    border-radius: var(--r-md);
    padding: 0 1rem;
    min-height: var(--tap);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s ease;
}
.sidebar-newchat:hover { background: var(--c-accent-strong); }
.sidebar-newchat span:first-child {
    font-size: 1.2rem;
    line-height: 0;
}

.sidebar-history-head {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: var(--c-ink-soft);
    padding: 0.85rem 0.4rem 0.35rem;
    font-weight: 600;
}

.sidebar-history {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-height: 0;
}
.sidebar-history .history-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: var(--r-md);
    padding: 0.55rem 0.65rem;
    color: var(--c-ink);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    transition: background 0.12s ease;
    min-height: 44px;
}
.sidebar-history .history-item:hover {
    background: var(--c-bg-soft);
}
.sidebar-history .history-item.is-active {
    background: var(--c-accent-soft);
}
.sidebar-history .history-title {
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--c-ink);
}
.sidebar-history .history-when {
    font-size: 0.7rem;
    color: var(--c-ink-soft);
}
.history-empty,
.history-loading {
    margin: 0;
    padding: 1rem 0.5rem;
    text-align: center;
    color: var(--c-ink-soft);
    font-size: 0.85rem;
}

/* Backdrop — only used on mobile, hidden by default. */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(43, 29, 16, 0.45);
    backdrop-filter: blur(2px);
    border: 0;
    padding: 0;
    z-index: 40;
}

/* Hamburger / menu button. Desktop hides it; mobile shows. */
.menu-btn {
    background: transparent;
    border: 0;
    width: var(--tap);
    height: var(--tap);
    border-radius: var(--r-pill);
    font-size: 1.3rem;
    color: var(--c-ink);
    display: none;
}
.menu-btn:hover { background: var(--c-bg-soft); }

/* Mobile drawer behavior. */
@media (max-width: 768px) {
    .bali-app.has-sidebar {
        display: block;        /* drop the grid, sidebar floats over content */
        max-width: none;
    }
    .bali-app.has-sidebar .bali-shell {
        max-width: 760px;
        margin: 0 auto;
    }
    .bali-sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        width: 84vw;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 50;
        box-shadow: 4px 0 24px rgba(43, 29, 16, 0.18);
        padding-top: env(safe-area-inset-top, 0.75rem);
    }
    .bali-app.sidebar-open .bali-sidebar { transform: translateX(0); }
    .bali-app.sidebar-open .sidebar-backdrop { display: block; }
    .sidebar-close { display: inline-flex; }
    .menu-btn { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
    .bali-sidebar { transition: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.bali-footer {
    text-align: center;
    color: var(--c-ink-soft);
    font-size: 0.78rem;
    padding: 0.5rem 0 0.25rem;
}

/* ==========================================================================
   Auth pages (login / signup) — share the chat shell
   ========================================================================== */
.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 1rem;
    gap: 1rem;
}
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--c-ink);
    font-size: 1.2rem;
}
.auth-brand:hover { text-decoration: none; }
.auth-brand-mark {
    width: 2rem; height: 2rem;
    border-radius: var(--r-pill);
    background: var(--c-accent-soft);
    display: inline-flex; align-items: center; justify-content: center;
}
.auth-brand em { font-style: normal; color: var(--c-accent-strong); }

.auth-card {
    background: var(--c-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--r-lg);
    padding: 1.75rem;
    width: 100%;
    max-width: 24rem;
    box-shadow: var(--shadow-md);
}
.auth-card h1 {
    margin: 0 0 0.4rem;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 500;
    font-size: 1.4rem;
}
.auth-lead {
    margin: 0 0 1.25rem;
    color: var(--c-ink-soft);
    font-size: 0.92rem;
}
.auth-field {
    margin-bottom: 0.85rem;
}
.auth-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    margin-bottom: 0.25rem;
}
.auth-field .form-control,
.auth-field input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 16px;
    border: 1px solid var(--c-rule-strong);
    border-radius: var(--r-md);
    background: var(--c-bg);
    color: var(--c-ink);
    min-height: var(--tap);
}
.auth-field .form-control:focus,
.auth-field input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.auth-field .invalid-feedback,
.auth-field .help-block {
    color: #b91c1c;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}
.auth-actions { margin-top: 1rem; }
.auth-submit {
    width: 100%;
    background: var(--c-accent);
    color: #fff;
    border: 0;
    border-radius: var(--r-pill);
    padding: 0 1rem;
    min-height: var(--tap);
    font-weight: 600;
    font-size: 1rem;
}
.auth-submit:hover { background: var(--c-accent-strong); }
.auth-alt {
    text-align: center;
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: var(--c-ink-soft);
}

/* ==========================================================================
   Mobile (≤480px) — tighten paddings, collapse some chrome
   ========================================================================== */
@media (max-width: 480px) {
    .bali-app:not(.has-sidebar) { padding: 0.65rem; gap: 0.65rem; }
    .bali-app.has-sidebar .bali-shell { padding: 0.65rem; gap: 0.65rem; }
    .bali-header { gap: 0.4rem; padding: 0.25rem 0; }
    .brand { font-size: 1.05rem; }
    .auth-link { padding: 0 0.65rem; font-size: 0.82rem; }
    .lang-pill { min-width: 2.1rem; font-size: 0.72rem; }

    .intro-title { font-size: 1.5rem; }
    .intro-sub { font-size: 0.92rem; }

    .turn-wrap { max-width: 86%; }
    .turn-body { font-size: 0.95rem; padding: 0.65rem 0.85rem; }

    .prompt-cards { grid-template-columns: repeat(2, 1fr); }
    .prompt-cards button { min-height: 4.8rem; padding: 0.6rem; }
    .prompt-emoji { font-size: 1.4rem; }
    .prompt-text { font-size: 0.85rem; }

    .cards { grid-template-columns: 1fr; }
    #chat-send { padding: 0 1rem; font-size: 0.9rem; }
    .send-label { display: none; } /* keep just the emoji on tiny phones */
}

/* ==========================================================================
   Reduced-motion: kill non-essential animation
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .turn,
    .thinking span,
    .prompt-cards button {
        animation: none !important;
        transition: none !important;
    }
}
