:root {
    --bg: #0b1020;
    --panel: #0f1a33;
    --panel2: #0c1428;
    --border: rgba(255,255,255,.08);
    --text: #eaf0ff;
    --muted: rgba(234,240,255,.65);
    --me: #2f6fed;
    --bot: #121f3d;
    --accent: #19c37d;
}

* {
    box-sizing: border-box;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: radial-gradient(1000px 600px at 10% 10%, rgba(47,111,237,.18), transparent 60%), radial-gradient(900px 500px at 90% 20%, rgba(25,195,125,.12), transparent 55%), var(--bg);
    color: var(--text);
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    background: rgba(11,16,32,.55);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.brand-logo {
    height: 44px;
    width: auto;
    border-radius: 10px;
    background: rgba(255,255,255,.03);
    padding: 6px;
    border: 1px solid var(--border);
}

.brand-title {
    font-weight: 800;
    letter-spacing: .6px;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.ghost {
    border: 1px solid var(--border);
    background: rgba(255,255,255,.03);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
}

    .ghost:hover {
        background: rgba(255,255,255,.06);
    }

.content {
    width: min(1100px, calc(100% - 32px));
    margin: 18px auto;
    flex: 1;
    display: flex;
}

.panel {
    width: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.02));
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 70px rgba(0,0,0,.35);
}

.panel-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.02);
}

.panel-head-title {
    font-weight: 700;
}

.panel-head-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.chat {
    height: calc(100vh - 280px);
    min-height: 420px;
    overflow: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, rgba(15,26,51,.35), rgba(12,20,40,.15));
}

.row {
    display: flex;
}

    .row.me {
        justify-content: flex-end;
    }

    .row.bot {
        justify-content: flex-start;
    }

.bubble {
    max-width: 78%;
    padding: 12px 12px;
    border-radius: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    border: 1px solid transparent;
}

.row.me .bubble {
    background: linear-gradient(180deg, rgba(47,111,237,1), rgba(47,111,237,.82));
}

.row.bot .bubble {
    background: rgba(18,31,61,.85);
    border-color: var(--border);
}

.quick {
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.015);
}

.chip {
    border: 1px solid var(--border);
    background: rgba(255,255,255,.03);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
}

    .chip:hover {
        background: rgba(255,255,255,.06);
    }

.composer {
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,.02);
}

.input {
    flex: 1;
    padding: 12px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(12,20,40,.7);
    color: var(--text);
    outline: none;
}

    .input::placeholder {
        color: rgba(234,240,255,.45);
    }

.btn {
    padding: 12px 16px;
    border-radius: 14px;
    border: 0;
    background: var(--accent);
    color: #071014;
    font-weight: 800;
    cursor: pointer;
}

    .btn:hover {
        filter: brightness(1.05);
    }

/* Mobile responsive */

@media (max-width: 768px) {

    body {
        font-size: 16px;
    }

    .brand-title {
        font-size: 18px;
    }

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

    .panel-head-title {
        font-size: 18px;
    }

    .panel-head-hint {
        font-size: 14px;
    }

    .bubble {
        font-size: 16px;
        line-height: 1.5;
        padding: 14px;
        max-width: 90%;
    }

    .input {
        font-size: 16px;
        padding: 14px;
    }

    .btn {
        font-size: 16px;
        padding: 14px 18px;
    }

    .chip {
        font-size: 14px;
        padding: 10px 14px;
    }

    .brand-logo {
        height: 36px;
    }

    .chat {
        height: calc(100vh - 240px);
    }
}

/* =============== Mobile polish (ChatGPT-like) =============== */
@media (max-width: 768px) {

    /* Base font to avoid tiny text */
    body {
        font-size: 16px;
    }

    /* Layout: use full height nicely on mobile */
    .content {
        width: calc(100% - 16px);
        margin: 10px auto;
    }

    .panel {
        border-radius: 16px;
    }

    /* Topbar compact but readable */
    .topbar {
        padding: 10px 12px;
    }

    .brand-logo {
        height: 34px;
        padding: 5px;
    }

    .brand-title {
        font-size: 16px;
        line-height: 1.1;
    }

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

    .ghost {
        padding: 9px 10px;
        border-radius: 12px;
        font-size: 14px;
    }

    /* Panel head: less vertical space */
    .panel-head {
        padding: 12px 12px;
    }

    .panel-head-title {
        font-size: 16px;
    }

    .panel-head-hint {
        font-size: 13px;
        line-height: 1.35;
    }

    /* Chat takes most of screen */
    .chat {
        height: calc(100dvh - 238px); /* modern mobile viewport */
        min-height: 360px;
        padding: 12px;
        gap: 10px;
    }

    /* Message bubbles: larger text + wider */
    .bubble {
        max-width: 92%;
        font-size: 16px;
        line-height: 1.55;
        padding: 13px 13px;
        border-radius: 16px;
    }

    /* Composer: sticky, comfy tap targets */
    .composer {
        padding: 10px 12px;
        gap: 10px;
        position: sticky;
        bottom: 0;
        background: rgba(11,16,32,.9);
        backdrop-filter: blur(10px);
    }

    /* IMPORTANT: keep input >=16px to prevent iOS zoom */
    .input {
        font-size: 16px;
        padding: 14px 14px;
        border-radius: 16px;
    }

    .btn {
        font-size: 16px;
        padding: 14px 16px;
        border-radius: 16px;
    }

    /* Quick chips: make them scroll horizontally instead of wrapping into 3 rows */
    .quick {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    .chip {
        flex: 0 0 auto;
        font-size: 14px;
        padding: 10px 12px;
        border-radius: 999px;
        white-space: nowrap;
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .brand-title {
        font-size: 15px;
    }

    .ghost {
        font-size: 13px;
    }

    .chat {
        height: calc(100dvh - 246px);
    }

    .bubble {
        font-size: 15.5px;
    }
}

/* Safe area for iPhone notch/home indicator */
@supports (padding: max(0px)) {
    .composer {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}