:root {
    color-scheme: light;
    --ink: #171717;
    --muted: #6b6b6b;
    --line: #e7e7e5;
    --soft: #f7f7f5;
    --accent: #111827;
    --user: #f1f1ef;
}

* { -webkit-box-sizing: border-box; box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #fff; color: var(--ink); font-family: Inter, system-ui, sans-serif; }
button, textarea { font: inherit; }
button { color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 99; padding: 10px 14px; border-radius: 8px; background: #111827; color: #fff; -webkit-transform: translateY(-150%); transform: translateY(-150%); }
.skip-link:focus { -webkit-transform: translateY(0); transform: translateY(0); }
.app-shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.topbar { height: 68px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 5; }
.home-link, .new-chat, .attach-button, .send { display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; border: 0; cursor: pointer; }
.home-link { width: 40px; height: 40px; color: #575757; border-radius: 10px; }
.home-link:hover, .new-chat:hover { background: var(--soft); }
.home-link svg, .new-chat svg, .attach-button svg, .send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 10px; }
.brand-mark, .welcome-mark { display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #111827, #475569); font-weight: 700; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 15px; }
.brand span { color: var(--muted); font-size: 11px; }
.new-chat { margin-left: auto; gap: 8px; padding: 10px 13px; background: transparent; border-radius: 10px; font-size: 14px; font-weight: 600; }

.chat-main { min-height: 0; overflow-y: auto; }
.welcome { max-width: 780px; margin: 0 auto; padding: clamp(72px, 12vh, 130px) 22px 150px; text-align: center; }
.welcome-mark { width: 54px; height: 54px; margin: 0 auto 22px; border-radius: 17px; -webkit-box-shadow: 0 10px 25px rgba(17,24,39,.18); box-shadow: 0 10px 25px rgba(17,24,39,.18); }
.welcome h1 { margin: 0 0 12px; font-size: clamp(30px, 5vw, 43px); letter-spacing: -.04em; }
.welcome > p { margin: 0 auto 34px; color: var(--muted); font-size: 16px; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.suggestions button { padding: 17px 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; -webkit-transition: .18s ease; transition: .18s ease; }
.suggestions button:hover { border-color: #b7b7b3; background: var(--soft); -webkit-transform: translateY(-1px); transform: translateY(-1px); }
.suggestions strong, .suggestions span { display: block; }
.suggestions strong { margin-bottom: 5px; font-size: 14px; }
.suggestions span { color: var(--muted); font-size: 12px; line-height: 1.4; }

.messages { max-width: 840px; margin: 0 auto; padding: 34px 22px 180px; }
.message { display: -webkit-box; display: -ms-flexbox; display: flex; gap: 15px; margin: 0 0 34px; }
.message-user { -webkit-box-orient: horizontal; -webkit-box-direction: reverse; -ms-flex-direction: row-reverse; flex-direction: row-reverse; }
.avatar { width: 32px; height: 32px; -webkit-box-flex: 0; -ms-flex: 0 0 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px; background: #161616; color: white; font-size: 11px; font-weight: 700; }
.message-user .avatar { background: #d8d8d4; color: #333; }
.message-body { max-width: min(720px, calc(100% - 48px)); }
.message-user .message-body { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-box-align: end; -ms-flex-align: end; align-items: flex-end; }
.message-name { margin: 5px 0 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.message-content { line-height: 1.72; font-size: 15px; overflow-wrap: anywhere; }
.message-user .message-content { padding: 11px 16px; border-radius: 18px 18px 4px 18px; background: var(--user); line-height: 1.55; }
.message-content h1, .message-content h2, .message-content h3 { margin: 1.3em 0 .55em; letter-spacing: -.02em; }
.message-content h1 { font-size: 1.45em; }.message-content h2 { font-size: 1.25em; }.message-content h3 { font-size: 1.08em; }
.message-content pre { margin: 18px 0; padding: 0 16px 17px; overflow-x: auto; border: 1px solid #30363d; border-radius: 12px; background: #161b22; color: #e6edf3; line-height: 1.55; }
.code-label { margin: 0 -16px 14px; padding: 8px 13px; border-bottom: 1px solid #30363d; color: #9da7b3; font: 12px Inter, sans-serif; }
.message-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.inline-code { padding: 2px 5px; border-radius: 5px; background: #ededeb; color: #b42318; }
.list-line { display: block; padding-left: 4px; }
.file-chip { display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 7px; max-width: 100%; margin-bottom: 8px; padding: 8px 11px; border: 1px solid #ddd; border-radius: 10px; color: #4b4b4b; background: #fff; font-size: 12px; }

.composer-wrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; padding: 10px max(18px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)); background: -webkit-gradient(linear, left bottom, left top, color-stop(78%, #fff), to(rgba(255,255,255,0))); background: linear-gradient(to top, #fff 78%, rgba(255,255,255,0)); }
.composer, .error { width: min(780px, 100%); margin: 0 auto; }
.composer { position: relative; padding: 10px 10px 8px; border: 1px solid #d6d6d2; border-radius: 24px; background: white; -webkit-box-shadow: 0 8px 30px rgba(0,0,0,.08); box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.composer:focus-within { border-color: #a8a8a3; -webkit-box-shadow: 0 8px 32px rgba(0,0,0,.11); box-shadow: 0 8px 32px rgba(0,0,0,.11); }
textarea { display: block; width: 100%; min-height: 44px; max-height: 180px; padding: 9px 12px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); line-height: 1.55; }
textarea::-webkit-input-placeholder { color: #8b8b87; }
textarea::-moz-placeholder { color: #8b8b87; }
textarea:-ms-input-placeholder { color: #8b8b87; }
textarea::-ms-input-placeholder { color: #8b8b87; }
textarea::placeholder { color: #8b8b87; }
.composer-actions { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 8px; padding: 1px 2px; }
#attach { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attach-button { gap: 7px; padding: 7px 10px; border-radius: 10px; color: #555; font-size: 12px; font-weight: 600; }
.attach-button:hover { background: var(--soft); }
.status { margin-left: auto; color: var(--muted); font-size: 12px; }
.send { width: 36px; height: 36px; margin-left: auto; border-radius: 50%; background: var(--accent); color: white; }
.send:hover { background: #303745; }
.send:disabled { opacity: .4; cursor: not-allowed; }
.stop span { width: 11px; height: 11px; border-radius: 2px; background: white; }
.attachment-preview { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 10px; margin: 1px 4px 7px; padding: 8px 10px; border-radius: 12px; background: var(--soft); }
.file-icon { font-size: 20px; }.attachment-preview > span:nth-child(2) { min-width: 0; display: grid; }
.attachment-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.attachment-preview small { color: var(--muted); font-size: 10px; }
.attachment-preview button { margin-left: auto; border: 0; background: transparent; font-size: 21px; cursor: pointer; }
.error { margin-bottom: 8px; padding: 10px 13px; border: 1px solid #fecaca; border-radius: 12px; background: #fef2f2; color: #b42318; font-size: 13px; }
.notice { margin: 8px auto 0; color: #888; text-align: center; font-size: 10px; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
    .topbar { height: 60px; padding: 0 12px; }
    .brand div span, .new-chat span { display: none; }
    .new-chat { width: 40px; height: 40px; padding: 0; }
    .welcome { padding-top: 58px; }
    .suggestions { grid-template-columns: 1fr; }
    .suggestions button:nth-child(n+3) { display: none; }
    .messages { padding: 25px 14px 175px; }
    .message { gap: 10px; margin-bottom: 27px; }
    .message-body { max-width: calc(100% - 42px); }
    .attach-button span { display: none; }
    .composer-wrap { padding-left: 9px; padding-right: 9px; }
    .notice { padding: 0 8px; font-size: 9px; }
}
