/* The canvas page (public/canvas/index.html, public/js/canvas/main.js), from the Round 4 handoff (Batch 1): a top bar,
   a tool rail, the stage with the painting, a right panel, and the replay tracks. */
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('/fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url('/fonts/fredoka-latin-700-normal.woff2') format('woff2'); }
/* The text faces a painting may use (wire.js FONTS): subsets of OFL and Apache fonts (Latin, Greek, Cyrillic, symbols),
   licences beside them. The same files draw the agent's picture (worker/canvas/render.js), so both agree. */
@font-face { font-family: 'Fredoka'; font-weight: 300; font-display: swap; src: url('/fonts/canvas/Fredoka-300.ttf') format('truetype'); }
@font-face { font-family: 'Fredoka'; font-weight: 400; font-display: swap; src: url('/fonts/canvas/Fredoka-400.ttf') format('truetype'); }
@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url('/fonts/canvas/Fredoka-500.ttf') format('truetype'); }
@font-face { font-family: 'Noto Sans'; font-weight: 400; font-display: swap; src: url('/fonts/canvas/NotoSans-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Noto Sans'; font-weight: 700; font-display: swap; src: url('/fonts/canvas/NotoSans-Bold.ttf') format('truetype'); }
/* Backups for what the faces lack (wire.js textRuns): arrows and maths, symbols, Chinese and Japanese. Each loads only
   when a painting has a character in its range. Emoji are left to the viewer's own colour emoji. */
@font-face { font-family: 'Noto Sans Math'; font-display: swap; src: url('/fonts/canvas/NotoSansMath-Regular.ttf') format('truetype'); unicode-range: U+2190-22FF, U+27F0-27FF, U+2900-297F, U+2B00-2B2F; }
@font-face { font-family: 'Noto Sans Symbols 2'; font-display: swap; src: url('/fonts/canvas/NotoSansSymbols2-Regular.ttf') format('truetype'); unicode-range: U+2190-2BFF; }
@font-face { font-family: 'Noto Sans SC'; font-display: swap; src: url('/fonts/canvas/NotoSansSC-Regular.ttf') format('truetype'); unicode-range: U+3000-30FF, U+31F0-31FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF; }
@font-face { font-family: 'PT Serif'; font-weight: 400; font-display: swap; src: url('/fonts/canvas/PTSerif-Regular.ttf') format('truetype'); }
@font-face { font-family: 'PT Serif'; font-weight: 700; font-display: swap; src: url('/fonts/canvas/PTSerif-Bold.ttf') format('truetype'); }
@font-face { font-family: 'PT Serif'; font-weight: 400; font-style: italic; font-display: swap; src: url('/fonts/canvas/PTSerif-Italic.ttf') format('truetype'); }
@font-face { font-family: 'Space Mono'; font-weight: 400; font-display: swap; src: url('/fonts/canvas/SpaceMono-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Space Mono'; font-weight: 700; font-display: swap; src: url('/fonts/canvas/SpaceMono-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Gochi Hand'; font-display: swap; src: url('/fonts/canvas/GochiHand-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Permanent Marker'; font-display: swap; src: url('/fonts/canvas/PermanentMarker-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Abril Fatface'; font-display: swap; src: url('/fonts/canvas/AbrilFatface-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Bebas Neue'; font-display: swap; src: url('/fonts/canvas/BebasNeue-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 400; font-display: swap; src: url('/fonts/instrument-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 500; font-display: swap; src: url('/fonts/instrument-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 600 700; font-display: swap; src: url('/fonts/instrument-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Funnel Display'; font-weight: 600; font-display: swap; src: url('/fonts/funnel-display-latin-600-normal.woff2') format('woff2'); }
/* ---- Tokens: the site's (public/site.css), plus Round 4's. Light by default, dark when the system asks, and either
   when the ⋯ menu's Dark theme sets data-theme on <html>. The short names (--bg2, --panel, --pin-c, --hover, --field)
   are the older ones this file and the canvas scripts still use. ---- */
:root {
  --bg: #fbfbfa; --bg-2: #f1f1ef; --card: #ffffff; --ink: #19191b; --ink-2: #454543; --mute: #6b6b68; --line: #e3e3e0; --line-2: #cfcfcb;
  --accent: #1f3fd0; --accent-ink: #ffffff; --accent-soft: #e8ecfc; --accent-2: #c8371b; --pin-ink: #ffffff; --ok: #12784f; --warn: #8a4b00; --danger: #b4232f;
  --error: #b4233c; --error-ink: #ffffff; --pin-halo: rgba(200, 55, 27, .28);
  --frame: #19191b; --mat: #ffffff; --cv-mat: #ffffff;
  --dis: #b4b4b0; --skel: #e7e7e4; --sel-text: #c9d3fa; --frame-hair: rgba(25, 25, 27, .2);
  --shadow-hair: 0 1px 2px rgba(25, 25, 27, .08), 0 14px 28px -18px rgba(25, 25, 27, .4);
  --shadow-pop: 0 14px 32px -14px rgba(25, 25, 27, .35), 0 0 0 1px var(--line);
  --shadow-placard: 0 1px 2px rgba(25, 25, 27, .08);
  --hairline-inner: 0 0 0 1px rgba(25, 25, 27, .14);
  --scrim: rgba(25, 25, 27, .32); --track: #c9c9c5;
  --radius: 3px; --mono: ui-monospace, Menlo, Consolas, monospace;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif; --font-display: 'Funnel Display', 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --bg2: var(--bg-2); --panel: var(--card); --pin-c: var(--accent-2); --hover: var(--bg-2); --field: var(--card);
  /* The canvas page's frame: a hairline (Round 4 Q1). The homepage and gallery keep the heavy 5px edge. */
  --frame-edge: 1px solid var(--frame-hair); --shadow-frame: var(--shadow-hair);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121213; --bg-2: #19191b; --card: #222224; --ink: #f1f1f2; --ink-2: #cfcfd3; --mute: #9d9da3; --line: #2f2f32; --line-2: #3d3d41;
    --accent: #8fa4ff; --accent-ink: #121213; --accent-soft: #23284a; --accent-2: #ff8266; --pin-ink: #121213; --ok: #4fca95; --warn: #f0b35a; --danger: #ff7484;
    --error: #ff8f9e; --error-ink: #121213; --pin-halo: rgba(255, 130, 102, .3); --frame: #000000; --cv-mat: var(--card); --field: var(--bg-2);
    --dis: #55555a; --skel: #2a2a2d; --sel-text: #34407a; --frame-hair: #3d3d41;
    --shadow-hair: 0 18px 36px -20px rgba(0, 0, 0, .85); --shadow-pop: 0 16px 36px -12px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2);
    --shadow-placard: 0 1px 2px rgba(0, 0, 0, .4); --hairline-inner: 0 0 0 1px rgba(255, 255, 255, .08);
    --scrim: rgba(0, 0, 0, .55); --track: #4a4a50; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121213; --bg-2: #19191b; --card: #222224; --ink: #f1f1f2; --ink-2: #cfcfd3; --mute: #9d9da3; --line: #2f2f32; --line-2: #3d3d41;
  --accent: #8fa4ff; --accent-ink: #121213; --accent-soft: #23284a; --accent-2: #ff8266; --pin-ink: #121213; --ok: #4fca95; --warn: #f0b35a; --danger: #ff7484;
  --error: #ff8f9e; --error-ink: #121213; --pin-halo: rgba(255, 130, 102, .3); --frame: #000000; --cv-mat: var(--card); --field: var(--bg-2);
  --dis: #55555a; --skel: #2a2a2d; --sel-text: #34407a; --frame-hair: #3d3d41;
  --shadow-hair: 0 18px 36px -20px rgba(0, 0, 0, .85); --shadow-pop: 0 16px 36px -12px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2);
  --shadow-placard: 0 1px 2px rgba(0, 0, 0, .4); --hairline-inner: 0 0 0 1px rgba(255, 255, 255, .08);
  --scrim: rgba(0, 0, 0, .55); --track: #4a4a50; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; overflow: hidden; }
button, a.cv-btn, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cv-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
kbd { font: 400 12px/1 var(--font); color: var(--mute); }

/* ---- Buttons (component sheet B1·E) ---- */
.cv-pbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font: 600 15px/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; }
.cv-pbtn:hover { filter: brightness(1.08); }
.cv-pbtn:disabled { background: var(--line-2); color: var(--mute); filter: none; cursor: default; }
.cv-pbtn .ic { width: 16px; height: 16px; }
.cv-sbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: none; color: var(--ink); font: 500 15px/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; }
.cv-sbtn:hover { border-color: var(--ink-2); }
.cv-sbtn:disabled { border-color: var(--line); color: var(--dis); cursor: default; }
.cv-sbtn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cv-sbtn .ic { width: 16px; height: 16px; }
.cv-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.cv-wide { width: 100%; }
.cv-ibtn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: var(--radius); background: none; color: var(--ink-2); cursor: pointer; }
.cv-ibtn:hover, .cv-ibtn[aria-expanded="true"] { background: var(--bg-2); color: var(--ink); }
.cv-ibtn:disabled { color: var(--dis); background: none; cursor: default; }
.cv-ibtn .ic { width: 18px; height: 18px; }
.cv-tbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent); font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.cv-tbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.cv-tbtn:disabled { color: var(--mute); text-decoration: none; cursor: default; }
/* The older button class, still made by the feedback and review scripts. */
.cv-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: none; color: var(--ink); font: 500 14px/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; }
.cv-btn:hover { border-color: var(--ink-2); }
.cv-btn:disabled { border-color: var(--line); color: var(--dis); cursor: default; }
.cv-btn.cv-go, .cv-sbtn.cv-go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cv-btn.cv-go:hover, .cv-sbtn.cv-go:hover { filter: brightness(1.08); }

/* ---- Fields: hover, focus, disabled, and an error in --error with a "!" mark ---- */
.cv-field, .cv-select { min-height: 44px; min-width: 0; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--field); color: var(--ink); font: 400 15px/1.2 var(--font); }
.cv-select { padding-right: 32px; appearance: none; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b68' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; cursor: pointer; }
.cv-field:hover, .cv-select:hover { border-color: var(--ink-2); }
.cv-field:focus, .cv-select:focus { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.cv-field:disabled, .cv-select:disabled { background: var(--bg-2); color: var(--dis); border-color: var(--line); }
.cv-field[aria-invalid="true"] { border: 2px solid var(--error); padding: 0 11px; }
.cv-err { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; color: var(--error); font-size: 12px; line-height: 1.4; }
.cv-err::before { content: "!"; flex: none; display: grid; place-items: center; width: 14px; height: 14px; margin-top: 1px; border-radius: 3px; background: var(--error); color: var(--error-ink); font: 700 10px/1 var(--font); }
.cv-err a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Toggle (square): track 38 x 22, knob 16, the whole row is the target ---- */
.cv-tog, .cv-togrow { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cv-tog input, .cv-togrow input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.cv-tog > i, .cv-togrow > i { position: relative; flex: none; width: 38px; height: 22px; border-radius: 3px; background: var(--line-2); transition: background .12s; }
.cv-tog > i::after, .cv-togrow > i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 2px; background: var(--card); transition: left .12s; }
.cv-tog:hover input:not(:checked):not(:disabled) + i, .cv-togrow:hover input:not(:checked):not(:disabled) + i { background: var(--mute); }
.cv-tog input:checked + i, .cv-togrow input:checked + i { background: var(--accent); }
.cv-tog input:checked + i::after, .cv-togrow input:checked + i::after { left: 19px; background: var(--accent-ink); }
.cv-tog input:focus-visible + i, .cv-togrow input:focus-visible + i { outline: 3px solid var(--accent); outline-offset: 2px; }
.cv-tog input:disabled + i, .cv-togrow input:disabled + i { background: var(--line); }
.cv-tog input:disabled + i::after, .cv-togrow input:disabled + i::after { background: var(--bg-2); }
.cv-tog { min-height: 44px; font-size: 14px; color: var(--ink-2); }
.cv-tog > i { order: -1; }
.cv-togrow { justify-content: space-between; min-height: 44px; gap: 16px; }
.cv-togrow + .cv-togrow, .cv-togrow + .cv-static { margin-top: 12px; }
.cv-togrow > span, .cv-radio > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cv-togrow b, .cv-radio b { font-weight: 500; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.cv-togrow small, .cv-radio small { font-size: 13px; color: var(--mute); }
.cv-togrow.locked b, .cv-radio.locked b { color: var(--mute); }
.cv-static { cursor: default; }
/* The locked tag: what a plan unlocks. Choosing a locked option opens the pricing page. */
.cv-plan { display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border: 1px solid var(--accent); border-radius: 3px; color: var(--accent); font: 600 11px/1.3 var(--font); font-style: normal; }
.cv-plan .ic { width: 12px; height: 12px; }

/* ---- Radios: 18px ring, 8px dot ---- */
.cv-radio { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 6px 0; cursor: pointer; }
.cv-radio input { appearance: none; flex: none; width: 18px; height: 18px; margin: 2px 0 0; border: 1.5px solid var(--line-2); border-radius: 50%; background: var(--card); display: grid; place-items: center; cursor: pointer; }
.cv-radio input::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); }
.cv-radio input:checked { border-color: var(--accent); }
.cv-radio input:checked::before { transform: scale(1); }
.cv-radio input:disabled { border-color: var(--line); }
.cv-radio .cv-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--mute); font-size: 12px; padding-top: 2px; }
.cv-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mute); cursor: pointer; }
.cv-check input { appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--line-2); border-radius: 3px; background: var(--card); display: grid; place-items: center; cursor: pointer; }
.cv-check input:checked { background: var(--accent); border-color: var(--accent); }
.cv-check input:checked::before { content: ""; width: 9px; height: 5px; margin-top: -2px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg); }

/* ---- Top bar: wordmark · title · status · space · watching · Share · ⋯ · the primary action ---- */
.cv-top { flex: none; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: env(safe-area-inset-top) 16px 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 6; }
.cv-row2 { display: contents; }
.cv-back { display: none; }
.cv-home { display: inline-flex; align-items: center; gap: 3px; flex: none; padding-right: 16px; border-right: 1px solid var(--line); color: var(--ink); font: 600 20px/24px var(--font-display); letter-spacing: -.03em; text-decoration: none; }
.cv-home::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); align-self: flex-end; margin-bottom: 5px; }
.cv-title { flex: 0 1 auto; min-width: 0; display: flex; align-items: baseline; }
.cv-title h1 { margin: 0; min-width: 0; font: 600 16px/1.2 var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-status { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 9px; border: 1px solid var(--line); border-radius: 3px; font: 600 13px/1 var(--font); white-space: nowrap; }
.cv-status i { width: 8px; height: 8px; border-radius: 50%; }
.cv-status[data-state="live"] { color: var(--accent); }
.cv-status[data-state="live"] i { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: cvhalo 1.8s ease-out infinite; }
.cv-status[data-state="finished"] { color: var(--ink-2); }
.cv-status[data-state="finished"] i { background: var(--ink-2); }
.cv-status[data-state="replaying"] { color: var(--accent); }
.cv-status[data-state="replaying"] i { box-shadow: inset 0 0 0 2px var(--accent); }
.cv-status[data-state="offline"] { color: var(--mute); }
.cv-status[data-state="offline"] i { box-shadow: inset 0 0 0 1.5px var(--mute); }
.cv-stime { font-weight: 400; color: var(--mute); font-variant-numeric: tabular-nums; }
.cv-stime:empty { display: none; }
@keyframes cvhalo { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent), 0 0 0 3px var(--accent-soft); } 100% { box-shadow: 0 0 0 8px transparent, 0 0 0 3px var(--accent-soft); } }
.cv-gap { flex: 1; }
.cv-watch { flex: none; font-size: 13px; color: var(--mute); white-space: nowrap; }
.cv-top #share .ic { width: 16px; height: 16px; }
/* The owner's primary action is Share; everyone else's is "Take it from here", when the canvas allows it. */
body.cv-owner #share { order: 2; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
body.cv-owner #share:hover { filter: brightness(1.08); }
.cv-morebtn { order: 1; }
#remix, #signin { order: 2; }
@media (max-width: 1100px) { .cv-watch { display: none; } }
@media (max-width: 960px) { .cv-top #share:not(:only-child) { width: 44px; padding: 0; } .cv-top #share span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }

/* ---- The ⋯ menu ---- */
.cv-menu { position: fixed; top: 52px; z-index: 20; width: 264px; max-height: calc(100vh - 64px); overflow-y: auto; padding: 6px; background: var(--card); border-radius: 3px; box-shadow: var(--shadow-pop); }
.cv-menu hr { margin: 6px -6px; border: 0; border-top: 1px solid var(--line); }
.cv-mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 3px; background: none; color: var(--ink); font: 400 14px/1.2 var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.cv-mi .ic { width: 18px; height: 18px; color: var(--ink-2); }
.cv-mi > span { flex: 1; }
.cv-mi:hover { background: var(--bg-2); }
.cv-mi:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.cv-mi:disabled { color: var(--dis); cursor: default; background: none; }
.cv-mi:disabled .ic { color: var(--dis); }
.cv-mi kbd:empty { display: none; }
.cv-mi .cv-tick { visibility: hidden; color: var(--accent); }
.cv-mi[aria-checked="true"] .cv-tick { visibility: visible; }
.cv-micheck input { width: 18px; height: 18px; accent-color: var(--accent); }
.cv-menu .cv-phone { display: none; }
.cv-rail .cv-fbbtn, .cv-share { display: none; }
.cv-badge { position: absolute; top: 5px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 8px; background: var(--accent-2); color: var(--pin-ink); font: 700 10px/16px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
#mFeedback kbd { min-width: 20px; height: 20px; border-radius: 50%; background: var(--accent-2); color: var(--pin-ink); display: grid; place-items: center; font: 600 11px/1 var(--font); }

/* ---- The page: rail · stage · panel ---- */
.cv-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 60px minmax(0, 1fr) 300px; }
body[data-panel="settings"] .cv-wrap, body[data-panel="download"] .cv-wrap { grid-template-columns: 60px minmax(0, 1fr) 320px; }
body:not(.cv-draw) .cv-wrap { grid-template-columns: 0 minmax(0, 1fr) 300px; }
body:not(.cv-draw)[data-panel="settings"] .cv-wrap, body:not(.cv-draw)[data-panel="download"] .cv-wrap { grid-template-columns: 0 minmax(0, 1fr) 320px; }

/* Tool rail: 44 x 44 buttons with a tooltip on the right; Undo at the bottom. */
.cv-rail { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; border-right: 1px solid var(--line); background: var(--bg); min-height: 0; overflow: visible; z-index: 3; }
body:not(.cv-draw) .cv-rail { visibility: hidden; }
.cv-handtools { display: flex; flex-direction: column; gap: 4px; }
.cv-railgap { flex: 1; }
.cv-rail .cv-raildiv, .cv-rail .cv-layersbtn { display: none; }
.cv-tool { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: 3px; background: none; color: var(--ink-2); cursor: pointer; }
.cv-tool:hover { background: var(--bg-2); color: var(--ink); }
.cv-tool[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.cv-tool:disabled { color: var(--dis); background: none; cursor: default; }
.cv-tip { position: absolute; left: 52px; top: 50%; translate: 0 -50%; z-index: 30; display: none; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 3px; background: var(--ink); color: var(--bg); font: 400 12px/1.2 var(--font); white-space: nowrap; pointer-events: none; }
.cv-tip kbd { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.cv-tool:hover .cv-tip, .cv-tool:focus-visible .cv-tip { display: flex; }
.cv-tool:disabled .cv-tip { display: none; }

/* Stage: --bg-2, the painting in the middle; the drawing strip along its top while drawing. */
.cv-stage { grid-column: 2; grid-row: 1; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; background: var(--bg-2); overflow: clip; }
body.cv-stripon .cv-stage { padding-top: 84px; }
.cv-strip { position: absolute; left: 0; right: 0; top: 0; z-index: 4; height: 60px; display: flex; align-items: center; gap: 20px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.cv-sdiv { flex: none; width: 1px; height: 28px; background: var(--line); }
.cv-sgroup { flex: none; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); }
.cv-sgroup .cv-select { min-height: 42px; font-size: 14px; }
.cv-seg { flex: none; display: flex; height: 42px; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.cv-seg button { min-width: 44px; padding: 0 14px; border: 0; border-left: 1px solid var(--line-2); background: none; color: var(--ink); font: 400 14px/1 var(--font); cursor: pointer; }
.cv-seg button:first-child { border-left: 0; }
.cv-seg button:hover { background: var(--bg-2); }
.cv-seg button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cv-seg button:focus-visible { outline-offset: -3px; }
.cv-colors { flex: none; display: flex; align-items: center; }
.cv-colors button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.cv-colors button::before { content: ""; width: 24px; height: 24px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px var(--line-2); }
.cv-colors button[aria-checked="true"]::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.cv-colors .cv-teamcolor::before { border-radius: 50%; }
.cv-colors .cv-pick::before { background: none; box-shadow: none; border: 1px dashed var(--line-2); }
.cv-colors .cv-pick { color: var(--mute); position: relative; }
.cv-colors .cv-pick .ic { position: absolute; width: 14px; height: 14px; }
.cv-size { flex: none; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mute); }
.cv-size output { min-width: 40px; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 110px; height: 22px; background: none; cursor: pointer; --p: 10%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--p) 100% no-repeat, var(--line-2); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); }
.cv-strip .cv-tog { flex: none; }
/* The colour picker behind "+": every colour (and the team's), and any colour. */
.cv-palette { position: absolute; z-index: 8; top: 64px; width: 252px; padding: 10px; background: var(--card); border-radius: 3px; box-shadow: var(--shadow-pop); }
.cv-pgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.cv-pgrid button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px var(--line-2); cursor: pointer; }
.cv-pgrid button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.cv-pcustom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--mute); }
.cv-pcustom input { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line-2); border-radius: 3px; background: none; cursor: pointer; }

/* The painting: a hairline edge, an 8px mat, the soft shadow, all drawn outside it, so pins and pointers measure the
   painting itself. fitFrame (main.js) gives --fit-h: the height left once the rest of the stage is placed. */
.cv-frame { position: relative; flex: none; width: min(calc(100% - 18px), calc(var(--fit-h, 100vh - 260px) * var(--ar, 1.6))); aspect-ratio: 16 / 10; margin: 9px 0; overflow: hidden; background: #fbf7ee; touch-action: none;
  box-shadow: var(--hairline-inner), 0 0 0 8px var(--cv-mat), 0 0 0 9px var(--frame-hair), var(--shadow-hair); }
.cv-frame svg#art { display: block; width: 100%; height: 100%; isolation: isolate; }
.cv-frame.drawable { cursor: crosshair; }
.cv-placard { flex: none; display: flex; align-items: flex-start; gap: 12px; max-width: 100%; margin: 6px 0 0; }
.cv-pl { margin: 0; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-placard); font-size: 13px; color: var(--mute); max-width: 100%; }
.cv-pl b { font: 600 14px/1.3 var(--font); color: var(--ink); }
.cv-pl > span:not(:empty)::before { content: " · "; }
.cv-pl > span#plMeta::before { content: " · "; }
.cv-from a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cv-plvis { margin-left: auto; padding-top: 9px; font-size: 13px; color: var(--mute); white-space: nowrap; }
.cv-caption { margin: 0; min-height: 22px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); max-width: 100%; }
.cv-caption i { width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--accent)); flex: none; }
.cv-caption b { color: var(--pc, var(--accent)); font-weight: 600; }
.cv-caption[hidden] { display: flex !important; visibility: hidden; }

/* Drawing in: dashes for lines, a fade for fills (main.js sets --d). */
.cv-dr { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: cvdraw var(--d, 400ms) linear forwards; }
@keyframes cvdraw { to { stroke-dashoffset: 0; } }
.cv-fade { opacity: 0; animation: cvfade var(--d, 400ms) ease-out forwards; }
@keyframes cvfade { to { opacity: 1; } }
.cv-out { animation: cvout var(--d, 600ms) ease-in forwards; pointer-events: none; }
@keyframes cvout { to { opacity: 0; } }
.cv-cursor { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; transition: transform 220ms ease-out; }
.cv-cursor.follow { transition: none; }
.cv-cursor i { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #ffffff; border: 2px solid var(--pc, var(--accent)); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.cv-cursor span { position: absolute; left: 12px; top: -10px; white-space: nowrap; font: 600 12px/1 var(--font); color: #ffffff; background: var(--pc, var(--accent)); padding: 4px 7px; border-radius: 3px; }
body.cv-offline .cv-cursor { display: none; }

/* Loading: the frame and mat keep their size; the painting, title, placard and layer rows are --skel blocks. */
.cv-loading { position: absolute; inset: 0; background: var(--skel); }
body.cv-loading .cv-title h1, body.cv-loading .cv-pl { color: transparent !important; background: var(--skel); border-color: transparent; box-shadow: none; border-radius: 3px; }
body.cv-loading .cv-title h1 { width: 180px; height: 18px; }
body.cv-loading .cv-pl { width: 260px; height: 34px; }
body.cv-loading .cv-pl *, body.cv-loading .cv-plvis { visibility: hidden; }
body.cv-loading .cv-status, body.cv-loading .cv-watch, body.cv-loading #share, body.cv-loading #remix, body.cv-loading .cv-morebtn, body.cv-loading .cv-tracks > * { visibility: hidden; }
.cv-skel { height: 44px; margin: 0 0 4px; border-radius: 3px; background: var(--skel); list-style: none; }

/* Covers on the frame: a private or hidden canvas (the frame filled with --bg-2), and "waiting for the first stroke". */
.cv-cover { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; text-align: center; }
.cv-covercard { max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cv-covercard b { font: 600 24px/1.15 var(--font-display); letter-spacing: -.02em; color: var(--ink); }
.cv-covercard p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.cv-covercard p a { color: var(--accent); }
.cv-coveric { width: 28px; height: 28px; color: var(--ink-2); }
.cv-coverbtns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.cv-coverbtns:empty { display: none; }
body.cv-missing .cv-frame { background: var(--bg-2) !important; }
body.cv-missing #art, body.cv-missing .cv-pins, body.cv-missing .cv-placard, body.cv-missing .cv-caption { visibility: hidden; }
body:not(.cv-missing) .cv-cover { pointer-events: none; }
body:not(.cv-missing) .cv-covercard { padding: 24px; background: var(--card); box-shadow: var(--shadow-pop); border-radius: 3px; }
body:not(.cv-missing) .cv-coveric { display: none; }

/* The owner's empty canvas: "Now ask your AI", centred over the painting. */
.cv-ask { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 5; width: min(420px, calc(100% - 32px)); padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 12px; }
.cv-ask > b { font: 600 26px/1.1 var(--font-display); letter-spacing: -.02em; padding-right: 36px; }
.cv-ask .cv-x { position: absolute; top: 12px; right: 12px; }
.cv-asklede { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.cv-promptf { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 6px 6px 12px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg); }
.cv-promptf p { flex: 1; min-width: 0; margin: 0; font: 400 13px/1.45 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.cv-ask .cv-promptf span:first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cv-addr { display: block; word-break: break-all; color: var(--ink); }
.cv-addr:empty { display: none; }
.cv-conn { margin: 0; font-size: 13px; color: var(--mute); }
.cv-conn a { color: var(--accent); text-underline-offset: 3px; }
.cv-conn.ok { color: var(--ok); }

/* The offline notice, 16px from the top of the stage. Editing is paused until the room is back. */
.cv-offline { position: absolute; top: 16px; left: 50%; translate: -50% 0; z-index: 7; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 32px); padding: 8px 8px 8px 14px; background: var(--card); border: 1px solid var(--line-2); border-radius: 3px; box-shadow: var(--shadow-pop); }
body.cv-stripon .cv-offline { top: 76px; }
.cv-offline p { margin: 0; font-size: 14px; color: var(--ink-2); }
.cv-offline b { color: var(--ink); }
.cv-offline .ic { color: var(--ink-2); }

/* ---- Selection (public/js/canvas/tools.js draws it in the painting's SVG) ---- */
.cv-sel-box { fill: none; stroke: var(--accent); stroke-width: 1.5; pointer-events: none; filter: drop-shadow(0 0 1px rgba(255, 255, 255, .6)); }
.cv-sel-box.multi { stroke-dasharray: 5 4; }
.cv-sel-box.marquee { stroke-dasharray: 5 4; fill: color-mix(in srgb, var(--accent-soft) 25%, transparent); }
.cv-sel-item { fill: none; stroke: var(--accent); stroke-width: 1; pointer-events: none; }
.cv-sel-handle { fill: #ffffff; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.cv-sel-stem { stroke: var(--accent); stroke-width: 1.5; pointer-events: none; }
.cv-sel-turn { fill: #ffffff; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; }
#art.cv-selecting { cursor: default; }
.cv-selsize { position: absolute; z-index: 5; translate: -50% 0; padding: 3px 7px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); font: 600 11px/1.2 var(--font); font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap; }
.cv-selbar { position: absolute; z-index: 6; translate: -50% 0; display: flex; align-items: center; gap: 2px; padding: 4px; max-width: calc(100% - 16px); background: var(--card); border-radius: 3px; box-shadow: var(--shadow-pop); }
.cv-selname { margin: 0; padding: 0 10px 0 8px; display: flex; flex-direction: column; min-width: 0; max-width: 200px; }
.cv-selname b { font: 600 13px/1.3 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-selname small { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-selbar .cv-sdiv { margin: 0 4px; }
.cv-selbar input { min-height: 36px; width: 160px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--field); }
.cv-selbar .cv-ibtn { color: var(--ink); }
.cv-swatch { width: 18px; height: 18px; border-radius: 3px; background: var(--c, var(--ink)); box-shadow: inset 0 0 0 1px var(--line-2); }
.cv-type { position: absolute; z-index: 5; transform: translateY(-50%); min-width: 160px; padding: 6px 10px; border-radius: 3px; border: 2px solid var(--accent); background: rgba(255, 255, 255, .95); color: #19191b; font: 600 16px/1.2 system-ui, sans-serif; }

/* ---- Feedback pins (public/js/canvas/feedback.js): filled circles in --accent-2 with a number ---- */
.cv-pins { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cv-pin { --pin: var(--accent-2); position: absolute; translate: -50% -50%; pointer-events: auto; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; border: 2px solid #ffffff; background: var(--pin); color: var(--pin-ink); font: 600 12px/22px var(--font); cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform 140ms ease-out, box-shadow 140ms; }
.cv-pin:hover { transform: translateY(-1px); box-shadow: 0 6px 12px rgba(0, 0, 0, .35); }
.cv-pin:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cv-pin.on { box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px var(--accent-2); z-index: 1; }
.cv-pin.answered { --pin: var(--accent); color: var(--accent-ink); }
.cv-pin.done { --pin: var(--card); color: var(--mute); border-color: var(--mute); }
.cv-pin.ping { animation: cvping 900ms ease-out 2; }
@keyframes cvping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 70%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.cv-pin.ghost { pointer-events: none; animation: cvping 900ms ease-out infinite; }
.cv-area { position: absolute; border: 2px dashed var(--accent-2); background: color-mix(in srgb, var(--accent-2) 8%, transparent); border-radius: 3px; pointer-events: none; }
.cv-area.on, .cv-area.drawing { border-style: solid; background: color-mix(in srgb, var(--accent-2) 14%, transparent); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .18); }
.cv-area.done { border-color: var(--mute); background: none; }
.cv-frame.pinning { cursor: crosshair; outline: 3px solid var(--accent-2); outline-offset: -3px; }
.cv-cmode { position: absolute; left: 50%; top: 10px; translate: -50% 0; z-index: 3; display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 20px); padding: 4px 4px 4px 14px; background: var(--card); color: var(--ink); border: 1px solid var(--accent-2); border-radius: 3px; font-size: 13px; box-shadow: var(--shadow-pop); }
.cv-before { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.cv-frame.before::after { content: "Before"; position: absolute; left: 10px; bottom: 10px; z-index: 3; background: rgba(0, 0, 0, .7); color: #fff; padding: 3px 10px; border-radius: 3px; font-size: 12px; }
.cv-pop { position: absolute; z-index: 9; width: min(340px, calc(100% - 16px)); background: var(--card); color: var(--ink); border-radius: 3px; padding: 14px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 10px; max-height: min(70vh, 520px); overflow-y: auto; }
.cv-pop.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; border-radius: 3px 3px 0 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); max-height: 70vh; }
.cv-pop-h { font-size: 15px; }
.cv-pop-form { display: flex; flex-direction: column; gap: 8px; }
.cv-pop textarea { font: 400 14px/1.4 var(--font); color: var(--ink); background: var(--field); border: 1px solid var(--line-2); border-radius: 3px; padding: 10px 12px; resize: vertical; min-height: 44px; }
.cv-pop textarea:focus { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.cv-pop-row { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cv-chips button { font: 500 12px/1 var(--font); color: var(--ink); background: none; border: 1px solid var(--line-2); border-radius: 3px; padding: 7px 10px; cursor: pointer; }
.cv-chips button:hover { border-color: var(--ink-2); }
.cv-pop-head { position: relative; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); padding-right: 28px; }
.cv-pop-head b { color: var(--ink); }
.cv-pop-head .cv-x { position: absolute; top: -6px; right: -6px; background: none; border: 0; color: var(--mute); font-size: 22px; line-height: 1; padding: 4px; cursor: pointer; }
.cv-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cv-thread li { background: var(--bg); border-radius: 3px; padding: 8px 10px; }
.cv-thread li:first-child { background: none; padding: 0 2px; }
.cv-thread li:first-child p { font-size: 15px; font-weight: 500; }
.cv-thread li.ai { border-left: 3px solid var(--accent); }
.cv-thread b { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cv-thread b i { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.cv-thread b small { font-size: 10px; letter-spacing: .5px; background: var(--accent); color: var(--accent-ink); border-radius: 3px; padding: 1px 5px; }
.cv-thread p { margin: 3px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cv-thread .when { color: var(--mute); font-size: 11px; }
.cv-before-btn { user-select: none; -webkit-user-select: none; touch-action: none; }
.cv-before-btn.on { border-color: var(--accent-2); }
.cv-del-btn { margin-right: auto; }
.cv-fb-n { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-2); color: var(--pin-ink); font: 600 11px/1 var(--font); font-style: normal; }
.cv-fb-n.done, li.done .cv-fb-n { background: none; color: var(--mute); box-shadow: inset 0 0 0 2px var(--mute); }

/* ---- The right panel: Layers and feedback, This canvas, or Download ---- */
.cv-side { grid-column: 3; grid-row: 1; position: relative; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.cv-scrim, .cv-grab, .cv-phone { display: none; }
.cv-view { height: 100%; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px; }
body[data-panel="settings"] #viewLayers, body[data-panel="download"] #viewLayers { display: none; }
body:not([data-panel="settings"]) #settings, body:not([data-panel="download"]) #dlPanel { display: none; }
.cv-ph { flex: none; display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 0 0 0 12px; }
.cv-ph h2 { flex: 1; margin: 0; font: 600 16px/1.2 var(--font-display); letter-spacing: -.01em; }
.cv-ph h2 small { font: 500 13px var(--font); color: var(--mute); margin-left: 6px; }
.cv-none { margin: 0 12px 8px; font-size: 14px; color: var(--mute); }
#studio-status { margin: 4px 12px; font-size: 13px; color: var(--mute); }
#studio-status:empty { display: none; }

/* Layer rows: eye · thumbnail · name · tag · lock · chevron, 44px. Opening one shows its card under it. */
#studio-layers { list-style: none; margin: 0; padding: 0 0 4px; }
.cv-lrow { position: relative; display: flex; align-items: center; min-height: 44px; border-radius: 3px; cursor: pointer; }
.cv-lrow:hover { background: var(--bg-2); }
li.open > .cv-lrow { background: var(--bg-2); }
li.now > .cv-lrow { background: var(--accent-soft); }
li.sel > .cv-lrow { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cv-lrow:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.cv-lrow .cv-ibtn { width: 40px; color: var(--ink-2); }
.cv-lrow .cv-ibtn:hover { background: none; color: var(--ink); }
.cv-lthumb { flex: none; width: 30px; height: 20px; margin-right: 10px; border-radius: 2px; object-fit: cover; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); }
img.cv-lthumb { border: 1px solid var(--line-2); }
.cv-lname { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
li.now .cv-lname { font-weight: 600; }
li.off .cv-lname { color: var(--mute); }
.cv-ltag { flex: none; margin-left: 8px; font: 600 12px/1 var(--font); font-style: normal; color: var(--accent); }
.cv-ltag.next { color: var(--mute); font-weight: 400; }
.cv-llock { width: 16px; height: 16px; margin-left: 8px; color: var(--mute); }
.cv-lchev { transition: rotate .12s; }
li.open .cv-lchev .ic { rotate: 90deg; }
/* Someone who only watches: plain labels, a status dot and the name. */
.cv-lrow.plain { cursor: default; padding-left: 12px; gap: 10px; }
.cv-lrow.plain:hover { background: none; }
li.now > .cv-lrow.plain { background: var(--accent-soft); }
.cv-ldot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
li.now .cv-ldot { background: var(--accent); }
li.off .cv-ldot { background: none; box-shadow: inset 0 0 0 1.5px var(--mute); }
.cv-lrow.plain .cv-ltag { margin-right: 12px; }
.cv-lcard { display: grid; gap: 12px; margin: 4px 0 8px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 3px; }
.cv-lcard label, .cv-lcard .cv-lfield { display: grid; gap: 6px; font-size: 13px; color: var(--mute); }
.cv-lcard .cv-lval { display: flex; justify-content: space-between; align-items: center; }
.cv-lcard .cv-lval output { color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-lcard input[type="range"] { width: 100%; }
.cv-lacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cv-lacts .cv-sbtn { min-height: 44px; padding: 0 4px; gap: 5px; font-size: 13px; white-space: nowrap; min-width: 0; }
.cv-lacts .cv-sbtn .ic { width: 14px; height: 14px; }
.cv-lnote { margin: 0; font-size: 12px; color: var(--mute); }
.cv-objs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; max-height: 120px; overflow: auto; }
.cv-objs button { font-size: 12px; padding: 5px 8px; border-radius: 3px; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; }
.cv-objs button:hover { border-color: var(--accent); }
li.cv-newrow > .cv-lrow { background: var(--accent-soft); padding-left: 40px; cursor: default; }
li.cv-newrow input { flex: 1; min-width: 0; height: 36px; margin-right: 4px; padding: 0 8px; border: 0; border-radius: 3px; background: var(--card); box-shadow: 0 0 0 2px var(--accent); font-size: 14px; }
li.cv-newrow input::selection { background: var(--sel-text); }

/* Approval, feedback and "Pin feedback" at the bottom of the panel. */
.cv-approved { margin: 4px 12px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--card); font-size: 13px; color: var(--ok); display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.cv-approved.cv-stale { color: var(--warn); }
.cv-approved a { color: inherit; }
.cv-approved small { color: var(--mute); }
#approve { margin: 8px 12px 0; width: auto; }
.cv-fb { margin: 12px 4px 0; padding-top: 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.cv-fb .cv-ph { padding-left: 8px; margin: 0 -4px; }
.cv-fb-tip, .cv-fb-empty { margin: 0 8px; font-size: 13px; color: var(--mute); }
.cv-fb-ask { margin: 0 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cv-fb-list { list-style: none; margin: 0; padding: 0 4px; display: flex; flex-direction: column; gap: 8px; }
.cv-fb-item { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; padding: 14px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; font: inherit; }
.cv-fb-item:hover, li.on .cv-fb-item { border-color: var(--ink-2); }
.cv-fb-text { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.cv-fb-item small { grid-column: 2; color: var(--mute); font-size: 12px; }
.cv-fb-last { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cv-fb-last b { color: var(--ink); }
li.done .cv-fb-item { opacity: .7; }
.cv-fb-done { margin: 0 8px; }
.cv-pinbtn { flex: none; width: auto; align-self: stretch; margin: auto 4px 12px; position: sticky; bottom: 12px; box-shadow: 0 12px 0 var(--bg), 0 -12px 0 var(--bg); }
#viewLayers::after { content: ""; flex: none; height: 12px; }

/* This canvas: sections split by 1px rules; the panel scrolls. */
.cv-pbody { flex: 1; padding: 0 12px; }
.cv-sec { margin: 0; padding: 16px 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.cv-sec:first-child { border-top: 0; padding-top: 4px; }
.cv-sec legend, .cv-sec h3 { margin: 0 0 8px; padding: 0; font: 600 14px/1.3 var(--font); color: var(--ink); }
.cv-sec legend { float: left; width: 100%; }
.cv-sec legend + * { clear: both; }
.cv-note { margin: 0; font-size: 14px; color: var(--ink-2); }
.cv-note:empty { display: none; }
.cv-note a { color: var(--accent); }
.cv-painters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cv-painters:empty { display: none; }
.cv-painter { display: flex; align-items: center; gap: 6px; font-size: 13px; border: 1px solid var(--line); border-radius: 3px; padding: 4px 10px 4px 8px; }
.cv-painter i { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }
.cv-sub { margin: 4px 0 0; font-size: 13px; color: var(--mute); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cv-sub .cv-tbtn { min-height: 32px; }
.cv-inline { display: flex; gap: 8px; margin: 8px 0 0; }
.cv-inline .cv-field { flex: 1; }
.cv-linkf { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; padding: 0 8px 0 12px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--field); }
.cv-linkf input { flex: 1; min-width: 0; border: 0; background: none; font: 400 12px/1 var(--mono); color: var(--ink); }
.cv-linkf input:focus { outline: none; }
.cv-people { list-style: none; margin: 8px 0 0; padding: 0; }
.cv-people:empty { display: none; }
.cv-people li { display: flex; align-items: center; gap: 8px; min-height: 44px; border-top: 1px solid var(--line); font-size: 14px; }
.cv-people li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-people li small { color: var(--mute); }
.cv-people .cv-tbtn { min-height: 36px; font-size: 13px; }
.cv-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.cv-compare:empty { display: none; }
.cv-compare figure { margin: 0; font-size: 12px; color: var(--mute); }
.cv-compare img { width: 100%; border: 1px solid var(--line); }

/* Download: PNG sizes, transparency, other formats; the note and the button stay at the bottom. */
.cv-dl .cv-sec h3 { margin-bottom: 4px; }
.cv-dl .cv-radio { align-items: center; padding: 0; }
.cv-dl .cv-radio input { margin: 0; }
.cv-dl .cv-radio > span:not(.cv-meta) { flex: 1; }
.cv-dl .cv-radio .cv-meta { flex: none; }
.cv-dl .cv-radio:has(small) { padding: 6px 0; }
.cv-dl .cv-radio .cv-meta { padding: 0; }
.cv-pfoot { flex: none; position: sticky; bottom: 0; padding: 16px 12px max(16px, env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 24px 0 var(--bg); display: flex; flex-direction: column; gap: 12px; }
.cv-pfoot p { margin: 0; font-size: 13px; color: var(--ink-2); }
.cv-pfoot a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
.cv-progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.cv-progress progress { flex: 1; accent-color: var(--accent); }

/* ---- Replay tracks: one row per layer; hidden while This canvas or Download is open ---- */
.cv-tracks { flex: none; display: grid; grid-template-columns: 60px 180px minmax(0, 1fr) 110px; align-items: center; padding: 0 0 env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--bg); max-height: 32vh; overflow-y: auto; }
body[data-panel="settings"] .cv-tracks, body[data-panel="download"] .cv-tracks, body.cv-blank .cv-tracks, body.cv-missing .cv-tracks { display: none; }
.cv-play { justify-self: center; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); cursor: pointer; }
.cv-play:disabled { opacity: .4; cursor: default; }
.cv-play svg { width: 18px; height: 18px; fill: currentColor; }
.cv-play .pa, .cv-play.on .pl { display: none; }
.cv-play.on .pa { display: inline; }
.cv-tnames { list-style: none; margin: 0; padding: 0 0 0 14px; align-self: stretch; border-left: 1px solid var(--line); }
.cv-tnames li { position: relative; height: 26px; display: flex; align-items: center; padding-left: 14px; }
.cv-tnames li::before { content: ""; position: absolute; left: 0; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.cv-tnames li.now::before { background: var(--accent); }
.cv-tnames li.queued::before { background: none; box-shadow: inset 0 0 0 1.5px var(--mute); }
.cv-tnames button { max-width: 100%; height: 26px; padding: 0; background: none; border: 0; color: var(--ink-2); font: 400 12px/26px var(--font); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-tnames button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.cv-tnames li.now button { color: var(--accent); }
.cv-tbars { position: relative; height: calc(var(--rows, 1) * 26px); margin: 0 16px; cursor: pointer; touch-action: none; }
.cv-tbar { position: absolute; height: 6px; min-width: 3px; border-radius: 1px; background: var(--track); }
.cv-tbar.now { background: var(--accent); }
.cv-tbar.queued { background: none; outline: 1px dashed var(--line-2); outline-offset: -1px; }
.cv-thead { position: absolute; top: 13px; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); pointer-events: none; }
.cv-play.on ~ .cv-tbars .cv-thead { animation: cvhalo 1.8s ease-out infinite; }
.cv-tclock { margin: 0; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-left: 1px solid var(--line); font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.cv-tclock b { color: var(--ink-2); font-weight: 600; }
.cv-tclock b.live { color: var(--accent); }

/* ---- Toasts, the follow note, dialogs ---- */
.cv-toast { position: fixed; left: 50%; bottom: 120px; translate: -50% 0; z-index: 40; max-width: calc(100vw - 32px); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 3px; box-shadow: var(--shadow-pop); font-size: 14px; }
.cv-followed { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; overflow: hidden; padding-bottom: 12px; bottom: 170px; }
.cv-followbtns { display: flex; gap: 6px; }
.cv-followed .cv-btn { min-height: 32px; border-color: color-mix(in srgb, var(--bg) 40%, transparent); color: var(--bg); }
.cv-followed .cv-go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cv-followbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.cv-followed.counting .cv-followbar { animation: cvfollow 2600ms linear forwards; }
@keyframes cvfollow { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.cv-dialog { width: min(460px, calc(100% - 32px)); padding: 0 20px 20px; border: 0; border-radius: 3px; background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop); }
.cv-dialog::backdrop { background: var(--scrim); }
.cv-dialog .cv-ph { padding: 0; }
.cv-dialog .cv-ph form { margin: 0; }
.cv-dialog .cv-hint { color: var(--mute); font-size: 13px; margin: 0 0 10px; }
.cv-keys { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.cv-keys dt { text-align: right; }
.cv-keys dd { margin: 0; color: var(--ink-2); }
.cv-keys kbd { display: inline-block; min-width: 24px; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 3px; color: var(--ink); text-align: center; font-size: 12px; }
.cv-rv-note { display: grid; gap: 6px; font-size: 14px; }
.cv-rv-note small { color: var(--mute); }
.cv-rv-note textarea { background: var(--field); color: var(--ink); border: 1px solid var(--line-2); border-radius: 3px; padding: 8px 10px; resize: vertical; }
.cv-rv-actions { margin: 12px 0 0; display: flex; gap: 8px; justify-content: flex-end; }

/* ---- Empty canvas, private and hidden canvases ---- */
body.cv-blank .cv-status, body.cv-blank .cv-watch, body.cv-blank #remix { display: none; }
body.cv-missing .cv-wrap, body.cv-missing[data-panel] .cv-wrap { grid-template-columns: minmax(0, 1fr); }
body.cv-missing .cv-rail, body.cv-missing .cv-side, body.cv-missing .cv-status, body.cv-missing .cv-watch, body.cv-missing #share, body.cv-missing #remix, body.cv-missing .cv-morebtn { display: none; }
body.cv-missing .cv-stage { grid-column: 1; }
body.cv-offline .cv-rail .cv-tool, body.cv-offline .cv-strip { opacity: .55; pointer-events: none; }

/* ---- The landing page (no canvas in the link): the sample replays beside a panel to start one ---- */
body.landing { overflow: auto; }
body.landing .cv-wrap { grid-template-columns: minmax(0, 1fr) 380px; }
body.landing .cv-stage { grid-column: 1; }
body.landing .cv-land { grid-column: 2; }
body.landing .cv-side, body.landing .cv-tracks, body.landing .cv-rail, body.landing #share, body.landing #remix, body.landing .cv-pins { display: none; }
body.landing #navNew { display: none; }
.cv-land { min-height: 0; padding: 20px 20px 24px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; border-left: 1px solid var(--line); }
.cv-eyebrow { margin: 0; color: var(--accent); font-size: 13px; font-weight: 600; }
.cv-land h2 { margin: 0; font: 600 32px/1.05 var(--font-display); letter-spacing: -.02em; }
.cv-lede { margin: 0; color: var(--ink-2); }
.cv-card { background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cv-card h3 { margin: 0; font: 600 17px/1.2 var(--font-display); }
.cv-card form { display: flex; flex-direction: column; gap: 10px; }
.cv-card p { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-card small { color: var(--mute); }
.cv-card textarea { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line-2); border-radius: 3px; padding: 10px 12px; resize: vertical; min-height: 64px; }
.cv-label { font-size: 14px; color: var(--mute); }
.cv-steps { margin: 0; padding-left: 20px; color: var(--ink-2); }
.cv-steps a { color: var(--accent); }
.cv-steps li.ok { color: var(--ok); }
.cv-mine { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cv-mine li { position: relative; }
.cv-mine a { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; padding: 6px; border-radius: 3px; min-width: 0; }
.cv-mine a:hover, .cv-mine a:focus-visible { background: var(--bg-2); }
.cv-mine img, .cv-thumb-empty { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: contain; background: var(--bg-2); border-radius: 3px; }
.cv-mine span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-mine small { color: var(--mute); white-space: nowrap; font-size: 12px; }
.cv-del { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s; }
.cv-mine li:hover .cv-del, .cv-del:focus-visible { opacity: 1; }
@media (hover: none) { .cv-del { opacity: .85; } }
#mineT small { color: var(--mute); font-size: 13px; font-weight: 600; margin-left: 6px; }
.cv-mine-plan, .cv-mine-none { margin: 0; font-size: 13px; color: var(--mute); }
.cv-mine-plan a, .cv-zip a { color: var(--accent); }
.cv-zip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-zip small { color: var(--mute); font-size: 12px; flex: 1; min-width: 140px; }
.cv-shapes { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cv-shapes legend { padding: 0; margin-bottom: 6px; }
.cv-shapes label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--mute); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 3px; cursor: pointer; min-width: 58px; }
.cv-shapes input { position: absolute; opacity: 0; pointer-events: none; }
.cv-shapes label:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cv-shapes label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.cv-shape { display: block; width: calc(var(--w) * 1.6px); height: calc(var(--h) * 1.6px); border: 2px solid currentColor; border-radius: 3px; }
#live-art-list { margin: 0; padding-left: 18px; }
#live-art-list a { color: var(--accent); }

/* ---- Narrower desktops ---- */
@media (max-width: 1100px) and (min-width: 761px) {
  .cv-wrap { grid-template-columns: 60px minmax(0, 1fr) 272px; }
  .cv-tracks { grid-template-columns: 56px 130px minmax(0, 1fr) 96px; }
}

/* ---- Phones (Batch 1 phone, 390 x 844): two top rows, the painting, a replay row, the tools along the bottom;
   Layers, Feedback, This canvas and Download open as sheets over a scrim ---- */
@media (max-width: 760px) {
  .cv-top { flex-wrap: wrap; gap: 0 8px; min-height: 0; padding: env(safe-area-inset-top) 8px 0 4px; }
  .cv-back { display: inline-grid; place-items: center; width: 44px; height: 52px; color: var(--ink); }
  .cv-back .ic { width: 22px; height: 22px; }
  .cv-home { display: none; }
  .cv-title { order: 0; flex: 1 1 calc(100% - 112px); height: 52px; align-items: center; }
  .cv-title h1 { font-size: 17px; }
  .cv-morebtn { order: 1; }
  /* Share (Round 5 F4): a visitor's is a 44px icon in the title row; the owner's is the second row's primary button. */
  body:not(.cv-owner) .cv-title { flex-basis: calc(100% - 160px); }   /* back · title · Share · ⋯ */
  .cv-top #share { order: 1; width: 44px; height: 52px; padding: 0; border: 0; background: none; color: var(--ink-2); }
  .cv-top #share .ic { width: 20px; height: 20px; }
  .cv-top #share[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
  body.cv-owner .cv-top #share { width: auto; height: auto; min-height: 44px; gap: 8px; padding: 0 16px 0 14px; margin-right: 4px; font-size: 15px; }
  body.cv-owner .cv-top #share .ic { width: 18px; height: 18px; }
  body.cv-owner .cv-top #share span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  body.cv-owner .cv-top #share[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
  .cv-status { order: 3; margin: 0 0 0 12px; }
  .cv-watch { order: 4; display: inline; }
  .cv-gap { order: 5; }
  #remix, #signin, body.cv-owner #share { order: 6; }
  .cv-top::after { content: ""; order: 2; flex: 0 0 100%; }
  .cv-top > .cv-row2 > * { margin-block: 6px; }
  #remix, #signin { min-height: 44px; padding: 0 14px; font-size: 15px; margin-right: 4px; }
  .cv-menu { right: 8px !important; left: auto !important; }
  .cv-menu .cv-phone { display: flex; }
  body:not(.cv-draw) .cv-menu #mUndo { display: none; }

  .cv-wrap, body[data-panel] .cv-wrap, body:not(.cv-draw) .cv-wrap { display: contents; }
  .cv-top { order: 0; }
  .cv-land { order: 2; }
  .cv-stage { order: 1; flex: 1; padding: 12px 10px; }
  body.cv-stripon .cv-stage { padding-top: 64px; }
  .cv-strip { height: 52px; gap: 12px; padding: 0 10px; }
  .cv-frame { width: min(calc(100% - 20px), calc(var(--fit-h, 60vh) * var(--ar, 1.6))); margin: 6px 0; box-shadow: var(--hairline-inner), 0 0 0 6px var(--cv-mat), 0 0 0 7px var(--frame-hair), var(--shadow-hair); }
  .cv-placard { width: auto !important; align-self: stretch; margin: 6px 10px 0; }
  .cv-plvis { display: none; }
  .cv-caption { display: none !important; }
  .cv-ask { position: relative; left: auto; top: auto; translate: none; width: 100%; margin-top: 12px; padding: 18px; }
  .cv-ask > b { font-size: 22px; }
  .cv-selbar { max-width: calc(100% - 8px); flex-wrap: wrap; }
  .cv-selname { display: none; }

  .cv-rail { order: 3; flex-direction: row; justify-content: space-around; align-items: center; gap: 0; height: calc(64px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); visibility: visible !important; }
  .cv-handtools { flex-direction: row; gap: 0; }
  body:not(.cv-draw) .cv-handtools, body:not(.cv-draw) #undo { display: none; }
  .cv-tool { width: 48px; height: 48px; }
  .cv-tool .ic { width: 22px; height: 22px; }
  .cv-railgap { display: none; }
  .cv-rail .cv-raildiv { display: block; width: 1px; height: 28px; background: var(--line); }
  body:not(.cv-draw) .cv-rail .cv-raildiv { display: none; }
  .cv-rail .cv-layersbtn { display: grid; }
  /* The bottom bar: five tools · divider · Layers · Feedback (Undo moves to the ⋯ menu). */
  .cv-rail #undo { display: none; }
  .cv-rail .cv-fbbtn { display: grid; }
  .cv-tip { display: none !important; }
  .cv-tracks { order: 2; }

  .cv-side { position: fixed; inset: 0; z-index: 30; border: 0; background: none; overflow: visible; pointer-events: none; }
  body:not([data-panel]) .cv-side, body[data-panel=""] .cv-side { display: none; }
  .cv-scrim { display: block; position: absolute; inset: 0; background: var(--scrim); pointer-events: auto; }
  .cv-view { position: absolute; left: 0; right: 0; bottom: 0; height: auto; max-height: min(640px, 85vh); padding: 0 8px max(8px, env(safe-area-inset-bottom)); background: var(--bg); border-radius: 3px 3px 0 0; pointer-events: auto; }
  .cv-grab { display: block; flex: none; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--line-2); }
  .cv-ph { min-height: 60px; }
  .cv-ph h2 { font-size: 18px; }
  .cv-phone { display: inline-grid; }
  body[data-panel="settings"] #viewLayers, body[data-panel="download"] #viewLayers { display: none; }
  body[data-panel="feedback"] #studio, body[data-panel="feedback"] #approved, body[data-panel="feedback"] #approve, body[data-panel="feedback"] #changes, body[data-panel="feedback"] #sendReview { display: none; }
  body[data-panel="layers"] .cv-fb, body[data-panel="layers"] #fbAdd { display: none; }
  body[data-panel="feedback"] .cv-fb { border-top: 0; margin-top: 0; }
  #fbOpenN { font: 400 14px var(--font); }
  .cv-fb-item { font-size: 15px; }
  body[data-panel="feedback"] #fbAdd { min-height: 48px; margin-inline: 4px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; justify-content: center; }
  body[data-panel="feedback"] #fbAdd .ic { width: 20px; height: 20px; }

  /* Pinning: no scrim; the new pin with its halo, dragged into place; the composer as a sheet. */
  .cv-pin.ghost.held { pointer-events: auto; animation: none; touch-action: none; cursor: grab; box-shadow: 0 0 0 2px #ffffff, 0 0 0 6px var(--pin-halo); }
  .cv-pop.sheet { padding: 8px 16px max(16px, env(safe-area-inset-bottom)); gap: 12px; border-top: 1px solid var(--line); background: var(--bg); }
  .cv-compose .cv-pop-head { min-height: 44px; padding-right: 36px; }
  .cv-compose .cv-pop-h { font: 600 18px/1.2 var(--font-display); color: var(--ink); }
  .cv-compose .cv-pop-head .cv-x { top: 2px; right: -4px; width: 44px; height: 44px; }
  .cv-compose textarea { min-height: 88px; font-size: 16px; }
  .cv-compose .cv-hint { margin: -4px 0 0; color: var(--mute); font-size: 13px; }
  .cv-compose .cv-pop-row { flex-wrap: nowrap; gap: 8px; }
  .cv-compose .cv-pop-row .cv-btn { flex: 1; min-height: 48px; font-size: 15px; }

  /* The share sheet */
  .cv-share { position: fixed; inset: 0; z-index: 35; display: block; }
  .cv-share[hidden] { display: none; }
  .cv-share .cv-scrim { display: block; position: absolute; inset: 0; background: var(--scrim); }
  .cv-sharebox { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; padding: 0 20px max(16px, env(safe-area-inset-bottom)); background: var(--bg); border-radius: 3px 3px 0 0; box-shadow: var(--shadow-pop); }
  .cv-sharebox .cv-grab { display: block; }
  .cv-sharebox .cv-ph { padding: 0; }
  .cv-sharebox .cv-ph h2 { font-size: 20px; }
  .cv-copyf { display: flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: 4px; padding: 0 4px 0 12px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--card); }
  .cv-copyf code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 13px/1.4 var(--mono); color: var(--ink); }
  .cv-copyf .cv-tbtn { min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 15px; }
  .cv-srow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; cursor: pointer; }
  .cv-srow > .ic { width: 20px; height: 20px; color: var(--ink-2); }
  .cv-srow > .ic:last-child { width: 16px; height: 16px; color: var(--mute); }
  .cv-srow > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .cv-srow b { font: 500 15px/1.3 var(--font); }
  .cv-srow small { color: var(--mute); font-size: 13px; }
  .cv-srow .cv-plan .ic { width: 12px; height: 12px; }
  .cv-lrow { min-height: 48px; }
  .cv-lacts .cv-sbtn, .cv-dl .cv-radio { min-height: 48px; }
  .cv-pfoot .cv-pbtn { min-height: 48px; }

  /* One replay row: a play button, one segmented track with the playhead, the state and time. */
  .cv-tracks { grid-template-columns: 64px minmax(0, 1fr) 72px; height: 60px; max-height: none; overflow: hidden; }
  .cv-tnames { display: none; }
  .cv-tbars { height: 26px !important; margin: 0 8px 0 4px; }
  .cv-tbar { top: 10px !important; height: 6px; border-radius: 0; }
  .cv-thead { top: 13px !important; }
  .cv-tclock { border-left: 0; align-items: flex-end; padding-right: 16px; }

  body.landing .cv-wrap { display: block; overflow: visible; }
  body.landing { display: block; }
  body.landing .cv-stage { padding: 12px 10px; }
  .cv-land { border-left: 0; padding: 12px 16px 24px; overflow: visible; }
  .cv-land h2 { font-size: 26px; }
  body.cv-missing .cv-frame { aspect-ratio: auto; min-height: 320px; }
  body.cv-missing .cv-cover { position: relative; min-height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  .cv-status i, .cv-thead, .cv-pin.ping, .cv-pin.ghost { animation: none !important; }
  .cv-pin, .cv-cursor { transition: none; }
}
.cv-dlclear { align-items: flex-start; min-height: 44px; padding-top: 12px; color: var(--ink); }
.cv-dlclear input { margin-top: 1px; }
.cv-dlclear > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cv-dlclear b { font-weight: 500; font-size: 15px; }
.cv-dlclear small { font-size: 13px; color: var(--mute); }
.cv-dlclear.locked b { color: var(--mute); }
#approvalsRow { margin-top: 12px; }
/* The strip fits 980px of stage at 1280 wide: tighter gaps and 36px colour targets with a mouse; 44px by touch. */
@media (pointer: fine) and (min-width: 761px) {
  .cv-strip { gap: 12px; padding: 0 12px; scrollbar-width: none; }
  .cv-colors button { width: 36px; height: 36px; }
  .cv-size input { width: 84px; }
}
body.cv-blank #approve, body.cv-blank #approved { display: none; }
.cv-radio > .cv-meta { flex-direction: row; white-space: nowrap; }
@media (max-width: 760px) { #plBy, #plBy::before { display: none; } }

/* ---- Move to team (A9) / Take out of team (A10): 520px, padding 28; a sheet on a phone ---- */
.cv-move { width: min(520px, calc(100% - 32px)); padding: 28px; }
.cv-move h2 { font: 600 22px/24px var(--font-display); letter-spacing: -.02em; margin: 0 0 10px; }
.cv-move > form > p { margin: 0 0 16px; color: var(--ink-2); font-size: 15px; }
.cv-after { border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px; margin: 0; }
.cv-after h3 { font: 600 12px/1 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin: 0 0 6px; }
.cv-after div { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.cv-after div:first-of-type { border-top: 0; }
.cv-after dt { color: var(--mute); }
.cv-after dd { margin: 0; }
.cv-after select { min-height: 36px; background: var(--field); color: var(--ink); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 8px; font: inherit; max-width: 100%; }
.cv-move .cv-hint { margin: 12px 0 0; color: var(--mute); font-size: 13px; }
.cv-move .cv-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.cv-ink { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.cv-ink:hover { border-color: var(--ink); filter: brightness(1.15); }
.cv-finished { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
@media (max-width: 640px) {
  .cv-move { width: 100%; max-width: none; margin: auto 0 0; border-radius: 12px 12px 0 0; padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); }
  .cv-after div { grid-template-columns: 1fr; gap: 2px; }
  .cv-move .cv-acts .cv-sbtn { flex: 1; }
}

/* ---- Share dialog (Round 7 A): 860px, people left, links right; a bottom sheet on a phone ---- */
.cv-sharedlg { width: min(860px, calc(100% - 32px)); max-height: min(740px, calc(100% - 32px)); padding: 0; display: none; flex-direction: column; }
.cv-sharedlg[open] { display: flex; }
.cv-sharedlg .cv-grab { display: none; }
.cv-sdh { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 24px 24px 0; }
.cv-sdh h2 { font: 600 22px/1.15 var(--font-display); letter-spacing: -.02em; margin: 0; }
.cv-sdsub { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; color: var(--mute); font-size: 13px; }
.cv-dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--mute); }
.cv-dot.on { background: var(--ink); border-color: var(--ink); }
.cv-sdbody { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 32px; padding: 20px 24px 24px; overflow: auto; }
.cv-sdadd { display: flex; gap: 8px; }
.cv-sdadd .cv-field { flex: 1; min-width: 0; min-height: 44px; }
.cv-sdadd select { padding-right: 8px; }
.cv-field[aria-invalid] { border: 2px solid var(--error, #b42318); }
.cv-sdhelp { color: var(--mute); font-size: 13px; margin: 8px 0 0; }
.cv-sdinfo { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: 13px; margin: 8px 0 0; }
.cv-sdinfo i { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--ink-2); font: 600 11px/14px var(--font); text-align: center; font-style: normal; }
.cv-sdyou { background: var(--bg-2); border-radius: 3px; padding: 12px; margin: 0; font-size: 14px; }
.cv-sdteam { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border-radius: 3px; padding: 10px 6px 10px 12px; margin-top: 16px; }
.cv-sdteam > span { flex: 1; display: grid; font-size: 14px; }
.cv-sdteam small { color: var(--mute); font-size: 12px; }
.cv-tmark { width: 32px; height: 32px; border-radius: 3px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font: 600 12px/1 var(--font); font-style: normal; }
.cv-sdh3 { display: flex; justify-content: space-between; font: 600 14px/1.2 var(--font); margin: 20px 0 6px; }
.cv-sdh3 span + span { color: var(--mute); font-weight: 400; font-size: 13px; }
.cv-sdh3 span.full { color: var(--ink); }
.cv-sdlist { list-style: none; margin: 0; padding: 0; }
.cv-sdlist li { display: flex; align-items: center; gap: 10px; min-height: 56px; border-top: 1px solid var(--line); padding: 6px 0; }
.cv-sdlist li:first-child { border-top: 0; }
.cv-av { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font: 600 12px/1 var(--font); font-style: normal; color: var(--ink-2); }
.cv-av.at { background: none; border: 1px dashed var(--line-2); }
.cv-who { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: 14px; }
.cv-who b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.cv-who small { flex-basis: 100%; color: var(--mute); font-size: 12px; }
.cv-tag { font: 600 11px/1 var(--font); font-style: normal; border: 1px solid var(--line-2); border-radius: 3px; padding: 2px 5px; color: var(--ink-2); }
.cv-tag.inv { color: var(--mute); }
.cv-tag.out { border-style: dashed; }
.cv-fixed { color: var(--mute); font-size: 14px; padding: 0 10px; }
.cv-acc { min-height: 44px; border: 1px solid transparent; background: none; color: var(--ink); font: 500 14px/1 var(--font); border-radius: 3px; padding: 0 6px; cursor: pointer; }
.cv-acc:hover, .cv-acc:focus-visible { border-color: var(--line-2); }
.cv-sdlinks .cv-togrow { margin-top: 14px; }
#shareReviewRow.locked .cv-togrow { opacity: .45; }
.cv-sdfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 14px 24px; }
.cv-sdfoot > span { display: flex; gap: 10px; margin-left: auto; }
.cv-accent { color: var(--accent); }
.cv-peoplerow { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); margin: 0 0 10px; }
.cv-stack { display: flex; }
.cv-stack .cv-av { width: 28px; height: 28px; border: 2px solid var(--card); margin-left: -8px; }
.cv-stack .cv-av:first-child { margin-left: 0; }
.cv-wide { width: 100%; }
@media (max-width: 640px) {
  .cv-sharedlg { width: 100%; max-width: none; max-height: 800px; margin: auto 0 0; border-radius: 12px 12px 0 0; }
  .cv-sharedlg .cv-grab { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto 0; }
  .cv-sdbody { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 16px; }
  .cv-sdh { padding: 12px 16px 0; }
  .cv-sdadd { flex-wrap: wrap; }
  .cv-sdadd .cv-field { flex-basis: 100%; }
  .cv-sdadd select, .cv-sdadd button { flex: 1; }
  .cv-sdfoot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .cv-sdfoot > span, .cv-sdfoot .cv-go { flex: 1; }
  .cv-sdfoot #shareCopyFoot { display: none; }
  .cv-sdteam { flex-wrap: wrap; }
  .cv-sdteam select { flex-basis: 100%; }
  .cv-sdlist li { flex-wrap: wrap; }
  .cv-sdlist .cv-who { flex-basis: calc(100% - 42px); }
  .cv-sdlist li > .cv-tbtn, .cv-sdlist li > .cv-acc, .cv-sdlist li > .cv-fixed { margin-left: auto; }
}
.cv-note .cv-renew { min-height: 32px; padding: 0 12px; font-size: 14px; margin-right: 6px; }
