/* 使う字だけに削った書体。文言を変えたら site/tools/subset-fonts.py で作り直す（OFL は assets/fonts/） */
@font-face { font-family: "Noto Sans JP"; src: url("assets/fonts/noto-sans-jp.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist"; src: url("assets/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("assets/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f5f6fa;
  --paper: #ffffff;
  --s0: #eceef4;
  --s1: #eef0f6;
  --s2: #e3e6f0;
  --ink: #1c2247;
  --ink-strong: #0f1330;
  --weak: #596089;
  --faint: #c9cee0;
  --indigo: #3a499e;
  --indigo-2: #5665cd;
  --mark: #aa2678;
  --line: #c9cee0;
  --shadow: 0 1px 2px rgba(28, 34, 71, .05), 0 24px 60px -24px rgba(58, 73, 158, .28);
  --shadow-s: 0 1px 2px rgba(28, 34, 71, .06), 0 8px 24px -12px rgba(58, 73, 158, .3);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --organic: cubic-bezier(.65, 0, .25, 1);
  --sans: "Geist", "Noto Sans JP", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --pad: clamp(20px, 5vw, 72px);
  --max: 1440px;
  --gutter: max(var(--pad), calc((100vw - var(--max)) / 2 + var(--pad)));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
ul, ol { list-style: none; }
::selection { background: rgba(86, 101, 205, .2); }
:focus-visible { outline: 2px solid var(--indigo-2); outline-offset: 3px; border-radius: 6px; }
h1, h2, .leave-sticky p, .f-sub, .lede { word-break: auto-phrase; }

/* ナビ */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 72px; padding: 0 var(--gutter);
  transition: background .3s var(--ease), backdrop-filter .3s var(--ease);
}
.nav.is-scrolled { background: rgba(245, 246, 250, .92); backdrop-filter: saturate(1.4) blur(20px); -webkit-backdrop-filter: saturate(1.4) blur(20px); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; }
.brand-word { width: 62px; height: 19px; }
.nav-links { display: flex; align-items: center; gap: 8px; }
/* 言語の切り替え（build-site.mjs が差し込む） */
.lang { position: relative; }
.lang-btn { list-style: none; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px 0 11px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--weak); cursor: pointer; user-select: none; transition: background .2s, color .2s; }
.lang-btn::-webkit-details-marker { display: none; }
.lang-btn:hover, .lang[open] .lang-btn { background: var(--s1); color: var(--ink); }
.lang-btn svg { width: 17px; height: 17px; flex: none; }
.lang-btn .lang-chev { width: 12px; height: 12px; transition: transform .2s var(--ease); }
.lang[open] .lang-chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10;
  display: grid; gap: 2px; min-width: 156px; padding: 6px; border-radius: 16px;
  background: #fff; box-shadow: 0 12px 32px rgba(28, 34, 71, .12), 0 2px 6px rgba(28, 34, 71, .06);
  animation: fade .18s var(--ease) both;
}
.lang-menu a { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; color: var(--ink); }
.lang-menu a:hover, .lang-menu a:focus-visible { background: var(--s1); }
.lang-menu a[aria-current]::after { content: ""; width: 5px; height: 9px; margin: -3px 3px 0 0; border: solid var(--indigo); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
@media (max-width: 560px) { .lang-cur { display: none; } .lang-btn { padding: 0 9px; } }
.nav-gh { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; color: var(--ink); transition: background .2s; }
.nav-gh:hover { background: var(--s1); }
.nav-gh svg { width: 20px; height: 20px; }
.nav-dl { transition: opacity .3s var(--ease), transform .3s var(--ease), background .2s; }
.nav-dl { transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s, background .2s; }
.nav:not(.show-dl) .nav-dl { opacity: 0; transform: translateY(-6px); pointer-events: none; visibility: hidden; transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s .3s; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 26px; border-radius: 999px;
  background: var(--indigo); color: #f4f5ff;
  font-size: 15px; font-weight: 500; letter-spacing: .01em; white-space: nowrap;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { background: #2f3c86; }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ghost { background: var(--s2); color: var(--ink); }
.btn-ghost:hover { background: #d8dcea; }
.btn-s { height: 40px; padding: 0 18px; font-size: 14px; }

/* ヒーロー */
.hero { position: relative; height: 100svh; min-height: 640px; overflow: hidden; }
.sky, .sky-still { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky-still { object-fit: cover; object-position: right center; }
.sky, .sky-still { -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 97%); mask-image: linear-gradient(to bottom, #000 72%, transparent 97%); }
.sky-labels { position: absolute; inset: 0; pointer-events: none; }
.sky-label {
  position: absolute; left: 0; top: 0; opacity: 0;
  display: flex; align-items: center; gap: 7px;
  margin: -10px 0 0 24px; padding: 0 10px 0 0;
  font-size: 13px; line-height: 20px; white-space: nowrap;
  text-shadow: 0 0 3px var(--bg), 0 0 6px var(--bg);
  will-change: transform, opacity;
}
.sky-label img { width: 14px; height: 14px; }
.sky-label .t { font-weight: 500; color: var(--ink); }
.sky-label .s { color: var(--weak); }
.sky-label.is-wait .s { color: var(--mark); }
.hero-copy { position: absolute; left: var(--gutter); bottom: clamp(56px, 12vh, 140px); max-width: 720px; }
h1 {
  font-size: clamp(44px, 6.6vw, 104px);
  line-height: 1.04; letter-spacing: -.035em; font-weight: 700;
  color: var(--ink-strong);
}
.ln { display: block; white-space: nowrap; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.ln > span { display: inline-block; animation: rise 1.1s var(--ease) both; }
.ln + .ln > span { animation-delay: .09s; }
.hero-copy .lede, .hero-copy .cta, .hero-copy .meta { animation: fade .9s var(--ease) both; }
.hero-copy .lede { animation-delay: .35s; }
.hero-copy .cta { animation-delay: .45s; }
.hero-copy .meta { animation-delay: .55s; }
@keyframes rise { from { transform: translateY(108%); } }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } }
.nw { display: inline-block; }
.lede { font-feature-settings: normal; margin-top: 28px; font-size: clamp(16px, 1.4vw, 19px); color: var(--weak); }
.lede img { display: inline-block; width: 1em; height: 1em; margin-right: .3em; vertical-align: -.14em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.meta { margin-top: 20px; font-size: 12.5px; line-height: 1.6; color: var(--weak); }

/* 共通の見出し */
.f-kicker { font-size: 14px; font-weight: 500; color: var(--indigo); letter-spacing: .08em; }
h2 {
  margin-top: 14px;
  font-size: clamp(32px, 3.8vw, 56px); line-height: 1.25; letter-spacing: -.02em; font-weight: 700;
  color: var(--ink-strong);
}
.f-sub { margin-top: 20px; font-size: 16px; color: var(--weak); }
.f-note { margin-top: 8px; font-size: 13px; color: var(--weak); }

[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }

/* ひとつの画面。前置き（離れる理由）→ 4 つの場面を、同じ固定の舞台で続けて見せる */
.screen { position: relative; height: calc(100svh + 150svh + 4 * 80svh); }
.screen-view {
  position: sticky; top: 0; height: 100svh;
  display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); align-items: center;
  column-gap: clamp(32px, 4vw, 72px);
  padding: 80px var(--gutter) 32px;
}
.prologue {
  position: absolute; inset: 0; z-index: 0;
  display: flex; flex-direction: column; justify-content: center; gap: .3em;
  padding: 0 var(--gutter);
  font-size: clamp(28px, 4.4vw, 64px); font-weight: 500; letter-spacing: -.03em; line-height: 1.25;
  opacity: calc(1 - var(--out, 0)); transform: translateY(calc(var(--out, 0) * -40px));
  pointer-events: none;
}
/* 前置きはスクロール量で進む。--t 読んだ分 / --s 句の取り消し線 / --x 行を消し終えた分 / --e 結びの一文（main.js） */
.leave-line { color: color-mix(in oklab, var(--faint) calc(var(--x, 0) * 100%), color-mix(in oklab, var(--ink) calc(var(--t, 0) * 100%), var(--faint))); }
.leave-end {
  margin-top: .6em; color: var(--indigo); font-weight: 700;
  opacity: var(--e, 0); transform: translateY(calc((1 - var(--e, 0)) * .4em));
}
.leave-line .nw { position: relative; }
.leave-line .nw::after {
  content: ""; position: absolute; left: -.04em; right: -.04em; top: 50%; height: .07em; border-radius: .035em;
  background: var(--indigo); transform: scaleX(var(--s, 0)); transform-origin: left center;
}
.stage { position: relative; z-index: 1; grid-column: 2; grid-row: 1; display: flex; align-items: center; min-width: 0; height: 100%; }
.stage-cam {
  position: relative; width: 100%; aspect-ratio: 1080 / 680; max-height: 100%;
  border-radius: 26px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow);
  opacity: var(--in, 0); transform: translateY(calc((1 - var(--in, 0)) * 60px)) scale(calc(.97 + var(--in, 0) * .03));
}
.cam-fade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  --fb: #fff;
  background:
    linear-gradient(#fff, rgba(255, 255, 255, 0)) top / 100% var(--ft, 0px) no-repeat,
    linear-gradient(to left, #fff, rgba(255, 255, 255, 0)) right / var(--fr, 0px) 100% no-repeat,
    linear-gradient(to top, var(--fb), transparent) bottom / 100% var(--fbh, 0px) no-repeat;
  transition: background-size .8s var(--organic);
}
.stage-cam.cut-top .cam-fade { --ft: 56px; }
.stage-cam.cut-right .cam-fade { --fr: 72px; }
.stage-cam.cut-bottom .cam-fade { --fbh: 16px; }
.stage-cam.cut-side .cam-fade { --fb: var(--s0); }
.steps { position: relative; z-index: 1; grid-column: 1; grid-row: 1; display: grid; }
.step {
  grid-area: 1 / 1; align-self: center;
  opacity: 0; transform: translateY(16px);
  transition: opacity .28s var(--ease), transform .5s var(--ease);
}
.screen.in .step.is-on { opacity: 1; transform: none; transition-delay: .14s; }
.step h2 { font-size: clamp(28px, 2.7vw, 40px); }
.agents-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; font-size: 15px; font-weight: 500; }
.agents-row li { display: flex; align-items: center; gap: 8px; }
.agents-row img { width: 18px; height: 18px; }
.f-compat { margin-top: 10px; font-size: 14px; font-feature-settings: normal; }

/* アプリ（1080 × 680 で組み、JS が縮める） */
.app {
  position: absolute; left: 0; top: 0; width: 1080px; height: 680px;
  transform-origin: 0 0;
  display: grid; grid-template-columns: 268px 1fr;
  background: var(--s0); color: var(--ink);
  font-size: 13px; line-height: 1.6; font-variant-numeric: tabular-nums;
  transition: transform 1.1s var(--organic);
}
.app img { width: 14px; height: 14px; flex: none; }
.app.is-measuring, .app.is-measuring * { transition: none !important; }
.app :is(.side, .main-head, .log, .composer, .msg, .fork, .handoff) { transition: opacity .7s var(--ease), filter .7s var(--ease); }

.side { padding: 16px 12px; min-width: 0; }
.side-head { display: flex; align-items: center; gap: 6px; padding: 2px 6px 14px; }
.side-mark { width: 20px; height: 20px; }
.side-word { width: 66px; height: 20px; }
.side-ic { margin-left: auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--weak); }
.side-ic svg, .side-search svg { width: 15px; height: 15px; }
.side-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; background: #fff; color: #8a90b0; }
.grp { display: flex; align-items: center; gap: 8px; margin: 18px 8px 4px; font-weight: 600; font-size: 12.5px; }
.grp-ic { width: 14px; text-align: center; color: var(--weak); font-weight: 400; }
.rows { display: grid; gap: 1px; }
.row {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; column-gap: 8px; align-items: center;
  margin-left: 14px; padding: 7px 10px; border-radius: 12px;
  transition: background .4s var(--ease);
}
.row b { font-weight: 500; min-width: 0; }
.row b span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row small { grid-column: 2; font-size: 11px; line-height: 1.5; color: var(--weak); }
.row small.cwd { grid-column: 3; text-align: right; }
.row.is-sel { background: #fff; }
.row.is-flash { background: #f4f5f9; }
.row.is-sel.is-flash { background: #fff; }
.mk { display: flex; align-items: center; gap: 5px; height: 16px; font-style: normal; font-size: 11.5px; white-space: nowrap; }
.mk .arc { width: 14px; height: 14px; }
.mk .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--indigo-2); }
.mk .wait { color: var(--mark); }
.mk .stale { font: 11px/1 var(--mono); color: var(--weak); }
.dia { display: inline-block; width: 7px; height: 7px; background: var(--mark); transform: rotate(45deg); border-radius: 1px; flex: none; }
.dia.is-open { background: none; box-shadow: inset 0 0 0 1.4px var(--weak); }

.arc path { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.main-head { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 22px 0 28px; flex: none; }
.main-head b { font-size: 14px; font-weight: 600; }
.usage { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--weak); }
.usage i { width: 22px; height: 6px; border-radius: 3px; background: #e8eaf1; overflow: hidden; }
.usage em { display: block; height: 100%; background: var(--weak); }
.more { color: var(--weak); letter-spacing: 1px; }

.log { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.log-inner {
  position: absolute; left: 8px; right: 0; bottom: 0; min-height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 18px;
  padding: 0 40px 14px 0;
}
.msg { position: relative; padding-left: 72px; }
.bubble { display: inline-block; padding: 9px 16px; border-radius: 20px; background: #e8eaf1; transition: opacity .42s; }
.spk { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--weak); margin-bottom: 4px; }
.spk time { margin-left: auto; font: 11px/1 var(--mono); color: var(--weak); }
.think time { font: 11px/1 var(--mono); color: var(--weak); margin-left: 4px; }
.viz { width: 540px; margin-top: 12px; padding: 16px 18px 12px; border-radius: 16px; background: #f4f5f9; }
.viz-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--weak); }
.viz-head b { font: 500 22px/1 var(--mono); letter-spacing: -.02em; color: var(--ink-strong); }
.viz-head small { margin-left: 3px; font: 11px var(--sans); color: var(--weak); letter-spacing: 0; }
.viz-chart { display: block; width: 100%; height: 130px; margin-top: 10px; overflow: visible; }
.viz-line { fill: none; stroke: var(--indigo-2); stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; }
.viz-area { opacity: 0; }
.viz-dot { fill: var(--indigo-2); opacity: 0; }
.viz-x { display: flex; justify-content: space-between; margin-top: 8px; font: 11px/1 var(--mono); color: var(--weak); }
.app.is-drawn .viz-line { transition: stroke-dashoffset 1.6s var(--organic) .3s; stroke-dashoffset: 0; }
.app.is-drawn .viz-area { transition: opacity 1s var(--ease) 1.2s; opacity: 1; }
.app.is-drawn .viz-dot { transition: opacity .3s 1.8s; opacity: 1; }

/* 会話の筋と節、分岐（web/style.css の .spine・.mw.node・.branch-row と同じ寸法と色。docs/design-system.md §7）。
   筋は x=20。branch.js が分岐のグループの上下で区切って描き、分岐のある会話（.is-branched）では青く太い */
.log-inner > .spine { position: absolute; left: 0; top: 0; width: 72px; height: 100%; overflow: visible; pointer-events: none; }
.spine path { fill: none; stroke: var(--line); stroke-width: 1px; transition: stroke .24s var(--ease), stroke-width .24s var(--ease); }
.log-inner.is-branched .spine path { stroke: var(--indigo-2); stroke-width: 2; }
/* 節は直径 7px、中心 (20, 話し手の行の中心 + 5.2)。branch.js の NODE_Y と揃える */
.msg::before { content: ""; position: absolute; left: 16.5px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: #dcdee8; }
.log-inner.is-branched .msg::before { background: var(--indigo-2); }
/* グループは高さ 176px。上は返答の 16px 下、下は次の発言の話し手の行が 2px 下（節が 16px 下） */
.fork { position: relative; height: 176px; flex: none; margin: -2px 0 -16px; overflow: hidden; }
.fork .branch-track { position: relative; height: 176px; min-width: 100%; }
.fork .branch-edges { position: absolute; inset: 0; height: 176px; overflow: visible; pointer-events: none; }
.fork .branch-edges path { fill: none; stroke: #9eabde; stroke-width: 1.5; stroke-linecap: round; }
.fork .branch-edges path.active { stroke: var(--indigo-2); stroke-width: 2; }
.fork .branch-tip {
  position: absolute; top: 84px; width: var(--tip-w, 64px); max-width: var(--tip-w, 64px); padding: 4px 0 0; transform: translateX(-20px);
  display: flex; align-items: flex-start; flex-direction: column; gap: 3px; color: var(--weak); border-radius: 8px;
}
.fork .branch-ring { width: 16px; height: 16px; margin-left: 12px; flex: none; overflow: visible; }
.fork .branch-ring circle { fill: #fff; stroke: #9eabde; stroke-width: 1.5; }
.fork .branch-tip.is-cur { color: var(--indigo); }
.fork :is(.branch-tip.is-cur, .branch-tip.emerging) circle { fill: var(--indigo-2); stroke: var(--indigo-2); stroke-width: 4; }
.fork :is(.branch-name, .branch-note) {
  display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: #fff; padding: 0 2px; border-radius: 8px; font-size: 11px; line-height: 1.5;
}
.fork .branch-note { font-size: 10px; color: var(--weak); }
.fork .branch-tip.growing .branch-ring { transform: scale(var(--reveal)); opacity: var(--reveal); }
.fork .branch-tip.growing :is(.branch-name, .branch-note) { opacity: var(--reveal); }
/* 返答の「⑂ ここから分岐」。触れている間だけ出る（web/style.css の .m.ai > .message-actions と .btn） */
.fk-actions { position: absolute; right: 48px; top: -1px; display: flex; opacity: 0; transition: opacity .12s var(--ease); }
.fk-actions.is-shown { opacity: 1; }
.fk-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; line-height: 1.5; color: var(--weak); white-space: nowrap;
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.fk-btn.is-hover { background: #e8eaf1; color: var(--ink); }

.handoff { display: flex; align-items: center; gap: 6px; padding-left: 72px; font-size: 12px; color: var(--weak); }
.handoff svg { width: 12px; height: 12px; }
.handoff span { margin-left: 4px; }
.think { display: flex; align-items: center; gap: 8px; color: var(--weak); }
.think .arc { width: 14px; height: 14px; }
.is-running::before { display: none; }

.is-hand, .is-ask, .is-reply, .is-late, .is-late2 { max-height: 0; opacity: 0; margin-top: -18px; overflow: hidden; transition: max-height .8s var(--organic), opacity .5s var(--ease), margin .8s var(--organic); }
.app.has-fork .is-late { max-height: 80px; opacity: 1; margin-top: 0; }
.app.has-run .is-late2 { max-height: 80px; opacity: 1; margin-top: 0; }
.app.has-hand .is-hand { max-height: 40px; opacity: 1; margin-top: 0; }
.app.has-ask .is-ask { max-height: 80px; opacity: 1; margin-top: 0; }
.app.has-reply .is-reply { max-height: 340px; opacity: 1; margin-top: 0; }
.see-body { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .9s var(--organic), opacity .6s var(--ease) .2s; }
.see-run { max-height: 24px; overflow: hidden; transition: max-height .5s var(--organic), opacity .3s var(--ease); }
.app.is-seen .see-body { max-height: 300px; opacity: 1; }
.app.is-seen .see-run { max-height: 0; opacity: 0; }

.composer { flex: none; margin: 6px 20px 18px; padding: 14px 12px 10px 18px; border-radius: 20px; background: #f4f5f9; }
.chip-ic { padding: 0 6px; }
.chip-agent + .chip { margin-left: auto; }
.cm-text { color: #8a90b0; }
.cm-row { display: flex; align-items: center; gap: 4px; margin-top: 12px; margin-left: -6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; color: var(--weak); transition: background .4s; }
.chip svg { width: 14px; height: 14px; }
.chip .chev { width: 12px; height: 12px; }
.chip-agent { color: var(--ink); }
.app.is-picking .chip-agent { background: #e8eaf1; }
.ag-logo, .ag-name { transition: opacity .2s; }
.chip-agent.is-swap .ag-logo, .chip-agent.is-swap .ag-name { opacity: 0; }
.send { margin-left: 4px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--indigo); color: #f4f5ff; }
.send svg { width: 15px; height: 15px; }

/* 狭い画面では、寄っても読めるように会話の面ごと細く組む */
.app.is-narrow { width: 688px; }
.app.is-narrow .log-inner { padding-right: 20px; }
.app.is-narrow .composer { margin: 6px 12px 14px; }
.app.is-narrow .chip-ic { display: none; }
.app.is-narrow .viz { width: 330px; }
.app.is-narrow .viz-chart { height: 110px; }

/* 照らす場所。ほかは沈めるが、読める程度に残す */
.app[data-step="0"] :is(.main-head, .msg:not(.is-ask, .is-reply)),
.app[data-step="1"] :is(.side, .main-head, .composer, .handoff, .msg:not(.is-reply)),
.app[data-step="2"] :is(.main-head, .log, .composer),
.app[data-step="3"] :is(.side, .main-head, .composer, .handoff, .msg:not(.is-late, .is-late2, [data-zone="see"]), [data-zone="see"] :is(.spk, .see-body)) { opacity: .45; filter: saturate(.6); }

/* 任せる・外から */
.pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  padding: clamp(48px, 7vh, 88px) var(--gutter) 0;
}
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: clamp(32px, 4vw, 56px);
  border-radius: 32px; background: var(--s0);
}
.tile h2 { font-size: clamp(30px, 3vw, 44px); }
.tile-visual { margin-top: auto; padding-top: 56px; }

.v-deleg { font-size: 13px; }
.dg-head { display: flex; align-items: center; gap: 8px; white-space: nowrap; padding: 0 4px; }
.dg-head b { font-weight: 600; }
.dg-head img { width: 14px; height: 14px; }
.dg-auto { color: var(--weak); }
.dg-why { overflow: hidden; text-overflow: ellipsis; }
.dg-why span { color: var(--weak); }
.dg-head img, .dg-why { opacity: 0; transition: opacity .5s; }
.v-deleg.is-decided .dg-head img, .v-deleg.is-decided .dg-why { opacity: 1; }
.dg-cands { margin-top: 16px; display: grid; gap: 6px; }
.dg-cands li {
  display: grid; grid-template-columns: 14px 16px 1fr auto; column-gap: 10px; row-gap: 10px; align-items: center;
  padding: 14px 16px; border-radius: 16px; background: #f4f5f9;
  transition: background .5s var(--ease), opacity .5s var(--ease), box-shadow .5s var(--ease);
}
.dg-cands em { font: 11px/1 var(--mono); font-style: normal; color: var(--weak); }
.dg-cands img { width: 16px; height: 16px; }
.c-name { font-weight: 500; }
.c-st { font-size: 12px; color: var(--weak); opacity: 0; transition: opacity .5s; }
.c-use { grid-column: 3 / 5; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 10px; font-size: 11.5px; color: var(--weak); }
.c-bar { height: 6px; border-radius: 3px; background: #e3e6f0; overflow: hidden; }
.c-bar i { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--weak); border-radius: 3px; transform-origin: left; transform: scaleX(0); transition: transform 1.2s var(--organic); }
.c-pct { font: 11.5px/1 var(--mono); text-align: right; }
.c-pick .c-bar i { background: var(--indigo-2); }
.c-pick .c-pct { color: var(--ink); }
.v-deleg.in .c-bar i { transform: scaleX(1); }
.v-deleg.is-decided .c-st { opacity: 1; }
.v-deleg.is-decided .c-skip, .v-deleg.is-decided .c-next { opacity: .55; }
.v-deleg.is-decided .c-pick { background: #fff; box-shadow: var(--shadow-s); }
.v-deleg.is-decided .c-pick .c-st { color: var(--ink-strong); font-weight: 600; }

#remote { padding-bottom: 0; }
#remote .tile-visual { display: flex; justify-content: center; }
.phone {
  width: 330px; height: 340px; border-radius: 46px 46px 0 0;
  background: #fff; box-shadow: var(--shadow); overflow: hidden;
  transform: translateY(40px); transition: transform 1.2s var(--ease), opacity .9s var(--ease);
}
.phone.in { transform: none; }
.ph-screen { --pt: 40px; --px: 24px; height: 100%; padding: var(--pt) var(--px) 0; font-size: 13.5px; overflow: hidden; }
.ph-top { position: relative; z-index: 1; display: flex; flex-direction: column; margin: calc(-1 * var(--pt)) calc(-1 * var(--px)) 0; padding: var(--pt) var(--px) 16px; background: #fff; }
.ph-top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px; background: linear-gradient(#fff, rgba(255, 255, 255, 0)); }
.ph-top b { font-size: 15px; font-weight: 600; }
.ph-top span { font-size: 11.5px; color: var(--weak); }
.ph-thread { position: relative; display: grid; gap: 14px; padding-left: 22px; transition: transform .8s var(--organic); }
.ph-thread::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: -60px; width: 1.4px; background: var(--indigo-2); }
.ph-msg, .ph-user { position: relative; }
.ph-user { justify-self: start; padding: 8px 14px; border-radius: 18px; background: #e8eaf1; }
.ph-user::before, .ph-msg::before { content: ""; position: absolute; left: -21px; width: 7px; height: 7px; border-radius: 50%; background: var(--indigo-2); }
.ph-user::before { top: 14px; }
.ph-msg::before { top: 8px; }
.ph-card { position: relative; padding: 16px; border-radius: 20px; background: #f4f5f9; }
.ph-q { display: flex; align-items: center; gap: 8px; }
.ph-q .dia { position: absolute; left: -22px; box-shadow: 0 0 0 3px #fff; transition: background .3s, box-shadow .3s; }
.ph-q .dia { top: 22px; }
.ph-q span { color: var(--mark); font-weight: 600; transition: color .4s; }
.ph-card code { font: 12px/1.4 var(--mono); color: var(--ink); }
.ph-card code { display: block; margin-top: 8px; }
.ph-btns { display: flex; gap: 8px; margin-top: 14px; }
.ph-btns span { padding: 8px 18px; border-radius: 999px; font-weight: 500; font-size: 13px; transition: transform .15s, background .2s; }
.ph-yes { background: var(--indigo); color: #f4f5ff; }
.ph-no { background: #e8eaf1; }
.ph-run { position: relative; display: flex; align-items: center; gap: 8px; color: var(--weak); opacity: 0; transition: opacity .5s .3s; }
.ph-run .arc { position: absolute; left: -26px; width: 16px; height: 16px; background: #fff; border-radius: 50%; }
.phone.is-press .ph-yes { transform: scale(.94); background: #2f3c86; }
.ph-card { transition: background .4s var(--ease); }
.ph-card > :not(.ph-q) , .ph-q span { transition: opacity .4s var(--ease); }
.phone.is-approved .ph-card:not(.ph-next) { background: #f7f8fb; }
.phone.is-approved .ph-card:not(.ph-next) code { color: var(--weak); }
.phone.is-approved .ph-card:not(.ph-next) .ph-btns { display: none; }
.ph-next { display: none; }
.phone.is-next .ph-next { display: block; animation: fade .6s var(--ease) both; }
.phone.is-approved .ph-card:not(.ph-next) .ph-q span { color: var(--weak); font-weight: 500; }
.phone.is-approved .ph-card:not(.ph-next) .ph-q .dia { background: #f4f5f9; box-shadow: inset 0 0 0 1.4px var(--weak), 0 0 0 3px #fff; }
.phone.is-approved .ph-run { opacity: 1; }

/* 終わり */
.end { position: relative; display: grid; justify-items: center; align-content: center; text-align: center; min-height: 92svh; padding: 96px var(--pad); isolation: isolate; }
/* 終わりにもう一度、ヒーローの星図を薄く敷く（頭と尾を同じ絵で閉じる） */
.end::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: url("assets/sky.webp") 62% 50% / cover no-repeat; opacity: .28;
  -webkit-mask-image: radial-gradient(ellipse 36% 42% at 50% 50%, transparent 30%, #000 75%), linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
  -webkit-mask-composite: source-in; mask-image: radial-gradient(ellipse 36% 42% at 50% 50%, transparent 30%, #000 75%), linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
  mask-composite: intersect;
}
.end-mark { width: 56px; height: 56px; }
.end h2 { margin-top: 28px; font-size: clamp(40px, 5vw, 72px); letter-spacing: -.03em; }
.end .cta { justify-content: center; margin-top: 44px; }
.end .meta { margin-top: 22px; }

.foot { display: flex; justify-content: center; gap: 24px; padding: 32px var(--pad) 48px; font-size: 13px; color: var(--weak); }
.foot a:hover { color: var(--ink); }

/* 英語。字が長い分だけ組みを調える（日本語の組みは変えない） */
html:lang(en) .step h2 { font-size: clamp(26px, 2.3vw, 38px); }
/* 承認待ちの印は長いので、題を狭めずに 2 行目（アプリの脇と同じく meta の側）へ回す */
html:lang(en) .row:has(.wait) b { grid-column: 2 / 4; }
html:lang(en) .row:has(.wait) .mk { grid-column: 2; grid-row: 2; }
html:lang(en) .row:has(.wait) small:not(.cwd) { display: none; }
/* 分岐の札は並びの間隔（最大 92px）に収まらないので、折り返す */
html:lang(en) .fork :is(.branch-name, .branch-note) { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  /* 「実装 · 難しさ 中 → Codex」の行き先が省かれないよう、狭い画面では折り返す */
  html:lang(en) .dg-head { align-items: flex-start; }
  html:lang(en) .dg-why { white-space: normal; }
}

@media (min-width: 1800px) {
  :root { --max: 1760px; }
  h1 { font-size: clamp(104px, 5.6vw, 132px); }
  .hero-copy { max-width: 960px; }
}
@media (max-width: 960px) {
  .hero-copy { right: var(--pad); }
  .sky-label { font-size: 12px; }
  .screen { height: calc(100svh + 130svh + 4 * 70svh); }
  .screen-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start; row-gap: 22px; padding: 84px 16px 0; }
  .stage { grid-column: 1; grid-row: 1; height: auto; }
  .stage-cam { aspect-ratio: auto; height: min(56svh, 520px); border-radius: 20px; }
  .steps { grid-column: 1; grid-row: 2; padding: 0 calc(var(--pad) - 16px); }
  .step { align-self: start; }
  .step h2 { font-size: clamp(28px, 7vw, 40px); }
  .step .f-sub { margin-top: 12px; font-size: 15px; }
  .agents-row { margin-top: 14px; font-size: 14px; }
  .pair { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .nav { height: 60px; }
  .btn { height: 48px; padding: 0 20px; }
  .btn-s { height: 36px; padding: 0 14px; }
  .tile { padding: 28px 22px 0; border-radius: 26px; }
  #delegate { padding-bottom: 22px; }
  .tile-visual { padding-top: 36px; }
  .dg-why span { display: none; }
  .cta { flex-direction: column; align-items: stretch; width: 100%; max-width: 320px; }
  .hero-copy .cta { max-width: 300px; }
  #remote .tile-visual { display: block; }
  .phone { width: 100%; height: 300px; border-radius: 22px 22px 0 0; }
  .ph-screen { --pt: 26px; --px: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  [data-reveal] { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
