@charset "utf-8";

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ── Theme variables ── */
:root {
    --bg:                  radial-gradient(ellipse at top left, #4a4a4a, #2a2a2a 60%, #1a1a1a);
    --sidebar-bg:          #0d0d0d;
    --sidebar-border:      rgba(252, 195, 2, 0.12);
    --sidebar-btn-bg:      rgba(184, 133, 5, 0.15);
    --sidebar-btn-border:  rgba(252, 195, 2, 0.2);
    --sidebar-btn-color:   rgba(255,255,255,0.8);
    --panel-bg:            rgba(255,255,255,0.04);
    --panel-border:        rgba(252, 195, 2, 0.15);
    --panel-shadow:        0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    --panel-focus-shadow:  0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(252,195,2,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
    --bot-msg-bg:          rgba(255,255,255,0.07);
    --bot-msg-color:       rgba(255,255,255,0.9);
    --bot-msg-border:      rgba(255,255,255,0.08);
    --input-row-bg:        rgba(0,0,0,0.35);
    --input-row-border:    rgba(255,255,255,0.1);
    --input-color:         rgba(255,255,255,0.9);
    --input-placeholder:   rgba(255,255,255,0.3);
    --icon-color:          rgba(255,255,255,0.45);
    --prelims-color:       rgba(255,255,255,0.7);
    --suggestion-bg:       rgba(255,255,255,0.05);
    --suggestion-border:   rgba(252,195,2,0.25);
    --suggestion-color:    rgba(255,255,255,0.75);
    --pill-heading-color:  rgba(255,255,255,0.3);
    --pill-bg:             rgba(255,255,255,0.04);
    --pill-border:         rgba(255,255,255,0.07);
    --pill-color:          rgba(255,255,255,0.7);
    --typing-dot:          #FCC302;
    --scrollbar-thumb:     #b88505;
}

[data-theme="light"] {
    --bg:                  radial-gradient(ellipse at top left, #e8e4dc, #d8d3c8 60%, #ccc7ba);
    --sidebar-bg:          #0d0d0d;
    --sidebar-border:      rgba(252, 195, 2, 0.2);
    --sidebar-btn-bg:      rgba(184, 133, 5, 0.15);
    --sidebar-btn-border:  rgba(252, 195, 2, 0.25);
    --sidebar-btn-color:   rgba(255,255,255,0.8);
    --panel-bg:            rgba(255,255,255,0.75);
    --panel-border:        rgba(184,133,5,0.25);
    --panel-shadow:        0 8px 40px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.8);
    --panel-focus-shadow:  0 8px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(252,195,2,0.35), inset 0 1px 0 rgba(255,255,255,0.8);
    --bot-msg-bg:          #eeebe4;
    --bot-msg-color:       #1a1a1a;
    --bot-msg-border:      rgba(0,0,0,0.07);
    --input-row-bg:        rgba(255,255,255,0.7);
    --input-row-border:    rgba(0,0,0,0.1);
    --input-color:         #1a1a1a;
    --input-placeholder:   rgba(0,0,0,0.35);
    --icon-color:          rgba(0,0,0,0.4);
    --prelims-color:       rgba(0,0,0,0.55);
    --suggestion-bg:       rgba(0,0,0,0.04);
    --suggestion-border:   rgba(184,133,5,0.35);
    --suggestion-color:    rgba(0,0,0,0.65);
    --pill-heading-color:  rgba(255,255,255,0.3);
    --pill-bg:             rgba(255,255,255,0.1);
    --pill-border:         rgba(255,255,255,0.12);
    --pill-color:          rgba(255,255,255,0.75);
    --typing-dot:          #b88505;
    --scrollbar-thumb:     #b88505;
}

/* ── Reset ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Kill mobile browsers' tap delay and grey tap-flash on all buttons */
button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    transition: background 0.35s ease;
    overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #FCC302; }

/* ── Blocked Screen ── */
#blocked-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 24px;
    animation: fadeIn 0.6s ease;
}

#blocked-screen .logo {
    height: 200px;
    width: auto;
    opacity: 0.9;
    filter: drop-shadow(0 0 30px rgba(252, 195, 2, 0.3));
}

#blocked-screen .blocked-message {
    color: rgba(255,255,255,0.75);
    font-size: 16px;
    text-align: center;
    max-width: 480px;
    line-height: 1.6;
}

#blocked-screen .cogninest-button {
    background: linear-gradient(135deg, #FCC302, #b88505);
    border: none;
    color: #1a1a1a;
    padding: 14px 36px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(252, 195, 2, 0.3);
}

#blocked-screen .cogninest-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(252, 195, 2, 0.45);
}

/* ── Main App Layout ── */
#main-app {
    display: flex;
    height: 100vh;
    animation: fadeIn 0.5s ease;
}

/* ── Sidebar ── */
#main-app .Chatbar {
    display: flex;
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    flex-direction: column;
    align-items: center;
    padding: 20px 12px;
    gap: 10px;
    transition: background 0.35s ease, border-color 0.35s ease;
}

#main-app .Chatbar button {
    background: var(--sidebar-btn-bg);
    border: 1px solid var(--sidebar-btn-border);
    color: var(--sidebar-btn-color);
    width: 100%;
    height: 40px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.3px;
}

#main-app .Chatbar button:hover {
    background: rgba(252, 195, 2, 0.2);
    border-color: rgba(252, 195, 2, 0.5);
    color: #FCC302;
    transform: translateX(3px);
}

/* Theme toggle button */
.theme-toggle {
    margin-top: auto !important;
    font-size: 16px !important;
    letter-spacing: 0 !important;
}

/* ── Chatbox ── */
#main-app .Chatbox {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 20px;
    gap: 16px;
    overflow: hidden;
}

/* ── Pre-lims ── */
#main-app .Chatbox .Chatlog {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

#main-app .Chatbox .Chatlog .Pre-Lims {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    animation: floatIn 0.7s ease;
}

#main-app .Chatbox .Chatlog .Pre-Lims img {
    filter: drop-shadow(0 0 24px rgba(252, 195, 2, 0.35));
    transition: filter 0.3s ease;
}

#main-app .Chatbox .Chatlog .Pre-Lims img:hover {
    filter: drop-shadow(0 0 40px rgba(252, 195, 2, 0.55));
}

#main-app .Chatbox .Chatlog .Pre-Lims p {
    font-size: 16px;
    color: var(--prelims-color);
    font-weight: 300;
    letter-spacing: 0.3px;
    transition: color 0.35s ease;
}

/* ── Chat Panel ── */
#main-app .Chatbox .Chatbox-bottom {
    display: flex;
    flex-direction: column;
    width: min(90%, 820px);
    height: 75%;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: var(--panel-shadow);
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.3s ease;
}

#main-app .Chatbox .Chatbox-bottom:focus-within {
    box-shadow: var(--panel-focus-shadow);
}

/* ── Message Log ── */
#message-log {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Message Bubbles ── */
.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #FCC302, #e6af00);
    color: #1a1a1a;
    padding: 10px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 68%;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 12px rgba(252, 195, 2, 0.25);
    animation: slideInRight 0.25s ease;
}

.bot-message {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    color: var(--bot-msg-color);
    padding: 10px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 68%;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    word-wrap: break-word;
    border: 1px solid var(--bot-msg-border);
    white-space: pre-wrap;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    animation: slideInLeft 0.25s ease;
    transition: background 0.35s ease, color 0.35s ease;
}

/* Formatted (rich) bot messages — rendered as real paragraphs/lists,
   so switch off pre-wrap and space the elements instead */
.bot-message.formatted {
    white-space: normal;
}

.bot-message.formatted p {
    margin: 0 0 10px;
}

.bot-message.formatted p:last-child,
.bot-message.formatted ul:last-child,
.bot-message.formatted ol:last-child {
    margin-bottom: 0;
}

.bot-message.formatted .msg-heading {
    font-weight: 600;
    color: #FCC302;
    margin: 2px 0 8px;
}

.bot-message.formatted ul,
.bot-message.formatted ol {
    margin: 0 0 10px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bot-message.formatted li::marker {
    color: #FCC302;
}

.bot-message.formatted strong {
    font-weight: 600;
    color: #FCC302;
}

[data-theme="light"] .bot-message.formatted strong,
[data-theme="light"] .bot-message.formatted .msg-heading {
    color: #b88505;
}

.bot-message.formatted code {
    background: rgba(252, 195, 2, 0.12);
    border: 1px solid rgba(252, 195, 2, 0.2);
    border-radius: 5px;
    padding: 1px 6px;
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 12.5px;
}

/* ── Typing Indicator ── */
.typing-indicator {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    border: 1px solid var(--bot-msg-border);
    padding: 12px 18px;
    border-radius: 18px 18px 18px 4px;
    display: flex;
    gap: 5px;
    align-items: center;
    animation: slideInLeft 0.25s ease;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--typing-dot);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

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

/* ── Input Row ── */
.input-row {
    display: flex;
    align-items: center;
    margin: 12px 16px;
    gap: 10px;
    background: var(--input-row-bg);
    border: 1px solid var(--input-row-border);
    border-radius: 14px;
    padding: 8px 12px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.35s ease;
}

.input-row:focus-within {
    border-color: rgba(252, 195, 2, 0.4);
    box-shadow: 0 0 0 3px rgba(252, 195, 2, 0.08);
}

.upload-btn, .mic-btn {
    background: none;
    border: none;
    color: var(--icon-color);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 8px;
    transition: color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.upload-btn:hover, .mic-btn:hover {
    color: #FCC302;
    transform: scale(1.15);
}

.mic-btn.listening {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

#main-app .Chatbox .Chatbox-bottom #Chatinput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--input-color);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    padding: 4px 0;
    caret-color: #FCC302;
    transition: color 0.35s ease;
}

#main-app .Chatbox .Chatbox-bottom #Chatinput::placeholder {
    color: var(--input-placeholder);
}

#main-app .Chatbox .Chatbox-bottom #Chatinput:disabled::placeholder {
    color: rgba(252, 195, 2, 0.4);
}

/* ── Suggestion Chips ── */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    max-width: 560px;
}

.suggestion-chip {
    background: var(--suggestion-bg);
    border: 1px solid var(--suggestion-border);
    color: var(--suggestion-color);
    padding: 9px 16px;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: rgba(252, 195, 2, 0.12);
    border-color: rgba(252, 195, 2, 0.6);
    color: #FCC302;
    transform: translateY(-2px);
}

/* ── Session Pills ── */
.pill-heading {
    color: var(--pill-heading-color);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 12px 6px 4px;
    width: 100%;
}

.session-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 10px;
    cursor: default;
    transition: background 0.2s ease;
    animation: fadeIn 0.3s ease;
}

.session-pill:hover {
    background: rgba(255,255,255,0.08);
}

.pill-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pill-topic {
    color: var(--pill-color);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── "Start here next" suggestion box ── */
.suggest-box {
    width: 100%;
    margin-top: 14px;
    padding: 12px 10px 10px;
    background: rgba(231, 76, 60, 0.06);
    border: 1px solid rgba(231, 76, 60, 0.28);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.suggest-heading {
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 2px 4px;
}

/* Beats the generic sidebar button styling */
#main-app .Chatbar .suggest-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    height: auto;
    padding: 9px 12px;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#main-app .Chatbar .suggest-item:hover {
    background: rgba(231, 76, 60, 0.14);
    border-color: rgba(231, 76, 60, 0.5);
    color: inherit;
    transform: translateX(3px);
}

.suggest-topic {
    color: var(--pill-color);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

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

/* ── Premium badge (burning gold) ─────────────────────────────── */
#premium-badge {
    display: none; /* revealed by JS for Premium members */
    background: linear-gradient(135deg, #b88505, #FCC302, #ffe27a, #FCC302, #b88505) !important;
    background-size: 300% 300% !important;
    color: #1a1200 !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    border: 1px solid #ffe27a !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    animation: premiumFlame 3s ease-in-out infinite, premiumFlicker 2.2s ease-in-out infinite;
    cursor: pointer;
}

#premium-badge:hover {
    transform: translateX(3px) scale(1.03);
    color: #1a1200 !important;
}

@keyframes premiumFlame {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes premiumFlicker {
    0%, 100% { box-shadow: 0 0 10px rgba(252, 195, 2, 0.55), 0 0 24px rgba(252, 130, 2, 0.30); }
    30%      { box-shadow: 0 0 16px rgba(252, 195, 2, 0.85), 0 0 36px rgba(252, 130, 2, 0.45); }
    55%      { box-shadow: 0 0 8px rgba(252, 195, 2, 0.45), 0 0 18px rgba(252, 130, 2, 0.25); }
    75%      { box-shadow: 0 0 14px rgba(252, 195, 2, 0.75), 0 0 30px rgba(252, 130, 2, 0.40); }
}

/* ── Premium thank-you modal ──────────────────────────────────── */
#premium-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#premium-modal-overlay.open { display: flex; }

.premium-modal {
    background: var(--chat-bg, #141414);
    border: 1px solid #FCC302;
    border-radius: 18px;
    box-shadow: 0 0 40px rgba(252, 195, 2, 0.35), 0 24px 60px rgba(0, 0, 0, 0.6);
    max-width: 480px;
    width: 100%;
    padding: 34px 30px;
    position: relative;
    animation: fadeInUp .3s ease;
    color: rgba(255, 255, 255, 0.92);
    font-family: 'Inter', sans-serif;
}

.premium-modal h2 {
    margin: 0 0 6px;
    color: #FCC302;
    font-size: 1.45rem;
}

.premium-modal .pm-sub {
    margin: 0 0 18px;
    font-size: .95rem;
    color: rgba(255, 255, 255, 0.65);
}

.premium-modal .pm-owners {
    font-style: italic;
    color: #ffe27a;
}

.premium-modal ul {
    margin: 14px 0 0;
    padding-left: 20px;
    line-height: 1.8;
    font-size: .95rem;
}

.premium-modal .pm-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.premium-modal .pm-close:hover { color: #FCC302; }

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

/* Light theme tweaks for the modal */
[data-theme="light"] .premium-modal {
    background: #fffdf5;
    color: #262626;
}

[data-theme="light"] .premium-modal .pm-sub { color: #6b6b6b; }
[data-theme="light"] .premium-modal h2 { color: #b88505; }
[data-theme="light"] .premium-modal .pm-owners { color: #b88505; }
[data-theme="light"] .premium-modal .pm-close { color: #999; }

/* ── Mobile-only elements: invisible on desktop ───────────────── */
.mobile-topbar, #drawer-backdrop { display: none; }

/* ── Tablets (761–1024px): keep the sidebar but slim it down ──── */
@media (min-width: 761px) and (max-width: 1024px) {
    #main-app .Chatbar { width: 200px; padding: 16px 10px; }
    #main-app .Chatbox .Chatbox-bottom { width: min(96%, 820px); }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE REDESIGN — slide-out drawer menu + hero welcome screen.
   Covers portrait phones and landscape phones.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 760px), ((max-width: 950px) and (max-height: 500px)) {

    #main-app {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    /* ── Top bar: menu · wordmark · new chat ── */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 14px;
        background: var(--sidebar-bg);
        border-bottom: 1px solid rgba(252, 195, 2, 0.25);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    }

    #menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 40px;
        height: 40px;
        padding: 10px;
        background: var(--sidebar-btn-bg);
        border: 1px solid var(--sidebar-btn-border);
        border-radius: 12px;
        cursor: pointer;
        transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
    }

    #menu-btn span {
        display: block;
        width: 100%;
        height: 2px;
        background: #FCC302;
        border-radius: 2px;
    }

    .mobile-title {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-title img {
        height: 30px;
        width: auto;
        filter: drop-shadow(0 0 10px rgba(252, 195, 2, 0.5));
    }

    .mobile-title span {
        font-family: 'Inter', sans-serif;
        font-size: 17px;
        font-weight: 700;
        letter-spacing: 0.5px;
        color: rgba(255, 255, 255, 0.92);
    }

    .mobile-title span b {
        background: linear-gradient(120deg, #b88505, #FCC302, #ffe27a, #FCC302, #b88505);
        background-size: 250% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: goldShimmer 4s linear infinite;
    }

    #mobile-new-chat {
        width: 40px;
        height: 40px;
        background: var(--sidebar-btn-bg);
        border: 1px solid var(--sidebar-btn-border);
        border-radius: 12px;
        color: #FCC302;
        font-size: 20px;
        font-weight: 600;
        cursor: pointer;
        line-height: 1;
        transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
    }

    /* Instant tap feedback: shrink + gold flash the moment a finger lands */
    #mobile-new-chat:active,
    #menu-btn:active {
        transform: scale(0.82);
        background: rgba(252, 195, 2, 0.4);
        box-shadow: 0 0 16px rgba(252, 195, 2, 0.5);
    }

    #main-app .Chatbar button:active {
        transform: scale(0.96);
        background: rgba(252, 195, 2, 0.3);
    }

    /* ── Sidebar → slide-out drawer ── */
    #main-app .Chatbar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(80vw, 300px);
        padding: 26px 16px 20px;
        z-index: 920;
        border-right: 1px solid rgba(252, 195, 2, 0.3);
        box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55);
        transform: translateX(-108%);
        transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    #main-app .Chatbar.open { transform: translateX(0); }

    #main-app .Chatbar button:hover { transform: none; }

    /* Session pills fit nicely in the drawer — welcome back */
    .pill-heading, .session-pill { display: flex; }
    .pill-heading { display: block; }

    /* Dimmed, blurred page behind the open drawer */
    #drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 910;
    }

    #drawer-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* ── Chat area ── */
    #main-app .Chatbox {
        padding: 10px 10px;
        gap: 6px;
        min-height: 0;
    }

    /* Welcome hero: fixed footprint, nothing scrolls, nothing clips */
    #main-app .Chatbox .Chatlog {
        flex: 0 0 auto;
        min-height: 0;
        overflow: visible;
    }

    #main-app .Chatbox .Chatlog .Pre-Lims { gap: 6px; }

    /* Floating, glowing mascot — capped by BOTH width and height so a
       wide logo can never hang off the screen edge */
    #main-app .Chatbox .Chatlog .Pre-Lims img {
        height: auto;
        width: auto;
        max-width: min(84vw, 320px);
        max-height: clamp(60px, 15dvh, 110px);
        filter: drop-shadow(0 0 26px rgba(252, 195, 2, 0.55));
        animation: floatMascot 3.6s ease-in-out infinite;
    }

    /* Golden shimmering greeting */
    #main-app .Chatbox .Chatlog .Pre-Lims p {
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.2px;
        padding: 0 12px;
        background: linear-gradient(120deg, #d9a406, #FCC302, #ffe9a3, #FCC302, #d9a406);
        background-size: 250% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: goldShimmer 5s linear infinite;
    }

    /* Suggestions: one swipeable row — no vertical scrolling, so the
       mascot never gets cut off */
    .suggestions {
        flex-wrap: nowrap;
        justify-content: flex-start;
        max-width: 100vw;
        overflow-x: auto;
        gap: 8px;
        margin-top: 8px;
        padding: 4px 14px 10px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
    }

    .suggestions::-webkit-scrollbar { display: none; }

    .suggestion-chip {
        flex: 0 0 auto;
        scroll-snap-align: start;
        white-space: nowrap;
        font-size: 12.5px;
        padding: 9px 14px;
        background: rgba(252, 195, 2, 0.08);
        border-color: rgba(252, 195, 2, 0.45);
    }

    /* The chat panel always owns the bulk of the screen */
    #main-app .Chatbox .Chatbox-bottom {
        width: 100%;
        height: auto;
        flex: 1 1 auto;
        min-height: 50dvh;
        border-radius: 18px;
    }

    .user-message, .bot-message { max-width: 85%; }

    /* 16px input font stops iPhones auto-zooming on tap */
    .input-row { margin: 10px 10px; gap: 8px; padding: 7px 10px; }

    #main-app .Chatbox .Chatbox-bottom #Chatinput { font-size: 16px; }

    /* Premium modal: comfortable on small screens */
    .premium-modal { padding: 26px 20px; max-height: 85vh; overflow-y: auto; }
    .premium-modal h2 { font-size: 1.2rem; }
    .premium-modal .pm-sub, .premium-modal ul { font-size: .9rem; }
}

/* Very short screens (landscape phones): shrink the hero further */
@media (max-width: 950px) and (max-height: 500px) {
    #main-app .Chatbox .Chatlog .Pre-Lims img { height: 44px; }
    #main-app .Chatbox .Chatlog .Pre-Lims p { font-size: 13px; }
    #main-app .Chatbox .Chatbox-bottom { min-height: 0; }
}

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

@keyframes goldShimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 250% 50%; }
}
