:root {
  color-scheme: light;
  --canvas: #f2f4f0;
  --panel: #ffffff;
  --panel-warm: #f8f7f2;
  --ink: #17211f;
  --muted: #66716e;
  --line: #d9ded9;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --teal-soft: #e0f2ef;
  --gold: #b7791f;
  --shadow: 0 18px 48px rgba(25, 45, 39, 0.1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.ai-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100dvh;
}

.conversation-sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px 18px;
  border-right: 1px solid var(--line);
  background: #faf9f5;
}

.sidebar-head { display: grid; gap: 18px; }

.ai-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.ai-brand__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--ink);
}

.ai-brand__mark img { width: 100%; height: 100%; }
.ai-brand strong, .ai-brand small { display: block; }
.ai-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }

.new-chat {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--teal);
  border-radius: 9px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.new-chat:hover, .new-chat:focus-visible { background: var(--teal-dark); outline: none; }
.new-chat:disabled { cursor: not-allowed; opacity: .48; }

.mode-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mode-nav a {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.mode-nav a.is-active { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }

.conversation-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.conversation-list-head button {
  display: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
}

.conversation-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
}

.conversation-loading, .conversation-empty { margin: 8px 4px; color: var(--muted); font-size: 13px; }

.conversation-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.conversation-item:hover { background: #fff; }
.conversation-item.is-active { border-color: #b9d8d2; background: var(--teal-soft); }
.conversation-item strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item time { color: var(--muted); font-size: 11px; }

.sidebar-note { margin: auto 2px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.chat-workspace {
  display: grid;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 75% 0%, rgba(15, 118, 110, .07), transparent 32%),
    var(--canvas);
}

.chat-header {
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(14px);
}

.assistant-identity { display: flex; align-items: center; gap: 10px; }
.assistant-identity strong, .assistant-identity small { display: block; }
.assistant-identity small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.assistant-avatar, .welcome-mark {
  display: grid;
  place-items: center;
  border: 1px solid #a8d0c8;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 900;
}

.assistant-avatar { width: 38px; height: 38px; }
.resource-link { margin-left: auto; color: var(--teal-dark); font-size: 13px; font-weight: 800; text-decoration: none; }
.sidebar-toggle { display: none; border: 0; background: transparent; color: var(--ink); font-size: 20px; }

.message-scroll { min-height: 0; max-height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 34px max(24px, calc((100% - 860px) / 2)); }
.message-list { display: grid; min-width: 0; gap: 22px; padding-bottom: 12px; }

.welcome { max-width: 820px; margin: min(8vh, 64px) auto 0; text-align: center; }
.welcome-mark { width: 64px; height: 64px; margin: 0 auto 18px; font-size: 24px; box-shadow: var(--shadow); }
.welcome-eyebrow { margin: 0 0 8px; color: var(--teal-dark); font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.welcome h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(32px, 5vw, 48px); font-weight: 600; }
.welcome-copy { max-width: 660px; margin: 15px auto 28px; color: var(--muted); font-size: 15px; line-height: 1.8; }

.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.prompt-card {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .78);
  color: var(--ink);
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.prompt-card:hover, .prompt-card:focus-within { border-color: #84b7ad; box-shadow: 0 10px 28px rgba(25,45,39,.08); }
.prompt-card > span { color: var(--teal); font-size: 11px; font-weight: 850; }
.prompt-grid strong { font-size: 14px; line-height: 1.5; }
.prompt-card label { align-self: end; }
.prompt-card select {
  width: 100%;
  min-height: 36px;
  padding: 7px 30px 7px 9px;
  border: 1px solid #cfd9d4;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 720;
}
.prompt-card select:focus { border-color: var(--teal); outline: 2px solid rgba(15,118,110,.1); }
.prompt-card select:disabled { color: var(--muted); cursor: wait; }
.is-ai-readonly .prompt-card select:disabled { cursor: not-allowed; }
.source-promise { margin: 24px 0 0; color: var(--muted); font-size: 12px; }

.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; max-width: 820px; width: 100%; margin-inline: auto; }
.message.is-user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.message__avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark); font-size: 12px; font-weight: 900; }
.message__bubble { min-width: 0; max-width: 100%; }
.message.is-user .message__bubble { max-width: min(78%, 640px); padding: 11px 15px; border-radius: 15px 15px 4px 15px; background: var(--ink); color: #fff; }
.message__text { margin: 0; overflow-wrap: anywhere; font-size: 15px; line-height: 1.75; white-space: pre-wrap; }
.thinking-indicator { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 650; }
.thinking-indicator__label { background: linear-gradient(90deg, #66716e 20%, #0f766e 50%, #66716e 80%); background-size: 220% 100%; background-clip: text; color: transparent; animation: thinking-shimmer 1.7s ease-in-out infinite; }
.thinking-indicator__dots { display: inline-flex; gap: 4px; }
.thinking-indicator__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); opacity: .25; animation: thinking-dot 1.05s ease-in-out infinite; }
.thinking-indicator__dots i:nth-child(2) { animation-delay: .14s; }
.thinking-indicator__dots i:nth-child(3) { animation-delay: .28s; }
@keyframes thinking-shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes thinking-dot { 0%, 60%, 100% { opacity: .22; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.markdown-body { white-space: normal; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5 { margin: 22px 0 9px; color: var(--ink); font-family: Georgia, "Songti SC", serif; line-height: 1.35; }
.markdown-body h2 { font-size: 23px; }
.markdown-body h3 { font-size: 19px; }
.markdown-body h4, .markdown-body h5 { font-size: 16px; }
.markdown-body ul, .markdown-body ol { margin: 8px 0 15px; padding-left: 24px; }
.markdown-body li { margin: 5px 0; padding-left: 2px; }
.markdown-body blockquote { margin: 12px 0; padding: 9px 13px; border-left: 3px solid #98c5bc; background: #f2fbf9; color: #465653; }
.markdown-body pre { max-width: 100%; margin: 12px 0; overflow-x: auto; padding: 12px; border-radius: 8px; background: #17211f; color: #edf7f4; }
.markdown-body code { padding: 2px 5px; border-radius: 4px; background: #edf1ed; font-family: "Cascadia Code", Consolas, monospace; font-size: .9em; }
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.markdown-body a { color: var(--teal-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-body a:hover { color: var(--teal); }
.markdown-table-wrap { max-width: 100%; margin: 13px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.markdown-body table { width: 100%; min-width: 420px; border-collapse: collapse; background: #fff; font-size: 13px; }
.markdown-body th, .markdown-body td { padding: 9px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-body th:last-child, .markdown-body td:last-child { border-right: 0; }
.markdown-body tr:last-child td { border-bottom: 0; }
.markdown-body th { background: var(--panel-warm); color: var(--ink); font-weight: 850; }
.math-node.is-display { display: block; margin: 12px 0; overflow-x: auto; }

.follow-up-panel { margin-top: 18px; }
.follow-up-panel > p { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.follow-up-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.follow-up-grid button { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #bfd8d3; border-radius: 9px; background: #f7fbfa; color: var(--ink); text-align: left; }
.follow-up-grid button:hover, .follow-up-grid button:focus-visible { border-color: var(--teal); outline: 0; background: var(--teal-soft); }
.follow-up-grid button span { font-size: 13px; font-weight: 720; line-height: 1.45; }
.follow-up-grid button b { color: var(--teal); font-size: 17px; }

.citation-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.citation-list a { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid #bfd8d3; border-radius: 7px; background: #f2fbf9; color: var(--teal-dark); font-size: 11px; font-weight: 750; text-decoration: none; }
.citation-list a::before { content: "↗"; }

.message-error { margin-top: 8px; color: #9f3542; font-size: 12px; }

.message-attachments { display: grid; gap: 7px; margin-top: 9px; }
.message-attachment { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 9px; min-width: min(100%, 250px); padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); text-decoration: none; }
.message-attachment:hover, .message-attachment:focus-visible { border-color: #84b7ad; outline: 0; }
.message-attachment__preview { display: grid; width: 38px; height: 38px; place-items: center; overflow: hidden; border-radius: 7px; background: var(--panel-warm); color: var(--teal-dark); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.message-attachment__preview img { width: 100%; height: 100%; object-fit: cover; }
.message-attachment__copy { min-width: 0; }
.message-attachment__copy strong, .message-attachment__copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-attachment__copy strong { font-size: 12px; }
.message-attachment__copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.message.is-user .message-attachment { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; }
.message.is-user .message-attachment__preview { background: rgba(255,255,255,.13); color: #fff; }
.message.is-user .message-attachment__copy small { color: rgba(255,255,255,.7); }

.question-card {
  width: min(100%, 774px);
  margin: -8px auto 4px 46px;
  padding: 18px;
  border: 1px solid #bfd8d3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(25, 45, 39, .07);
}
.question-card.is-unavailable { color: var(--muted); border-style: dashed; box-shadow: none; }
.question-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.question-card__head span { color: var(--teal-dark); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.question-card__head a { color: var(--muted); font-size: 11px; font-weight: 750; text-decoration: none; }
.question-card__head a:hover { color: var(--teal-dark); text-decoration: underline; }
.question-card__prompt { font-size: 15px; line-height: 1.75; }
.question-card__prompt p, .question-card__prompt div { margin: 0 0 10px; }
.question-card__prompt > :last-child { margin-bottom: 0; }
.question-card__prompt ul, .question-card__prompt ol { padding-left: 24px; }
.question-formula { margin: 12px 0; overflow-x: auto; padding: 10px 12px; border-radius: 7px; background: var(--panel-warm); }
.question-formula .math-node.is-display { margin: 0; }
.question-figure { margin: 12px 0; }
.question-figure img { display: block; width: auto; max-width: 100%; max-height: 460px; border-radius: 7px; }
.question-figure__zoom { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.question-figure__zoom:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.question-figure figcaption { margin-top: 5px; color: var(--muted); font-size: 11px; }
.image-lightbox { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; }
.image-lightbox[hidden] { display: none; }
.image-lightbox__backdrop { position: absolute; inset: 0; border: 0; background: rgba(12, 22, 20, .72); cursor: zoom-out; }
.image-lightbox__frame { position: relative; z-index: 1; max-width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: 0; }
.image-lightbox__frame img { display: block; max-width: 100%; max-height: calc(100vh - 72px); background: #fff; border-radius: 10px; }
.image-lightbox__close { position: absolute; top: 8px; right: 8px; padding: 6px 10px; border: 0; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12px; cursor: pointer; }
body.is-image-lightbox-open { overflow: hidden; }
.question-options { display: grid; gap: 8px; margin-top: 16px; }
.question-option { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-align: left; }
.question-option:hover:not(:disabled), .question-option:focus-visible { border-color: #7fb5ab; outline: 0; }
.question-option.is-selected { border-color: var(--teal); background: var(--teal-soft); }
.question-option.is-correct { border-color: #4f8a62; background: #edf8f0; }
.question-option.is-incorrect { border-color: #c66e77; background: #fff1f2; }
.question-option:disabled { cursor: default; opacity: 1; }
.is-ai-readonly .question-option:disabled { cursor: not-allowed; opacity: .7; }
.question-option__label { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: var(--panel-warm); font-size: 12px; font-weight: 900; }
.question-option.is-selected .question-option__label { background: var(--teal); color: #fff; }
.question-option__copy { min-width: 0; overflow-wrap: anywhere; line-height: 1.65; }
.question-option__image { display: block; max-width: 100%; max-height: 260px; margin-top: 8px; border-radius: 6px; }
.question-option__image[data-image-zoom] { cursor: zoom-in; }
.question-input-label { display: grid; gap: 7px; margin-top: 16px; color: var(--muted); font-size: 12px; font-weight: 800; }
.question-input, .question-textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.question-textarea { min-height: 112px; resize: vertical; }
.question-input:focus, .question-textarea:focus { border-color: var(--teal); outline: 3px solid rgba(15, 118, 110, .1); }
.question-card__actions { display: flex; align-items: center; gap: 12px; margin-top: 15px; }
.question-action { min-height: 38px; padding: 8px 14px; border: 1px solid var(--teal); border-radius: 8px; background: #fff; color: var(--teal-dark); font-weight: 850; }
.question-action.is-primary { background: var(--teal); color: #fff; }
.question-action:disabled { opacity: .5; cursor: wait; }
.is-ai-readonly .question-action:disabled { cursor: not-allowed; }
.question-save-status { color: var(--muted); font-size: 11px; }
.question-solution { margin-top: 16px; padding: 14px; border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; background: #fffaf0; font-size: 14px; line-height: 1.7; }
.question-solution p { margin: 7px 0; }
.question-result { font-weight: 850; }
.question-result.is-correct { color: #27663b; }
.question-result.is-incorrect { color: #973946; }
.question-mark-scheme { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e6d8bb; }

.composer-wrap { padding: 10px max(20px, calc((100% - 860px) / 2)) 16px; background: linear-gradient(transparent, var(--canvas) 18%); }
.composer-availability { display: flex; flex-wrap: wrap; min-height: 34px; align-items: center; justify-content: center; gap: 2px 8px; margin: 0 4px 7px; padding: 7px 12px; border: 1px solid #d5ddd8; border-radius: 10px; background: rgba(255,255,255,.82); color: var(--muted); font-size: 12px; line-height: 1.45; text-align: center; }
.composer-availability[hidden] { display: none; }
.composer-availability__link { color: var(--teal-dark); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.composer-availability__link:hover, .composer-availability__link:focus-visible { color: var(--teal); outline: 0; }
.tool-activity { display: flex; min-height: 23px; align-items: center; gap: 7px; padding: 0 6px; color: var(--teal-dark); font-size: 12px; opacity: 0; transform: translateY(3px); transition: opacity .18s ease, transform .18s ease; }
.tool-activity.is-active { opacity: 1; transform: translateY(0); }
.tool-activity__text { font-weight: 750; letter-spacing: .01em; }
.tool-activity.is-active .tool-activity__text { animation: activity-breathe 1.8s ease-in-out infinite; }
.tool-activity__dots { display: inline-flex; width: 22px; align-items: center; justify-content: space-between; }
.tool-activity__dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .25; transform: translateY(0); }
.tool-activity.is-active .tool-activity__dots i { animation: activity-dot 1.05s ease-in-out infinite; }
.tool-activity.is-active .tool-activity__dots i:nth-child(2) { animation-delay: .14s; }
.tool-activity.is-active .tool-activity__dots i:nth-child(3) { animation-delay: .28s; }
@keyframes activity-breathe { 0%, 100% { opacity: .62; } 50% { opacity: 1; } }
@keyframes activity-dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.model-control { position: relative; display: inline-flex; align-self: end; margin-bottom: 2px; color: var(--teal-dark); font-size: 11px; font-weight: 800; }
.model-control__button { display: inline-flex; min-width: 82px; height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid #d7dfda; border-radius: 999px; background: #fbfcfa; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease; }
.model-control__button:hover, .model-control__button:focus-visible, .model-control.is-open .model-control__button { border-color: #8bb9b0; background: #eff8f5; box-shadow: 0 0 0 3px rgba(15,118,110,.08); outline: 0; }
.model-control__button:active { transform: translateY(1px); }
.model-control__button:disabled { cursor: default; opacity: .48; box-shadow: none; }
.model-control__icon { color: var(--teal); font-size: 12px; line-height: 1; }
.model-control__chevron { width: 6px; height: 6px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; opacity: .58; transform: rotate(45deg); transition: transform .16s ease, margin .16s ease; }
.model-control.is-open .model-control__chevron { margin-top: 3px; transform: rotate(225deg); }
.model-menu { position: absolute; z-index: 30; bottom: calc(100% + 9px); left: 0; width: 172px; padding: 6px; border: 1px solid #d7e3df; border-radius: 14px; background: rgba(255,255,255,.98); box-shadow: 0 14px 38px rgba(15,35,31,.15), 0 3px 9px rgba(15,35,31,.07); backdrop-filter: blur(14px); }
.model-menu[hidden] { display: none; }
.model-menu__option { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.model-menu__option:hover, .model-menu__option:focus-visible { background: var(--teal-soft); outline: 0; }
.model-menu__option > span:first-child { display: grid; gap: 2px; }
.model-menu__option strong { font-size: 12px; font-weight: 850; }
.model-menu__option small { color: var(--muted); font-size: 10px; font-weight: 550; }
.model-menu__check { color: var(--teal); font-size: 13px; opacity: 0; transform: scale(.7); transition: opacity .12s ease, transform .12s ease; }
.model-menu__option[aria-selected="true"] { background: #f2f8f6; }
.model-menu__option[aria-selected="true"] .model-menu__check { opacity: 1; transform: scale(1); }
.composer { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid #c8d0ca; border-radius: 15px; background: #fff; box-shadow: 0 14px 38px rgba(25,45,39,.1); }
.composer:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.1), 0 14px 38px rgba(25,45,39,.1); }
.composer.is-readonly { border-color: #d6ddd8; background: #f8faf7; box-shadow: none; }
.composer.is-readonly:focus-within { border-color: #d6ddd8; box-shadow: none; }
.composer-row { display: grid; grid-template-columns: 38px 84px minmax(0, 1fr) 44px; align-items: end; gap: 8px; }
.composer textarea { width: 100%; max-height: 180px; padding: 8px 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); line-height: 1.55; }
.composer textarea::placeholder { color: #8b9592; }
.composer textarea:disabled { cursor: not-allowed; color: var(--muted); }
.attach-button { display: grid; width: 38px; height: 38px; place-items: center; margin-bottom: 2px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0; }
.attach-button span { font-size: 19px; line-height: 1; filter: grayscale(1); }
.attach-button:hover, .attach-button:focus-visible { outline: 0; background: var(--teal-soft); color: var(--teal-dark); }
.attach-button:disabled { cursor: default; opacity: .4; }
.send-button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 10px; background: var(--teal); color: #fff; font-size: 21px; font-weight: 900; }
.send-button:disabled { cursor: default; opacity: .42; }
.is-ai-readonly .send-button:disabled,
.is-ai-readonly .attach-button:disabled,
.is-ai-readonly .model-control__button:disabled { cursor: not-allowed; }
.is-ai-readonly .prompt-card { opacity: .72; }
.is-ai-readonly .follow-up-grid button:disabled { cursor: not-allowed; opacity: .55; }
.attachment-queue { display: flex; max-width: 100%; gap: 7px; padding: 2px 2px 5px; overflow-x: auto; }
.attachment-queue[hidden] { display: none; }
.attachment-chip { position: relative; display: grid; flex: 0 0 min(218px, 72vw); grid-template-columns: 40px minmax(0, 1fr) 25px; align-items: center; gap: 8px; min-height: 50px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-warm); }
.attachment-chip.is-error { border-color: #d9a2a8; background: #fff5f5; }
.attachment-chip__preview { display: grid; width: 40px; height: 40px; place-items: center; overflow: hidden; border-radius: 7px; background: var(--teal-soft); color: var(--teal-dark); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.attachment-chip__preview img { width: 100%; height: 100%; object-fit: cover; }
.attachment-chip__copy { min-width: 0; }
.attachment-chip__copy strong, .attachment-chip__copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip__copy strong { font-size: 11px; }
.attachment-chip__copy small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.attachment-chip.is-error .attachment-chip__copy small { color: #9f3542; }
.attachment-chip__remove { display: grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; }
.attachment-chip__remove:hover, .attachment-chip__remove:focus-visible { outline: 0; background: #e4e8e4; color: var(--ink); }
.attachment-chip__remove:disabled { cursor: default; opacity: .35; }
.attachment-chip__progress { position: absolute; right: 7px; bottom: 2px; left: 54px; height: 2px; overflow: hidden; border-radius: 999px; background: #d8e2de; }
.attachment-chip__progress span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .15s linear; }
.attachment-chip__retry { margin-left: 4px; padding: 0; border: 0; background: transparent; color: var(--teal-dark); font: inherit; font-weight: 800; text-decoration: underline; }
.attachment-chip__retry:disabled { cursor: not-allowed; opacity: .48; }
.composer-note { margin: 8px 4px 0; color: var(--muted); font-size: 10px; text-align: center; }

.file-drop-overlay { position: fixed; inset: 12px; z-index: 100; display: grid; place-items: center; border: 2px dashed rgba(15,118,110,.62); border-radius: 18px; background: rgba(242,247,244,.9); opacity: 0; pointer-events: none; transform: scale(.99); transition: opacity .15s ease, transform .15s ease; backdrop-filter: blur(5px); }
.file-drop-overlay > div { display: grid; min-width: min(360px, calc(100vw - 48px)); place-items: center; gap: 7px; padding: 30px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); color: var(--teal-dark); }
.file-drop-overlay span { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: var(--teal-soft); font-size: 26px; }
.file-drop-overlay strong { font-size: 17px; }
.file-drop-overlay small { color: var(--muted); }
body.is-file-dragging .file-drop-overlay { opacity: 1; transform: scale(1); }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 80; max-width: 340px; padding: 11px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.mobile-scrim { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
  .ai-shell { grid-template-columns: 1fr; }
  .conversation-sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); transform: translateX(-105%); box-shadow: var(--shadow); transition: transform .2s ease; }
  body.sidebar-open .conversation-sidebar { transform: translateX(0); }
  .conversation-list-head button, .sidebar-toggle { display: inline-grid; }
  .mobile-scrim { position: fixed; inset: 0; z-index: 15; display: block; background: rgba(12, 22, 20, .34); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.sidebar-open .mobile-scrim { opacity: 1; pointer-events: auto; }
  .chat-header { padding-inline: 14px; }
  .message-scroll { padding: 24px 14px; }
  .question-card { width: calc(100% - 42px); margin-left: 42px; padding: 15px; }
  .composer-wrap { padding: 8px 12px 10px; }
  .attachment-chip { flex-basis: min(205px, 76vw); }
  .resource-link { font-size: 12px; }
}

@media (max-width: 560px) {
  .prompt-grid { grid-template-columns: 1fr; }
  .welcome { margin-top: 18px; }
  .welcome-mark { width: 54px; height: 54px; }
  .welcome-copy { font-size: 14px; }
  .message { gap: 8px; }
  .message.is-user .message__bubble { max-width: 88%; }
  .message__text { font-size: 14px; }
  .follow-up-grid { grid-template-columns: 1fr; }
  .question-card { width: 100%; margin-left: 0; }
  .question-card__actions { align-items: flex-start; flex-direction: column; }
  .composer-row { grid-template-columns: 36px 76px minmax(0, 1fr) 40px; gap: 6px; }
  .model-control__button { min-width: 76px; padding-inline: 10px; }
  .model-menu { left: -2px; width: 164px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .tool-activity.is-active .tool-activity__text,
  .tool-activity.is-active .tool-activity__dots i,
  .thinking-indicator__label,
  .thinking-indicator__dots i { animation: none !important; opacity: 1; transform: none; }
  .thinking-indicator__label { background: none; color: var(--muted); }
}
