:root {
  --paper: #fafafa;
  --ink: #111;
  --copy: #424242;
  --muted: #717171;
  --line: #d5d5d5;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #eee; color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { height: var(--available-height, 100dvh); overflow: hidden; }
button, textarea { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid #555; outline-offset: 4px; }
::selection { background: #222; color: #fff; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.app { position: relative; display: flex; flex-direction: column; width: min(930px, calc(100% - 28px)); height: calc(100% - 28px); margin: 14px auto; padding: 16px 44px 26px; background: var(--paper); border: 1px solid #b8b8b8; border-radius: 2px; }
.topbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 43px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: -.5px; }
.brand-mark { display: block; width: 11px; height: 11px; position: relative; }
.brand-mark::before { content: ""; position: absolute; width: 3px; height: 3px; background: #111; box-shadow: 4px 0 #111, 8px 0 #111, 0 4px #111, 8px 4px #111, 0 8px #111, 4px 8px #111; }
.topbar-actions { display: flex; align-items: center; gap: 23px; }
.service-status { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.service-status::before { content: ""; width: 3px; height: 3px; background: #888; }
.service-status[data-state="ready"]::before { background: #111; }
.new-chat { padding: 5px 0; font-size: 11px; color: #555; }
.new-chat:hover:not(:disabled) { color: #111; }
.new-chat:disabled { color: #aaa; }
.workspace { width: min(760px, 100%); margin: 0 auto; display: flex; flex-direction: column; justify-content: center; flex: 1; min-height: 0; padding-bottom: 42px; }
.welcome { text-align: center; margin: 0 0 29px; }
.pixel-heading { width: min(620px, 100%); margin: 0 auto 25px; aspect-ratio: 5; position: relative; }
.pixel-heading canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: pan-y; }
.welcome h1 { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 26px; margin: 0; font-size: 16px; line-height: 1.6; font-weight: 400; color: #555; }
.welcome-caption-text { display: inline-block; }
.welcome-cursor { display: inline-block; width: 8px; height: 15px; background: #111; }
.welcome[data-intro="on"] .welcome-caption-text { animation: caption-reveal .65s steps(10,end) .12s both; }
.welcome[data-intro="on"] .welcome-cursor { animation: blink .26s steps(1,end) 4; }
.composer { flex: none; display: flex; align-items: center; gap: 18px; width: 100%; min-height: 82px; border: 1px solid #b7b7b7; border-radius: 2px; padding: 18px 16px 18px 20px; background: #fff; box-shadow: 3px 3px 0 #e5e5e5; }
.composer:focus-within { border-color: #111; box-shadow: 3px 3px 0 #d5d5d5; }
.composer textarea { flex: 1; min-width: 0; display: block; width: 100%; height: 30px; min-height: 30px; max-height: 120px; resize: none; padding: 0; border: 0; background: none; outline: none !important; font-size: 14px; line-height: 30px; scrollbar-width: thin; scrollbar-color: #aaa transparent; }
.composer textarea::placeholder { color: #858585; }
.send { display: grid; place-items: center; flex: none; width: 35px; height: 35px; padding: 0; background: #111; color: #fff; }
.send:hover:not(:disabled) { background: #333; }
.send:disabled { background: #e8e8e8; color: #999; }
.send svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.stop-square { width: 10px; height: 10px; background: #fff; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 21px; margin: 17px 0 0; }
.suggestions button { font-size: 11px; color: #666; padding: 7px 4px; line-height: 1.6; }
.suggestions button:hover:not(:disabled) { color: #111; }
.suggestions button:disabled { opacity: .6; }
.page-notice { margin: 17px 0 0; color: #666; font-size: 12px; line-height: 1.8; text-align: center; }
.started .workspace { justify-content: initial; padding-bottom: 0; padding-top: 17px; }
.started .welcome, .started .suggestions { display: none; }
.started .composer { min-height: 69px; padding: 15px 16px 15px 20px; align-items: flex-end; margin-top: 13px; box-shadow: 2px 2px 0 #e5e5e5; }
.messages { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9c9c9 transparent; padding: 12px 2px 17px; }
.message { margin: 0 0 34px; overflow-wrap: anywhere; }
.message.user { display: flex; justify-content: flex-end; margin: 15px 0 27px; }
.user-bubble { max-width: 85%; font-size: 13px; line-height: 1.85; white-space: pre-wrap; background: #efefef; border: 1px solid #e2e2e2; border-radius: 2px; padding: 11px 17px; color: #222; }
.message.assistant { padding: 0 3px; }
.answer-copy { font-size: 14px; line-height: 1.95; color: var(--copy); }
.answer-copy.is-streaming { white-space: pre-wrap; }
.answer-copy.is-streaming::after { content: ""; display: inline-block; width: 7px; height: 14px; margin-left: 3px; background: #111; vertical-align: -2px; animation: blink .8s steps(1) infinite; }
.answer-copy p { margin: 0 0 14px; white-space: pre-line; }
.answer-copy p:last-child { margin-bottom: 0; }
.answer-copy h2, .answer-copy h3, .answer-copy h4 { margin: 23px 0 9px; font-size: 16px; font-weight: 550; line-height: 1.7; color: #111; }
.answer-copy > :first-child { margin-top: 0; }
.answer-copy strong { color: #222; font-weight: 550; }
.answer-copy ul, .answer-copy ol { padding-left: 22px; margin: 12px 0 16px; }
.answer-copy li { margin: 5px 0; }
.answer-copy code { font-family: var(--mono); font-size: .88em; background: #eee; padding: 2px 4px; overflow-wrap: anywhere; }
.answer-copy pre { margin: 16px 0; padding: 14px 16px; background: #f0f0f0; overflow-x: auto; line-height: 1.7; white-space: pre; }
.answer-copy pre code { padding: 0; background: none; overflow-wrap: normal; }
.answer-copy .citation { display: inline; font-size: 10px; padding: 0 2px; color: #666; border-bottom: 1px dotted #aaa; vertical-align: super; line-height: 1; white-space: nowrap; }
.answer-copy .citation:hover { color: #111; border-bottom-color: #111; }
.answer-end { margin: 12px 0 0; font-size: 11px; line-height: 1.8; color: var(--muted); }
.answer-end:empty { display: none; }
.retry { margin: 10px 0 0; padding: 3px 0; border-bottom: 1px solid #aaa; font-size: 11px; color: #555; }
.trace { margin: 0 0 18px; max-width: 100%; }
.trace > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 11px; color: var(--muted); line-height: 1.7; padding: 2px 0; width: fit-content; max-width: 100%; user-select: none; }
.trace > summary::-webkit-details-marker { display: none; }
.trace > summary:hover { color: #111; }
.trace-chevron { width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(-45deg); margin-left: 2px; flex: none; }
.trace[open] .trace-chevron { transform: rotate(45deg); }
.trace-indicator { width: 11px; height: 11px; flex: none; position: relative; }
.trace-indicator::before { content: ""; position: absolute; width: 3px; height: 3px; background: #777; box-shadow: 4px 0 #777, 8px 0 #777, 0 4px #777, 8px 4px #777, 0 8px #777, 4px 8px #777, 8px 8px #777; }
.trace[data-state="running"] .trace-indicator::before { background: #111; box-shadow: 8px 0 #111, 4px 4px #111, 0 8px #111, 8px 8px #111; }
.trace[data-state="completed"] .trace-indicator::before { background: #111; box-shadow: 4px 0 #111, 8px 0 #111, 0 4px #111, 4px 4px #111, 8px 4px #111, 0 8px #111, 4px 8px #111, 8px 8px #111; }
.trace-body { margin: 12px 0 21px; padding: 16px 18px; border-left: 1px solid #d0d0d0; background: #f3f3f3; }
.trace-note { margin: 0; font-size: 11px; line-height: 1.8; color: #666; }
.trace-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.trace-step { position: relative; padding-left: 16px; }
.trace-step::before { content: ""; position: absolute; top: 7px; left: 0; width: 4px; height: 4px; background: #777; }
.trace-step[data-state="running"]::before { background: #111; box-shadow: 0 0 0 3px #11111110; }
.trace-step[data-state="failed"]::before { background: transparent; border: 1px solid #555; }
.step-heading { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; line-height: 1.7; }
.step-title { font-size: 12px; color: #333; font-weight: 400; }
.step-state { font-family: var(--mono); font-size: 10px; color: #777; white-space: nowrap; }
.step-info { margin: 4px 0 0; font-size: 11px; line-height: 1.85; color: #666; white-space: pre-line; overflow-wrap: anywhere; }
.step-info:empty { display: none; }
.sources { margin: 17px 0 0; }
.sources > summary { font-size: 11px; line-height: 1.8; color: var(--muted); cursor: pointer; width: fit-content; }
.source-links { display: grid; gap: 9px; margin-top: 11px; padding-left: 13px; border-left: 1px solid #ccc; }
.source-links button { text-align: left; font-size: 11px; color: #555; width: fit-content; padding: 0; line-height: 1.75; }
.source-links button:hover { color: #111; }
.source-number { display: inline-block; min-width: 23px; color: #888; font-family: var(--mono); font-size: 10px; }
.followups { margin-top: 19px; }
.followups button { font-size: 11px; color: #666; padding: 3px 0; line-height: 1.7; text-align: left; }
.followups button::after { content: " ↗"; color: #999; margin-left: 4px; }
.followups button:hover { color: #111; }
.jump-latest { position: absolute; left: 50%; bottom: calc(var(--composer-height, 69px) + 42px); z-index: 1; transform: translateX(-50%); background: #fff; border: 1px solid #bfbfbf; border-radius: 2px; padding: 6px 12px; font-size: 10px; color: #333; box-shadow: 2px 2px 0 #ddd; }
.source-dialog { width: min(580px, calc(100vw - 32px)); max-height: calc(var(--available-height, 100dvh) - 50px); margin: auto; padding: 28px 30px 32px; background: var(--paper); color: #222; border: 1px solid #999; border-radius: 2px; box-shadow: 5px 5px 0 #00000015; overflow: auto; scrollbar-width: thin; }
.source-dialog::backdrop { background: #00000044; backdrop-filter: blur(2px); }
.source-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.source-head > span { font-size: 11px; color: var(--muted); }
.source-close { padding: 0; width: 25px; height: 25px; font-size: 24px; font-weight: 300; line-height: 1; color: #444; }
.source-dialog h2 { margin: 0 0 13px; font-size: 22px; line-height: 1.4; font-weight: 500; letter-spacing: -.4px; }
.source-kind { margin: 0 0 24px; font-size: 11px; color: var(--muted); line-height: 1.8; }
.source-section { margin-top: 24px; }
.source-section-title { margin: 0 0 10px; font-size: 12px; line-height: 1.8; font-weight: 500; color: #333; }
.source-section .source-kind { margin-bottom: 12px; }
.source-current { padding-top: 21px; border-top: 1px solid var(--line); }
.source-version-notice { margin: 13px 0 0; font-size: 11px; line-height: 1.8; color: #666; }
.source-current-title { margin: 0 0 12px; font-size: 13px; line-height: 1.8; font-weight: 500; color: #333; }
.source-text { margin: 0; font-size: 13px; color: #555; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; }
.source-foot { padding-top: 18px; margin-top: 25px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.8; }
.source-foot a { color: #333; overflow-wrap: anywhere; }
.noscript { position: fixed; bottom: 20px; left: 20px; right: 20px; background: #fff; padding: 20px; border: 1px solid #aaa; }
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes caption-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
html[data-page-hidden="true"] *, html[data-page-hidden="true"] *::before, html[data-page-hidden="true"] *::after { animation-play-state: paused !important; }
@media (max-width: 760px) {
  .app { width: calc(100% - 16px); height: calc(100% - 16px); margin: 8px auto; padding: 13px 19px max(19px, env(safe-area-inset-bottom)); }
  .topbar { height: 38px; padding-bottom: 12px; }
  .brand { font-size: 12px; gap: 10px; }
  .topbar-actions { gap: 17px; }
  .service-status { font-size: 9px; }
  .new-chat { font-size: 10px; }
  .workspace { padding-bottom: 35px; }
  .welcome { margin-bottom: 27px; }
  .pixel-heading { margin-bottom: 22px; }
  .welcome h1 { font-size: 14px; }
  .welcome-cursor { width: 7px; height: 13px; }
  .composer { min-height: 78px; padding: 17px 13px 17px 16px; gap: 13px; }
  .composer textarea { height: 28px; min-height: 28px; max-height: 112px; font-size: 16px; line-height: 28px; }
  .composer textarea::placeholder { font-size: 12px; }
  .send { height: 33px; width: 33px; }
  .suggestions { gap: 4px 13px; margin-top: 16px; }
  .suggestions button { font-size: 11px; padding: 6px 0; }
  .started .workspace { padding-top: 9px; }
  .started .composer { padding: 13px 12px 13px 15px; min-height: 65px; gap: 11px; margin-top: 9px; }
  .messages { padding-top: 12px; padding-bottom: 7px; }
  .message { margin-bottom: 28px; }
  .message.user { margin: 12px 0 23px; }
  .user-bubble { font-size: 12px; max-width: 90%; padding: 10px 13px; }
  .answer-copy { font-size: 13px; }
  .answer-copy h2, .answer-copy h3, .answer-copy h4 { font-size: 15px; }
  .trace { margin-bottom: 17px; }
  .trace > summary { gap: 7px; }
  .trace-body { padding: 14px 13px; margin-bottom: 18px; }
  .trace-steps { gap: 15px; }
  .source-dialog { padding: 24px 23px 27px; }
  .source-dialog h2 { font-size: 20px; }
  .source-text { font-size: 12px; }
  .jump-latest { bottom: calc(var(--composer-height, 65px) + 33px); font-size: 10px; }
}
@media (max-width: 380px) {
  .app { padding-left: 16px; padding-right: 16px; }
  .topbar-actions { gap: 14px; }
  .composer { padding-left: 14px; gap: 10px; }
  .suggestions { gap: 3px 12px; }
  .step-heading { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
