:root {
  font-family: "Inter", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: #24322b;
  background: #fcfdfa;
  --green: #245640;
  --subtle: #5a6b62;
  --line: #d8dfd7;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; display: grid; grid-template-columns: clamp(200px, 22vw, 282px) minmax(0, 1fr); }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible { outline: 2px solid #297957; outline-offset: 2px; }
aside { background: #eff3ed; border-right: 1px solid var(--line); padding: 26px 16px 14px; display: flex; flex-direction: column; gap: 22px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 11px; padding-left: 6px; font-size: 20px; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--green); color: #fff; font-family: Georgia, serif; font-weight: bold; }
#new-session, #send { background: var(--green); color: #fff; border: none; border-radius: 9px; font-size: 14px; }
#new-session { padding: 11px 14px; text-align: left; display: flex; align-items: center; gap: 8px; }
#new-session:hover:enabled, #send:hover:enabled { background: #17432e; }
nav { overflow: auto; }
nav h2 { color: var(--subtle); font-size: 12px; font-weight: 600; margin: 2px 7px 9px; }
#sessions { list-style: none; margin: 0; padding: 2px; display: grid; gap: 2px; }
#sessions button { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; border: 0; border-radius: 7px; background: transparent; color: #37483e; padding: 10px 8px; text-align: left; font-size: 14px; }
#sessions button:hover { background: #e4ebe2; }
#sessions button[aria-current="page"] { background: #dae6d9; color: #204832; font-weight: 600; }
main { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 19px clamp(18px, 4vw, 62px); border-bottom: 1px solid var(--line); }
h1 { font-size: 17px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#model-status { flex: 0 1 auto; max-width: 48%; text-align: right; color: var(--subtle); font-size: 12px; overflow-wrap: anywhere; }
#thread { overflow: auto; }
.thread-inner, .composer-area { width: min(100%, 830px); margin: 0 auto; padding-inline: clamp(14px, 3vw, 32px); }
.thread-inner { min-height: 100%; display: flex; flex-direction: column; }
#empty-state { margin: auto 0; padding: 32px 0; text-align: center; }
#empty-state h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 650; margin: 0 0 8px; }
#empty-state p { margin: 0; color: var(--subtle); font-size: 15px; }
#messages { display: grid; gap: 24px; padding-block: 24px; }
#messages:empty { display: none; }
.message { max-width: 95%; min-width: 0; justify-self: start; }
.message.user { justify-self: end; }
.sender { margin: 0 2px 6px; color: var(--subtle); font-weight: 600; font-size: 12px; }
.user .sender { text-align: right; }
.bubble { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 15px; }
.user .bubble { background: #e5efe5; border-radius: 14px 4px 14px 14px; padding: 10px 15px; }
footer { padding: 3px 0 clamp(12px, 3vh, 28px); }
#status { min-height: 1.5em; font-size: 13px; color: var(--subtle); margin: 3px 4px; }
#status.error { color: #9a452d; }
#composer { background: white; border: 1px solid #c9d4cb; border-radius: 15px; box-shadow: 0 3px 14px #203e2510; padding: 13px; }
#composer:focus-within { border-color: #698b70; }
textarea { border: none; outline: none; resize: vertical; display: block; width: 100%; min-height: 45px; max-height: 25vh; background: transparent; color: inherit; line-height: 1.5; }
textarea::placeholder { color: #6f7a72; }
.controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hint { font-size: 12px; color: var(--subtle); }
#send { padding: 8px 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 640px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  aside { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 11px 14px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; font-size: 17px; }
  .mark { width: 27px; height: 27px; border-radius: 8px; }
  #new-session { padding: 7px 12px; }
  nav { grid-column: 1 / -1; }
  nav h2 { margin: 0 2px 3px; }
  #sessions { display: flex; overflow-x: auto; }
  #sessions li { max-width: 180px; flex-shrink: 0; }
  #sessions button { padding: 4px 8px; }
  header { padding: 10px 15px; }
  .hint { font-size: 11px; }
}
