:root {
  --ink: #202638;
  --muted: #65708a;
  --surface: #ffffff;
  --canvas: #f6f7fb;
  --line: #e3e7f0;
  --accent: #0a775f;
  --accent-deep: #075944;
  --user: #e8f3ef;
  --shadow: 0 10px 30px rgba(38, 48, 73, .08);
  font-family: Georgia, "Noto Serif TC", serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); }
button, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100dvh; display: flex; }
.sidebar { position: fixed; z-index: 4; inset: 0 auto 0 0; width: 275px; padding: 20px 14px; display: flex; flex-direction: column; background: #eef1f7; border-right: 1px solid var(--line); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 20px; }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; gap: 9px; align-items: center; font-size: 18px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 7px; background: var(--accent); color: white; font-size: 15px; }
.new-chat { border: 1px solid #cfd7e5; background: #fff; border-radius: 7px; color: var(--ink); padding: 11px 13px; text-align: left; font-size: 14px; box-shadow: 0 2px 5px rgba(0,0,0,.03); }
.new-chat span { color: var(--accent); font-size: 19px; line-height: 10px; vertical-align: -1px; }
.history-list { flex: 1; overflow-y: auto; margin-top: 19px; }
.history-entry { width: 100%; border-radius: 6px; padding: 0; display: flex; align-items: center; gap: 7px; background: transparent; color: #465069; font-size: 13px; }
.history-entry:hover, .history-entry.active { background: #dce8e4; color: #174c40; }
.history-open { min-width: 0; flex: 1; border: 0; padding: 10px 0 10px 11px; background: transparent; color: inherit; text-align: left; }
.history-entry span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.delete-history { border: 0; background: transparent; color: #71809a; visibility: hidden; padding: 0 9px 0 2px; font-size: 17px; }
.history-entry:hover .delete-history { visibility: visible; }
.sidebar-footer { margin-top: 12px; padding: 0 8px; }
.local-note { margin: 0; color: var(--muted); font-size: 12px; }
.creator-note { margin: 7px 0 0; color: #8290a7; font-size: 12px; }
.chat-area { width: 100%; min-height: 100dvh; padding: 0 max(24px, calc((100vw - 1120px) / 2)); margin-left: 275px; display: flex; flex-direction: column; }
.topbar { min-height: 70px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid transparent; }
.topic-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
select { max-width: 125px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 26px 7px 9px; background: var(--surface); color: var(--ink); font-size: 13px; }
.conversation { width: min(100%, 820px); margin: 0 auto; padding: 44px 0 185px; flex: 1; }
.welcome { margin: 10vh auto 0; max-width: 680px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 1px; }
h1 { margin: 0; font-size: clamp(31px, 4vw, 49px); line-height: 1.2; font-weight: 600; letter-spacing: 0; }
.suggestion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 33px; }
.suggestion { min-height: 80px; border: 1px solid var(--line); border-radius: 7px; padding: 13px; background: var(--surface); color: #4b566e; text-align: left; line-height: 1.45; font-size: 14px; box-shadow: 0 3px 8px rgba(38,48,73,.03); }
.suggestion:hover { border-color: #9ec5ba; color: var(--accent-deep); }
.message { margin: 0 0 26px; animation: enter .18s ease-out; }
.message-label { margin: 0 0 7px; color: var(--muted); font-family: ui-sans-serif, sans-serif; font-size: 12px; font-weight: 700; }
.message-content { max-width: 100%; overflow-wrap: anywhere; font-size: 16px; line-height: 1.75; }
.message.user .message-content { padding: 13px 15px; background: var(--user); border-radius: 7px; }
.message-content p { margin: 0 0 13px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content pre { overflow-x: auto; padding: 14px; border-radius: 6px; background: #1e2735; color: #eff5f4; font-family: "Cascadia Code", monospace; font-size: 13px; }
.message-content code { font-family: "Cascadia Code", monospace; background: #edf0f5; padding: 1px 4px; border-radius: 3px; font-size: .88em; }
.message-content pre code { padding: 0; background: transparent; }
.message-image { display: block; max-width: min(100%, 520px); margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; }
.diagram-button { margin-top: 12px; border: 1px solid #8fbeb1; border-radius: 6px; padding: 7px 10px; background: transparent; color: var(--accent-deep); font-size: 13px; }
.composer-wrap { position: fixed; z-index: 3; bottom: 0; left: 275px; right: 0; padding: 10px max(24px, calc((100vw - 1120px) / 2)) 18px; background: linear-gradient(transparent, var(--canvas) 25%); }
.attachment-tray, .composer { width: min(100%, 820px); margin: 0 auto; }
.attachment-tray { padding: 0 10px 7px; display: flex; gap: 8px; overflow-x: auto; }
.attachment-card { position: relative; display: flex; max-width: 160px; gap: 7px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-family: ui-sans-serif, sans-serif; font-size: 12px; }
.attachment-card img { width: 30px; height: 30px; object-fit: cover; border-radius: 3px; }
.attachment-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-attachment { border: 0; padding: 0; background: none; color: #8a94a8; }
.composer { display: flex; align-items: end; gap: 8px; padding: 9px; background: var(--surface); border: 1px solid #d8deea; border-radius: 8px; box-shadow: var(--shadow); }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; color: #4f5a70; font-size: 22px; line-height: 1; }
.add-button { flex: 0 0 34px; font-size: 25px; }
textarea { min-height: 34px; max-height: 160px; flex: 1; resize: none; border: 0; outline: 0; padding: 7px 0; line-height: 1.4; background: transparent; color: var(--ink); }
textarea::placeholder { color: #8892a6; }
.send-button { width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 6px; background: var(--accent); color: white; font-size: 20px; }
.send-button:hover { background: var(--accent-deep); }
.send-button:disabled { background: #b6c4c0; cursor: not-allowed; }
.composer-note { width: min(100%, 820px); margin: 7px auto 0; color: var(--muted); text-align: center; font-family: ui-sans-serif, sans-serif; font-size: 11px; }
.scrim, .mobile-only { display: none; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 720px) {
  .mobile-only { display: block; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .scrim.open { position: fixed; z-index: 3; inset: 0; display: block; background: rgba(22, 28, 41, .24); }
  .chat-area { margin-left: 0; padding: 0 16px; }
  .topbar { min-height: 59px; }
  .conversation { padding: 25px 0 174px; }
  .welcome { margin-top: 7vh; }
  .suggestion-grid { grid-template-columns: 1fr; margin-top: 25px; }
  .suggestion { min-height: 55px; }
  .composer-wrap { left: 0; padding: 9px 16px 12px; }
  .composer-note { font-size: 10px; }
  .message-content { font-size: 15px; }
}
