/* axi0 AI (/ai/): the axi0 family look, as on Notes. True black, Instrument Sans, the orange core as the one accent.
   No inline styles in the markup (the page runs under style-src 'self'). */
@font-face {
  font-family: "Instrument Sans";
  src: url(/axi0/fonts/instrument-sans-latin-var.woff2) format("woff2");
  font-weight: 400 700;
  font-display: optional;
}
:root {
  --bg: #000; --panel: #0a0a0c; --panel2: #0d0d10; --panel-a: rgba(10, 10, 12, .9); --field: #050506; --hover: #141418; --raise: #18181d;
  --line: #1c1c21; --line1b: #1d1d23; --line2: #2a2a31; --line3b: #33333b; --line3: #3a3a42; --field-line: #2a2a31;
  --head: #fff; --ink: #f5f5f7; --ink2: #f1f1f4; --text: #d6d6dc; --text2: #c4c4cc; --icon: #b9b9c2; --soft: #b4b4bd; --soft2: #a9a9b3;
  --lede: #a3a3ad; --soft4: #9a9aa4; --mute: #8e8e98; --faint: #868692; --place: #7c7c87;
  --core: #f6a04d; --core-ink: #f6a04d; --core-hover: #ffb26a; --on-core: #000;
  --danger: #ff8f78; --danger-line: rgba(255, 143, 120, .4);
  --knob: #c8c8d0; --veil: rgba(255, 255, 255, .08); --uline: rgba(196, 196, 204, .45);
  --bubble: #121216; --code-bg: #07070a;
  color-scheme: dark;
}
html[data-axi0-theme="light"] {
  --bg: #f6f2ea; --panel: #fffdf9; --panel2: #fffdf9; --panel-a: rgba(255, 253, 249, .92); --field: #fffdf9; --hover: #efe8dc; --raise: #ece5d8;
  --line: #e6dfd3; --line1b: #e6dfd3; --line2: #d3cabb; --line3b: #b9ae9c; --line3: #8a8174; --field-line: #8a8174;
  --head: #17140f; --ink: #17140f; --ink2: #1f1b16; --text: #2c2823; --text2: #3d3730; --icon: #4f4940; --soft: #4a433b; --soft2: #50483f;
  --lede: #4f4940; --soft4: #5d554b; --mute: #675f54; --faint: #675f54; --place: #6f665a;
  --core-ink: #9a4a0a; --danger: #b3261e; --danger-line: rgba(179, 38, 30, .4);
  --knob: #6f665a; --veil: rgba(60, 40, 20, .07); --uline: rgba(61, 55, 48, .45);
  --bubble: #f1ebe0; --code-bg: #faf6ee;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  html:not([data-axi0-theme="dark"]) {
    --bg: #f6f2ea; --panel: #fffdf9; --panel2: #fffdf9; --panel-a: rgba(255, 253, 249, .92); --field: #fffdf9; --hover: #efe8dc; --raise: #ece5d8;
    --line: #e6dfd3; --line1b: #e6dfd3; --line2: #d3cabb; --line3b: #b9ae9c; --line3: #8a8174; --field-line: #8a8174;
    --head: #17140f; --ink: #17140f; --ink2: #1f1b16; --text: #2c2823; --text2: #3d3730; --icon: #4f4940; --soft: #4a433b; --soft2: #50483f;
    --lede: #4f4940; --soft4: #5d554b; --mute: #675f54; --faint: #675f54; --place: #6f665a;
    --core-ink: #9a4a0a; --danger: #b3261e; --danger-line: rgba(179, 38, 30, .4);
    --knob: #6f665a; --veil: rgba(60, 40, 20, .07); --uline: rgba(61, 55, 48, .45);
    --bubble: #f1ebe0; --code-bg: #faf6ee;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 15px/1.55 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
}
a { color: var(--core-ink); text-underline-offset: 3px; }
::selection { background: rgba(246, 160, 77, .35); }
[hidden] { display: none !important; }
.v-setup .when-ready, .v-ready .when-setup { display: none !important; }
body:not(.when-key-on) .when-key { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 8px 14px; border-radius: 999px; background: var(--core); color: var(--on-core); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--core-ink); outline-offset: 2px; }

/* ---- header ------------------------------------------------------------------------------------------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1080px; margin: 0 auto; padding: 22px 20px 8px; }
.mark { display: inline-flex; align-items: baseline; gap: .12em; color: var(--head); text-decoration: none; font-size: 26px; font-weight: 600; letter-spacing: -.045em; white-space: nowrap; }
.mark-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--core); box-shadow: 0 0 9px var(--core); transform: translateY(-2px); }
.mark-s { color: var(--mute); font-weight: 500; }
.top-nav { display: flex; gap: 20px; }
.top-nav a { color: var(--soft); text-decoration: none; font-size: 14px; }
.top-nav a:hover { color: var(--head); text-decoration: underline; }
.top-right { display: flex; align-items: center; gap: 14px; }
.top-nav a { line-height: 44px; }
.theme-btn {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line2); border-radius: 50%;
  background: var(--panel); color: var(--icon); cursor: pointer; transition: border-color .15s, color .15s;
}
.theme-btn:hover { border-color: var(--core); color: var(--head); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-moon, html[data-axi0-theme="light"] .theme-btn .i-sun { display: none; }
html[data-axi0-theme="light"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: light) {
  html:not([data-axi0-theme="dark"]) .theme-btn .i-sun { display: none; }
  html:not([data-axi0-theme="dark"]) .theme-btn .i-moon { display: block; }
}
.me-slot { position: relative; flex: none; width: 36px; height: 36px; }
.me-slot:empty { display: none; }

/* ---- layout ------------------------------------------------------------------------------------------------- */
main { max-width: 1080px; margin: 0 auto; padding: 4px 20px 24px; }
h1 { margin: 22px 0 8px; color: var(--head); font-size: clamp(32px, 5vw, 44px); font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
.lede { max-width: 46em; margin: 0; color: var(--lede); }
.v-ready h1 { margin-top: 12px; font-size: 30px; }
.v-ready .lede { font-size: 14px; }
.card { margin-top: 18px; padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
h2 { margin: 0 0 12px; color: var(--head); font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
h3 { margin: 22px 0 6px; color: var(--head); font-size: 15px; font-weight: 600; }
.card > p { margin: 0 0 10px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; color: var(--lede); font-size: 14px; }
.facts li { padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; }
.facts strong { display: block; margin-bottom: 4px; color: var(--head); font-weight: 600; }
@media (min-width: 860px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- form controls ------------------------------------------------------------------------------------------- */
label { display: block; margin: 16px 0 6px; color: var(--head); font-size: 14px; }
label.inline { display: inline; margin: 0; color: var(--text); }
input[type="text"], input[type="password"], input:not([type]), textarea, select {
  width: 100%; min-height: 42px; padding: 9px 13px; border: 1px solid var(--field-line); border-radius: 12px;
  background: var(--field); color: var(--head); font: inherit; font-size: 15px;
}
select { width: auto; min-width: 120px; }
input::placeholder, textarea::placeholder { color: var(--place); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--core); box-shadow: 0 0 0 3px rgba(246, 160, 77, .18); }
.hint { margin: 6px 0 0; color: var(--mute); font-size: 13px; }
.hint.inline { margin: 0; }
.hint code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }
.error { margin: 6px 0 0; color: var(--danger); font-size: 13px; }
.error:empty, .note:empty { display: none; }
.note { margin: 8px 0 0; color: var(--core-ink); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.row.tight { flex-wrap: nowrap; margin-top: 0; }
.row.tight input { flex: 1 1 auto; min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; margin: 0;
  border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); color: var(--head); font: inherit; font-size: 14px;
  white-space: nowrap; cursor: pointer; transition: border-color .15s, background .15s;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { border-color: rgba(246, 160, 77, .7); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { border-color: var(--core); background: var(--core); color: var(--on-core); font-weight: 600; }
.btn.primary:hover { background: var(--core-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0 0; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--core); }
.icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--soft2); cursor: pointer; }
.icon:hover { background: var(--hover); color: var(--head); }
.icon:disabled { opacity: .35; cursor: default; background: none; }
.icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.small { width: 30px; height: 30px; }
.icon.small svg { width: 16px; height: 16px; }
.icon.is-done { color: var(--core-ink); }
.chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: rgba(246, 160, 77, .7); }
.chip[aria-pressed="true"] { border-color: var(--core-ink); color: var(--core-ink); }

/* ---- the app: list + chat ------------------------------------------------------------------------------------------ */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.side, .chat { min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }   /* min-width: a nowrap title must not widen the grid */
.side { display: flex; flex-direction: column; min-height: 68vh; max-height: 78vh; padding: 14px 12px; }
.side-top { display: flex; flex-direction: column; gap: 10px; padding: 0 2px 10px; border-bottom: 1px solid var(--line); }
.convs { flex: 1 1 auto; margin: 8px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.conv-btn {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 12px; background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.conv-btn:hover { background: var(--hover); }
.conv-btn[aria-current="true"] { background: rgba(246, 160, 77, .1); box-shadow: inset 2px 0 0 var(--core); }
.ct { display: block; overflow: hidden; color: var(--head); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cm { display: block; margin-top: 1px; color: var(--mute); font-size: 12.5px; }
.empty { margin: 12px 8px 0; color: var(--mute); font-size: 14px; }
.side-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 2px 0; border-top: 1px solid var(--line); }
.side-foot .btn { min-height: 36px; font-size: 13px; }
.chat { display: flex; flex-direction: column; min-height: 68vh; max-height: 78vh; padding: 10px 14px 14px; }
.chat-bar { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px 8px; border-bottom: 1px solid var(--line); }
.chat-title { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--head); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.chat-acts { display: flex; gap: 2px; }
.back { display: none; }
.log-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 2px; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { .log-wrap { scroll-behavior: auto; } }
.hello { margin: 24px auto; max-width: 34em; color: var(--mute); text-align: center; font-size: 14px; }
.log { margin: 0; padding: 0; list-style: none; }
.msg { margin: 0 0 14px; }
.msg.u { margin-left: auto; max-width: 78%; }
.mh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 2px; }
.who { color: var(--mute); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.msg.u .who { order: 2; }
.msg.u .acts { order: 1; }
.acts { display: flex; gap: 2px; opacity: .6; }
.msg:hover .acts, .msg:focus-within .acts { opacity: 1; }
.mb { padding: 10px 14px; border-radius: 16px; background: var(--bubble); color: var(--ink2); font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; }
.msg.u .mb { background: rgba(246, 160, 77, .13); border-radius: 16px 16px 4px 16px; }
.msg.a .mb { background: transparent; padding: 4px 4px 2px; border-radius: 0; }
.mb p { margin: 0 0 10px; white-space: pre-wrap; }
.mb > :last-child, .mb li > :last-child { margin-bottom: 0; }
.mb ul, .mb ol { margin: 0 0 10px; padding-left: 1.5em; }
.mb li { margin: 2px 0; }
.mb blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 2px solid var(--line3b); color: var(--text2); }
.mb hr { margin: 12px 0; border: 0; border-top: 1px solid var(--line2); }
.mb .md-h { margin: 14px 0 6px; color: var(--head); }
.mb .md-h1 { font-size: 20px; } .mb .md-h2 { font-size: 17px; } .mb .md-h3 { font-size: 15.5px; }
.mb code { padding: 1px 5px; border-radius: 6px; background: var(--code-bg); border: 1px solid var(--line1b); color: var(--head); font: 13.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mb .code { margin: 0 0 10px; border: 1px solid var(--line1b); border-radius: 12px; background: var(--code-bg); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line1b); }
.code-bar .lang { color: var(--mute); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.code-bar .copy { min-height: 26px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.code-bar .copy:hover { border-color: rgba(246, 160, 77, .7); color: var(--head); }
.mb pre { margin: 0; padding: 10px 12px; overflow-x: auto; font: 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); }
.mb pre code { padding: 0; border: 0; background: none; font: inherit; }
.mb .tbl { margin: 0 0 10px; overflow-x: auto; }
.mb table { border-collapse: collapse; font-size: 14px; }
.mb th, .mb td { padding: 5px 10px; border: 1px solid var(--line2); text-align: left; vertical-align: top; }
.mb th { color: var(--head); background: var(--code-bg); }
.mb a { color: var(--core-ink); }
.thinking { color: var(--mute); }
.is-live > :last-child::after { content: "\258D"; display: inline-block; margin-left: 2px; color: var(--core); animation: blink 1s steps(2) infinite; }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .is-live > :last-child::after { animation: none; } }
.mf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 4px 4px 0; min-height: 18px; color: var(--mute); font-size: 12.5px; }
.mf:empty { display: none; }
.use:empty { display: none; }
.merr { color: var(--danger); }
.msg.u .mf { display: none; }

/* ---- the composer -------------------------------------------------------------------------------------------- */
.composer { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.sys { margin: 0 0 8px; color: var(--mute); font-size: 13px; }
.sys summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; color: var(--soft); }
.sys summary:hover { color: var(--head); }
.sys-name { color: var(--core-ink); }
.sys-name:not(:empty)::before { content: "\00b7\00a0"; color: var(--mute); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.sys textarea { min-height: 64px; font-size: 14px; resize: vertical; }
.compose-row { display: flex; align-items: flex-end; gap: 8px; }
.compose-row textarea { flex: 1 1 auto; min-height: 44px; max-height: 220px; padding: 11px 14px; border-radius: 16px; font-size: 15.5px; line-height: 1.45; resize: none; }
.send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--core); color: var(--on-core); cursor: pointer; }
.send:hover { background: var(--core-hover); }
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.send.stop { background: var(--panel); border: 1px solid var(--line3b); color: var(--head); }
.send.stop svg { fill: currentColor; stroke: none; }
.compose-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 2px 0; color: var(--mute); font-size: 13px; }
.compose-foot label { font-size: 13px; color: var(--mute); }
.compose-foot input { width: auto; min-width: 12em; max-width: 24em; flex: 0 1 auto; min-height: 32px; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.dest { color: var(--mute); }
.allow { flex: 1 1 100%; min-height: 18px; color: var(--mute); }
.allow:empty { min-height: 0; }


/* ---- dialogs ------------------------------------------------------------------------------------------------ */
.dlg { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 22px 24px 24px; border: 1px solid var(--line2); border-radius: 20px; background: var(--panel); color: var(--text); overflow-y: auto; }
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg h2 { margin-bottom: 4px; }
.dlg h3 { margin-top: 20px; }
.dlg label:first-of-type { margin-top: 12px; }
.dlg select { width: 100%; }
.layer-note { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; }
.layer-note .hint { margin: 0; }
.layer-note .hint + .hint { margin-top: 8px; }
.models { margin: 8px 0 0; padding: 0; list-style: none; color: var(--mute); font-size: 13px; }
.models li { padding: 6px 0; border-top: 1px solid var(--line); }
.models strong { color: var(--head); font-weight: 600; }
.models a { color: var(--text2); text-decoration: underline; text-decoration-color: var(--uline); }
.models a:hover { text-decoration-color: currentColor; }
.models .attr { color: var(--core-ink); }
.dlg .row { margin-top: 18px; }
.device-note { padding: 10px 12px; border: 1px dashed var(--line3b); border-radius: 12px; }
.keynote { margin-top: 12px; }

/* ---- status, undo, footer -------------------------------------------------------------------------------- */
.sync { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 12px 0 0; color: var(--mute); font-size: 13px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line3); flex: none; }
.sync:empty::before { display: none; }
.sync.is-ok::before { background: var(--core); box-shadow: 0 0 7px rgba(246, 160, 77, .8); }
.sync.is-busy::before { background: var(--icon); }
.sync.is-bad { color: var(--danger); }
.sync.is-bad::before { background: var(--danger); }
.undo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 0; padding: 10px 12px 10px 16px; border: 1px solid var(--line2); border-radius: 14px; color: var(--head); font-size: 14px; }
.undo .btn { min-height: 34px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 4px 20px 44px; color: var(--faint); font-size: 12.5px; }
.foot p { margin: 0 0 6px; max-width: 60em; }
.foot a { color: var(--text2); text-decoration: underline; text-decoration-color: var(--uline); }
.foot a:hover { text-decoration-color: currentColor; }
.locker { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.locker .row { margin-top: 8px; }
.locker .btn { min-height: 36px; font-size: 13px; }
.locker select { min-height: 36px; padding: 5px 10px; font-size: 13px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { min-height: 0; max-height: none; }
  .is-chatting .side { display: none; }
  .chat { display: none; min-height: 72vh; max-height: none; }
  .is-chatting .chat { display: flex; }
  .log-wrap { max-height: 56vh; }
  .back { display: inline-flex; min-height: 36px; padding: 0 14px; }
  .msg.u { max-width: 92%; }
}
@media (max-width: 600px) {
  .top { padding: 16px 16px 4px; }
  .mark { font-size: 22px; }
  .top-nav { gap: 14px; }
  .top { flex-wrap: wrap; gap: 4px 12px; padding-bottom: 2px; }
  .mark { margin-right: auto; }
  .top-right { display: contents; }
  .top-nav { order: 3; flex-basis: 100%; margin: 0; }
  main { padding: 0 14px 20px; }
  .card { padding: 18px 16px 20px; border-radius: 18px; }
  .row.tight { flex-wrap: wrap; }
  .row.tight input { flex-basis: 100%; }
  .dlg { padding: 18px 16px 20px; }
  .compose-foot input { min-width: 0; flex: 1 1 10em; }
  .foot { padding: 4px 16px 36px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
