@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(/fonts/onest-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Onest; font-weight: 500; font-display: swap; src: url(/fonts/onest-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(/fonts/onest-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
  --bg0: #0b1020; --bg: #10172a; --panel: #1b2540; --hi: #243050; --line: #2e3b5e; --line2: #44527a;
  --mute: #7d8aa8; --text: #c9d3e6; --white: #eef2fa;
  --hd: #9a7340; --honey: #e3b46a; --hl: #f3d79e; --ok: #8fc7a4; --err: #d98b8b;
  --gut: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg) url(/art/hex.png) repeat; background-size: 28px 48px;
  image-rendering: pixelated; color: var(--text);
  font: 400 15px/1.55 Onest, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
img, canvas { image-rendering: pixelated; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--honey); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.px { display: inline-block; line-height: 0; vertical-align: middle; }
.px canvas { display: block; }
h1, h2 { margin: 0; font-weight: 400; }

/* ---------- pixel frames (Aseprite 9-slice, 4 px slice shown at 3x) ---------- */
.frame { border: 12px solid transparent; border-image-slice: 4 fill; border-image-width: 12px; border-image-repeat: stretch; background: none; }
.panel { border-image-source: url(/art/panel.png); }
.panel.hot { border-image-source: url(/art/panel-hi.png); }
.field { border-image-source: url(/art/field.png); border-width: 9px; border-image-width: 9px; padding: 2px 4px; outline: 0; width: 100%; resize: none; }
.field:focus { border-image-source: url(/art/field-hi.png); }
.field::placeholder { color: var(--mute); }
select.field { appearance: none; background: var(--bg0); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 4px 14px 8px;
  border: 12px solid transparent; border-image: url(/art/btn.png) 4 fill / 12px stretch; text-decoration: none; white-space: nowrap;
}
.btn:hover, .btn:focus-visible { border-image-source: url(/art/btn-hover.png); outline: 0; }
.btn:active { transform: translateY(2px); }
.btn.ghost { border-image-source: url(/art/btn-ghost.png); }
.btn.ghost:hover, .btn.ghost:focus-visible { border-image-source: url(/art/btn-ghost-hover.png); }
.btn.stop { border-image-source: url(/art/btn-stop.png); }
.btn.sm { min-height: 40px; border-width: 9px; border-image-width: 9px; padding: 2px 8px 5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 9px solid transparent; border-image: url(/art/btn-ghost.png) 4 fill / 9px stretch; }
.icon-btn:hover { border-image-source: url(/art/btn-ghost-hover.png); }
.link { color: var(--mute); text-decoration: underline dotted; text-underline-offset: 4px; }
.link:hover { color: var(--honey); }

/* ---------- login ---------- */
.login { min-height: 100svh; display: grid; place-items: center; padding: var(--gut); }
.login-box { width: min(360px, 100%); display: grid; gap: 14px; padding: 10px; }
.login-box label { display: grid; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.mark { width: 26px; height: 26px; }
.err { color: var(--err); margin: 0; min-height: 1.4em; font-size: 14px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px;
  padding: 10px max(var(--gut), 3vw); background: rgba(11, 16, 32, .88); backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--line);
}
.nav { display: flex; gap: 20px; margin-right: auto; }
.nav a { padding: 6px 2px; }
.nav a:hover canvas { filter: brightness(1.6); }
.claude { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); }
.claude i { width: 6px; height: 6px; background: var(--mute); }
.claude.ok i { background: var(--ok); } .claude.missing i { background: var(--err); } .claude.checking i { background: var(--honey); }
.menu { position: absolute; right: max(var(--gut), 3vw); top: 60px; display: grid; padding: 4px; min-width: 180px; }
.menu button { padding: 10px 8px; text-align: left; }
.menu button:hover { background: var(--hi); }

/* ---------- hero ---------- */
.hero { position: relative; min-height: calc(100svh - 62px); display: grid; grid-template-columns: min(540px, 46%) 1fr; grid-template-rows: auto 1fr auto; padding: 5vh max(var(--gut), 3vw) 4vh; overflow: hidden; }
#swarm { position: absolute; inset: 0; width: 100%; height: 100%; cursor: default; }
.hero-text { position: relative; pointer-events: none; display: grid; gap: 14px; }
.sub { margin: 0; color: var(--mute); max-width: 34ch; }
.hero-text { grid-column: 1; grid-row: 1; }
.hero-ui { position: relative; grid-column: 1; grid-row: 3; display: grid; gap: 10px; margin-top: 28px; }
.count { padding: 2px 6px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 16px; }
.count .meter { grid-column: 1 / -1; }
.count-l { font-size: 13px; color: var(--mute); }
.meter { height: 6px; background: var(--bg0); }
.meter i { display: block; height: 100%; width: 0; background: var(--honey); transition: width .4s steps(8); }
.composer { display: grid; gap: 10px; padding: 6px; }
.composer textarea { font-size: 18px; line-height: 1.4; }
.crow { display: flex; gap: 10px; align-items: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.chip { padding: 4px 8px; border: 2px solid var(--line); font-size: 13px; color: var(--mute); }
.chip:hover { border-color: var(--honey); color: var(--honey); }

/* ---------- sections ---------- */
.sec { padding: 72px max(var(--gut), 3vw) 24px; max-width: 1280px; margin: 0 auto; }
.sec-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.tools { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--mute); }

/* team rows */
.rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.row { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 4px 6px; cursor: pointer; }
.row:hover { border-image-source: url(/art/panel-hi.png); }
.row.off { opacity: .55; }
.row img.ic { width: 48px; height: 48px; }
.row .rule { font-size: 13px; color: var(--mute); margin-top: 6px; line-height: 1.35; }
.row .side { display: grid; justify-items: end; gap: 8px; }
.st { font-size: 12px; color: var(--mute); text-align: right; }
.st b { font-weight: 500; }
.st.working b, .st.waiting b { color: var(--honey); } .st.done b { color: var(--ok); } .st.error b, .st.stopped b { color: var(--err); }
.switch { width: 42px; height: 24px; background: url(/art/switch.png) 0 0 / 84px 24px; }
.switch[aria-checked="true"] { background-position: -42px 0; }

/* brief */
.brief-grid { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.brief-side { padding: 6px; display: grid; gap: 12px; justify-items: start; }
.ceo-icon { width: 64px; height: 64px; }
.brief-side dl { margin: 0; display: grid; gap: 8px; font-size: 13px; }
.brief-side dt { color: var(--mute); } .brief-side dd { margin: 0 0 4px; }
.brief-body { padding: 6px 14px; min-height: 200px; }
.empty { color: var(--mute); }

/* markdown */
.md { overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { font-weight: 500; color: var(--honey); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; margin: 22px 0 8px; }
.md h3 { color: var(--text); text-transform: none; letter-spacing: 0; }
.md > :first-child { margin-top: 6px; }
.md p { margin: 0 0 10px; } .md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin-bottom: 4px; } .md ul li::marker { content: "▪  "; color: var(--honey); }
.md strong { font-weight: 500; color: var(--white); }
.md code { background: var(--bg0); padding: 1px 5px; font-size: 13px; }
.md pre { background: var(--bg0); padding: 10px; overflow: auto; }
.md table { border-collapse: collapse; width: 100%; margin: 4px 0 14px; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 2px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { color: var(--mute); font-weight: 400; }
.md hr { border: 0; border-top: 2px dashed var(--line); margin: 16px 0; }

/* brief modal */
.b-agents { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 12px; border-bottom: 3px solid var(--line); }
.b-agents button { display: grid; justify-items: center; gap: 4px; padding: 4px; border: 2px solid transparent; }
.b-agents button:hover, .b-agents button:focus-visible { border-color: var(--honey); outline: 0; }
.b-agents img { width: 32px; height: 32px; }
.b-stats { margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; }
.b-stats dt { color: var(--mute); } .b-stats dd { margin: 0; }

/* guide */
.guide { list-style: none; margin: 0; padding: 4px 4px 16px; display: grid; gap: 14px; }
.guide li { display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; font-size: 14px; line-height: 1.45; }
.guide img { width: 32px; height: 32px; }
.guide b { font-weight: 500; color: var(--honey); }

/* history */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.card { padding: 4px 6px; display: grid; gap: 8px; text-align: left; cursor: pointer; }
.card:hover { border-image-source: url(/art/panel-hi.png); }
.card .t { color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .m { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--mute); }
.card .del { color: var(--mute); font-size: 12px; text-decoration: underline dotted; }
.card .del:hover { color: var(--err); }
.foot { display: flex; gap: 18px; align-items: center; padding: 48px max(var(--gut), 3vw); font-size: 13px; }
.foot a { color: var(--mute); }

/* ---------- modals ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(6, 9, 20, .72); }
.modal {
  position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 2 * var(--gut))); max-height: calc(100svh - 2 * var(--gut));
  display: flex; flex-direction: column; padding: 4px;
}
.modal.small { width: min(440px, calc(100vw - 2 * var(--gut))); }
.m-head { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; }
.m-icon { width: 48px; height: 48px; }
.m-title { display: grid; gap: 8px; margin-right: auto; min-width: 0; }
.m-sub { font-size: 13px; color: var(--mute); }
.grow { flex: 1; }
.m-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch[disabled] { opacity: .45; cursor: default; }
.tabs { display: flex; gap: 18px; padding: 0 4px; border-bottom: 3px solid var(--line); }
.tabs button { padding: 8px 0 10px; border-bottom: 3px solid transparent; margin-bottom: -3px; opacity: .6; }
.tabs button[aria-selected="true"] { border-color: var(--honey); opacity: 1; }
.m-body { overflow-y: auto; padding: 14px 6px; flex: 1; min-height: 120px; }
.bubble { margin: 14px 0; padding: 10px 14px; border: 2px solid var(--line); }
.bubble.you { margin-left: 18%; border-color: var(--hd); color: var(--hl); }
.act { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; }
.act li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.act b { font-weight: 500; color: var(--honey); }
.act span { color: var(--mute); overflow-wrap: anywhere; }
.m-ask { display: flex; gap: 10px; padding: 10px 2px 2px; border-top: 3px solid var(--line); }
.form { display: grid; gap: 14px; padding: 4px; }
.form label { display: grid; gap: 8px; }
.note { margin: 0; font-size: 13px; color: var(--mute); }
.row-end { display: flex; justify-content: flex-end; gap: 10px; }
.ed { display: grid; grid-template-columns: 200px 1fr; gap: 14px; min-height: 0; overflow-y: auto; }
.ed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; align-content: start; }
.ed-list button { width: 100%; text-align: left; padding: 7px 8px; font-size: 14px; color: var(--mute); }
.ed-list button:hover { color: var(--text); }
.ed-list button[aria-current="true"] { background: var(--hi); color: var(--honey); }
.ed-main { display: grid; gap: 10px; }
.mono { font: 13px/1.5 ui-monospace, monospace; height: 38svh; }
.ed-new { display: grid; gap: 8px; padding-top: 10px; border-top: 3px solid var(--line); }
#toast {
  position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translate(-50%, 200%); max-width: calc(100vw - 32px);
  padding: 10px 16px; background: var(--bg0); border: 3px solid var(--honey); color: var(--hl); font-size: 14px;
  visibility: hidden; opacity: 0; transition: transform .25s steps(5), opacity .25s steps(5), visibility 0s .25s;
}
#toast.on { transform: translate(-50%, 0); visibility: visible; opacity: 1; transition: transform .25s steps(5), opacity .25s steps(5); }
#toast.bad { border-color: var(--err); color: var(--err); }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .top { gap: 12px; }
  .nav, .claude span { display: none; }
  .claude { margin-left: auto; }
  .hero { min-height: auto; grid-template-columns: 1fr; grid-template-rows: auto 74vw auto; padding-top: 22px; }
  #swarm { inset: 64px 0 auto 0; height: 82vw; }
  .hero-ui { margin-top: 0; }
  .crow { flex-direction: column; align-items: stretch; }
  .rows { grid-template-columns: 1fr; }
  .brief-grid, .ed { grid-template-columns: 1fr; }
  .bubble.you { margin-left: 8%; }
  .act li { grid-template-columns: 1fr; gap: 0; }
}
