/* IELTS Simulator assistant (/chat) - warm neutral layout, brand navy accent, light + dark theme */
:root {
    --c-bg: #f6f4ee;
    --c-side: #efece4;
    --c-surface: #ffffff;
    --c-ink: #1d2230;
    --c-muted: #6b6f7b;
    --c-line: #e4e0d4;
    --c-brand: #081F62;
    --c-brand-2: #2b4fd8;
    --c-brand-hover: #051747;
    --c-user: #e8e4d8;
    --c-accent-soft: #e6ebfb;
    --c-code: #ece8dd;
    --c-hover: rgba(30, 34, 48, .06);
    --c-danger: #b3261e;
    --c-danger-bg: #fdeceb;
    --shadow-1: 0 1px 2px rgba(20, 24, 40, .05), 0 4px 14px rgba(20, 24, 40, .06);
    --shadow-2: 0 10px 34px rgba(20, 24, 40, .14);
    --side-w: 296px;
    --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --c-bg: #15171c;
    --c-side: #1b1e24;
    --c-surface: #22252c;
    --c-ink: #ececf1;
    --c-muted: #9b9eab;
    --c-line: #31343d;
    --c-brand: #3d5bd9;
    --c-brand-2: #6a86ff;
    --c-brand-hover: #5472ee;
    --c-user: #2a2e37;
    --c-accent-soft: #232a47;
    --c-code: #2a2d36;
    --c-hover: rgba(255, 255, 255, .07);
    --c-danger: #ff8f86;
    --c-danger-bg: #3a2220;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-2: 0 10px 34px rgba(0, 0, 0, .5);
    color-scheme: dark;
}
/* embedded on the home page: use the website theme (white background, navy text) */
:root.embedded:not([data-theme="dark"]) { --c-bg: #FEFEFE; --c-side: #F4F7FF; --c-surface: #ffffff; --c-ink: #051747; --c-muted: #535F80; --c-line: #E7E9F0; --c-user: #E8EDFF; --c-accent-soft: #E8EDFF; --c-code: #EEF2FB; --c-hover: rgba(8, 31, 98, .06); }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: var(--font-ui); color: var(--c-ink); background: var(--c-bg);
    -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.6; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--c-brand); }
:root[data-theme="dark"] a { color: #9db2ff; }
:focus-visible { outline: 2px solid var(--c-brand-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ── sidebar ── */
.side {
    width: var(--side-w); flex: 0 0 var(--side-w); background: var(--c-side); border-right: 1px solid var(--c-line);
    display: flex; flex-direction: column; min-height: 0; transition: transform .24s ease;
}
.side-top { padding: 18px 16px 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 24px; width: auto; display: block; }
:root[data-theme="dark"] .brand img { filter: brightness(0) invert(.92); }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--c-muted); flex: 0 0 auto;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--c-hover); color: var(--c-ink); }
.icon-btn svg { width: 20px; height: 20px; }
.new-chat {
    margin: 10px 14px 8px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px;
    border: 1px solid var(--c-line); background: var(--c-surface); font-weight: 600; font-size: .95rem; color: var(--c-brand);
    box-shadow: var(--shadow-1); transition: transform .15s, border-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] .new-chat { color: #b8c6ff; }
.new-chat:hover { transform: translateY(-1px); border-color: var(--c-brand-2); }
.new-chat svg { width: 18px; height: 18px; }
.side-search { padding: 4px 14px 6px; }
.side-search input {
    width: 100%; border: 1px solid transparent; background: var(--c-hover); border-radius: 12px; padding: 9px 12px 9px 34px; font: inherit; font-size: .9rem; color: var(--c-ink); outline: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 10px 50%; background-size: 16px; transition: border-color .15s, background-color .15s;
}
.side-search input:focus { border-color: var(--c-brand-2); background-color: var(--c-surface); }
.side-search input::placeholder { color: var(--c-muted); }
.hist { flex: 1; overflow-y: auto; padding: 0 10px 12px; min-height: 0; }
.hist-group { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); padding: 16px 12px 6px; }
.hist-item { position: relative; display: flex; align-items: center; border-radius: 12px; margin: 1px 0; }
.hist-item:hover { background: var(--c-hover); }
.hist-item.is-active { background: var(--c-surface); box-shadow: var(--shadow-1); }
.hist-item.is-active::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--c-brand-2); }
.hist-link {
    flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 10px 12px; font-size: .92rem; color: var(--c-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 12px;
}
.hist-item.is-active .hist-link { font-weight: 600; }
.hist-more { opacity: 0; width: 30px; height: 30px; margin-right: 4px; }
.hist-item:hover .hist-more, .hist-item.is-active .hist-more, .hist-more:focus-visible { opacity: 1; }
.hist-menu {
    position: absolute; right: 6px; top: 100%; z-index: 20; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 14px;
    box-shadow: var(--shadow-2); padding: 6px; min-width: 156px;
}
.hist-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 9px; font-size: .9rem; }
.hist-menu button:hover { background: var(--c-hover); }
.hist-menu .danger { color: var(--c-danger); }
.hist-empty { padding: 22px 14px; color: var(--c-muted); font-size: .9rem; text-align: center; }
.skel { height: 36px; margin: 6px 4px; border-radius: 12px; background: linear-gradient(90deg, var(--c-hover), rgba(120, 120, 130, .14), var(--c-hover)); background-size: 200% 100%; animation: sh 1.3s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.side-bottom { border-top: 1px solid var(--c-line); padding: 12px 14px 14px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; font-weight: 600; font-size: .92rem; min-width: 0; }
.side-user span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-av { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; }
.side-links { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; font-size: .86rem; margin-bottom: 10px; }
.side-links a { color: var(--c-muted); text-decoration: none; padding: 5px 8px; border-radius: 8px; white-space: nowrap; }
.side-links a:hover { color: var(--c-ink); background: var(--c-hover); }
.side-help { border-top: 1px dashed var(--c-line); padding-top: 10px; margin-top: 2px; display: flex; flex-direction: column; gap: 6px; }
.sh-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); padding: 0 8px; }
.sh-row { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: .9rem; font-weight: 600; color: var(--c-ink); padding: 8px 10px; border-radius: 12px; border: 1px solid var(--c-line); background: var(--c-surface); transition: border-color .15s, transform .15s; }
.sh-row:hover { border-color: var(--c-brand-2); transform: translateY(-1px); }
.sh-row svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--c-brand-2); }
.sh-row.wa svg { color: #1fa855; }
:root[data-theme="dark"] a.sh-row { color: var(--c-ink); }

/* ── main ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; min-height: 58px; }
.topbar .t-title { flex: 1; min-width: 0; font-weight: 600; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.only-mobile { display: none; }
.pill-link {
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: .86rem; font-weight: 600; color: var(--c-ink); padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--c-line); background: var(--c-surface); transition: border-color .15s, transform .15s;
}
.pill-link:hover { border-color: var(--c-brand-2); transform: translateY(-1px); }
:root[data-theme="dark"] a.pill-link { color: var(--c-ink); }
.scroll { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; position: relative; }
.col { width: 100%; max-width: 800px; margin: 0 auto; padding: 14px 22px 28px; }
.to-bottom {
    position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%) translateY(6px); width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--c-line);
    background: var(--c-surface); box-shadow: var(--shadow-2); display: none; align-items: center; justify-content: center; z-index: 5; opacity: 0; transition: opacity .2s, transform .2s;
}
.to-bottom.show { display: inline-flex; opacity: 1; transform: translateX(-50%); }
.to-bottom svg { width: 18px; height: 18px; }

/* welcome */
.welcome { padding-top: clamp(14px, 6vh, 64px); text-align: center; animation: rise .5s ease both; }
.w-mark {
    width: 64px; height: 64px; border-radius: 20px; background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-2) 100%); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; margin-bottom: 20px; box-shadow: 0 12px 30px rgba(43, 79, 216, .35);
}
.w-mark svg { width: 32px; height: 32px; }
.welcome h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.9rem, 5vw, 2.7rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.015em; }
.welcome p.lead { margin: 0 auto 30px; max-width: 540px; color: var(--c-muted); font-size: 1.02rem; }
.chips-label { text-align: left; font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); margin: 0 4px 10px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; text-align: left; }
.chip {
    text-align: left;
    background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 18px; padding: 15px 16px; font-size: .96rem; line-height: 1.4;
    display: flex; align-items: flex-start; gap: 13px; transition: border-color .15s, box-shadow .15s, transform .15s; box-shadow: var(--shadow-1);
}
.chip:hover { border-color: var(--c-brand-2); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.chip .ci { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; background: var(--bg, var(--c-accent-soft)); }
.chip .ct { min-width: 0; }
.chip b { display: block; font-weight: 600; }
.chip span.s { display: block; color: var(--c-muted); font-size: .85rem; margin-top: 2px; }
.fineprint { margin-top: 24px; font-size: .8rem; color: var(--c-muted); }

/* messages */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg { margin: 0 0 28px; display: flex; gap: 14px; animation: rise .3s ease both; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--c-user); border-radius: 20px 20px 6px 20px; padding: 11px 17px; max-width: 86%; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow-1); }
.msg.bot .avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.msg.bot .avatar svg { width: 17px; height: 17px; }
.msg.bot .body { flex: 1; min-width: 0; }
.md { overflow-wrap: anywhere; font-size: 1rem; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .9em; }
.md ul, .md ol { margin: 0 0 .9em; padding-left: 1.45em; }
.md li { margin: .3em 0; }
.md li::marker { color: var(--c-muted); }
.md h2, .md h3, .md h4 { margin: 1.2em 0 .45em; line-height: 1.3; font-size: 1.05rem; }
.md h2 { font-size: 1.18rem; }
.md strong { font-weight: 650; }
.md code { background: var(--c-code); border-radius: 6px; padding: .12em .42em; font-size: .9em; }
.md pre { background: var(--c-code); border-radius: 14px; padding: 13px 16px; overflow-x: auto; margin: 0 0 .9em; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .9em; padding: .1em 0 .1em 14px; border-left: 3px solid var(--c-line); color: var(--c-muted); }
.md a { font-weight: 500; text-underline-offset: 2px; }
.md a.btn-link {
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: .92rem; line-height: 1.3; padding: 6px 13px; margin: 3px 6px 3px 0;
    border-radius: 999px; background: var(--c-accent-soft); border: 1px solid transparent; transition: border-color .15s, transform .15s;
}
.md a.btn-link:hover { border-color: var(--c-brand-2); transform: translateY(-1px); }
.md a.btn-link::after { content: '\2197'; font-size: .85em; opacity: .7; }
.md .tbl { overflow-x: auto; margin: 0 0 .9em; border: 1px solid var(--c-line); border-radius: 14px; }
.md table { border-collapse: collapse; font-size: .92rem; width: 100%; }
.md th, .md td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--c-line); }
.md tr:last-child td { border-bottom: 0; }
.md th { background: var(--c-code); font-weight: 600; }
.actions { display: flex; gap: 2px; margin-top: 8px; }
.act { background: none; border: 0; border-radius: 9px; padding: 5px 9px; font-size: .8rem; color: var(--c-muted); display: inline-flex; align-items: center; gap: 5px; }
.act:hover { background: var(--c-hover); color: var(--c-ink); }
.act svg { width: 15px; height: 15px; }
.typing { display: inline-flex; align-items: center; gap: 5px; padding: 8px 0; color: var(--c-muted); font-size: .9rem; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-brand-2); opacity: .6; animation: bounce 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.typing em { font-style: normal; margin-left: 6px; }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-5px); opacity: 1; } }
.cursor::after { content: ''; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--c-brand-2); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.err {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--c-danger-bg); color: var(--c-danger); border: 1px solid rgba(179, 38, 30, .25);
    border-radius: 16px; padding: 13px 15px; font-size: .93rem; margin: 0 0 24px; animation: rise .25s ease both;
}
.err .retry { margin-left: auto; background: var(--c-surface); border: 1px solid rgba(179, 38, 30, .35); color: var(--c-danger); font-weight: 600; border-radius: 11px; padding: 7px 16px; }
.err .retry:hover { filter: brightness(.97); }
.stopped { color: var(--c-muted); font-size: .82rem; margin-top: 4px; }
.convo-loading { display: flex; justify-content: center; padding: 70px 0; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--c-line); border-top-color: var(--c-brand-2); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* gate (signed out / guest) */
.gate { text-align: center; padding-top: clamp(40px, 14vh, 130px); animation: rise .4s ease both; }
.gate .w-mark { margin-bottom: 22px; }
.gate h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.7rem, 4.6vw, 2.2rem); margin: 0 0 10px; }
.gate p { color: var(--c-muted); max-width: 450px; margin: 0 auto 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2)); color: #fff; font-weight: 600; border-radius: 13px; padding: 12px 24px; border: 0; box-shadow: 0 8px 22px rgba(43, 79, 216, .28); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); color: #fff; box-shadow: 0 12px 26px rgba(43, 79, 216, .36); }
:root[data-theme="dark"] a.btn { color: #fff; }
.btn.ghost { background: transparent; color: var(--c-ink); border: 1px solid var(--c-line); margin-left: 8px; box-shadow: none; }
.btn.ghost:hover { background: var(--c-surface); color: var(--c-ink); box-shadow: none; }

/* composer */
.composer-wrap { padding: 4px 18px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--c-bg) 70%, transparent); }
.composer {
    max-width: 800px; margin: 0 auto; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 26px; padding: 10px 10px 10px 20px;
    display: flex; align-items: flex-end; gap: 8px; box-shadow: var(--shadow-2); transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--c-brand-2); box-shadow: var(--shadow-2), 0 0 0 3px rgba(43, 79, 216, .14); }
.composer textarea {
    overflow-y: auto; scrollbar-width: none;
    flex: 1; border: 0; outline: 0; resize: none; background: transparent; font: inherit; color: inherit; line-height: 1.5; padding: 9px 0; max-height: 200px; min-height: 28px;
}
.composer textarea::placeholder { color: var(--c-muted); opacity: .8; }
.send {
    flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2)); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; transition: transform .15s, opacity .15s, box-shadow .15s; box-shadow: 0 6px 16px rgba(43, 79, 216, .35);
}
.send:hover:not(:disabled) { transform: scale(1.06); }
.send:disabled { opacity: .35; cursor: default; box-shadow: none; }
.send svg { width: 20px; height: 20px; }
.send.stop { background: var(--c-ink); color: var(--c-bg); box-shadow: none; }
.disclaimer { max-width: 800px; margin: 9px auto 0; display: flex; justify-content: space-between; gap: 12px; font-size: .76rem; color: var(--c-muted); padding: 0 8px; }
.disclaimer .keys { white-space: nowrap; }
.counter { font-size: .72rem; color: var(--c-danger); align-self: center; white-space: nowrap; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--c-ink); color: var(--c-bg); padding: 9px 18px; border-radius: 999px; font-size: .87rem; z-index: 60; box-shadow: var(--shadow-2); animation: rise .2s ease both; }

.scrim { display: none; }

@media (max-width: 860px) {
    body { font-size: 15.5px; }
    .side { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; transform: translateX(-102%); box-shadow: 10px 0 40px rgba(0, 0, 0, .25); width: min(86vw, 330px); }
    .app.nav-open .side { transform: none; }
    .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 18, 28, .45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
    .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
    .only-mobile { display: inline-flex; }
    .only-desktop { display: none !important; }
    .topbar { padding: 8px 8px; min-height: 54px; border-bottom: 1px solid var(--c-line); background: var(--c-bg); }
    .topbar .t-title { text-align: center; padding-left: 0; }
    .col { padding: 16px 16px 20px; }
    .chips { grid-template-columns: 1fr; gap: 10px; }
    .hist-more { opacity: 1; }
    .msg { gap: 11px; margin-bottom: 24px; }
    .msg.user .bubble { max-width: 92%; }
    .disclaimer .keys { display: none; }
    .composer-wrap { padding: 4px 12px calc(10px + env(safe-area-inset-bottom)); }
    .to-bottom { bottom: 138px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ── extra responsive tuning ── */
@media (min-width: 861px) and (max-width: 1100px) {
    :root { --side-w: 262px; }
    .col { padding-left: 18px; padding-right: 18px; }
    .chips { gap: 10px; }
}
@media (min-width: 1500px) {
    :root { --side-w: 312px; }
    .col, .composer, .disclaimer { max-width: 860px; }
    body { font-size: 16.5px; }
}
@media (max-width: 860px) {
    /* 16px inputs stop iOS from zooming the page when a field is focused; bigger touch targets */
    .composer textarea, .side-search input { font-size: 16px; }
    .icon-btn { width: 44px; height: 44px; }
    .hist-more { width: 40px; height: 40px; }
    .hist-link { padding: 13px 12px; }
    .new-chat { padding: 13px 14px; }
    .side-links a, .sh-row { min-height: 44px; display: flex; align-items: center; }
    .side { padding-left: env(safe-area-inset-left); }
    .topbar { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
    .welcome { padding-top: clamp(6px, 3vh, 36px); }
    .welcome h1 { font-size: clamp(1.7rem, 7.2vw, 2.2rem); }
    .welcome p.lead { font-size: .96rem; margin-bottom: 22px; }
    .w-mark { width: 56px; height: 56px; border-radius: 18px; margin-bottom: 14px; }
    .chip { padding: 13px 14px; }
}
@media (max-width: 380px) {
    body { font-size: 15px; }
    .col { padding: 12px 12px 16px; }
    .msg { gap: 9px; }
    .msg.bot .avatar { flex-basis: 28px; width: 28px; height: 28px; border-radius: 9px; }
    .composer { padding: 8px 8px 8px 14px; border-radius: 22px; }
    .send { flex-basis: 40px; width: 40px; height: 40px; }
    .md a.btn-link { font-size: .88rem; padding: 6px 11px; }
    .welcome h1 br { display: none; }
}
@media (max-height: 520px) {
    /* phones held sideways: keep the conversation visible */
    .welcome { padding-top: 0; }
    .w-mark, .welcome p.lead, .fineprint, .chips-label { display: none; }
    .welcome h1 { font-size: 1.5rem; margin-bottom: 14px; }
    .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .chip { padding: 9px 12px; }
    .chip .ci { flex-basis: 30px; width: 30px; height: 30px; font-size: 1rem; }
    .chip span.s { display: none; }
    .topbar { min-height: 46px; padding-top: 4px; padding-bottom: 4px; }
    .disclaimer { display: none; }
    .composer-wrap { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
    .to-bottom { bottom: 80px; }
    .gate { padding-top: 16px; }
}
@media (max-width: 860px) and (min-width: 600px) {
    /* tablets in portrait: use the width, two suggestion columns again */
    .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .col { max-width: 720px; }
}

/* login prompt under an answer that needs an account */
.login-cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.login-cta .btn { padding: 9px 18px; font-size: .9rem; border-radius: 11px; }
.login-cta .btn.ghost { margin-left: 0; }
.hist-empty a { color: var(--c-brand-2); font-weight: 600; }
