:root {
  color-scheme: dark;
  --canvas: #0a0b0d;
  --sidebar: #101114;
  --surface: #15171a;
  --raised: #1e2024;
  --hover: #272a2e;
  --line: rgb(255 255 255 / 8%);
  --text: #f4f5f2;
  --secondary: #c2c5c0;
  --muted: #929690;
  --glass-edge: rgb(230 238 244 / 12%);
  --glass-shine: inset 0 1px 0 rgb(255 255 255 / 7%);
  --active: #a8d4b5;
  --accent-wash: rgb(168 212 181 / 10%);
  --elevation: 0 18px 60px rgb(0 0 0 / 35%);
  --gutter: clamp(20px, 4vw, 48px);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
*, *::before, *::after { box-sizing: border-box }
body, h1, h2, p { margin: 0 }
button, input, textarea { font: inherit; color: inherit }
button { padding: 0; background: none; border: 0; cursor: pointer }
button:disabled { opacity: .45; cursor: default }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent }
:focus-visible { outline: 2px solid #a8c8ef; outline-offset: 3px }
::placeholder { color: var(--muted); opacity: 1 }
::selection { color: #f8fff9; background: rgb(127 183 145 / 38%) }
svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round }
.symbols, .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%) }
[hidden], .mobile, #shade { display: none !important }
.brand { display: flex; align-items: center; gap: 9px; letter-spacing: -.025em; font-size: 16px }
.brand img { width: 28px; height: 28px; filter: drop-shadow(0 5px 12px rgb(0 0 0 / 35%)) }
.brand strong { font-weight: 600 }
.login { position: relative; isolation: isolate; overflow: hidden; min-height: 100svh; background: radial-gradient(ellipse at 74% 50%, #222730 0, transparent 50%),
  radial-gradient(ellipse at 18% 78%, #171b20, transparent 44%), #08090a; display: grid; grid-template-rows: auto 1fr; padding: max(28px, env(safe-area-inset-top)) max(7vw, 24px) max(32px, env(safe-area-inset-bottom)) }
.login::before { content: ''; position: absolute; z-index: -1; inset: 0; opacity: .22; pointer-events: none; background-image: linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom, #000, transparent 72%) }
.entry-brand { width: min(100%, 1200px); margin-inline: auto; padding-bottom: 20px; border-bottom: 1px solid #252527 }
.entry-layout { align-self: center; width: min(100%, 720px); margin: 0 auto; padding: clamp(36px, 8vh, 92px) 0 }
.entry-copy h1 { margin: 16px 0 14px; font-size: clamp(46px, 7vw, 76px); line-height: 1.08; letter-spacing: -.06em; font-weight: 620 }
.entry-intro { max-width: 540px; font-size: clamp(18px, 2.3vw, 26px); letter-spacing: -.025em; line-height: 1.55; color: var(--secondary) }
.entry-guide { max-width: 430px; border: 1px solid var(--glass-edge); border-radius: 18px; margin-top: clamp(28px, 5vh, 48px); padding: 17px 19px; box-shadow: var(--glass-shine), var(--elevation) }
.entry-guide h2 { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600 }
.entry-guide svg { width: 16px; height: 16px; color: var(--secondary) }
#entry-help { color: var(--muted); margin-top: 8px; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere }
.device-art { display: block; width: 100%; height: auto; stroke: none; filter: drop-shadow(0 30px 50px rgb(0 0 0 / 48%)) }
.shell {
  background: radial-gradient(ellipse at 96% -12%, #303741 0, transparent 46%),
    radial-gradient(ellipse at 9% 106%, #20252b 0, transparent 42%), var(--canvas);
  height: 100vh; height: 100dvh; display: grid; grid-template-columns: clamp(244px, 22vw, 286px) minmax(0, 1fr) }
aside, main { min-width: 0; min-height: 0; display: flex; flex-direction: column }
aside { padding: 18px 14px 10px; border-right: 1px solid var(--glass-edge) }
.side-top, .side-actions, .side-bar-row, .side-bottom, header, .header-main-row, .header-meta, .composer-row, .composer-left, .dialog-head, .files-bar, .lightbox-bar, .lightbox-actions { display: flex; align-items: center; gap: 8px }
.side-top, .composer-row, .dialog-head, .lightbox-bar { justify-content: space-between }
.side-top { margin: 0 2px 12px }
.icon, .icon-btn, .att-remove { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px; color: var(--secondary) }
.new-chat { display: flex; align-items: center; justify-content: flex-start; gap: 9px; width: 100%; min-height: 40px; margin-bottom: 10px; padding: 0 12px; border: 1px solid var(--glass-edge); border-radius: 11px; background: var(--raised); color: var(--text); font-size: 14px; font-weight: 590; box-shadow: var(--glass-shine); transition: background .14s ease, border-color .14s ease }
.new-chat svg { width: 17px; height: 17px; color: var(--active) }
.new-chat:hover { background: var(--hover); border-color: rgb(255 255 255 / 18%) }
.logout-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; margin-left: auto; padding: 4px 7px; border-radius: 8px; color: var(--muted); font-size: 11px }
.logout-btn svg { width: 15px; height: 15px }
#search, #workspace { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: rgb(10 11 13 / 48%); padding: 9px 12px }
#search { font-size: 14px; margin-bottom: 12px }
.side-bar-row { margin: 12px 0; gap: 7px }
.project-tabs { display: flex; gap: 2px; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: thin }
.proj-tab, .mode-toggle, .pill-btn, .chip-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 5px 9px; border-radius: 7px; color: var(--secondary); font-size: 12px; text-decoration: none; white-space: nowrap }
.proj-tab, .mode-toggle { flex: none; min-height: 30px }
.proj-tab.active, .thread.selected { background: var(--raised); color: var(--text) }
.mode-toggle { border: 1px solid var(--line) }
.history-scroll, #scroll, .files-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain }
.project-group + .project-group { margin-top: 14px }
.project-group-head, .project-group-title, .thread-title-row, .thread-sub-row, .home-proj-top, .recent-btn, .att-item, .file-card, .file-actions, .dir-row, .msg-img-bar { display: flex; align-items: center; gap: 8px; min-width: 0 }
summary { cursor: pointer }
.project-group-head { padding: 6px 8px; list-style: none; color: var(--muted); font-size: 12px }
.project-group-head::-webkit-details-marker { display: none }
.project-group-head::before { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 1px 1px 0 0; transform: rotate(45deg); flex: none }
.project-group[open] > summary::before { transform: rotate(135deg) }
.project-group-title { flex: 1 }
.thread, .recent-btn { width: 100%; text-align: left }
.thread { position: relative; display: block; padding: 9px 11px 9px 14px; border-radius: 10px; transition: background .14s ease, color .14s ease }
.thread.selected::before { content: ''; position: absolute; left: 4px; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--active) }
.thread-main, .home-proj-top strong, .file-info, .att-meta { flex: 1; min-width: 0 }
.thread-sub-row { justify-content: space-between; margin-top: 2px }
.thread-title-row strong, .project-group-title strong, .home-proj-top strong, .header-title strong, .att-name, .file-info strong, .files-cwd, .lightbox-bar > span, #project-label, .header-meta > *, .thread-sub-row > *, #work-badge-text, .msg-img-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.thread-title-row strong, .home-proj-top strong { font-size: 14px; font-weight: 530 }
.thread-sub-row small, .project-group-count, .home-proj-count, .header-meta, .att-size, .file-info small { color: var(--muted); font-size: 12px }
.side-bottom { padding: 8px 0 0 8px; margin-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted) }
.side-bottom .icon { margin-left: auto }
.led, .work-dot, .pulse-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--active) }
.led:not(.working), .idle .pulse-dot { background: var(--muted) }
.group-work-badge, .work-badge, .thread-work-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--active); white-space: nowrap }
.work-badge { max-width: 42%; min-width: 0 }
.thread-work-pill { display: block; max-width: 50% }
.work-badge.idle { color: var(--muted) }
.list-more { padding: 10px; color: var(--secondary); font-size: 13px; text-decoration: underline; text-underline-offset: 3px }
header { position: sticky; top: 0; z-index: 5; min-height: 72px; padding: 9px 24px; border-bottom: 1px solid var(--glass-edge); box-shadow: 0 1px 0 rgb(255 255 255 / 2%) }
#scroll { scroll-padding-top: 80px }
.header-title { flex: 1; min-width: 0 }
.header-main-row { gap: 10px }
.header-title strong { font-size: 16px; font-weight: 600 }
.header-meta { margin-top: 2px; gap: 4px }
.header-meta small { font-size: inherit }
.home, #reading, .dock { width: min(100%, 900px); padding-inline: var(--gutter); margin-inline: auto }
.home, #reading { padding-block: 28px }
.start-state { display: grid; justify-items: center; max-width: 470px; margin: clamp(48px, 13vh, 130px) auto 0; text-align: center }
.start-state > svg { width: 28px; height: 28px; padding: 13px; box-sizing: content-box; border: 1px solid var(--glass-edge); border-radius: 18px; color: var(--active); background: var(--accent-wash); box-shadow: var(--glass-shine) }
.start-state h1 { margin: 22px 0 8px; font-size: clamp(28px, 4vw, 38px); line-height: 1.2; letter-spacing: -.045em; font-weight: 610 }
.start-state p { max-width: 360px; color: var(--muted); font-size: 14px; line-height: 1.7 }
.home-hero { position: relative; isolation: isolate; margin: clamp(12px, 5vh, 56px) 0 clamp(32px, 5vh, 52px) }
.home-hero::before { content: ''; position: absolute; z-index: -1; width: 210px; height: 210px; right: 2%; top: -70px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgb(168 212 181 / 11%), transparent 68%) }
.hero-kicker { display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--secondary); background: rgb(21 23 26 / 68%); font-size: 10px; font-weight: 650; letter-spacing: .13em }
.hero-kicker::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--active); box-shadow: 0 0 0 4px rgb(168 212 181 / 9%) }
.home-hero h1 { max-width: 680px; font-size: clamp(32px, 4vw, 52px); line-height: 1.18; letter-spacing: -.055em; font-weight: 610; margin: 16px 0 12px }
.home-hero p { max-width: 510px; font-size: 15px; line-height: 1.75; color: var(--muted) }
.section-head, .recent-head { display: flex; align-items: end; justify-content: space-between; gap: 16px }
.section-head h2, .recent-head h2 { font-size: 14px; font-weight: 620 }
.section-head p { color: var(--muted); font-size: 12px }
.home-projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 8px; margin: 12px 0 26px }
.home-proj-card { position: relative; min-width: 0; padding: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgb(255 255 255 / 3%), transparent 55%), var(--surface); text-align: left; box-shadow: var(--glass-shine); transition: transform .16s ease, border-color .16s ease, background .16s ease }
.home-proj-card::after { content: '↗'; position: absolute; right: 13px; bottom: 10px; color: var(--muted); font-size: 12px; opacity: .62 }
.home-proj-card.active { border-color: rgb(168 212 181 / 34%); background: linear-gradient(145deg, var(--accent-wash), transparent 62%), var(--raised) }
.home-proj-top svg, .recent-btn > svg { color: var(--muted); width: 16px; height: 16px }
.recent-list { margin-top: 8px }
.recent-btn { padding: 14px 8px; border-radius: 10px; border-bottom: 1px solid var(--line) }
.recent-btn:last-child { border: 0 }
.muted { font-size: 13px; color: var(--muted); padding: 12px 4px }
.dock { flex: none; padding-top: 10px; padding-bottom: max(18px, env(safe-area-inset-bottom)) }
#composer { border: 1px solid var(--glass-edge); border-radius: 23px; padding: 13px 13px 11px; background: linear-gradient(145deg, rgb(255 255 255 / 4%), transparent 46%), rgb(22 24 27 / 82%); box-shadow: var(--glass-shine), 0 18px 44px rgb(0 0 0 / 32%); transition: border-color .16s ease, box-shadow .16s ease }
#composer:focus-within { border-color: rgb(168 212 181 / 34%); box-shadow: var(--glass-shine), 0 0 0 3px rgb(168 212 181 / 6%), 0 20px 52px rgb(0 0 0 / 42%) }
#composer.dragover { outline: 2px dashed var(--secondary); outline-offset: -3px }
#prompt { display: block; width: 100%; min-height: 40px; max-height: min(20dvh, 180px); padding: 2px 5px; border: 0; background: transparent; resize: none; font-size: 16px; line-height: 1.5 }
#prompt:focus-visible { outline: none }
.composer-row { margin-top: 4px }
.composer-left { min-width: 0; gap: 4px }
.pill-btn { min-width: 0; min-height: 34px }
.pill-btn svg { width: 16px; height: 16px }
.send, .primary { background: var(--text); color: #111; font-weight: 650 }
.send { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; box-shadow: 0 5px 16px rgb(0 0 0 / 28%); transition: transform .14s ease, background .14s ease }
.send:disabled { opacity: 1; color: #aaa; background: #343436 }
#status:not(:empty), .error:not(:empty) { padding: 8px 4px; font-size: 13px; color: var(--secondary); overflow-wrap: anywhere }
#status.status-working { color: var(--active) }
.error:not(:empty), .message.error .who { color: #ffaba6 }
.message { position: relative; margin: 20px 0; min-width: 0 }
.message .who { color: var(--secondary); font-size: 12px; font-weight: 650; margin-bottom: 6px; letter-spacing: .01em }
.message .body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.78 }
.message.assistant .body { color: #e9eae6 }
.message.assistant .msg-head .who::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--active); box-shadow: 0 0 0 4px rgb(168 212 181 / 7%); vertical-align: 1px }
.message.user, .message.queued { width: fit-content; max-width: min(82%, 680px); margin-left: auto; padding: 11px 16px; border: 1px solid rgb(255 255 255 / 9%); border-radius: 18px 18px 6px 18px; background: linear-gradient(145deg, rgb(255 255 255 / 5%), transparent 90%), #292c31; box-shadow: 0 10px 28px rgb(0 0 0 / 18%) }
.message.user .who { display: none }
.message-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; opacity: .75 }
.message > details { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--secondary); background: linear-gradient(110deg, rgb(255 255 255 / 3%), transparent 58%), rgb(18 20 23 / 72%); font-size: 13px; transition: border-color .16s ease, background .16s ease }
.message > details:hover { border-color: rgb(255 255 255 / 13%); background: linear-gradient(110deg, rgb(255 255 255 / 5%), transparent 58%), rgb(20 22 25 / 82%) }
.message > details[open] { padding-bottom: 11px }
.message > details > summary { position: relative; min-height: 40px; padding: 10px 2px 10px 20px; list-style: none }
.message > details > summary::-webkit-details-marker { display: none }
.message > details > summary::before { content: ''; position: absolute; left: 3px; top: 16px; width: 6px; height: 6px; border: solid var(--muted); border-width: 1px 1px 0 0; transform: rotate(45deg); transition: transform .15s ease }
.message > details[open] > summary::before { transform: rotate(135deg) }
.message.tool, .message.changes { margin-block: 8px }
.message details .body { font: 12px/1.65 ui-monospace, monospace; margin-top: 6px }
dialog { width: min(420px, calc(100% - 32px)); max-height: 85dvh; overflow-y: auto; color: var(--text); border: 1px solid var(--glass-edge); border-radius: 22px; padding: 23px; box-shadow: var(--glass-shine), 0 30px 100px rgb(0 0 0 / 70%) }
dialog::backdrop { background: rgb(0 0 0 / 58%); backdrop-filter: blur(5px) }
.dialog-head h2 { font-size: 20px; letter-spacing: -.035em }
dialog label { display: block; font-size: 13px; margin: 16px 0 7px }
#workspace { font-size: 16px; background: var(--canvas) }
#path-hint { margin: 8px 0 20px; font-size: 13px; color: var(--muted) }
.primary { width: 100%; min-height: 42px; border-radius: 10px }
.project-picker { width: min(540px, calc(100% - 24px)) }
.project-picker .dialog-head { align-items: flex-start }
.project-picker-intro { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.55 }
.project-picker-list { display: grid; gap: 8px; max-height: 54dvh; margin-top: 18px; overflow-y: auto; overscroll-behavior: contain }
.project-picker-option, .project-picker-custom { display: flex; align-items: center; width: 100%; min-width: 0; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); text-align: left; transition: background .14s ease, border-color .14s ease, transform .14s ease }
.project-picker-option.active { border-color: rgb(168 212 181 / 36%); background: linear-gradient(145deg, var(--accent-wash), transparent 72%), var(--raised) }
.project-picker-actions { display: grid; gap: 8px; margin-top: 10px }
.project-picker-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; color: var(--secondary); background: rgb(10 11 13 / 38%) }
.project-picker-icon svg { width: 18px; height: 18px }
.project-picker-copy { flex: 1; min-width: 0 }
.project-picker-copy strong, .project-picker-copy small, .project-picker-custom strong, .project-picker-custom small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.project-picker-copy strong, .project-picker-custom strong { font-size: 14px; font-weight: 570 }
.project-picker-copy small, .project-picker-custom small { margin-top: 2px; color: var(--muted); font: 11px/1.45 ui-monospace, monospace }
.project-picker-state { flex: none; min-width: 32px; color: var(--active); font-size: 11px; text-align: right }
.project-picker-custom { border-style: dashed; color: var(--secondary) }
.project-picker-create { border-style: solid; border-color: rgb(168 212 181 / 28%); background: linear-gradient(145deg, var(--accent-wash), transparent 72%), var(--surface); color: var(--text) }
.project-picker-create svg { color: var(--active) }
.project-picker-custom svg { width: 18px; height: 18px; color: var(--muted) }
.create-project-dialog { width: min(510px, calc(100% - 24px)) }
.create-project-dialog input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); color: var(--text); font-size: 16px }
.project-path-preview { min-height: 34px; margin-top: 9px; padding: 8px 10px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 8px; background: rgb(10 11 13 / 45%); color: var(--muted); font: 11.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace }
.field-error { margin: 4px 0 0; padding-inline: 0 !important }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px }
.dialog-primary { width: auto; min-width: 118px; padding-inline: 20px }
.attachments, .msg-images { display: flex; flex-wrap: wrap; gap: 8px }
.attachments { max-height: 18vh; overflow: auto; margin-bottom: 8px }
.att-item, .file-card, .msg-img-card { border: 1px solid var(--line); border-radius: 11px; background: var(--surface) }
.att-item { max-width: min(240px, 100%); padding: 5px 8px }
.att-item img { width: 34px; height: 34px; object-fit: cover; border-radius: 5px; cursor: zoom-in }
.att-name, .att-size, .file-info strong, .file-info small { display: block }
.att-name, .file-info strong { font-size: 13px; font-weight: 550 }
.att-remove { width: 28px; height: 28px }
.att-remove svg { width: 14px; height: 14px }
.msg-images, .msg-files { margin-top: 8px }
.msg-img-card { max-width: min(100%, 300px); overflow: hidden }
.msg-img-card img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; cursor: zoom-in }
.msg-img-bar { justify-content: space-between; padding: 6px 8px; color: var(--secondary); font-size: 12px }
.msg-files, .files-list { display: flex; flex-direction: column; gap: 6px }
.file-card, .dir-row { padding: 9px; font-size: 13px }
.file-actions { gap: 4px }
.chip-btn { background: var(--raised); min-height: 30px; border: 1px solid transparent; transition: background .14s ease, border-color .14s ease }
#keep-awake-toggle.active { color: #101411; background: var(--active) }
.files-dialog { width: min(590px, calc(100% - 24px)) }
.files-dialog[open] { display: flex; flex-direction: column; gap: 12px }
.files-bar { padding-bottom: 10px; border-bottom: 1px solid var(--line) }
.files-cwd { color: var(--muted); font: 12px ui-monospace, monospace }
.files-list { min-height: 100px; max-height: 56dvh }
.dir-row { width: 100%; border-radius: 8px; text-align: left; overflow-wrap: anywhere }
.lightbox { width: fit-content; max-width: 94vw; padding: 14px }
.lightbox-bar { font-size: 13px; margin-bottom: 10px }
.lightbox-body img { display: block; max-width: 100%; max-height: 68dvh; margin: auto; object-fit: contain }
.glass { background: #1b1d21 }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    --tint: rgb(20 22 25 / 78%);
    background: linear-gradient(135deg, rgb(244 248 255 / 6%), transparent 48%), var(--tint);
    -webkit-backdrop-filter: blur(24px) saturate(112%);
    backdrop-filter: blur(24px) saturate(112%);
  }
  header.glass, aside.glass { --tint: rgb(14 15 18 / 82%) }
  dialog.glass { --tint: rgb(27 29 33 / 90%) }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  .glass { background: #202125; -webkit-backdrop-filter: none; backdrop-filter: none }
}
@media (hover: hover) {
  :is(.icon, .icon-btn, .att-remove, .proj-tab, .mode-toggle, .thread, .pill-btn, .chip-btn, .dir-row, .project-picker-option):hover:not(:disabled), #new:hover { background: var(--hover); color: var(--text) }
  .project-picker-option:hover { transform: translateY(-1px); border-color: rgb(255 255 255 / 16%) }
  .project-picker-custom:hover { border-color: rgb(255 255 255 / 18%); background: var(--hover); color: var(--text) }
  .home-proj-card:hover { transform: translateY(-1px); background: var(--raised); border-color: rgb(255 255 255 / 16%) }
  .home-proj-card::after { transition: color .14s ease, transform .14s ease }
  .home-proj-card:hover::after { color: var(--text); transform: translate(1px, -1px) }
  .recent-btn:hover { background: var(--sidebar) }
  .send:hover:not(:disabled) { transform: translateY(-1px); background: #fff }
  .quick-chip:hover, .copy-btn:hover { border-color: rgb(255 255 255 / 15%); color: var(--text) }
}
@media (max-width: 750px) {
  .shell { display: flex; overflow: hidden }
  main { width: 100% }
  .mobile { display: inline-grid !important }
  .new-mobile { display: inline-grid !important; width: 42px; height: 42px; border: 1px solid var(--line); background: var(--raised); color: var(--text) }
  aside {
    display: flex;
    position: fixed;
    z-index: 3;
    inset: 0 auto 0 0;
    width: min(320px, 89vw);
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    transform: translate3d(-104%, 0, 0);
    visibility: hidden;
    pointer-events: none;
    transition: transform .22s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .22s;
    will-change: transform;
  }
  aside.open, aside.dragging {
    visibility: visible;
    pointer-events: auto;
    box-shadow: 16px 0 48px #000a;
    transition: transform .22s cubic-bezier(.22, 1, .36, 1), visibility 0s;
  }
  aside.open { transform: translate3d(0, 0, 0) }
  aside.dragging { transition: none }
  #shade:not([hidden]) {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 2;
    background: #0009;
    transition: opacity .2s ease;
  }
  header { min-height: 60px; gap: 1px; padding: max(6px, env(safe-area-inset-top)) 8px 6px; box-shadow: none }
  #scroll > header.glass {
    background: rgb(15 16 19 / 96%);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .icon, .icon-btn, .send { width: 44px; height: 44px }
  #fork-thread, #archive-thread, #model-badge { display: none !important }
  .header-title { min-width: 0 }
  .header-title strong { font-size: 15px }
  .header-main-row { gap: 6px }
  .header-meta { min-width: 0; gap: 3px }
  #header-project { flex: 0 1 auto; min-width: 0; max-width: 62% }
  #sync-state { flex: 0 0 auto; font-size: 10px }
  #work-badge { flex: 0 1 auto; max-width: 34%; overflow: visible }
  #work-badge-text { display: inline }
  .pill-btn, .proj-tab, .mode-toggle { min-height: 40px }
  #search { font-size: 16px }
  .start-state { margin-top: clamp(54px, 15vh, 110px) }
  .start-state h1 { margin-top: 18px }
  .home-hero { margin: 12px 0 32px }
  .home-hero::before { width: 170px; height: 170px; right: -20px; top: -34px }
  .home-hero h1 { margin-top: 14px }
  .section-head p { display: none }
  .home-projects { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  #reading { padding-block: 18px 14px }
  .message { margin-block: 16px }
  .message.assistant .body { line-height: 1.76 }
  .message.user, .message.queued { max-width: 92% }
  .message > details {
    border-radius: 12px;
    padding: 0 10px;
    background: rgb(20 22 25 / 76%);
  }
  .message > details[open] { padding-bottom: 10px }
  .message > details > summary {
    position: relative;
    min-height: 42px;
    padding: 10px 0 10px 18px;
    list-style: none;
  }
  .message > details > summary::-webkit-details-marker { display: none }
  .message > details > summary::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 16px;
    width: 6px;
    height: 6px;
    border: solid currentColor;
    border-width: 1px 1px 0 0;
    transform: rotate(45deg);
  }
  .message > details[open] > summary::before { transform: rotate(135deg) }
  .message .cmd-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    max-width: none;
    row-gap: 4px;
    vertical-align: initial;
  }
  .message .cmd-summary > span:first-child { grid-column: 1; grid-row: 1; white-space: nowrap }
  .message .cmd-summary .cmd-preview {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 100%;
    font-size: 11px;
  }
  .message .cmd-summary .cmd-pill {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .cmd-meta-bar { gap: 10px }
  .cmd-meta-bar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
  .dock { padding-inline: 12px; padding-top: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)) }
  #composer { padding: 9px 10px 8px; border-radius: 21px }
  .composer-row { gap: 5px }
  .composer-left { flex: 1; min-width: 0; overflow: hidden; gap: 3px }
  #attach-btn { flex: 0 0 34px; width: 34px; padding-inline: 0 }
  #attach-btn span { display: none }
  #project-btn { flex: 0 1 auto; width: auto; max-width: 130px; padding-inline: 8px }
  #project-label { max-width: 92px }
  #model-btn { flex: 0 1 auto; max-width: min(160px, 41vw) }
  #model-label { font-size: 11px }
  #send { margin-left: 2px }
  .quick-prompts {
    padding-right: 30px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent);
  }
  .quick-chip { scroll-snap-align: start }
  .message-actions { opacity: 1 }
  .entry-layout { max-width: 510px; padding-block: 32px }
  .entry-copy h1 { font-size: clamp(44px, 10vw, 61px); margin: 10px 0 }
  .entry-intro { font-size: 18px }
  .entry-guide { max-width: none; margin-top: 30px; padding-top: 16px }
}
@media (max-width: 380px) {
  .home-proj-card { padding: 10px }
  .home-proj-top, .file-card { gap: 5px }
  .files-dialog { padding: 14px }
  #sync-state { font-size: 9px }
  .header-title strong { font-size: 14px }
  #model-btn { max-width: 150px }
  .project-picker { padding: 18px 16px }
  .project-picker-option, .project-picker-custom { padding: 10px }
}

#sync-state { color: var(--muted); font-size: 11px }
#sync-state::before { content: '● '; color: var(--active); font-size: 7px; vertical-align: 1px }
#stop { margin-left: auto; flex: none }
#model-select, #effort-select, #thread-name-input, #quick-prompts-setting { width: 100%; background: var(--raised); color: var(--text); padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit }
#quick-prompts-setting { min-height: 92px; resize: vertical; line-height: 1.55 }
#push-toggle { margin-top: 16px }
.setting-note { margin: 7px 0 16px; font-size: 12px; color: var(--muted) }
#approvals { max-height: 32dvh; overflow-y: auto }
.approval-card { padding: 12px; margin-bottom: 8px; border: 1px solid var(--glass-edge); border-radius: 12px; background: var(--surface) }
.approval-card small { margin-left: 8px; color: var(--muted) }
.approval-card button { margin-right: 8px }
.approval-card pre, .patch pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 26vh; overflow-y: auto; font: 12px/1.5 ui-monospace, monospace }
.message .patch { margin-top: 8px; overflow-wrap: anywhere }
.message.queued button { margin-top: 6px }
.approval-card p, .approval-card details { font-size: 13px; margin: 6px 0 }
.approval-card .approval-cwd { display: block; margin: 0; overflow-wrap: anywhere }
.diff-add { color: #a1dab2 }
.diff-remove { color: #efa8a5 }
.mode-toggle.active { background: var(--raised); color: var(--text); border-color: #65656a }
#title.editable { cursor: pointer; border-radius: 6px; padding: 1px 4px; margin-left: -4px }
#title.editable:hover { background: var(--raised) }
.model-badge { font-size: 11px; color: var(--secondary); padding: 2px 7px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line) }
.model-pill { max-width: 175px }
#model-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.quick-prompts { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 9px; scrollbar-width: none }
.quick-prompts::-webkit-scrollbar { display: none }
.quick-chip { flex: none; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: rgb(21 23 26 / 78%); color: var(--secondary); font-size: 12px; white-space: nowrap; transition: border-color .14s ease, color .14s ease, background .14s ease }
.dock-float { display: flex; justify-content: center; margin-bottom: 6px; pointer-events: none }
.scroll-bottom { pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--glass-edge); color: var(--text); font-size: 12px; box-shadow: 0 6px 18px #0008 }
.scroll-bottom svg, .chip-btn svg, .proj-tab svg { width: 14px; height: 14px }
.prefs-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 10px; margin-bottom: 6px }
.inline-field { display: flex; gap: 8px; align-items: center }
.inline-field input { flex: 1; min-width: 0 }
.manage-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px }
.manage-row.compact { margin-top: 8px }
.dialog-tabs { display: flex; gap: 6px }
.files-pane { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1 }
.files-bar { justify-content: space-between }
.files-bar .files-cwd { flex: 1; min-width: 0 }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px }
.msg-head .who { margin-bottom: 0 }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: 11px; color: var(--muted); background: rgb(21 23 26 / 76%); border: 1px solid var(--line); transition: color .14s ease, border-color .14s ease }
.code-block { margin: 11px 0; border: 1px solid var(--line); border-radius: 12px; background: #0f1012; overflow: hidden; box-shadow: var(--glass-shine) }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 10px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace }
.code-block pre, .cmd-output { margin: 0; padding: 10px 12px; overflow-x: auto; white-space: pre; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #e8e8ed }
.cmd-output { margin-top: 8px; max-height: 32vh; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #0c0c0e; border: 1px solid var(--line); border-radius: 8px }
.inline-code { padding: 1px 5px; border-radius: 5px; background: var(--raised); border: 1px solid var(--line); font: .9em ui-monospace, monospace }
.inline-link { color: #9fc8ff; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere }
.markdown-heading { margin: 16px 0 8px; line-height: 1.35; letter-spacing: -.025em; font-weight: 620 }
.markdown-heading:first-child { margin-top: 2px }
.markdown-heading + .body { margin-top: 4px }
h3.markdown-heading { font-size: 20px }
h4.markdown-heading { font-size: 17px }
h5.markdown-heading, h6.markdown-heading { font-size: 15px; color: var(--secondary) }
.markdown-list { margin: 8px 0 12px; padding-left: 24px; line-height: 1.75 }
.markdown-list li + li { margin-top: 3px }
.markdown-list li::marker { color: var(--muted) }
.markdown-task { display: inline-grid; place-items: center; width: 16px; height: 16px; margin: 0 5px 0 -20px; border: 1px solid #68686e; border-radius: 4px; color: #111; background: transparent; font-size: 11px; vertical-align: -2px }
.markdown-task.checked { background: var(--active); border-color: var(--active) }
.markdown-quote { margin: 10px 0; padding: 2px 0 2px 12px; border-left: 3px solid #55555b; color: var(--secondary) }
.markdown-rule { height: 1px; margin: 16px 0; border: 0; background: var(--line) }
.markdown-table-wrap {
  max-width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101012;
}
.markdown-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.55;
}
.markdown-table th, .markdown-table td {
  min-width: 72px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}
.markdown-table th {
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
}
.markdown-table tbody tr:nth-child(even) { background: rgb(255 255 255 / 2%) }
.markdown-table th:first-child, .markdown-table td:first-child { min-width: 48px }
.markdown-table th:last-child, .markdown-table td:last-child { min-width: 190px; max-width: 300px }
.markdown-table th:last-child, .markdown-table td:last-child { border-right: 0 }
.markdown-table tbody tr:last-child td { border-bottom: 0 }
.cmd-summary { display: inline-flex; align-items: center; gap: 7px; max-width: calc(100% - 18px); vertical-align: middle }
.cmd-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(46vw, 380px); font: 12px ui-monospace, monospace; color: var(--secondary) }
.cmd-pill { flex: none; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-family: ui-monospace, monospace; background: var(--raised); color: var(--secondary) }
.cmd-pill.ok { color: #91d5aa; background: rgb(145 213 170 / 12%) }
.cmd-pill.err { color: #ffaba6; background: rgb(255 171 166 / 14%) }
.cmd-meta-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--muted) }
.git-section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 2px 4px }
.git-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 10px }
.git-card summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px }
.git-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px ui-monospace, monospace }
.git-tag { flex: none; font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--raised); color: var(--secondary) }
.git-tag.add, .git-tag.untracked { color: #91d5aa }
.git-tag.delete, .git-tag.conflict { color: #ffaba6 }
.git-commit { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface); font-size: 12px }
.git-commit code { color: var(--active); flex: none; font: 11.5px ui-monospace, monospace }
.git-commit span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.git-commit small { color: var(--muted); flex: none; font-size: 11px }
.preview-dialog { width: min(760px, calc(100% - 20px)); max-height: 86dvh; padding: 16px }
.preview-dialog[open] { display: flex; flex-direction: column }
.preview-body { flex: 1; min-height: 160px; max-height: 70dvh; overflow: auto; background: #0d0d0f; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 2 }
.code-table { display: table; width: 100% }
.code-row { display: table-row }
.line-num { display: table-cell; width: 1%; padding-right: 12px; user-select: none; text-align: right; color: #66666d }
.line-txt { display: table-cell; white-space: pre-wrap; overflow-wrap: anywhere }

#scroll, .history-scroll, .files-list, .preview-body { scrollbar-width: thin; scrollbar-color: #3b3e42 transparent }
#scroll::-webkit-scrollbar, .history-scroll::-webkit-scrollbar, .files-list::-webkit-scrollbar, .preview-body::-webkit-scrollbar { width: 9px; height: 9px }
#scroll::-webkit-scrollbar-thumb, .history-scroll::-webkit-scrollbar-thumb, .files-list::-webkit-scrollbar-thumb, .preview-body::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #3b3e42; background-clip: padding-box }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important }
}
