/* Board prototype P1 — one stylesheet. The look is the one settled on the earlier mocks: neutral dark and light
   themes, Geist, four text sizes and two weights, controls of 32 and 24 px, blue kept for Generate, a state is a
   word. Colour carries meaning only: the type of a node (its dot, its links), the state of a shot or a take.
   States read as a progression: violet (to look at: New, To choose), orange (decided: Chosen, To send), green
   (Sent); yellow warns (Outdated), red refuses (Rejected, Failed). The colour of a take's chip is the colour of
   the word it gives its shot. */

@font-face { font-family: 'Geist'; src: url(../fonts/geist-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: block; }
@font-face { font-family: 'Geist Mono'; src: url(../fonts/geist-mono-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: block; }

:root {
  --fs-title: 14px; --fs-body: 13px; --fs-meta: 12px; --fs-cap: 11px;
  --w-reg: 400; --w-strong: 500;
  --font: 'Geist', system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, monospace;
  --h: 32px; --h-sm: 24px;
  --r-sm: 3px; --r: 6px; --r-lg: 10px; --r-round: 999px;
  --accent: hsl(218 82% 51%); --accent-ink: #fff;
}
:root, [data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e1014; --canvas: #121419; --surface: #171a20; --surface-2: #1d2129; --surface-3: #262a33;
  --line: #2b3039; --line-strong: #3b414c; --dot: #2d323c; --seg-on: #2c313b; --card-ring: 0 0 0 1px #2b3039;
  --ink: #eef0f4; --ink-2: #c6cbd3; --ink-3: #a3aab5;
  --sel: hsl(212 95% 64%); --viewer: #07080a; --mk-bg: rgb(8 9 12 / 0.88); --mk-ink: #fff;
  --overlay: rgb(5 6 8 / 0.72);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 18px rgb(0 0 0 / 0.28);
  --shadow-lift: 0 0 0 1px rgb(255 255 255 / 0.08), 0 4px 8px rgb(0 0 0 / 0.45), 0 16px 34px rgb(0 0 0 / 0.5);
  /* states, as fills (black text on them) and as text */
  --s-choose: hsl(278 85% 78%); --s-send: hsl(26 94% 62%); --s-sent: hsl(142 58% 54%);
  --s-star: hsl(52 96% 60%); --s-rej: hsl(0 78% 66%); --s-warn: hsl(52 96% 60%);
  --tx-choose: hsl(278 88% 82%); --tx-send: hsl(26 94% 66%); --tx-sent: hsl(142 58% 58%); --tx-warn: hsl(52 96% 64%); --tx-ko: #f18a8a; --tx-ok: hsl(142 58% 58%);
  /* what a node gives: its dot, its handle, its links. Three hues kept away from the hues of the states:
     an element is a reference (pink), a picture is a start frame (teal), a text is a prompt (lime) */
  --t-el: hsl(322 72% 72%); --t-shot: #aab3c0; --t-image: hsl(180 58% 52%); --t-text: hsl(84 52% 58%); --t-note: hsl(52 70% 62%); --t-sound: hsl(214 82% 70%);
  --t-character: var(--t-el); --t-location: var(--t-el); --t-style: var(--t-el); --t-prop: var(--t-el);
  --note-bg: hsl(48 88% 72%); --note-ink: #1d1a0c;
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #f3f4f6; --canvas: #e6e8ec; --surface: #ffffff; --surface-2: #f3f4f6; --surface-3: #e4e7eb;
  --line: #dde0e5; --line-strong: #c3c8d0; --dot: #c0c5cd; --seg-on: #ffffff; --card-ring: 0 0 0 1px #b4bac4, 0 1px 3px rgb(16 24 40 / 0.14);
  --ink: #15181d; --ink-2: #454c57; --ink-3: #5b6370;
  --sel: hsl(214 88% 52%); --viewer: #dfe2e7; --mk-bg: #ffffff; --mk-ink: #15181d;
  --overlay: rgb(20 24 32 / 0.5);
  --shadow: 0 1px 2px rgb(16 24 40 / 0.08), 0 6px 18px rgb(16 24 40 / 0.08);
  --shadow-lift: 0 0 0 1px rgb(16 24 40 / 0.06), 0 4px 8px rgb(16 24 40 / 0.1), 0 16px 34px rgb(16 24 40 / 0.14);
  --s-choose: hsl(278 82% 80%); --s-send: hsl(26 94% 60%); --s-sent: hsl(142 52% 52%);
  --s-star: hsl(50 96% 54%); --s-rej: hsl(0 80% 68%); --s-warn: hsl(50 96% 54%);
  --tx-choose: hsl(280 64% 40%); --tx-send: hsl(24 94% 32%); --tx-sent: hsl(142 70% 26%); --tx-warn: hsl(44 100% 23%); --tx-ko: hsl(0 68% 42%); --tx-ok: hsl(142 70% 26%);
  --t-el: hsl(322 62% 46%); --t-shot: #6b7482; --t-image: hsl(182 74% 29%); --t-text: hsl(84 62% 28%); --t-note: hsl(46 80% 36%); --t-sound: hsl(214 72% 40%);
  --note-bg: hsl(48 92% 74%); --note-ink: #1d1a0c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--ink); font: var(--w-reg) var(--fs-body)/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }
b, h1, h4 { font-weight: var(--w-strong); }
h1 { font-size: var(--fs-title); margin: 0 0 4px; }
h4 { font-size: var(--fs-meta); color: var(--ink-3); margin: 12px 0 6px; display: flex; align-items: center; gap: 6px; }
h4 small { font-weight: var(--w-reg); }
small { font-size: var(--fs-cap); }
svg { flex: none; }
img { -webkit-user-drag: none; user-select: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.warn { color: var(--tx-warn); }
.pad { padding: 12px; }
.sp { flex: 1 1 0; min-width: 0; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 2px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); color: var(--ink-2); font: var(--w-reg) var(--fs-cap) var(--mono); }

/* ---- controls ------------------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; height: var(--h); padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.btn:hover { background: var(--surface-3); color: var(--ink); }
.btn:has(> svg:only-child) { width: var(--h); padding: 0; }
.btn.sm { height: var(--h-sm); padding: 0 8px; font-size: var(--fs-meta); gap: 4px; }
.btn.sm:has(> svg:only-child) { width: var(--h-sm); padding: 0; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.pick { background: transparent; padding-right: 6px; }
.btn.wide { width: 100%; }
.btn.round { border-radius: var(--r-round); width: var(--h); padding: 0; }
.btn.is-on { background: var(--surface-3); color: var(--ink); border-color: var(--ink-3); font-weight: var(--w-strong); }
.btn.strong { background: var(--ink); color: var(--bg); border-color: transparent; font-weight: var(--w-strong); }
.btn.strong:hover { background: var(--ink-2); color: var(--bg); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; padding: 0 6px 0 12px; font-weight: var(--w-strong); }
.btn.primary:hover { background: hsl(218 82% 46%); color: var(--accent-ink); }
.btn.primary .cost { margin-left: 4px; padding: 2px 8px; border-radius: 4px; background: rgb(0 0 0 / 0.28); font-size: var(--fs-meta); font-weight: var(--w-reg); }
.btn.primary.sm { padding: 0 4px 0 8px; }
.btn.primary.sm .cost { padding: 1px 6px; }
.btn.is-warn { color: var(--tx-warn); border-color: currentColor; }
.btn[aria-disabled='true'], .ch-eg[aria-disabled='true'], .menu-it.is-off { opacity: 0.45; cursor: not-allowed; }
/* blue only when the run can start */
.btn.primary[aria-disabled='true'] { opacity: 1; background: var(--surface-3); color: var(--ink-3); border-color: var(--line-strong); }
.btn.primary[aria-disabled='true'] .cost { background: rgb(128 128 128 / 0.18); }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--r); font-size: var(--fs-meta); white-space: nowrap; }
.stepper .btn { background: transparent; border-color: transparent; }
.stepper b { min-width: 16px; text-align: center; }
.av { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: hsl(var(--av) 44% 30%); color: #fff; font-size: var(--fs-cap); font-weight: var(--w-strong); }
.av.sm { width: 22px; height: 22px; letter-spacing: -0.03em; }
input[type='text'], textarea { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 6px 8px; color: var(--ink); width: 100%; resize: none; }
input[type='text']:focus, textarea:focus { outline: none; border-color: var(--sel); }
input[type='range'] { accent-color: var(--ink-2); }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > span { font-size: var(--fs-meta); color: var(--ink-3); }

/* a state is a word */
.word { font-size: var(--fs-meta); font-weight: var(--w-strong); white-space: nowrap; }
.w-none { color: var(--ink-3); } .w-choose { color: var(--tx-choose); } .w-send { color: var(--tx-send); } .w-sent { color: var(--tx-sent); }
.chip { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--r-sm); font: var(--w-strong) var(--fs-cap)/1 var(--font); font-style: normal; white-space: nowrap; color: #000; background: #d5d9df; }
.c-chosen { background: var(--s-send); } .c-sent { background: var(--s-sent); } .c-rejected { background: var(--s-rej); }
.c-new { background: var(--s-choose); } .c-out { background: var(--s-warn); } .c-ab { background: #fff; }
.c-kind, .c-plain, .c-star { background: var(--mk-bg); color: var(--mk-ink); }
.tag { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 5px; border-radius: var(--r-sm); background: var(--mk-bg); color: var(--mk-ink); font-size: var(--fs-cap); }

/* ---- menu, tooltip, toast ------------------------------------------------------------------------------- */
.menu { position: fixed; z-index: 80; min-width: 210px; max-width: 340px; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lift); }
.menu-wide { width: 310px; }
.menu-list { max-height: 344px; overflow: auto; }
.menu-more { display: none; height: 22px; margin-top: 2px; border-top: 1px solid var(--line); font-size: var(--fs-cap); line-height: 21px; text-align: center; color: var(--ink-2); }
.menu.is-long .menu-more { display: block; }
.menu-it { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 5px 8px; border: 0; border-radius: var(--r); background: none; color: var(--ink-2); text-align: left; }
.menu-it.is-on { background: var(--surface-3); color: var(--ink); }
.menu-it.is-danger { color: var(--tx-ko); }
.menu-lb { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-lb small { color: var(--ink-3); }
.menu-thumb { width: 44px; height: 26px; object-fit: cover; border-radius: var(--r-sm); }
.menu-pad { width: 15px; flex: none; }
.menu-key { margin-left: auto; }
.menu-head { padding: 6px 8px 2px; font-size: var(--fs-cap); color: var(--ink-3); }
.menu-title { padding: 6px 8px; font-weight: var(--w-strong); }
.menu-sep { height: 1px; margin: 4px 0; background: var(--line); }
.menu-empty { padding: 10px; font-size: var(--fs-meta); color: var(--ink-3); }
.menu-search { display: flex; align-items: center; gap: 6px; padding: 4px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.menu-search input { flex: 1; border: 0; background: none; padding: 4px 0; }
#tip { position: fixed; z-index: 100; display: flex; align-items: center; gap: 6px; max-width: 320px; padding: 4px 8px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-size: var(--fs-meta); pointer-events: none; box-shadow: var(--shadow); }
#tip kbd { background: transparent; border-color: currentColor; color: inherit; }
#toasts { position: fixed; z-index: 90; top: 84px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
/* above an open sheet, never on it: the newest one only, in the margin every sheet leaves at the top */
body:has(#sheet:not([hidden])) #toasts { top: 8px; }
body:has(#sheet:not([hidden])) #toasts .toast:not(:last-child) { display: none; }
/* on the home page the rows of the sequences start under the title: the newest one only there too */
body:has(.home):not(:has(#sheet:not([hidden]))) #toasts .toast:not(:last-child) { display: none; }
/* one that stays while a file is read */
.toast.is-busy { border-left: 4px solid var(--ink-3); }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(560px, 100%); padding: 8px 12px; border-radius: 8px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lift); pointer-events: auto; }
.toast.is-ok { border-left: 4px solid var(--s-sent); } .toast.is-ko { border-left: 4px solid var(--s-rej); }
.toast .btn { background: transparent; border-color: currentColor; color: inherit; }

/* ---- the strip that is not part of Board ----------------------------------------------------------------- */
#proto { flex: none; display: flex; align-items: center; gap: 10px; height: 28px; padding: 0 12px; background: #f2c744; color: #1a1400; font-size: var(--fs-meta); }
.proto-badge { padding: 1px 6px; border-radius: var(--r-sm); background: #1a1400; color: #f2c744; font-size: var(--fs-cap); letter-spacing: 0.06em; }
.proto-tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proto-tx:last-child { flex: none; }
.proto-btn { flex: none; height: 20px; padding: 0 8px; border: 1px solid rgb(26 20 0 / 0.55); border-radius: 4px; background: transparent; color: #1a1400; font-size: var(--fs-cap); white-space: nowrap; }
.proto-btn:hover, .proto-btn.is-on { background: #1a1400; color: #f2c744; }
#app { flex: 1; min-height: 0; position: relative; }

/* ---- top bar, home ------------------------------------------------------------------------------------------ */
.top { position: relative; flex: none; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-size: var(--fs-title); }
.pj-sq { flex: none; width: 12px; height: 12px; border-radius: var(--r-sm); background: hsl(var(--h) 82% 58%); }
.crumb { gap: 7px; padding: 0 8px; color: var(--ink); }
.crumb-name { color: var(--ink-3); max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.views { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.view { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--ink-3); }
.view:hover { color: var(--ink); }
.view.is-on { background: var(--seg-on); color: var(--ink); font-weight: var(--w-strong); box-shadow: var(--shadow); }
.view kbd { background: transparent; }
.top-team, .pj-team { display: flex; gap: 3px; }
.top-cr, .pj-meta { display: inline-flex; align-items: center; gap: 5px; padding: 0 6px; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.pj-meta.is-warn { color: var(--tx-warn); }
.top-busy { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.top-busy::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); animation: pulse 1s ease-in-out infinite; }
.top-sep { width: 1px; height: 18px; margin: 0 3px; background: var(--line); }
@keyframes pulse { 50% { opacity: 0.25; } }
.home { display: flex; flex-direction: column; height: 100%; }
.home-body { flex: 1; overflow: auto; }
.home-in { max-width: 940px; margin: 0 auto; padding: 28px 24px 60px; }
.home-in > p { max-width: 640px; margin-bottom: 20px; }
.pj { margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.pj-h { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.pj.is-locked .pj-h b, .sq.is-locked { color: var(--ink-3); }
.sq { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 8px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; color: var(--ink); }
.pj-h + .sq { border-top: 0; }
button.sq:hover { background: var(--surface-2); }
.sq-name { min-width: 150px; }
.sq-words { display: flex; gap: 6px; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.sq-words > span { width: 86px; } /* one column per word, so that the rows compare */
.pj.is-locked .pj-sq { opacity: 0.4; }

/* ---- workspace ------------------------------------------------------------------------------------------------ */
.ws { display: flex; flex-direction: column; height: 100%; }
.ws-body { flex: 1; min-height: 0; display: flex; }
.ws-main { flex: 1; min-width: 0; position: relative; background: var(--canvas); }
.host { position: absolute; inset: 0; }
.pn { flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.pn-left { width: 268px; border-right: 1px solid var(--line-strong); }
.pn-right { width: 360px; border-left: 1px solid var(--line-strong); }
.no-left .pn-left, .no-right .pn-right { display: none; }
.pn-head { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--line); }
.pn-right .pn-head { padding-left: 6px; }
.pn-title { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn-foot { flex: none; padding: 8px; border-top: 1px solid var(--line); }
.past-bar { flex: none; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 12px; background: var(--ink); color: var(--bg); }
.past-bar .btn { background: transparent; color: inherit; border-color: currentColor; }
.past-bar .btn.strong { background: var(--bg); color: var(--ink); border-color: transparent; }

/* left: the shots */
.lp-sum { flex: none; padding: 8px 10px; font-size: var(--fs-meta); color: var(--ink-3); border-bottom: 1px solid var(--line); }
.lp-words { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 6px; }
.lp-word { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px; border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--ink); }
.lp-word:hover { background: var(--surface-2); }
.lp-word.is-on { background: var(--surface-3); border-color: var(--ink-3); }
.lp-list { flex: 1; overflow: auto; }
.lp-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; text-align: left; }
.lp-row:hover { background: var(--surface-2); }
.lp-row.is-sel { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--sel); }
.lp-thumb { flex: none; width: 62px; height: 30px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.lp-thumb:empty { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--ink) 9%, transparent) 6px 12px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.lp-thumb img, .as-el img, .as-take img, .tk img, .el-pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lp-top { display: flex; gap: 6px; min-width: 0; }
.lp-name { min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-sub { display: flex; align-items: center; gap: 6px; }
.lp-busy, .lp-cm, .lp-len { font-size: var(--fs-cap); color: var(--ink-3); display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.lp-fail { font-size: var(--fs-cap); color: var(--tx-ko); white-space: nowrap; }
.lp-len { margin-left: auto; }

/* right: tabs */
.tabs { display: flex; gap: 2px; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--ink-3); }
.tab:hover { color: var(--ink); }
.tab.is-on { background: var(--surface-3); color: var(--ink); font-weight: var(--w-strong); }
.tab-n { min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--ink-3); color: var(--bg); font-family: var(--mono); }
.rt-body { flex: 1; min-height: 0; overflow: auto; }

/* ---- canvas ----------------------------------------------------------------------------------------------------- */
.cv { position: absolute; inset: 0; overflow: hidden; outline: none; background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px); user-select: none; }
.cv.is-hand { cursor: grab; } .cv.is-panning { cursor: grabbing; } .cv.is-wiring { cursor: crosshair; }
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ed { fill: none; stroke-width: 2; opacity: 0.85; pointer-events: none; }
.ed-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.ed-g.is-dim .ed { opacity: 0.34; } .ed-g.is-hot .ed { opacity: 1; stroke-width: 2.5; }
.ed-g.is-sel .ed { opacity: 1; stroke-width: 4; } .ed-g.is-source .ed { stroke-dasharray: 5 4; }
.ed-temp { stroke-dasharray: 6 4; opacity: 1; }
.cv-marquee { position: absolute; z-index: 4; border: 1px solid var(--sel); background: color-mix(in srgb, var(--sel) 14%, transparent); pointer-events: none; }
.grp { position: absolute; border: 1px dashed var(--line-strong); border-radius: 12px; background: color-mix(in srgb, var(--ink) 4%, transparent); pointer-events: none; }
.grp.is-sel { border-color: var(--sel); border-style: solid; }
.grp-title { position: absolute; top: 6px; left: 10px; display: flex; align-items: center; gap: 6px; font-size: var(--fs-meta); font-weight: var(--w-strong); color: var(--ink-2); pointer-events: auto; cursor: grab; }
.grp-title small { color: var(--ink-3); font-weight: var(--w-reg); }
.grp-input { width: 150px; height: 22px; padding: 0 6px; }

.nd { position: absolute; }
.nd.is-dim { opacity: 0.32; }
/* inside a node, text is one step larger: the canvas is read at 70 to 80 % */
.nd-lb { display: flex; align-items: center; gap: 6px; height: 26px; font-size: var(--fs-title); white-space: nowrap; }
.nd .word { font-size: var(--fs-body); }
.nd .chip, .nd .tag { height: 20px; font-size: var(--fs-meta); }
.nd-name { flex: 0 1 auto; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.nd-len { font-size: var(--fs-body); color: var(--ink-3); }
.nd-cm { display: inline-flex; align-items: center; gap: 3px; padding: 0 2px; border: 0; background: none; color: var(--ink-3); font-size: var(--fs-meta); }
.nd-card { position: relative; border-radius: 8px; background: var(--surface); box-shadow: var(--card-ring); cursor: default; }
.nd-card > img, .nd-card > .nd-empty, .nd-card > .nd-gen, .nd-card > .nd-fail { display: flex; width: 100%; aspect-ratio: 2.39 / 1; border-radius: 8px; }
.nd-card > img { display: block; object-fit: cover; }
.nd-image .nd-card > img, .nd-image .nd-card > div { aspect-ratio: 16 / 9; }
.nd-element .nd-card > img, .nd-element .nd-card > div { aspect-ratio: 16 / 10; }
.nd-card.is-rej > img, .st-frame.is-rej img, .tk.is-rej img, .as-take.is-rej img { opacity: 0.35; }
.nd.is-sel .nd-card, .nd.is-sel .nd-sticky { box-shadow: 0 0 0 2px var(--sel); }
.nd.is-drop .nd-card { box-shadow: 0 0 0 3px var(--s-sent); } .nd.is-nodrop .nd-card { box-shadow: 0 0 0 2px var(--s-rej); }
.nd-empty, .nd-gen, .nd-fail { position: relative; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px; text-align: center; overflow: hidden; }
.nd-empty b { color: var(--ink-2); } .nd-empty small { color: var(--ink-3); }
.nd-gen span { font-size: var(--fs-meta); color: var(--ink-2); } .nd-gen b { font-family: var(--mono); }
.nd-fail { color: var(--tx-ko); font-size: var(--fs-cap); }
.prog { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p) * 100%); background: var(--ink); transition: width 0.12s linear; }
.nd-chips { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; pointer-events: none; }
.nd-chips .chip { pointer-events: auto; }
.nd-foot { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; pointer-events: none; }
.nd-doc { padding: 10px; }
.nd-doc p, .nd-sticky p { font-size: var(--fs-body); line-height: 1.45; color: var(--ink-2); white-space: pre-wrap; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; overflow: hidden; }
.nd-sticky { padding: 10px; border-radius: 3px; background: var(--note-bg); box-shadow: var(--shadow); }
.nd-sticky p { color: var(--note-ink); }
.port { position: absolute; top: 50%; }
.port-in { left: -4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-strong); }
.port-out { right: -9px; width: 18px; height: 18px; margin-top: -9px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 1px var(--line-strong); cursor: crosshair; opacity: 0; }
.nd:hover .port-out, .nd.is-sel .port-out, .cv.is-wiring .port-out { opacity: 1; }
.port-out:hover { background: var(--ink); color: var(--bg); }
.nd-strip, .st-strip, .tl-strip, .ch-thumbs { display: flex; gap: 4px; }
.nd-strip { margin-top: 6px; }
.tk { position: relative; flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 21px; padding: 0; border: 0; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink-2); overflow: hidden; opacity: 0.62; }
.tk:hover, .tk.is-gen, .tk.is-fail, .tk-more { opacity: 1; }
/* a take being made: a ring that turns, above its progress */
.tk.is-gen::before { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent); border-top-color: var(--ink); animation: turn 0.9s linear infinite; }
.tk.lg.is-gen::before { width: 14px; height: 14px; }
@keyframes turn { to { transform: rotate(360deg); } }
.tk.is-active { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
.tk.is-chosen::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--s-send); }
.tk.is-new::before { content: ''; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--s-choose); }
.tk.is-rej::before { content: ''; position: absolute; z-index: 1; top: 2px; left: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--s-rej); }
.tk.is-fail { color: var(--tx-ko); }
.tk-more { width: auto; padding: 0 5px; font-size: var(--fs-cap); }
.tk.lg { width: 96px; height: 54px; border-radius: 4px; }
.tk.lg.is-chosen::after { height: 4px; }
.tk-n { position: absolute; left: 3px; bottom: 5px; padding: 0 4px; border-radius: 2px; background: var(--mk-bg); color: var(--mk-ink); font-size: var(--fs-cap); }
.tk-star { position: absolute; top: 3px; right: 3px; color: var(--s-star); }

.cv-rail { position: absolute; z-index: 5; left: 10px; top: 50%; transform: translateY(-58%); display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.cv-rail .btn, .cv-zoom .btn, .nodebar .btn { background: transparent; border-color: transparent; }
.cv-rail .btn:hover, .cv-rail .btn.is-on, .nodebar .btn:hover, .nodebar .btn.is-on, .cv-zoom .btn:hover { background: var(--surface-3); }
.rail-sep { height: 1px; margin: 3px 4px; background: var(--line); }
.cv-top { position: absolute; z-index: 5; top: 10px; left: 10px; display: flex; gap: 4px; }
.cv-top .btn { background: var(--surface); box-shadow: var(--shadow); }
/* the zoom sits top right: the bottom of the canvas belongs to the prompt box */
.cv-zoom { position: absolute; z-index: 5; right: 10px; top: 10px; display: flex; padding: 2px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.cv-zoom .btn { height: 26px; }
.cv-zoom .btn:has(> svg:only-child) { width: 26px; }
.zoom-pct { min-width: 46px; padding: 0 4px; font-size: var(--fs-meta); }
.nodebar { position: absolute; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lift); white-space: nowrap; }
.nodebar .btn { height: 28px; }
.nodebar .btn:has(> svg:only-child) { width: 28px; }
.nodebar .btn.is-warn { border-color: currentColor; }
.nb-label { padding: 0 8px; font-size: var(--fs-meta); color: var(--ink-3); }
.nb-sep { flex: none; width: 1px; height: 18px; margin: 0 3px; background: var(--line); }

/* ---- the prompt box ------------------------------------------------------------------------------------------- */
.cp-host { position: absolute; z-index: 7; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(700px, calc(100% - 120px)); }
.tl-cp { bottom: 298px; }
.cp { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lift); }
.cp-head { display: flex; align-items: center; gap: 6px; min-height: 20px; font-size: var(--fs-meta); color: var(--ink-3); }
.cp-head b { color: var(--ink); }
.cp-hint { margin-left: auto; font-size: var(--fs-cap); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-inputs, .ch-ctx, .ch-ins { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cp-in-lb { margin-right: 2px; font-size: var(--fs-cap); color: var(--ink-3); }
.cp-none { margin-right: 4px; font-size: var(--fs-meta); color: var(--ink-3); }
.cp-body { position: relative; }
#cpPrompt { display: block; min-height: 40px; padding: 4px 2px; border: 0; background: none; line-height: 1.45; }
#cpPrompt[readonly] { color: var(--ink-3); cursor: default; } /* an earlier state: it reads, it is not written in */
.cp-lock { max-height: 96px; overflow: auto; padding: 6px 8px; border-radius: var(--r); background: var(--surface-2); font-size: var(--fs-meta); }
.cp-lock-lb { display: flex; align-items: center; gap: 5px; color: var(--ink-3); }
.cp-lock p { margin-top: 3px; color: var(--ink-2); line-height: 1.6; }
.cp-mention, .ch-suggest { position: absolute; z-index: 10; left: 0; bottom: calc(100% + 4px); width: 300px; padding: 4px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lift); }
.cp-row { display: flex; align-items: center; gap: 4px; }
.cp-multi { font-size: var(--fs-meta); color: var(--ink-2); }
.cp-why { color: var(--tx-warn); } /* why a run cannot start: in the head of the box, in place of the hint */
/* a reason is read whole: it takes the rest of the line and goes on a second one, the name beside it stays on one */
.cp-head .cp-why { flex: 1 1 0; min-width: 0; white-space: normal; overflow: visible; text-align: right; line-height: 1.3; }
.cp-head > b, .cp-head > b + span { flex: none; white-space: nowrap; }
.in-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 3px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2); font-size: var(--fs-meta); white-space: nowrap; }
.in-chip img { width: 28px; height: 18px; object-fit: cover; border-radius: var(--r-sm); }
.in-chip > .dot { margin-left: 4px; }
.in-name { color: var(--ink); } .in-name small { margin-left: 4px; color: var(--ink-3); }
.in-role { padding: 0 4px; border: 0; border-left: 1px solid var(--line-strong); background: none; font-size: var(--fs-cap); color: var(--ink-3); }
.in-role.is-btn { text-decoration: underline dotted; } .in-role.is-btn:hover { color: var(--ink); }
.in-x { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-3); }
.in-x:hover { background: var(--surface-3); color: var(--ink); }
.in-chip.sm { height: 20px; font-size: var(--fs-cap); padding-right: 6px; }

/* ---- timeline -------------------------------------------------------------------------------------------------- */
.tl { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface); }
.tl-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: var(--viewer); container-type: size; }
/* the viewer is exactly the picture: its labels sit on it, not in the bands around */
.tl-viewer { position: relative; width: min(100cqw, 100cqh * 2.39); height: min(100cqh, 100cqw / 2.39); display: flex; border-radius: 6px; overflow: hidden; }
.tl-viewer > img, .st-frame > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tl-viewer > div, .st-frame > div { display: flex; width: 100%; height: 100%; }
.tl-slate { flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--ink-2); }
.tl-slate b { font-size: var(--fs-title); color: var(--ink); } .tl-slate small { color: var(--ink-3); }
.tl-tag { position: absolute; padding: 3px 8px; border-radius: 4px; background: var(--mk-bg); color: var(--mk-ink); font-size: var(--fs-meta); }
.tl-tl { top: 10px; left: 10px; } .tl-bl { left: 10px; bottom: 10px; }
.tl-viewer .nd-chips { top: 10px; left: auto; right: 10px; }
.tl-takes, .tl-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--line); }
.tl-takes { min-height: 66px; }
.tl-shot { flex: none; display: flex; flex-direction: column; gap: 1px; min-width: 132px; margin-right: 6px; white-space: nowrap; }
.tl-shot > span:first-child { display: flex; align-items: center; gap: 6px; }
.tl-shot small { color: var(--ink-3); }
.tl-strip { position: relative; flex: 1 1 0; min-width: 80px; overflow-x: auto; padding: 3px; }
.tl-strip .tk.lg { width: 62px; height: 35px; }
.tl-time { display: inline-flex; align-items: baseline; gap: 8px; margin-left: 8px; }
.tl-time span, .tl-note { font-size: var(--fs-meta); color: var(--ink-3); white-space: nowrap; }
/* (the note is short and never gives way: when the row is tight, the zoom slider does) */
.tl-note { flex: none; overflow: hidden; text-overflow: ellipsis; }
.tl-zoom { display: inline-flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; color: var(--ink-3); }
.tl-zoom input { flex: 0 1 80px; width: 80px; min-width: 36px; }
.tl-zoom .ic { flex: none; }
.tl-tracks { flex: none; display: flex; height: 176px; border-top: 1px solid var(--line); background: var(--surface-2); }
.tl-labels { flex: none; width: 112px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.tl-labels span { display: flex; align-items: center; gap: 6px; padding-left: 10px; font-size: var(--fs-cap); color: var(--ink-3); }
.tl-labels span:nth-child(1) { height: 24px; } .tl-labels span:nth-child(2) { height: 100px; } .tl-labels span:nth-child(3) { height: 32px; }
.tl-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.tl-inner { position: relative; height: 100%; }
.tl-ruler { position: relative; height: 24px; border-bottom: 1px solid var(--line); cursor: ew-resize; }
.tl-tick { position: absolute; top: 0; height: 24px; padding-left: 4px; border-left: 1px solid var(--line-strong); display: flex; align-items: center; gap: 5px; font-size: var(--fs-cap); white-space: nowrap; pointer-events: none; }
.tl-tick b { font-weight: var(--w-reg); color: var(--ink-2); } .tl-tick small { color: var(--ink-3); }
.tl-track { position: relative; height: 100px; }
.tl-clip { position: absolute; top: 4px; height: 92px; border-radius: var(--r); background-color: var(--surface-3); background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px var(--line-strong); overflow: hidden; cursor: pointer; }
.tl-clip.is-gap { background-image: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--ink) 13%, transparent) 8px 16px); }
.tl-clip.is-sel { box-shadow: inset 0 0 0 2px var(--sel); }
.tl-clip-lb { position: absolute; left: 4px; bottom: 4px; display: flex; flex-direction: column; padding: 1px 5px; border-radius: var(--r-sm); background: var(--mk-bg); color: var(--mk-ink); font-size: var(--fs-cap); line-height: 1.25; white-space: nowrap; }
.tl-clip .chip { position: absolute; top: 4px; right: 4px; }
.tl-track-pipe { height: 32px; }
.tl-pipe { position: absolute; top: 4px; height: 20px; display: flex; align-items: center; gap: 6px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-cap); white-space: nowrap; overflow: hidden; }
.tl-pipe.is-none { background: none; color: var(--ink-3); }
/* a version in the pipe carries the colour of « Sent » */
.tl-pipe:not(.is-none) { color: var(--ink); }
.tl-pipe:not(.is-none)::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--s-sent); }
.tl-pipe small { color: var(--tx-warn); }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.tl-head::before { content: ''; position: absolute; top: 0; left: -4px; border: 5px solid transparent; border-top-color: var(--ink); }

/* ---- assets, history ------------------------------------------------------------------------------------------- */
.as-sec { padding: 4px 12px 12px; }
.as-sec h4 small { color: var(--ink-3); }
.as-els { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 8px; }
.as-el { display: flex; flex-direction: column; gap: 3px; padding: 0; border: 0; background: none; text-align: left; min-width: 0; }
.as-el img, .as-noimg { aspect-ratio: 16 / 10; height: auto; border-radius: var(--r); background: var(--surface-3); }
.as-el.is-sel img, .as-take.is-sel { box-shadow: 0 0 0 2px var(--sel); }
.as-el-lb { display: flex; align-items: center; gap: 5px; min-width: 0; }
.as-el-lb b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-el small { color: var(--ink-3); }
.as-takes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.as-take { position: relative; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: var(--r); background: var(--surface-3); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.as-take.is-orphan { outline: 1px dashed var(--line-strong); outline-offset: -1px; }
.as-fail { color: var(--tx-ko); }
.as-take-lb { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 4px; padding: 2px 4px; background: var(--mk-bg); color: var(--mk-ink); font-size: var(--fs-cap); white-space: nowrap; overflow: hidden; }
.as-take-lb .chip { margin-left: auto; height: 14px; padding: 0 4px; }
.hs-past { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-3); border-bottom: 1px solid var(--line); font-size: var(--fs-meta); }
.hs-day { margin: 10px 12px 2px; }
.hs-it { display: flex; align-items: flex-start; gap: 8px; padding: 5px 8px 5px 12px; }
.hs-it:hover, .hs-it.is-on { background: var(--surface-2); }
.hs-it.is-on { box-shadow: inset 2px 0 0 var(--ink); }
.hs-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 0; border: 0; background: none; text-align: left; color: var(--ink-2); }
.hs-tx b { color: var(--ink); }
.hs-tx small { display: flex; align-items: center; gap: 4px; color: var(--ink-3); }

/* ---- chat ---------------------------------------------------------------------------------------------------------- */
#rtChat { display: flex; flex-direction: column; overflow: hidden; }
.ch-top { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
.ch-who { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--ink-2); }
.ch-list { position: relative; flex: 1; min-height: 0; overflow: auto; overflow-anchor: none; display: flex; flex-direction: column; gap: 14px; padding: 12px; }
.ch-list::after { content: ''; flex: none; height: 40vh; } /* room to bring the last message to the top */
.ch-me { align-self: flex-end; max-width: 88%; padding: 7px 10px; border-radius: 10px; background: var(--surface-3); }
.ch-me-ctx { display: block; margin-bottom: 2px; font-size: var(--fs-cap); color: var(--ink-3); }
.ch-ag { display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); }
.ch-ag b { color: var(--ink); }
.ch-steps { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font-size: var(--fs-meta); color: var(--ink-3); }
.ch-steps:hover { color: var(--ink); }
.ch-steplist { margin: 0; padding-left: 20px; font-size: var(--fs-meta); color: var(--ink-3); }
.ch-intro { display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); }
.ch-egs, .ch-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-eg { padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 14px; background: none; color: var(--ink-2); font-size: var(--fs-meta); text-align: left; }
.ch-eg:hover, .ch-eg.is-on { background: var(--surface-3); color: var(--ink); }
.ch-shot { height: 20px; padding: 0 5px; border: 0; border-radius: 4px; background: var(--surface-3); color: var(--ink); font-size: var(--fs-meta); }
.ch-shot:hover { background: var(--line-strong); }
.ch-table { width: 100%; border-collapse: collapse; font-size: var(--fs-meta); }
.ch-table th { padding: 3px 6px; text-align: left; font-weight: var(--w-reg); color: var(--ink-3); }
.ch-table td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.ch-ask p { margin-bottom: 6px; color: var(--ink); }
.ch-card { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); overflow: clip; }
/* a card that waits for an answer keeps that answer in view: the approval does not scroll out while its card shows */
.ch-card.is-pending .ch-card-f { position: sticky; bottom: -12px; z-index: 1; background: var(--surface-2); } /* -12: the padding of the list, so that no row shows under it */
.ch-card.is-cancelled { opacity: 0.6; }
.ch-card-h, .ch-card-f { display: flex; align-items: center; gap: 8px; padding: 7px 10px; }
.ch-card-h small { color: var(--ink-3); }
.ch-card-f { border-top: 1px solid var(--line-strong); flex-wrap: wrap; row-gap: 6px; }
.ch-card-f .muted { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-meta); }
.ch-row-it { padding: 8px 10px; border-top: 1px solid var(--line-strong); }
.ch-row-it.is-off { opacity: 0.6; }
.ch-row-h, .ch-row-f { display: flex; align-items: center; gap: 6px; }
.ch-row-f { align-items: flex-start; }
.ch-model { min-width: 0; font-size: var(--fs-meta); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-cost { font-size: var(--fs-meta); color: var(--ink); white-space: nowrap; }
.ch-prompt { margin: 4px 0 6px; font-size: var(--fs-meta); color: var(--ink-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ch-row-f .ch-ins { flex: 1; min-width: 0; }
.ch-thumbs { margin-top: 6px; }
.ch-thumbs .tk { opacity: 1; width: 52px; height: 24px; }
.ch-total { flex: 1 1 100%; display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-meta); }
.ch-total small { color: var(--ink-3); font-size: var(--fs-meta); }
.ch-box { position: relative; flex: none; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.ch-ctx:not(:empty) { margin-bottom: 6px; }
.ch-suggest { left: 10px; width: calc(100% - 20px); }
.ch-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }

/* ---- sheets ---------------------------------------------------------------------------------------------------------- */
#sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.sheet-dim { position: absolute; inset: 0; background: var(--overlay); }
.sheet { position: relative; display: flex; flex-direction: column; max-height: calc(100vh - 100px); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lift); overflow: hidden; }
.sheet-take { width: min(1240px, calc(100vw - 70px)); }
/* as tall as its content, and held by its top: it grows downwards when the pictures to pick from open */
.sheet-el { width: min(1180px, calc(100vw - 70px)); align-self: flex-start; margin-top: 56px; max-height: calc(100vh - 91px); }
.sheet-text { width: 580px; } .sheet-send { width: 760px; } .sheet-folder, .sheet-keys { width: 540px; }
.sheet-head { flex: none; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.sheet-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-title); font-weight: var(--w-strong); white-space: nowrap; }
.sheet-sub { display: flex; align-items: center; gap: 10px; font-size: var(--fs-meta); color: var(--ink-3); white-space: nowrap; }
.st-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); }
.st-main { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px; overflow: auto; }
/* the frame is exactly the picture: nothing floats in a band around it */
.st-view { flex: none; display: flex; justify-content: center; border-radius: 8px; background: var(--viewer); overflow: hidden; }
.st-frame { position: relative; display: flex; width: 100%; aspect-ratio: 2.39 / 1; }
/* an element shows its picture whole, at its own proportions, on the width of the column */
.sheet-el .st-view { background: none; overflow: visible; }
.sheet-el .st-frame { display: block; aspect-ratio: auto; }
.sheet-el .st-frame > img { display: block; width: 100%; height: auto; max-height: 440px; object-fit: contain; object-position: left top; border-radius: 8px; }
.sheet-el .st-frame > .nd-empty { width: 100%; aspect-ratio: 2.39 / 1; border-radius: 8px; background: var(--viewer); }
.st-frame .nd-chips { top: 10px; left: 10px; }
.st-bar { flex: none; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.st-pos { padding: 0 6px; font-size: var(--fs-meta); color: var(--ink-3); white-space: nowrap; }
.st-strip { position: relative; flex: none; overflow-x: auto; padding: 3px; gap: 6px; }
/* a strip that holds more than it shows fades on the side where the rest is */
.st-strip.more-r, .tl-strip.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); }
.st-strip.more-l, .tl-strip.more-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 30px), transparent); }
.st-strip.more-l.more-r, .tl-strip.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 30px, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, transparent, #000 30px, #000 calc(100% - 30px), transparent); }
.st-side { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-left: 1px solid var(--line); overflow: auto; }
.st-side h4:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: var(--fs-meta); }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
.st-prompt { margin-bottom: 8px; color: var(--ink-2); white-space: pre-wrap; }
.st-inputs { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.st-inputs li { display: flex; align-items: center; gap: 8px; }
.st-inputs img { width: 40px; height: 24px; object-fit: cover; border-radius: var(--r-sm); }
.st-inputs span { flex: 1; min-width: 0; } .st-inputs small { color: var(--ink-3); white-space: nowrap; } .st-inputs small.warn { color: var(--tx-warn); }
.cm { padding-top: 10px; border-top: 1px solid var(--line); }
.cm h4 { margin-top: 0; }
.cm-it { display: flex; gap: 8px; margin-bottom: 10px; }
.cm-it small { margin-left: 6px; color: var(--ink-3); } .cm-it p { margin-top: 2px; color: var(--ink-2); }
.cm-form { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.el-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.el-pick { display: flex; flex-direction: column; gap: 3px; padding: 0; border: 0; background: none; min-width: 0; font-size: var(--fs-cap); color: var(--ink-2); text-align: left; }
.el-pick img { aspect-ratio: 16 / 10; height: auto; border-radius: var(--r); }
.el-pick:hover img { box-shadow: 0 0 0 2px var(--ink); }
.el-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-body, .sd-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow: auto; }
.sheet-foot { display: flex; align-items: center; gap: 8px; }
.sd-row { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; }
.sd-row.is-off { opacity: 0.62; }
.sd-row img, .sd-noimg { flex: none; width: 110px; height: 46px; object-fit: cover; border-radius: 4px; background: var(--surface-3); }
.sd-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sd-row code { font: var(--w-reg) var(--fs-cap) var(--mono); color: var(--ink-2); overflow-wrap: anywhere; }
.sd-row code .seg { white-space: nowrap; }
.sd-row small { color: var(--ink-3); }
.sd-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sd-checks li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.sd-checks li.ok svg { color: var(--tx-ok); } .sd-checks li.ko svg { color: var(--tx-ko); }
.sd-progress { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.sd-progress i { display: block; width: 40%; height: 100%; background: var(--ink); animation: slide 0.9s linear infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.fd-list { display: flex; flex-direction: column; gap: 6px; }
.fd-it { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: none; text-align: left; }
.fd-it:hover { background: var(--surface-2); }
.fd-it small { margin-left: auto; color: var(--ink-3); }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.keys td:last-child { text-align: right; white-space: nowrap; }

/* ---- round 13, lot A ---------------------------------------------------------------------------------------- */
/* the two decisions are one kind of button: an icon while not taken, the icon and the word when it is the state */
.btn.dc.dc-chosen { color: var(--tx-send); border-color: currentColor; }
.btn.dc.dc-rejected { color: var(--tx-ko); border-color: currentColor; }
.nodebar .btn.dc.is-on, .btn.dc.is-on { padding: 0 9px 0 7px; width: auto; }

/* the prompt box put away: a handle stays where it was */
.cp-handle { position: absolute; z-index: 7; left: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r-round); background: var(--surface); box-shadow: var(--shadow-lift); color: var(--ink-2); font-size: var(--fs-meta); white-space: nowrap; }
.cp-handle:hover { background: var(--surface-3); color: var(--ink); }
.cp-handle b { color: var(--ink); font-weight: var(--w-strong); }
.cp-head .btn.sm.ghost { margin-left: 2px; }

/* full screen: the picture and its transport, nothing else. The transport is drawn on the picture and leaves when
   the pointer rests. */
body[data-full] #proto, body[data-full] .top, body[data-full] .past-bar, body[data-full] .pn { display: none !important; }
body[data-full][data-idle] { cursor: none; }
body[data-full='timeline'] .tl-takes, body[data-full='timeline'] .tl-tracks, body[data-full='timeline'] .tl-cp,
body[data-full='timeline'] .tl-note, body[data-full='timeline'] .tl-zoom, body[data-full='timeline'] [data-act='tl.fit'], body[data-full='timeline'] [data-act='tl.export'] { display: none; }
body[data-full='timeline'] .tl-stage, body[data-full='sheet'] .st-view { padding: 0; background: #000; }
body[data-full] .tl-viewer, body[data-full] .st-frame { border-radius: 0; }
body[data-full] .tl-bar, body[data-full] .st-bar { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; flex-wrap: nowrap; padding: 26px 14px 12px; border: 0; color: var(--ink); background: linear-gradient(to top, rgb(0 0 0 / 0.82), rgb(0 0 0 / 0)); transition: opacity 0.25s; }
body[data-full] .tl-tag, body[data-full] .nd-chips { transition: opacity 0.25s; }
body[data-full][data-idle] .tl-bar, body[data-full][data-idle] .st-bar, body[data-full][data-idle] .tl-tag, body[data-full][data-idle] .nd-chips { opacity: 0; }
/* (full screen is there to see the picture: a rejected take is not dimmed in it; its chip says it) */
body[data-full] .st-frame.is-rej img { opacity: 1; }
.tl-scrub { display: none; }
body[data-full='timeline'] .tl-scrub { display: block; position: absolute; z-index: 4; left: 14px; right: 14px; bottom: 56px; height: 16px; cursor: pointer; transition: opacity 0.25s; }
body[data-full][data-idle] .tl-scrub { opacity: 0; }
.tl-seg { position: absolute; top: 6px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 0.42); }
.tl-seg.is-gap { background: repeating-linear-gradient(135deg, rgb(255 255 255 / 0.42) 0 3px, transparent 3px 6px); }
.tl-seg.is-sel { background-color: #fff; }
.tl-scrub:hover .tl-seg { top: 5px; height: 6px; }
.tl-scrub-head { position: absolute; top: 1px; width: 3px; height: 14px; margin-left: -1px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5); pointer-events: none; }
body[data-full='sheet'] .sheet-dim, body[data-full='sheet'] .sheet-head, body[data-full='sheet'] .st-side, body[data-full='sheet'] .st-strip { display: none; }
body[data-full='sheet'] .sheet { position: fixed; inset: 0; width: auto; max-width: none; max-height: none; border: 0; border-radius: 0; }
body[data-full='sheet'] .st-body { display: block; position: relative; }
body[data-full='sheet'] .st-main { position: absolute; inset: 0; padding: 0; overflow: hidden; }
body[data-full='sheet'] .st-view { position: absolute; inset: 0; border-radius: 0; align-items: center; }
body[data-full='sheet'] .st-frame { width: 100%; height: 100%; aspect-ratio: auto; }

/* the strip that is not part of Board: the journal of a test session */
.rec-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #b3261e; vertical-align: 1px; }
.jr { margin: 4px 0 10px; padding-left: 18px; color: var(--ink-2); }
.jr li { margin: 2px 0; }

/* ---- round 13, lot B: an element holds several pictures --------------------------------------------------------- */
.el-pics { flex: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.el-pics-lb { margin-right: 4px; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.el-pics-lb small { color: var(--ink-3); }
.el-pics .tk.lg { width: 84px; height: 52px; opacity: 1; }
.el-pics .tk.lg img, .tk.is-pic img { width: 100%; height: 100%; object-fit: cover; }
.el-pics .btn { margin-left: 4px; }
.tk.is-pic { opacity: 1; }
.tk.is-pic.is-active { box-shadow: 0 0 0 1px var(--ink-3); }
.in-n { margin-left: 5px; color: var(--ink-3); }
.in-n.is-part { color: var(--tx-warn); }
.cp-left { margin-left: 4px; font-size: var(--fs-cap); color: var(--tx-warn); }
.in-pics { display: inline-flex; gap: 2px; flex: none; }
.st-inputs .in-pics img { width: 30px; height: 20px; }

/* Isolate: a view of one node with what is wired to it. Its bar says what is shown and how to leave. */
.cv-iso { position: absolute; z-index: 6; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 5px 0 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--sel); box-shadow: var(--shadow-lift); font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.cv-iso b { color: var(--ink); font-weight: var(--w-strong); }
.cv-iso .muted { margin: 0 4px; color: var(--ink-3); }
.cv.is-iso { box-shadow: inset 0 0 0 2px var(--sel); }
.st-strip > .el-pics-lb { align-self: center; flex: none; }
/* (the thumbnails of an input take their own width: the name starts right after them) */
.st-inputs .in-pics { flex: none; }
.st-inputs li > span:not(.in-pics) small { white-space: nowrap; }
/* a toast does not lie on the bar of the isolated view: it comes under it */
body:has(.ws.tab-canvas #cvIso:not([hidden])):not(:has(#sheet:not([hidden]))) #toasts { top: 126px; }
/* (the labels of the three rows of an element start on one line) */
.sheet-el .st-bar .st-pos { padding-left: 0; }
.st-strip > .el-pics-lb { margin-left: -3px; }

/* ---- round 13, lot C: from the journal of the first recorded session ------------------------------------------- */
/* the name of a node, changed where it is written */
.nd-rename { flex: 1 1 auto; min-width: 60px; height: 20px; margin: -2px 0; padding: 0 5px; border-radius: 5px; border: 1px solid var(--sel); background: var(--surface); color: var(--ink); font: inherit; }
/* the list of pictures to add: a sentence in it takes the whole line; while it is open the large picture gives it room */
.el-grid > .muted { grid-column: 1 / -1; }
.sheet-el.is-adding .st-frame > img { max-height: 200px; }
.sheet-el.is-adding .st-frame > .nd-empty { aspect-ratio: auto; height: 120px; }

/* ---- round 13, lot C2: real pictures and videos from the disk ----------------------------------------------------- */
.cv.is-drop { box-shadow: inset 0 0 0 3px var(--s-sent); }
.nd-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgb(0 0 0 / 0.55); color: #fff; pointer-events: none; }
.nd-play .ic { margin-left: 2px; }
.st-frame.is-video { background: #000; }
.st-video { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; background: #000; }
.nd-empty.is-btn { display: flex; border: 1px dashed var(--line-strong); color: inherit; font: inherit; cursor: pointer; }
.nd-empty.is-btn:hover { border-color: var(--ink-2); }
.nd-empty.is-btn[aria-disabled="true"] { cursor: default; }

/* ---- round 13, lot C3: the sound track of the timeline ----------------------------------------------------------- */
.tl-labels .tl-lb-snd { gap: 3px; border-top: 1px solid var(--line); }
.tl-labels .tl-lb-snd .btn { margin-left: 0; }
.tl-labels .tl-lb-snd .btn:first-of-type { margin-left: auto; }
.tl-track-snd { border-top: 1px solid var(--line); }
.tl-tracks.is-drop .tl-track-snd { background: color-mix(in srgb, var(--s-sent) 16%, transparent); }
.tl-snd { position: absolute; height: 24px; display: flex; align-items: center; gap: 2px; padding: 0 2px 0 3px; border-radius: 5px; background: color-mix(in srgb, var(--t-sound) 20%, var(--surface-3)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-sound) 55%, transparent); overflow: hidden; cursor: grab; }
.tl-snd.is-sel { box-shadow: inset 0 0 0 2px var(--ink); }
.tl-snd.is-moving { cursor: grabbing; opacity: 0.85; }
.tl-snd.is-mute { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tl-snd.is-gone { background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--s-rej) 30%, transparent) 6px 12px); }
/* (the wave is cut at the end of the sound by its own box: the sound itself lets a short name run past its end) */
.tl-wave-box { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.tl-wave { position: absolute; left: 0; top: 2px; bottom: 2px; height: calc(100% - 4px); pointer-events: none; }
.tl-snd.is-over { overflow: visible; }
.tl-snd.is-over .tl-snd-lb { flex: none; overflow: visible; }
.tl-wave path { fill: color-mix(in srgb, var(--t-sound) 62%, transparent); }
.tl-snd.is-mute .tl-wave path { fill: var(--ink-3); opacity: 0.45; }
.tl-snd-lb { position: relative; flex: 0 1 auto; min-width: 0; padding: 1px 4px; border-radius: 3px; background: var(--surface-2); font-size: var(--fs-cap); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-snd .btn:first-of-type { margin-left: auto; }
.tl-snd.is-narrow { padding-left: 2px; }
.tl-snd.is-narrow:not(:hover):not(.is-sel) .btn { display: none; }
.tl-snd.is-narrow:hover, .tl-snd.is-narrow.is-sel { z-index: 3; min-width: 168px; background: var(--surface-3); }
/* a muted sound: grey, its wave faded, a muted loudspeaker before its name (no line through the name: that reads as removed) */
.tl-snd.is-mute .tl-snd-lb { color: var(--ink-2); }
.tl-snd-off { position: relative; flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; background: var(--surface-2); color: var(--ink-2); }
.tl-snd .btn { position: relative; flex: none; height: 20px; min-width: 20px; padding: 0 3px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.tl-snd-none { position: absolute; left: 10px; top: 0; bottom: 0; display: flex; align-items: center; font-size: var(--fs-cap); color: var(--ink-3); white-space: nowrap; }
.st-note { margin: 12px 0 0; }
/* the list of pictures to add: the real disk first, as a button; a line held at the bottom of the sheet counts what lies below */
.el-disk-row { display: flex; align-items: center; gap: 10px; }
.el-add:not(:empty) { padding-bottom: 38px; }
.el-more { display: none; }
.sheet-el.is-adding .el-more.is-on { flex: none; position: sticky; z-index: 2; bottom: -12px; display: block; height: 24px; margin: -34px -12px 0; border-top: 1px solid var(--line); background: var(--surface); font-size: var(--fs-cap); line-height: 23px; text-align: center; color: var(--ink-2); pointer-events: none; }
.nd-empty.is-btn .ic { color: var(--ink-2); margin-bottom: 2px; }
.sheet-el .st-bar:empty { display: none; }
