/* Chats (D523): one chat a project, a camera reel of blocks across the top. Loaded last. */

/* the header reads AI Film Studio and carries the bell; the money and pause notices wait behind it */
.appname { display: none; font-weight: 750; letter-spacing: -.015em; font-size: 17px; color: var(--ink); white-space: nowrap; }
html[data-layout="simple"] .appname { display: inline; }
html[data-layout="simple"] header.top #viewName, html[data-layout="simple"] header.top #filmPick,
html[data-layout="simple"] header.top .wordmark { display: none !important; }
.bellbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 12px; border: 0; background: transparent; color: var(--muted); }
.bellbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bellbtn:hover { background: var(--panel); color: var(--ink); }
.bellbtn .bellcount { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font: 700 10.5px/17px var(--font); text-align: center; pointer-events: none; }
.bellbtn.has svg { color: var(--ink); }
html:not([data-layout="pro"]) #alertBar { display: none; }
html:not([data-layout="pro"]).alerts-open #alertBar { display: block; position: fixed; z-index: 70; top: 58px; right: 12px;
  width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 8px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3); }
html:not([data-layout="pro"]).alerts-open #alertBar:empty::before { content: 'No notifications.'; display: block; padding: 14px; color: var(--muted); }
html:not([data-layout="pro"]).alerts-open #alertBar .alert { margin: 0 0 8px; border-radius: 12px; }
html:not([data-layout="pro"]).alerts-open #alertBar .alert:last-child { margin-bottom: 0; }
html[data-layout="pro"] .bellbtn { display: none; }

/* the shell: a list of chats beside the chat open */
.ch-shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100%; min-height: 0; background: var(--bg); }
.ch-side { display: flex; flex-direction: column; gap: 6px; padding: 14px 12px; border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; min-height: 0; }
.ch-new { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 12px; width: 100%; font-weight: 650; }
.ch-new svg, .ch-item svg, .ch-head svg, .ch-compose svg, .ch-blank svg, .ch-frame svg, .ch-play svg, .ch-card svg, .ch-upload svg, .ch-ref svg, .ch-clip svg, .ch-pbtn svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ch-label { margin: 12px 8px 2px; font-size: 12px; font-weight: 650; color: var(--faint); letter-spacing: .02em; }
.ch-list { display: flex; flex-direction: column; gap: 2px; }
.ch-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); text-align: left; cursor: pointer; min-height: 52px; }
.ch-item:hover { background: var(--panel); }
.ch-item.on { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ch-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--raised); color: var(--muted); overflow: hidden; }
.ch-assist .ch-ico { background: var(--accent-soft); color: var(--primary); }
.ch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ch-it { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.ch-it b { font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-it small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-empty { padding: 18px 10px; color: var(--muted); font-size: 14px; }

.ch-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; }
.ch-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.ch-back { display: none; width: 40px; height: 40px; padding: 0; border-radius: 10px; }
.ch-ht { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ch-ht b { font-size: 16.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-ht small { font-size: 12.5px; color: var(--muted); }
.ch-play { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--cream); color: var(--cream-ink); border: 0; font-weight: 650; }
.ch-play svg { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.ch-blank { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 32px; max-width: 420px; color: var(--muted); }
.ch-blank > svg { width: 44px; height: 44px; color: var(--faint); }
.ch-blank b { color: var(--ink); font-size: 18px; }
.ch-blank button { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.ch-desk { flex: 1; min-height: 0; display: flex; }
.ch-desk > * { flex: 1; }

/* the camera reel: frames with sprocket holes, each at the project's shape */
.ch-reelbar { border-bottom: 1px solid var(--line); background: #08090b; }
html[data-theme="light"] .ch-reelbar, html:not([data-theme]) .ch-reelbar { background: #0b0c0e; }
.ch-reel { --h: 112px; display: flex; gap: 10px; padding: 18px 16px; overflow-x: auto; scroll-snap-type: x proximity; position: relative;
  background-image: radial-gradient(circle at 6px 6px, rgba(255,255,255,.18) 2.6px, transparent 3px), radial-gradient(circle at 6px 6px, rgba(255,255,255,.18) 2.6px, transparent 3px);
  background-size: 18px 12px, 18px 12px; background-repeat: repeat-x, repeat-x; background-position: 4px 2px, 4px calc(100% - 2px); }
.ch-frame { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: transparent; color: #f3ece1; cursor: pointer; scroll-snap-align: start; position: relative; }
.ch-pic { position: relative; display: grid; place-items: center; height: var(--h); width: calc(var(--h) * var(--ar)); max-width: 220px; min-width: 64px;
  border-radius: 6px; overflow: hidden; background: #1b1c21; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.ch-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ch-frame:hover .ch-pic { box-shadow: 0 0 0 2px var(--primary); }
.st-review .ch-pic { box-shadow: 0 0 0 2px var(--warn); }
.st-failed .ch-pic { box-shadow: 0 0 0 2px var(--bad); }
.ch-state { position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 650; }
.st-review .ch-state { background: #f5b454; color: #1a1205; }   /* the dark theme's amber in both: the light theme's --warn is too dark under dark words (axe, the walk: 3.6:1) */
.st-failed .ch-state { background: var(--bad); color: #fff; }
/* D538: a block added with + waits empty until he says what happens in it */
.st-empty .ch-pic { background: transparent; box-shadow: none; border: 2px dashed rgba(255,255,255,.4); }
.st-empty .ch-state { background: rgba(255,255,255,.14); color: #fff; }
.ch-remove { align-self: flex-start; margin-top: 4px; }
.ch-pbtn { position: absolute; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; }
.ch-pbtn svg { width: 15px; height: 15px; fill: currentColor; stroke: none; margin-left: 2px; }
.ch-spin { position: absolute; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: ch-spin 1s linear infinite; }
@keyframes ch-spin { to { transform: rotate(360deg); } }
.ch-cap { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #c9c3b9; white-space: nowrap; }
.ch-cap b { display: grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: rgba(255,255,255,.12); color: #fff; font-size: 11.5px; }
.ch-res { padding: 1px 6px; border-radius: 6px; font-weight: 700; font-size: 10.5px; letter-spacing: .02em; background: rgba(255,255,255,.12); color: #fff; }
.ch-res.rhd { background: #2f7ff5; }
.ch-res.r4k { background: linear-gradient(90deg, #d4a24c, #f3d48a); color: #1a1205; }
.ch-exp { font-size: 11px; color: #8db8ff; white-space: nowrap; }
.ch-exp.soon { color: var(--warn); }
.ch-add .ch-pic { background: transparent; box-shadow: none; border: 2px dashed rgba(255,255,255,.28); color: #fff; }
.ch-add .ch-pic svg { width: 30px; height: 30px; }
.ch-add:hover .ch-pic { border-color: var(--primary); box-shadow: none; }

/* the conversation */
.ch-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ch-thread { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px 24px; max-width: 760px; margin: 0 auto; }
.ch-msg { display: flex; flex-direction: column; gap: 8px; max-width: min(560px, 88%); }
.ch-msg p { margin: 0; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.ch-msg.studio { align-self: flex-start; }
.ch-msg.studio p { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 6px; }
.ch-msg.you { align-self: flex-end; align-items: flex-end; }
.ch-msg.you p { background: var(--primary); color: var(--primary-ink); border-top-right-radius: 6px; }
.ch-msg.bad p { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); }
.ch-msg.ok p { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.ch-msg time { font-size: 11.5px; color: var(--faint); padding: 0 6px; }
.ch-typing p { color: var(--muted); }
.ch-dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.ch-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ch-dot 1.2s infinite; }
.ch-dots i:nth-child(2) { animation-delay: .2s; } .ch-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ch-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ch-clip { position: relative; display: grid; place-items: center; padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: #000;
  width: min(360px, 100%, calc(400px * var(--ar))); aspect-ratio: var(--ar); cursor: pointer; }
.ch-clip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ch-clip .ch-pbtn { width: 52px; height: 52px; }
.ch-clip .ch-pbtn svg { width: 22px; height: 22px; }
.ch-clip.big { width: min(100%, calc(52vh * var(--ar))); margin: 0 auto 12px; }
.ch-frameimg { width: min(320px, 100%, calc(360px * var(--ar))); aspect-ratio: var(--ar); object-fit: cover; border-radius: 12px; }
.ch-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-acts button, .ch-acts .btn { height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; }
.ch-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-width: 620px; }
.ch-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); cursor: pointer; min-height: 48px; justify-content: center; }
.ch-opt:hover, .ch-opt.on { border-color: var(--primary); background: var(--accent-soft); }
.ch-opt b { font-size: 14.5px; } .ch-opt small { font-size: 12px; color: var(--muted); }
.ch-shape { display: block; height: 34px; width: calc(34px * var(--ar)); max-width: 80px; border: 2px solid currentColor; border-radius: 4px; opacity: .8; }

/* the composer */
.ch-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.ch-input { flex: 1; min-height: 44px; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line-strong); background: var(--field); color: var(--ink);
  font: 16px/1.4 var(--font); resize: none; width: 100%; box-sizing: border-box; }
textarea.ch-input { border-radius: 16px; }
.ch-compose .ch-input { border-radius: 22px; max-height: 140px; }
.ch-send, .ch-attach { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.ch-attach { border: 1px solid var(--line-strong); }
.ch-send:disabled { opacity: .45; }

/* the modal: a block and the + form */
html.ch-locked { overflow: hidden; }
.ch-modal { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); align-items: center; justify-content: center; padding: 20px; }
.ch-modal.on { display: flex; }
.ch-card { width: min(560px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3); overflow: hidden; }
.ch-card > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.ch-card > header b { font-size: 17px; }
.ch-card > header button { width: 44px; height: 44px; padding: 0; border-radius: 12px; }
.ch-mbody { padding: 16px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.ch-q { display: flex; flex-direction: column; gap: 8px; }
.ch-q > b { font-size: 14.5px; }
.ch-hint { color: var(--muted); font-size: 12.5px; }
.ch-seg { display: flex; gap: 6px; flex-wrap: nowrap; }
.ch-seg.wrap { flex-wrap: wrap; }
.ch-seg button { height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink); font-weight: 600; }
.ch-seg button.on { background: var(--primary); border-color: transparent; color: var(--primary-ink); }
.ch-lastimg { width: min(260px, 100%, calc(220px * var(--ar))); aspect-ratio: var(--ar); object-fit: cover; border-radius: 10px; }
.ch-thumbrow { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-ref { position: relative; display: flex; flex-direction: column; gap: 4px; width: 112px; }
.ch-ref img, .ch-vid { width: 112px; height: 76px; object-fit: cover; border-radius: 10px; background: var(--raised); display: grid; place-items: center; }
.ch-ref input { height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--field); color: var(--ink); font-size: 12.5px; width: 100%; box-sizing: border-box; }
.ch-ref button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; border: 0; display: grid; place-items: center; }
.ch-ref button svg { width: 14px; height: 14px; }
.ch-upload { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 12px; border: 1px dashed var(--line-strong); color: var(--ink); cursor: pointer; width: max-content; }
.ch-upload.small { flex-direction: column; justify-content: center; width: 112px; height: 76px; padding: 0; font-size: 12.5px; gap: 4px; }
.ch-upload:hover { border-color: var(--primary); }
.ch-toggle { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.ch-toggle input { width: 20px; height: 20px; accent-color: var(--primary); }
.ch-foot { position: sticky; bottom: -20px; margin: 0 -20px -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px;
  justify-content: space-between; background: var(--panel); border-top: 1px solid var(--line); }
.ch-price { font-size: 13.5px; color: var(--muted); }
.ch-price.bad { color: var(--bad); }
.ch-foot .primary { height: 46px; padding: 0 20px; border-radius: 12px; font-weight: 650; white-space: nowrap; }
.ch-facts { margin: 0; display: grid; gap: 8px; }
.ch-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.ch-facts dt { color: var(--muted); font-size: 13px; } .ch-facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.ch-words summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.ch-words p { white-space: pre-wrap; font-size: 13px; color: var(--muted); }

/* Home holds the shell; its height is measured by chats.js */
html[data-layout="simple"] body[data-view="home"] .sx-chat:has(.ch-shell) { height: auto; display: block; }

@media (max-width: 899px) {
  .ch-shell { grid-template-columns: 1fr; }
  .ch-shell[data-pane="list"] .ch-main { display: none; }
  .ch-shell[data-pane="chat"] .ch-side { display: none; }
  .ch-side { border-right: 0; padding: 14px 16px; }
  .ch-back { display: grid; place-items: center; }
  .ch-head { padding: 8px 10px; }
  .ch-reel { --h: 92px; padding: 16px 12px; }
  .ch-thread { padding: 14px 12px 20px; }
  .ch-compose { padding-left: 10px; padding-right: 10px; }
  .ch-modal { padding: 0; align-items: flex-end; }
  .ch-card { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .ch-play span { display: none; }
  .ch-play { width: 40px; padding: 0; justify-content: center; }
}

/* Home is the chats edge to edge: no page padding, no column limit, no page scroll behind it */
html[data-layout="simple"] body[data-view="home"] main { max-width: none; padding: 0; }
html[data-layout="simple"] body[data-view="home"] .v-home, html[data-layout="simple"] body[data-view="home"] .sx-chathome { max-width: none; margin: 0; }
html[data-layout="simple"] body[data-view="home"] .view-title { display: none; }
html[data-layout="simple"] #livePill { display: none; }
.ch-frame.ch-add.wait .ch-pic { opacity: .45; border-style: dotted; }
.ch-frame.ch-add.wait .ch-cap { opacity: .75; white-space: nowrap; }
@media (min-width: 900px) {
  html[data-layout="simple"] header.top { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 899px) {
  html[data-layout="simple"] body[data-view="home"] main { padding-bottom: 0; }
}

/* ---------------------------------------------------------------- D524: the hard review of Home */

/* the bell only when something waits; its notices open as a sheet over a dim page, never a
   card floating on the chat */
.bellbtn[hidden] { display: none !important; }
.notif-scrim { display: none; }
html:not([data-layout="pro"]).alerts-open .notif-scrim { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(0,0,0,.45); }
html:not([data-layout="pro"]).alerts-open #alertBar { top: 64px; right: 16px; padding: 48px 10px 10px; }
html:not([data-layout="pro"]).alerts-open #alertBar::before { content: 'Notifications'; position: absolute; top: 14px; left: 18px; font-weight: 700; font-size: 16px; color: var(--ink); }
@media (max-width: 899px) {
  html:not([data-layout="pro"]).alerts-open #alertBar { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 75dvh; border-radius: 20px 20px 0 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-bottom: 0; }
}
/* Home is the chat, so the header's Ask is not needed there */
html[data-layout="simple"] body[data-view="home"] header.top .askbtn { display: none !important; }

/* the phone's tab bar: lower and slimmer, its pill around the icon only */
@media (max-width: 899px) {
  html[data-layout="simple"] nav.tabs { padding: 2px 6px env(safe-area-inset-bottom); box-shadow: none; }
  html[data-layout="simple"] nav.tabs .navbtn { min-height: 52px; padding: 4px 2px 2px; gap: 2px; }
  html[data-layout="simple"] nav.tabs .navbtn svg { width: 22px; height: 22px; }
  html[data-layout="simple"] nav.tabs .navbtn[aria-current="page"] svg { width: 48px; height: 28px; padding: 3px 13px; }
  /* an open chat takes the whole screen, as a messaging app does; the list brings the bar back */
  html[data-layout="simple"].ch-in-chat body[data-view="home"] nav.tabs { display: none; }
  /* D569: chat first; Home has no bottom bar, Create and Studio are on top */
  html[data-layout="simple"] body[data-view="home"] nav.tabs { display: none; }
}

/* the chat head: one row, the reel's play a quiet pill, options behind ... */
.ch-menu { width: 40px; height: 40px; padding: 0; border-radius: 10px; display: grid; place-items: center; flex: none; }
.ch-menu svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.ch-play { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13.5px; }
.ch-play:hover { border-color: var(--primary); color: var(--primary); }
.ch-danger { border-top: 1px solid var(--line); padding-top: 14px; }
.ch-danger .danger { height: 40px; padding: 0 16px; border-radius: 12px; }

/* the conversation and the composer share one centred column on a desk */
.ch-compose { justify-content: center; }
.ch-compose > * { max-width: 760px; }
@media (min-width: 900px) {
  .ch-compose { padding-left: max(16px, calc((100% - 760px) / 2)); padding-right: max(16px, calc((100% - 760px) / 2)); }
}
.ch-meta { font-size: 11.5px; font-weight: 650; color: var(--faint); padding: 0 6px; letter-spacing: .01em; }
.ch-msg.you .ch-meta { align-self: flex-end; }
/* a clip in the thread is a still you tap, not a wall of picture */
.ch-clip { width: min(300px, 100%, calc(300px * var(--ar))); }
@media (max-width: 899px) { .ch-clip { width: min(260px, 100%, calc(260px * var(--ar))); } }

/* a block being made: a live bar, its step, how long, and Cancel while it waits its turn */
.ch-prog { display: block; height: 6px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.ch-prog > i { display: block; height: 100%; width: 3%; border-radius: 3px; background: var(--primary); transition: width 1.8s linear; }
.ch-prog.thin { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; background: rgba(255,255,255,.2); }
.ch-live { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; width: min(320px, 100%); padding: 10px 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); }
.ch-live .ch-prog { grid-column: 1 / -1; }
.ch-livet { font-size: 13px; color: var(--muted); } .ch-livet b { color: var(--ink); font-weight: 650; }
.ch-cancel { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }

/* list search */
.ch-search { display: flex; align-items: center; gap: 8px; height: 40px; margin: 2px 0 4px; padding: 0 12px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); color: var(--muted); }
.ch-search[hidden] { display: none; }
.ch-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 15px var(--font); outline: none; height: 100%; }
.ch-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* the + form: one row of lengths that scrolls, and three ideas to start from */
.ch-durs { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ch-durs::-webkit-scrollbar { display: none; }
.ch-durs button { flex: none; padding: 0 12px; }
.ch-starters { display: flex; flex-direction: column; gap: 6px; }
.ch-starters button { text-align: left; height: auto; min-height: 36px; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--line-strong);
  background: transparent; color: var(--muted); font-size: 13.5px; line-height: 1.35; }
.ch-starters button:hover { border-color: var(--primary); color: var(--ink); }
.ch-starters button { display: block; width: 100%; justify-content: flex-start; }
.ch-q:has(#chWhat:not(:placeholder-shown)) .ch-starters { display: none; }

/* D525: the end-to-end review */
.ch-desk { min-width: 0; overflow: hidden; }
.ch-desk > * { min-width: 0; max-width: 100%; }
html:not([data-layout="pro"]).alerts-open .bellbtn { position: relative; z-index: 71; }
.ch-ref { padding-top: 0; }
.ch-ref button { top: 6px; right: 6px; width: 24px; height: 24px; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.ch-ref .ch-vid, .ch-ref img { overflow: hidden; }
.ch-confirm { margin: 4px 0 14px; font-size: 15px; line-height: 1.5; }
#chGo:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 899px) { .ch-starters { flex-wrap: wrap; overflow: visible; } .ch-starters button { max-width: 100%; white-space: normal; } }
@media (max-width: 899px) { .ch-desk { padding: 0 12px; box-sizing: border-box; } }

/* D528: a clip already made, used as a block */
.ch-src button { flex: 1 1 0; }
/* the founder (18/11/2026): "Choose a clip" is a sideways row that snaps, like every gallery in the app,
   not a grid to scroll down into empty space */
.ch-mine { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; padding: 2px 2px 10px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.ch-mine > .ch-mclip { flex: 0 0 min(170px, 46vw); scroll-snap-align: start; }
.ch-mclip { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink); text-align: left; min-width: 0; }
.ch-mclip.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
/* the founder (18/11/2026): the clip picked in Use a clip I made plays where it can be seen, above the
   list; it stays put while the list scrolls, and a picture letterboxes inside its own frame */
.ch-pickprev { position: sticky; top: 0; z-index: 3; background: var(--panel); margin: 0 -20px; padding: 0 20px 10px; }
.ch-pickprev:empty { display: none; }
.ch-pickcard { display: grid; gap: 6px; }
.ch-pickvid { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 12px; }
.ch-pickcap { display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 40px; }
.ch-pickcap b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pickcap small { font-size: 12.5px; color: var(--muted); }
.ch-pickframe { position: relative; height: min(24vh, 210px); border-radius: 12px; overflow: hidden; }
.ch-pickhint { margin: 0; height: 100%; display: flex; align-items: center; justify-content: center; padding: 12px; box-sizing: border-box; text-align: center; font-size: 13px; color: var(--muted); border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 12px; }
.ch-pickgo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer; }
.ch-pickgo[hidden] { display: none; }
.ch-pickgo svg { width: 26px; height: 26px; fill: currentColor; margin-left: 3px; }
.ch-pickerr { position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.74); color: var(--warn); font-size: 12.5px; line-height: 1.35; text-align: center; }
.ch-pickerr[hidden] { display: none; }
.ch-mpic { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: var(--ar, 1.778); max-height: 200px; border-radius: 8px; background: var(--raised); overflow: hidden; color: var(--muted); }
.ch-mpic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.ch-mpic svg { width: 22px; height: 22px; opacity: .6; }
.ch-mname { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-mtag { font-size: 12px; color: var(--muted); }

/* D540: attachments waiting above the message box */
.ch-attachrow { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; }
.ch-attachrow:empty { display: none; }
.ch-attachrow { padding-top: 8px; }
@media (min-width: 900px) { .ch-attachrow { padding-left: max(16px, calc((100% - 760px) / 2)); padding-right: max(16px, calc((100% - 760px) / 2)); } }
.ch-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 34px; padding: 0 4px 0 10px; border-radius: 17px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); font-size: 13px; }
.ch-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-chip svg { width: 16px; height: 16px; flex: none; }
.ch-chip button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; flex: none; }
.ch-chip.busy { opacity: .7; padding-right: 10px; }
/* D542: delete a project from the list */
.ch-row { display: flex; align-items: center; gap: 2px; }
.ch-row .ch-item { flex: 1; min-width: 0; }
.ch-del { flex: none; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; color: var(--faint); border-radius: 10px; opacity: .55; }
.ch-row:hover .ch-del, .ch-del:focus-visible { opacity: 1; }
.ch-del:hover { color: var(--danger, #e5484d); background: var(--panel); }
@media (hover: none) { .ch-del { opacity: .8; } }
.ch-del svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* D543: a block being made, step by step */
.ch-livesheet { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.ch-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--faint); }
.ch-steps li { position: relative; padding-left: 24px; }
.ch-steps li::before { content: ''; position: absolute; left: 4px; top: 5px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-strong); }
.ch-steps li.done { color: var(--muted); }
.ch-steps li.done::before { background: var(--primary); border-color: var(--primary); }
.ch-steps li.now { color: var(--ink); font-weight: 600; }
.ch-steps li.now::before { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }

/* D544: what a block cost, on its frame */
.ch-frame .ch-cost { display: block; margin-top: 2px; font-size: 11px; color: #a9a39a; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* D546: the phone's bottom bar never floats while the page scrolls. No script moves it; what
   moved it was the browser itself: a fixed bar with a backdrop blur is repainted late while the
   toolbar of a phone browser collapses or springs back, so for a moment it rode above the screen's
   edge with the page showing under it. The bar sits on a layer of its own, pinned to all three
   edges, without the blur (it is 96 percent opaque anyway), and its own colour runs on below it,
   so even a frame the browser lays out late shows the bar and never the page. */
@media (max-width: 899px) {
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden; -webkit-backface-visibility: hidden; will-change: transform;
    backdrop-filter: none; -webkit-backdrop-filter: none; }
  nav.tabs::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 160px;
    background: inherit; pointer-events: none; }
}

/* D547: a block being dragged rides above the strip; the others slide to open its gap */
#chReel .ch-frame[data-n] { touch-action: pan-x; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#chReel.ch-reordering { scroll-snap-type: none; }
/* lane RS: the reel strip does not snap. Measured in Chromium at 390 px: with proximity snapping a
   swipe of 40 px rested back where it began (block 1), on both roads; a strip of small tiles is read
   by eye, so it rests exactly where his thumb and its glide leave it */
#chReel { scroll-snap-type: none; }
/* lane RS: a block lifted by a thumb holds the strip still under it (a phone may have begun its own pan) */
#chReel.ch-touchdrag { overflow-x: hidden; }
#chReel.ch-reordering .ch-frame { transition: transform .16s ease; }
#chReel .ch-frame.ch-dragging { z-index: 5; transition: none; opacity: .92; cursor: grabbing;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45)); }

/* D552: the founder, 13 November 2026: "bottom nav bar in mobile view is having a lot of
   height, its atleast 10% of entire screen". It was 63 px plus the iPhone's 34 px home
   strip, about 97 px of an 844 px screen. Now 48 px of buttons, the highlight inside them
   with no margin, and the home strip tucked to what the indicator itself needs. */
@media (max-width: 899px) {
  html[data-layout] nav.tabs { padding: 0 6px max(0px, calc(env(safe-area-inset-bottom) - 18px)); gap: 0; }
  html[data-layout] nav.tabs .navbtn { min-height: 48px; padding: 4px 2px 2px; gap: 1px; margin: 0; }
  html[data-layout] nav.tabs .navbtn[aria-current="page"] { margin: 0; }
  html[data-layout] nav.tabs .navbtn svg { width: 21px; height: 21px; }
  html[data-layout="simple"] nav.tabs .navbtn[aria-current="page"] svg { width: 44px; height: 25px; padding: 2px 11px; }
  html[data-layout] nav.tabs .navbtn .badge.sxbadge, html[data-layout] nav.tabs .navbtn .badge { top: 1px; }
}

/* D560, D561: the progress card in the thread and a block's speed */
.ch-progcard { display: flex; flex-direction: column; gap: 8px; width: min(340px, 100%); margin-top: 8px; padding: 12px; border-radius: 14px;
  background: var(--surface-2, rgba(127,127,127,.08)); border: 1px solid var(--line, rgba(127,127,127,.2)); }
.ch-progcard .ch-live { width: 100%; padding: 0; background: none; border: 0; }
.ch-pctop { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.ch-steps.row { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.ch-steps.row li { padding-left: 16px; }
.ch-steps.row li::before { left: 0; top: 4px; width: 8px; height: 8px; }
.ch-speedtag { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--accent-soft, rgba(49,103,237,.15)); color: var(--primary, #3167ed); }
.ch-speeds { flex-wrap: wrap; }
/* the clip to copy: one row, its remove button a true circle whatever the phone's tap rules */
.ch-copyclip { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--raised);
  border: 1px solid var(--line-strong); }
.ch-copythumb { flex: 0 0 auto; width: 72px; height: 48px; border-radius: 10px; display: grid; place-items: center;
  background: var(--field); color: var(--ink); }
.ch-copythumb svg { width: 18px; height: 18px; }
.ch-copymeta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-copymeta b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-copymeta small { font-size: 12.5px; color: var(--muted); }
button.ch-copyx { flex: 0 0 40px; width: 40px; height: 40px; min-width: 40px; min-height: 40px; max-height: 40px; padding: 0;
  border-radius: 50%; aspect-ratio: 1; display: grid; place-items: center; background: transparent; color: var(--muted);
  border: 1px solid var(--line-strong); box-shadow: none; }
button.ch-copyx:hover, button.ch-copyx:active { color: var(--ink); background: var(--field); }
button.ch-copyx svg { width: 16px; height: 16px; }
.ch-ref button { min-width: 0; min-height: 0; max-height: 26px; aspect-ratio: 1; }
.ch-seg.ch-src { flex-wrap: wrap; }
.ch-src button { min-width: 0; white-space: normal; }
.ch-upbar { display: block; height: 6px; margin: 6px 0 2px; border-radius: 3px; background: var(--field); overflow: hidden; }
.ch-upbar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--primary, #3167ed); transition: width .25s ease; }
.ch-upbar.reading i { width: 100% !important; animation: ch-uppulse 1.2s ease-in-out infinite; }
@keyframes ch-uppulse { 50% { opacity: .45; } }
/* D567: the reel's text-only actions read as buttons */
.ch-remove { border: 1px solid color-mix(in srgb, var(--bad) 50%, transparent) !important; background: var(--bad-soft) !important; color: var(--bad) !important; font-weight: 600; }
.ch-acts button.ghost, .ch-modal button.ghost { border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); }

/* D569: the brand, ITTIHAAS over AI FILM STUDIO at the same width */
html[data-layout="simple"] .appname { display: inline-flex; flex-direction: column; align-items: stretch; width: max-content; line-height: 1; gap: 3px; }
.appname .an-big { font-weight: 800; font-size: 18px; letter-spacing: .14em; color: var(--ink); margin-right: -.14em; }
.appname .an-small { display: flex; justify-content: space-between; font-size: 7.5px; font-weight: 650; color: var(--muted); }
.appname .an-small i { font-style: normal; }
/* D569: Create and Studio beside the bell, in the Simple layout only */
.topbtn { display: none; }
html[data-layout="simple"] .topbtn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; font-weight: 650; }
html[data-layout="simple"] .topbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-layout="simple"] .topbtn.cog { width: 40px; padding: 0; justify-content: center; }
@media (max-width: 480px) { html[data-layout="simple"] .topbtn.create span { display: none; } html[data-layout="simple"] .topbtn.create { width: 40px; padding: 0; justify-content: center; } }
/* D569: the block's number at its edge, its length and quality in the middle under it */
.ch-cap.ch-cap3 { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; }
.ch-cap.ch-cap3 > b { justify-self: start; }
.ch-cap3 .ch-mid { display: inline-flex; align-items: center; gap: 6px; justify-self: center; }
.ch-acts .ch-remove { margin-top: 0; align-self: auto; }

/* D570: no page has a bottom bar on a phone; the top bar is the brand, Create, Studio and the bell */
@media (max-width: 899px) {
  html[data-layout="simple"] nav.tabs { display: none !important; }
  /* BB: main's bottom padding is set once, with the home strip, at the end of this file */
}
html[data-layout="simple"] header.top #me, html[data-layout="simple"] header.top .askbtn,
html[data-layout="simple"] header.top .themebtn, html[data-layout="simple"] header.top .signoutbtn { display: none !important; }
html[data-layout="simple"] header.top { gap: 8px; }
html[data-layout="simple"] header.top .appname { cursor: pointer; }
/* NR (N3): the brand's tap target is 44 px tall; the margin gives back what the padding adds, so it looks the same */
html[data-layout="simple"] header.top .appname { box-sizing: border-box; min-height: 44px; justify-content: center; padding-block: 7px; margin-block: -7px; }
html[data-layout="simple"] header.top .topbtn, html[data-layout="simple"] header.top .bellbtn { height: 40px; min-height: 40px; border-radius: 12px; flex: none; }
html[data-layout="simple"] header.top .topbtn.cog, html[data-layout="simple"] header.top .bellbtn { width: 40px; min-width: 40px; padding: 0; }
html[data-layout="simple"] header.top .topbtn.cog { border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); }
html[data-layout="simple"] header.top .bellbtn { border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); }
/* D570: one brand on a desk, in the top bar; the rail keeps the places */
html[data-layout="simple"] nav.rail .brand, html[data-layout="simple"] .rail > .brand { display: none; }
/* D571: who can open a project */
.ch-access { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.ch-check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised); cursor: pointer; }
.ch-check input { width: 20px; height: 20px; accent-color: var(--primary); }
#chDelGo:disabled { opacity: .45; cursor: not-allowed; }
/* D572: the first block never touches the edge, even when the strip has scrolled */
.ch-reel { scroll-padding-inline: 16px; }
@media (max-width: 899px) { .ch-reel { scroll-padding-inline: 14px; padding-left: 14px; padding-right: 14px; } }
.ch-cap.ch-cap3 > b { margin-left: 2px; }
/* D572: hide or show the camera reel */
.ch-reelbar.folded { display: none; }
.ch-fold { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); flex: none; }
.ch-fold svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 480px) { .ch-fold span, .ch-play span { display: none; } .ch-fold, .ch-play { width: 40px; padding: 0; justify-content: center; } }
/* D573: the notifications page */
.view.v-notices { display: none; max-width: 760px; margin: 0 auto; }
body[data-view="notices"] .view.v-notices { display: block; }
.v-notices #alertBar { display: block !important; position: static !important; width: auto !important; max-height: none !important; padding: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.v-notices #alertBar::before { content: none !important; }
.v-notices #alertBar .alert { margin: 0 0 10px; border-radius: 14px; }
.nt-h { font-size: 15px; margin: 22px 0 10px; color: var(--muted); font-weight: 650; }
.nt-list { display: flex; flex-direction: column; gap: 8px; }
.nt-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.nt-row.unread { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.nt-w { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nt-w span { font-size: 13px; color: var(--muted); }
.nt-acts { margin-top: 14px; }
@media (max-width: 560px) { .nt-row { flex-direction: column; align-items: stretch; } }

/* D579: a test's measured result and the listener's 1 to 5 */
.ch-trows { display: grid; gap: 4px; margin: 8px 0 0; font-size: 13px; }
.ch-trows > div { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2, rgba(255,255,255,.04)); }
.ch-trows dt { color: var(--muted, #9aa0a6); margin: 0; }
.ch-trows dd { margin: 0; overflow-wrap: anywhere; }
.ch-trows .ok dd { color: var(--ok, #3fb37f); }
.ch-trows .bad dd { color: var(--bad, #e5534b); }
.ch-trows .warn dd { color: var(--warn, #d9a441); }
.ch-rate { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ch-rate button { width: 40px; height: 40px; min-width: 40px; border-radius: 10px; padding: 0; font-weight: 600; }
.ch-rate button.on { background: var(--primary, #3167ed); color: #fff; border-color: transparent; }
.ch-rate small { color: var(--muted, #9aa0a6); margin-left: 4px; }
/* D579: a test's state under its plan, a compared test's parts, and the cost line of making one */
.ch-teststate { display: block; margin-top: 6px; }
.ch-testcost { display: block; margin-top: 6px; max-width: 60ch; }
.ch-arms { margin-top: 8px; }
.ch-armsay { margin: 6px 0 0; font-weight: 600; }
.ch-testplanned { margin: 8px 0 0; }

/* ---------------------------------------------------------------- P7, the chat's screen faults (15/11/2026) */

/* row 1: New chat opens on a grid of what can be started; one column on a phone, three on a desk */
.ch-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 760px; }
.ch-choice { display: flex; align-items: center; justify-content: flex-start; gap: 12px; min-height: 64px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; white-space: normal; height: auto; }
.ch-choice:hover, .ch-choice.on { border-color: var(--primary); background: var(--accent-soft); }
.ch-cico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--raised); color: var(--primary); }
.ch-cico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ch-ctext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch-ctext b { font-size: 15px; font-weight: 650; line-height: 1.3; }
.ch-ctext small { font-size: 12.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
@media (max-width: 899px) { .ch-choices { grid-template-columns: minmax(0, 1fr); } }

/* row 8: the state is a dot and one word inside the tile; the strip's start padding is its gap */
.ch-state { left: 4px; top: 4px; right: auto; max-width: calc(100% - 8px); display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px 2px 5px;
  font-size: 10.5px; line-height: 1.3; overflow: hidden; white-space: nowrap; box-sizing: border-box; }
.ch-state > i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ch-reel { gap: 10px; padding-left: 10px; padding-right: 10px; scroll-padding-inline: 10px 112px; }
@media (max-width: 899px) { .ch-reel { gap: 10px; padding-left: 10px; padding-right: 10px; scroll-padding-inline: 10px 112px; } }

/* row 12: a labelled + Block handle, 44 px tall, held in view at the strip's right end */
.ch-frame.ch-addbtn { position: sticky; right: 0; z-index: 3; align-self: center; flex-direction: row; align-items: center; justify-content: center; gap: 6px;
  height: 44px; min-height: 44px; padding: 0 14px; margin-left: auto; border-radius: 12px; background: var(--primary); color: var(--primary-ink, #fff);
  font-weight: 650; font-size: 14px; box-shadow: 0 0 0 6px #08090b; white-space: nowrap; }
.ch-frame.ch-addbtn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.ch-frame.ch-addbtn:hover { filter: brightness(1.08); }
/* D621 (the founder, 18/11/2026): on a phone the + Block handle is the + alone, a 44 px square;
   the word stays on a desk, and the button's aria-label names it on every width. Cancel in a
   move keeps its word. */
@media (max-width: 899px) {
  .ch-frame.ch-addbtn:not(.ch-movecancel) { width: 44px; min-width: 44px; padding: 0; gap: 0; }
  .ch-frame.ch-addbtn:not(.ch-movecancel) > span { display: none; }
}

/* row 10: Delete is the sheet's last row, apart from the form */
.ch-delrow { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.ch-foot:has(+ .ch-delrow) { margin-bottom: 0; bottom: 0; }

/* row 6: every control in the chat is at least 44 x 44 */
.ch-back, .ch-menu, .ch-del { width: 44px; height: 44px; min-width: 44px; }
.ch-play, .ch-fold { min-height: 44px; height: 44px; }
.ch-acts button, .ch-acts .btn, .ch-seg button, .ch-danger .danger, .ch-remove { min-height: 44px; height: auto; }
.ch-chip { height: 44px; border-radius: 22px; }
.ch-chip button { width: 44px; height: 44px; margin-right: -4px; }
.ch-ref button { width: 44px; height: 44px; top: 0; right: 0; background: transparent; }
.ch-ref button svg { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: rgba(0,0,0,.65); box-sizing: content-box; }
.ch-ref input { height: 44px; }
.bellbtn { width: 44px; height: 44px; }
@media (max-width: 899px) { .ch-play { width: 44px; } }
.ch-rate button { width: 44px; height: 44px; min-width: 44px; }
button.ch-copyx { flex-basis: 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; max-height: 44px; }
/* row 6: the top bar's Create, Studio and bell are 44 x 44 */
html[data-layout="simple"] .topbtn, html[data-layout="simple"] header.top .topbtn, html[data-layout="simple"] header.top .bellbtn { height: 44px; min-height: 44px; }
html[data-layout="simple"] .topbtn.cog, html[data-layout="simple"] header.top .topbtn.cog, html[data-layout="simple"] header.top .bellbtn { width: 44px; min-width: 44px; }
@media (max-width: 480px) { html[data-layout="simple"] .topbtn.create { width: 44px; min-width: 44px; } }
@media (max-width: 899px) { .ch-fold { min-width: 44px; justify-content: center; } }

/* Z15: the old Studio assistant row lives in a slot today's list fills (the inbox has its own) */
.ch-assistslot { display: contents; }

/* the walk (WK): "+ Block" is white words on the primary at 14 px and needs 4.5:1; the Simple
   layout's primary gives 3.8:1, so it takes the primary darkened (the same hue) */
.ch-frame.ch-addbtn { background: color-mix(in srgb, var(--primary) 85%, #000); }

/* L5 (a): inside an open chat the app's own offline banner steps aside, so it never covers the
   chat's header, its back button or its name; the chat's own line above the box says it once
   (composer.js reads the banner's state), and a message kept to send says it on its bubble */
body.desk-on .offlinebar.on { display: none; }
@media (min-width: 900px) { body:has(#chDesk #desk) .offlinebar.on { display: none; } }
@media (max-width: 899px) { html.ch-in-chat body:has(#chDesk #desk) .offlinebar.on { display: none; } }

/* L6: the chat's sheets are opaque. The page's #sheet came in on an opacity fade, so the thread
   showed through its rows while it opened; inside the chat the scrim is firmer and the sheet's
   surface is solid from its first frame (it slides, it never fades). The film player, the picture
   viewer and the review sheet are other overlays and keep their own look */
:is(body.desk-on, body:has(#chDesk #desk)) #sheet.sheet { background: rgba(0, 0, 0, calc(.74 * var(--dim, 1))); }
:is(body.desk-on, body:has(#chDesk #desk)) #sheet.sheet.on { animation: ch-scrim-in .2s ease both; }
:is(body.desk-on, body:has(#chDesk #desk)) #sheet .sheetcard { background: var(--panel); opacity: 1; animation-name: ch-sheet-slide; }
.ch-modal { background: rgba(0, 0, 0, .74); }
.ch-modal .ch-card { background: var(--panel); opacity: 1; }
@keyframes ch-scrim-in { from { background-color: rgba(0, 0, 0, 0); } }
@keyframes ch-sheet-slide { from { transform: translateY(10px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  :is(body.desk-on, body:has(#chDesk #desk)) #sheet.sheet.on, :is(body.desk-on, body:has(#chDesk #desk)) #sheet .sheetcard { animation: none; }
}

/* Renew a lapsed draft and Make it real (the founder, 16/11/2026): the four ways of making a
   block sit two by two on a phone; the read-back's rows sit under the clip they read, each with
   its verdict as a dot and the reader's words; a warning sits above the button it is about */
@media (max-width: 899px) { .ch-seg.ch-src button { flex: 1 1 calc(50% - 3px); } }
.ch-exp.lapsed { color: var(--warn); }
.ch-exp.renew { color: var(--muted); }
.ch-renew { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.ch-renew button { min-height: 44px; height: auto; padding: 8px 16px; border-radius: 12px; font-weight: 600; }
.ch-renew .ch-hint, .ch-renewno { margin: 0; }
.ch-warn { margin: 0 0 6px; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4;
  background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); color: var(--ink); width: 100%; }
.ch-readback { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2, var(--raised)); border: 1px solid var(--line); max-width: 100%; }
.ch-readback b { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.ch-readback ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ch-readback li { position: relative; padding-left: 16px; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.ch-readback li::before { content: ''; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ch-readback li.rb-yes::before { background: var(--ok); }
.ch-readback li.rb-partly::before { background: var(--warn); }
.ch-readback li.rb-no::before { background: var(--bad); }
.ch-readback.pending li { color: var(--muted); }
.ch-realsrc { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-realsrc .ch-upload { background: none; font: inherit; min-height: 44px; }
.ch-realwhy { margin: 0; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.ch-realwhy.bad { color: var(--bad); }
.ch-realplan:empty { display: none; }
#chRealGo[hidden] { display: none; }

/* N3 (b): a lifted block is plain to see: it grows, casts a shadow and the others dim */
#chReel .ch-frame.ch-dragging { transform-origin: center; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .55)); opacity: 1; }
#chReel.ch-reordering .ch-frame[data-n]:not(.ch-dragging) { opacity: .55; }
/* N3 (a): the move state. The block being moved reads "moving"; a target at least 44 px wide
   stands wherever it could go; the strip scrolls freely with a thumb; the + is Cancel */
#chReel .ch-target { flex: none; align-self: stretch; width: 56px; min-width: 44px; min-height: 44px; margin: 0; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; border-radius: 12px; cursor: pointer;
  border: 2px dashed var(--primary, #2f7ff5); background: color-mix(in srgb, var(--primary, #2f7ff5) 14%, transparent);
  color: inherit; font: 600 12px/1.2 var(--font, inherit); text-align: center; touch-action: pan-x; }
/* NR (N2): in the move state the strip never snaps. Its first child is the target before block 1,
   so block 1's snap point (about 68 px in) held the strip there: the first target never came fully
   on screen and every touch pulled the strip back under the finger, so the tap on Put here missed */
#chReel:has(.ch-target) { scroll-snap-type: none !important; }
#chReel .ch-target:focus-visible { outline: 3px solid var(--primary, #2f7ff5); outline-offset: 2px; }
#chReel .ch-frame.ch-movesrc .ch-pic { outline: 3px solid var(--primary, #2f7ff5); outline-offset: 2px; opacity: .8; }
/* N1: the plain question before an accepted block's clip is changed */
.ch-ask { margin: 4px 0 14px; font-size: 15px; line-height: 1.5; }
.ch-earlier { margin: 0 0 10px; }

/* N4: on a phone an open chat (and the chat list) on Home is a layer of its own, fixed from under
   the header to the bottom edge of what the screen shows; the page behind does not scroll and
   the box's bar runs to the edge with the safe area as its bottom padding (D546's way). The
   keyboard is followed by the visual viewport (--ch-kb, --ch-vvt), as the app's sheets do. */
@media (max-width: 899px) {
  html.ch-layer, html.ch-layer body { overflow: hidden; overscroll-behavior: none; }
  html.ch-layer #chShell { position: fixed; left: 0; right: 0; top: calc(var(--ch-top, 0px) + var(--ch-vvt, 0px));
    bottom: var(--ch-kb, 0px); height: auto !important; min-height: 0; z-index: 4; }
  html.ch-layer #chShell .ch-main, html.ch-layer #chShell .ch-side { height: 100%; min-height: 0; overflow: hidden; }
  html.ch-layer #chShell .ch-side { overflow-y: auto; overscroll-behavior: contain; }
  html.ch-layer #chShell #chDesk { padding-bottom: 0; }
  html.ch-layer #chShell #desk.desk-inline { height: auto !important; min-height: 0 !important; }
  html.ch-layer #chShell #desk.desk-inline .desk-foot { padding-bottom: var(--strip); background: var(--bg); }
  html.ch-layer #chShell .ch-compose { padding-bottom: var(--strip); }
  /* D623 (18/11/2026): stretched over the band, the layer reaches the screen's bottom edge like a
     bottom nav bar: its background runs to the edge and the box sits above the home indicator */
  html.ch-layer.stretch-app #chShell .ch-compose,
  html.ch-layer.stretch-app #chShell #desk.desk-inline .desk-foot { padding-bottom: max(var(--strip), env(safe-area-inset-bottom, 0px)); }
  /* BB: with the keyboard up the home strip is under the keyboard, so the box sits on it */
  html.ch-layer #chShell #desk.desk-inline.kbd .desk-foot { padding-bottom: 6px; }
  /* BB: Stretch (the Screen check) carries the layer over a band the window leaves at the
     bottom of an iOS home screen app; off unless the person turns it on */
  html.ch-layer.stretch-app #chShell { bottom: calc(var(--ch-kb, 0px) - var(--app-band, 0px)); }
  html.ch-layer #chShell .ch-scroll, html.ch-layer #chShell .desk-log { overscroll-behavior: contain; }
}

/* K15, K16 (17/11/2026): Save the file on every block, Save the reel, and Add a block after this.
   A save is a link drawn as a button (D567), 44 px tall, never wider than the screen */
.ch-savefile, a.ch-play.ch-savereel { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; min-height: 44px; box-sizing: border-box; }
.ch-savefile { padding: 0 16px; border-radius: 12px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); max-width: 100%; white-space: nowrap; }
.ch-savefile:hover, .ch-savefile:focus-visible { border-color: var(--primary); color: var(--primary); }
.ch-savefile.ch-savesmall { padding: 0 12px; font-size: 13.5px; }
.ch-saverow { margin-top: 8px; }
a.ch-play.ch-savereel svg, .ch-head .ch-savereel svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
a.ch-play.ch-savereel[hidden] { display: none; }
.ch-insrow { margin-top: 10px; }
.ch-acts .ch-insafter, .ch-acts .ch-insbefore { white-space: normal; }

/* MCP (18/11/2026): What happens, short, with More and Less (chats.js shortWords). The whole
   words stay in the page for a screen reader while folded; the eye sees the head and More. */
.ch-short .ch-sfull { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.ch-short.open .ch-sfull { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; clip-path: none; white-space: normal; }
.ch-short.open .ch-shead { display: none; }
.ch-short .ch-smore { display: inline-flex; align-items: center; justify-content: center; vertical-align: baseline; min-height: 32px; min-width: 44px;
  padding: 0 10px; margin: 0 0 0 2px; border: 0; border-radius: 999px; background: transparent; color: inherit;
  font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; box-shadow: none; }
.ch-short .ch-smore:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (max-width: 899px) { .ch-short .ch-smore { min-height: 44px; min-width: 44px; } }

/* BB: every page reaches the bottom edge (the founder, 18/11/2026: "in every page its like some invisible bottom nav bar is there not
   allowing platform to reach at bottom of screen"). On a phone every page reaches the bottom edge
   of the screen. There is no bottom bar in the Simple layout (D570), so nothing reserves room for
   one: a page ends on its own padding plus the home strip, the strip being the safe area less
   18 px and never under 6 px (D552), read once as --strip; the chat box's bar runs to the edge in
   its own colour with the input just clear of the strip (the N4 layer above); sticky footers,
   toasts and the chat's Back sit on the strip, never 76 to 96 px up where the old bar stood. */
:root { --strip: max(6px, calc(env(safe-area-inset-bottom, 0px) - 18px)); }
@media (max-width: 899px) {
  html[data-layout="simple"] main { padding-bottom: calc(24px + var(--strip)); }
  html[data-layout="simple"] :is(#vsForm, #psForm) .vs-go { bottom: 0; padding-bottom: calc(10px + var(--strip)); }
  html[data-layout="simple"] .itt-toasts { bottom: calc(12px + var(--strip)); }
  /* a toast on the bottom edge would sit on a sheet's own buttons: while a chat sheet is open it
     rides at the top, as it does over the app's own sheets (D475) */
  html[data-layout="simple"] body:has(.ch-modal.on) .itt-toasts { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; }
  html[data-layout="simple"] .toast { bottom: calc(16px + var(--strip)); }
  html[data-layout="simple"] .desk-back { bottom: calc(16px + var(--strip)); }
  html[data-layout="simple"] .swundo { bottom: calc(16px + var(--strip)); }
  /* the Professional layout keeps its bar (48 px plus the strip, D552): the page ends 24 px over it */
  html[data-layout="pro"] main { padding-bottom: calc(72px + var(--strip)); }
  /* the home screen app with Stretch on: a page's own colour runs over the band at the bottom */
  html.stretch-app, html.stretch-app body { min-height: calc(100% + var(--app-band, 0px)); }
}

/* the review of 18/11/2026: D622 took the Talking about pill away from a tapped block, so nothing said which
   block the typed words go to. Its number on the strip is marked instead: no pill to close, no state ring lost. */
.ch-frame.ch-inhand .ch-cap b { background: var(--primary, #3167ed); color: #fff; }

/* ---- K20 (lane N4K): how a block's 4K is made, two rows each with its price and one line ---- */
.ch-how4k { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 8px; }
.ch-howrow { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ch-howbtn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; height: auto;
  padding: 10px 16px; border-radius: 12px; text-align: left; font-weight: 600; white-space: normal; }
.ch-howbtn b { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ch-howprice { flex: 0 0 auto; font-weight: 600; opacity: .85; }
.ch-howrow .ch-hint, .ch-howrow .ch-no4k { margin: 0 4px; overflow-wrap: anywhere; }
.ch-no4k { overflow-wrap: anywhere; }
.ch-howgo { flex: 0 0 auto; opacity: .7; }
/* K19 (the founder, 18/11/2026): a block saves every size it holds and always a 480p; Save the
   reel is a sheet of the stitched reel's sizes, each prepared by the studio and saved when ready */
.ch-acts .ch-savesize { flex: 0 1 auto; }
.ch-rsizes { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.ch-rsize { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.ch-rsizehd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ch-rsizehd b { font-size: 15px; color: var(--ink); }
.ch-rsizehd span { font-size: 13.5px; color: var(--muted); }
.ch-rsizebody { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.ch-rstate { margin: 0; flex: 1 1 140px; min-width: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.ch-rstate.ch-rerr { color: var(--bad); }
.ch-rsize .ch-rprep, .ch-rsize .ch-rsave { min-height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 600; }
.ch-rsize .ch-rprep { border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); }
.ch-rbar { flex: 1 1 100%; height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.ch-rbar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .4s ease; }
button.ch-play.ch-savereel svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
button.ch-play.ch-savereel[hidden] { display: none; }
