/* CuePoint - studio review. Dark by default: review rooms are dark rooms. */

:root {
  --bg: #0b0d10;
  --bg-2: #12151a;
  --panel: #16191f;
  --panel-2: #1c2027;
  --line: #262b33;
  --line-2: #333a45;
  --ink: #e8ecf2;
  --ink-2: #a7b0bd;
  --ink-3: #6e7885;
  /* Taken from the studio logo: butter, browned butter, and the pan's steel. */
  --accent: #f5cd50;
  --accent-deep: #c17f1f;
  --accent-ink: #1a1206;
  --steel: #778492;
  --steel-light: #cdd3d5;
  --blue: #4ea1ff;
  --green: #57d18f;
  --red: #ff5f56;
  --amber: #ffc93c;
  --purple: #c084fc;
  --radius: 8px;
  --radius-sm: 5px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }
#app { height: 100vh; display: flex; }
.shell { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* --- left icon rail -------------------------------------------------------- */

.rail {
  width: 56px; flex: 0 0 56px; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 8px 0 12px; background: #0a0c0f;
  border-right: 1px solid var(--line); z-index: 20;
}
.rail-mark {
  width: 34px; height: 34px; object-fit: contain; cursor: pointer;
  margin-bottom: 10px; flex: 0 0 auto;
  /* A touch of glow so the artwork sits on the near-black rail. */
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .8));
}
.rail-mark:hover { filter: drop-shadow(0 0 6px rgba(255, 180, 84, .55)); }
.rail-btn {
  width: 46px; padding: 7px 0 5px; display: flex; flex-direction: column; align-items: center;
  gap: 3px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3);
  cursor: pointer; position: relative;
}
.rail-btn:hover { background: #14181e; color: var(--ink-2); }
.rail-btn.active { color: var(--accent); background: #16191f; }
/* The active marker sits on the rail edge, the way a tab strip reads. */
.rail-btn.active::before {
  content: ''; position: absolute; left: -5px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.rail-btn svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.rail-label { font-size: 8.5px; letter-spacing: .02em; text-transform: uppercase; font-weight: 700; }
.rail .spacer { flex: 1; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b313a; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a424e; }

/* --- buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: #242a33; border-color: #454e5b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-deep); font-weight: 600; }
.btn.primary:hover { background: #f9e17f; }
.btn.danger { background: #2a1618; border-color: #5c2b2b; color: #ff9d97; }
.btn.danger:hover { background: #3a1c1f; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.on { background: var(--blue); border-color: var(--blue); color: #06121f; font-weight: 600; }

.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 18px; line-height: 1;
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }

/* --- inputs --------------------------------------------------------------- */

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  background: #0e1116;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(78, 161, 255, .15); }
textarea { resize: vertical; min-height: 74px; }
select { cursor: pointer; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.field-hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* --- chrome --------------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 50px; padding: 0 14px; flex: 0 0 auto;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; cursor: pointer; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 800;
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; min-width: 0; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink-2); }
.crumbs .sep { color: var(--ink-3); }
.crumbs b { color: var(--ink); font-weight: 600; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #0b0d10; flex: 0 0 auto;
}
.avatar.sm { width: 21px; height: 21px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

.main { flex: 1; overflow: auto; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 700; }

/* Page titles read as section headers, in the house amber. */
.page-title {
  font-size: 19px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); margin: 2px 0 0;
}

.global-search {
  width: 260px; padding: 6px 10px 6px 30px; font-size: 12.5px; border-radius: 20px;
  background: #0e1116 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236e7885' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5L14 14'/%3E%3C/svg%3E") no-repeat 9px center / 13px;
}
.user-chip { cursor: pointer; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 20px; }
.user-chip:hover { background: var(--panel-2); }
.user-name { font-size: 12.5px; color: var(--ink-2); }

/* --- badges --------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; border: 1px solid;
}
.badge.wip       { color: #9fb0c4; border-color: #37404d; background: #1b2028; }
.badge.review    { color: var(--blue); border-color: #2d4f78; background: #131e2b; }
.badge.retake    { color: var(--red); border-color: #6b2f2c; background: #251517; }
.badge.approved  { color: var(--green); border-color: #2c6045; background: #12241b; }
.badge.final     { color: #0f1a13; border-color: var(--green); background: var(--green); }
.badge.omit      { color: var(--ink-3); border-color: var(--line-2); background: transparent; }
.badge.pending   { color: var(--amber); border-color: #6b5620; background: #241f10; }
.badge.open      { color: var(--amber); border-color: #6b5620; background: #241f10; }
.badge.addressed { color: var(--blue); border-color: #2d4f78; background: #131e2b; }
.badge.wontfix   { color: var(--ink-3); border-color: var(--line-2); background: transparent; }
.badge.blocker   { color: #fff; border-color: var(--red); background: #a32b25; }
.badge.polish    { color: var(--purple); border-color: #5b3a7a; background: #1d1526; }
.badge.role      { color: var(--ink-2); border-color: var(--line-2); background: var(--panel-2); }

/* --- cards / grid --------------------------------------------------------- */

.grid { display: grid; gap: 14px; }
.grid.projects { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.shots { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .14s, transform .1s;
}
.card.link { cursor: pointer; }
.card.link:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-body { padding: 13px 14px; }
.card-head { padding: 13px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 14px; }

.thumb {
  aspect-ratio: 16 / 9; background: #05070a center/cover no-repeat;
  display: grid; place-items: center; color: var(--ink-3); font-size: 11px;
  border-bottom: 1px solid var(--line); position: relative;
}
.thumb .thumb-badge { position: absolute; top: 7px; right: 7px; }
.thumb .thumb-notes {
  position: absolute; bottom: 7px; left: 7px; background: rgba(0,0,0,.72);
  border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--amber);
}

.stat-row { display: flex; gap: 22px; flex-wrap: wrap; }
.stat { min-width: 84px; }
.stat .n { font-size: 22px; font-weight: 700; font-family: var(--mono); }
.stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }

.empty {
  padding: 46px 20px; text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line-2); border-radius: var(--radius);
}

/* --- tables --------------------------------------------------------------- */

table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: rgba(255, 255, 255, .022); }
table.data tr.clickable { cursor: pointer; }

/* --- resizable / hideable columns ---------------------------------------- */

.dt-wrap { position: relative; }
.dt-bar { display: flex; justify-content: flex-end; position: relative; margin-bottom: 6px; }

/* A fixed layout only respects a width if the content cannot force it wider. */
table.data.dt th, table.data.dt td { overflow: hidden; text-overflow: ellipsis; }
table.data.dt th { position: relative; }
table.data.dt.dt-resizing { user-select: none; cursor: col-resize; }

/* Wide enough to hit without hunting; the visible line stays hairline. */
.dt-grip {
  position: absolute; top: 0; right: -5px; width: 11px; height: 100%;
  cursor: col-resize; touch-action: none; z-index: 2;
}
.dt-grip::after {
  content: ''; position: absolute; top: 20%; bottom: 20%; left: 5px; width: 1px;
  background: var(--line-2); opacity: 0; transition: opacity .12s;
}
.dt-grip:hover::after, .dt-resizing .dt-grip::after { opacity: 1; background: var(--accent); }

.dt-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 30;
  min-width: 178px; padding: 8px; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.dt-menu-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 700; padding: 2px 4px 6px;
}
.dt-menu-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 4px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.dt-menu-row:hover { background: var(--panel-2); }
.dt-menu-row input { width: auto; margin: 0; }
.dt-menu-reset { width: 100%; margin-top: 6px; }

/* --- login --------------------------------------------------------------- */

/* #app is a flex row (it holds the rail), so the sign-in shell has to claim the
   whole width itself or it collapses to the card's size on the left. */
.login-shell { flex: 1; width: 100%; height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1100px 620px at 50% -12%, #1b2130, var(--bg) 62%); }
.login-card { width: 100%; max-width: 372px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 30px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; margin-bottom: 5px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-err { background: #2a1517; border: 1px solid #5c2b2b; color: #ff9d97;
  padding: 9px 11px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }

/* --- review layout ------------------------------------------------------- */

/* Named -layout on purpose: badge status classes (.review, .open, .final...)
   live in the same global class namespace, and a bare .review here was being
   applied to any 'In review' badge. */
.review-layout {
  display: grid; grid-template-columns: 208px 1fr 360px;
  height: 100%; overflow: hidden;
}
.review-layout.no-panel { grid-template-columns: 208px 1fr; }

/* --- draggable / foldable side panes ------------------------------------- */

/*
 * Once panes.js is driving, it supplies two widths and this builds the shape
 * from them. Keeping the template in the stylesheet is what lets the narrow
 * layout below override it - an inline template would win over every media
 * query and leave the picture in a 6px gutter on a phone.
 */
.review-layout.split {
  grid-template-columns:
    var(--pane-left, 208px) 6px minmax(0, 1fr) 6px var(--pane-right, 360px);
}

/* A folded pane keeps its place in the grid at zero width. It must not be
   display:none - that takes the element out of the grid altogether, and every
   pane after it slides up a track, which puts the picture in a 6px gutter. */
.review-layout.split > aside { min-width: 0; }
.pane-off { overflow: hidden; visibility: hidden; pointer-events: none; }

.pane-grip {
  position: relative; cursor: col-resize; touch-action: none;
  background: var(--line); transition: background .12s;
}
.pane-grip:hover, body.pane-resizing .pane-grip { background: var(--accent); }
.pane-grip.is-off { cursor: pointer; }

/* The tab hangs off the grip so a folded pane is still reachable. */
.pane-tab {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 15px; height: 44px; padding: 0; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--ink-3);
  font-size: 12px; line-height: 1; cursor: pointer; z-index: 6;
  display: flex; align-items: center; justify-content: center;
}
.pane-grip-left  .pane-tab { left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pane-grip-right .pane-tab { right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pane-tab:hover { background: var(--panel); color: var(--ink); border-color: var(--accent); }

/* A resize should not paint half the screen blue on the way past. */
body.pane-resizing { user-select: none; cursor: col-resize; }

/*
 * The guest page has no media list - a share link is one version - so it is two
 * columns, not three. It used to reuse the studio grid as-is, which put the
 * picture in the 208px sidebar slot and left the third column empty: the video
 * came out 208px wide in a 1234px window.
 */
.review-layout.guest { grid-template-columns: minmax(0, 1fr) 340px; }

/* The whole guest page, stacked: bar on top, review filling everything under. */
.guest-shell {
  display: flex; flex-direction: column;
  flex: 1; min-width: 0; min-height: 0; height: 100%;
}

/* --- media list: every version of this shot, down the left ---------------- */

.media-list {
  background: var(--bg-2); border-right: 1px solid var(--line);
  overflow-y: auto; display: flex; flex-direction: column;
}
.media-list-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--bg-2); z-index: 2;
}
.media-item {
  display: grid; grid-template-columns: 14px 64px 1fr auto; gap: 8px;
  align-items: center; padding: 8px 10px; cursor: pointer;
  border-bottom: 1px solid var(--line); position: relative;
}
.media-item:hover { background: var(--panel); }
.media-item.current { background: var(--panel-2); cursor: default; }
.media-item.current::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.media-num { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-align: right; }
.media-thumb {
  width: 64px; aspect-ratio: 16 / 9; border-radius: 3px; background: #05070a center/cover no-repeat;
  display: grid; place-items: center; font-size: 9px; color: var(--ink-3);
  border: 1px solid var(--line);
}
.media-meta { min-width: 0; }
.media-name {
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-by {
  font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-tags { margin-top: 3px; }
.media-tags .badge { font-size: 9px; padding: 1px 5px; }
.media-count {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--ink-3);
  background: #0e1116; border: 1px solid var(--line-2); border-radius: 10px; padding: 1px 6px;
}
.media-count.open { color: var(--amber); border-color: #6b5620; }

/* General notes: not pinned to any frame. */
.note-frame.general {
  color: var(--blue); background: rgba(78,161,255,.1); border-color: rgba(78,161,255,.3);
  cursor: default; font-family: var(--sans); letter-spacing: .03em;
}
.pin-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.pin-check { width: auto; margin: 0; cursor: pointer; }
.note-frame.unpinned {
  color: var(--blue); background: rgba(78,161,255,.1); border-color: rgba(78,161,255,.3);
}
.stage-col { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: #05070a; }
.stage {
  flex: 1; position: relative; display: grid; place-items: center;
  overflow: hidden; min-height: 0;
}
.stage-inner { position: relative; line-height: 0; }
.plate-blank { position: absolute; inset: 0; }
.plate-blank canvas { display: block; width: 100%; height: 100%; }
.stage video, .stage img.plate {
  display: block; width: 100%; height: 100%; object-fit: contain; background: #000;
}
/*
 * A canvas is a replaced element: with inset:0 and width:auto it takes its
 * INTRINSIC size (the backing-store attributes), not the parent's box. Without
 * these explicit 100%s the markup layer renders at devicePixelRatio times the
 * plate size and every stroke lands in the wrong place on a hi-dpi screen.
 */
/*
 * The markup canvas overhangs the picture by 50% on every side so strokes can
 * run off the frame. Explicit width/height are required: a canvas is a replaced
 * element and would otherwise take its intrinsic backing size.
 */
#draw-layer {
  position: absolute; left: -50%; top: -50%; width: 200%; height: 200%;
  touch-action: none; cursor: crosshair;
}
#draw-layer.pan { cursor: default; }

.stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(5, 7, 10, .85); color: var(--ink-2); font-size: 13px; z-index: 5; text-align: center;
}

.compare-wrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.compare-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare-handle {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent);
  pointer-events: auto; cursor: ew-resize; z-index: 4;
}
.compare-handle::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.compare-tag {
  position: absolute; top: 8px; padding: 2px 8px; border-radius: 4px; font-size: 11px;
  font-weight: 700; background: rgba(0,0,0,.7); color: var(--accent); z-index: 4;
}

/* --- toolbar / transport ------------------------------------------------- */

.stage-bar {
  flex: 0 0 auto; background: var(--bg-2); border-top: 1px solid var(--line);
  padding: 8px 12px; display: flex; flex-direction: column; gap: 8px;
}
.tool-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Toolbar items keep their natural width; only the spacer absorbs slack. */
.tool-row > * { flex: 0 0 auto; }
.tool-row > .spacer { flex: 1 1 auto; }
.tool-group { display: flex; align-items: center; gap: 2px; padding: 2px; background: #0e1116;
  border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tool {
  width: 30px; height: 27px; display: grid; place-items: center; border-radius: 4px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.tool:hover { background: var(--panel-2); color: var(--ink); }
.tool.active { background: var(--blue); color: #06121f; }
.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }

.swatches { display: flex; gap: 3px; }
.swatch { width: 20px; height: 20px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: #fff; }

/* The wheel on the end of the row. A colour input is a button everywhere and a
   swatch nowhere, so the browser's own chrome is stripped back to match its
   neighbours - and it wears a spectrum so it reads as "any other colour". */
.swatch.wheel {
  padding: 0; background: conic-gradient(#ff3b30, #ffcc00, #34c759, #00c7be,
    #4ea1ff, #c084fc, #ff2d92, #ff3b30);
  -webkit-appearance: none; appearance: none;
}
.swatch.wheel::-webkit-color-swatch-wrapper { padding: 0; }
.swatch.wheel::-webkit-color-swatch { border: none; border-radius: 2px; opacity: 0; }
.swatch.wheel::-moz-color-swatch { border: none; opacity: 0; }

/* --- volume -------------------------------------------------------------- */

.volume-group { display: flex; align-items: center; gap: 4px; }
.volume-slider {
  width: 74px; height: 18px; padding: 0; margin: 0; background: none;
  border: none; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.volume-slider::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px; background: var(--line-2);
}
.volume-slider::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-2); }
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -4.5px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}
.volume-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.tc-readout {
  font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums;
  background: #0e1116; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px 9px; display: flex; align-items: center; gap: 8px;
}
.tc-readout .frame { color: var(--accent); font-weight: 700; }
.tc-readout .of { color: var(--ink-3); }

/* timeline */
/*
 * Three lanes, so what you are looking at is never ambiguous:
 *   0-14   marker flags (scratch, dropped with M)
 *   16-33  note markers (written feedback)
 *   35-43  keyframes - which frames carry drawing
 *   45-53  the scrub track itself
 */
.timeline { position: relative; height: 66px; user-select: none; cursor: pointer; flex: 0 0 auto; }
.tl-track { position: absolute; left: 0; right: 0; top: 45px; height: 8px;
  background: #0e1116; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.tl-buffer { position: absolute; top: 0; bottom: 0; left: 0; background: #2a3140; }
.tl-played { position: absolute; top: 0; bottom: 0; left: 0; background: #3d4a5e; }
.tl-range { position: absolute; top: 43px; height: 12px; background: rgba(255, 180, 84, .16);
  border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); pointer-events: none; }
.tl-playhead { position: absolute; top: 0; bottom: 13px; width: 2px; background: #fff;
  pointer-events: none; box-shadow: 0 0 6px rgba(255,255,255,.6); z-index: 4; }
.tl-playhead::before { content: ''; position: absolute; top: -4px; left: -4px; border: 5px solid transparent;
  border-top-color: #fff; }
/* Note markers: a pin with a point, big enough to hit and to see. */
.tl-mark {
  position: absolute; top: 16px; width: 12px; height: 18px; margin-left: -6px;
  cursor: pointer; border: 1px solid rgba(0,0,0,.55);
  border-radius: 3px 3px 1px 1px;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.tl-mark:hover { transform: scale(1.22); z-index: 5; }
.tl-mark.blocker { box-shadow: 0 0 0 1px #fff, 0 0 6px rgba(255,95,86,.9); }
.tl-mark-count {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; color: var(--ink); font-family: var(--mono);
}
/* Range of a note: an in/out selection, or the span of animated markup. */
.tl-span {
  position: absolute; top: 8px; height: 4px; border-radius: 2px;
  opacity: .55; pointer-events: none;
}
.tl-span.done { opacity: .3; }
.tl-mark.sel { outline: 2px solid #fff; z-index: 3; }
.tl-tick { position: absolute; top: 55px; font-size: 9px; color: var(--ink-3);
  font-family: var(--mono); transform: translateX(-50%); pointer-events: none; }

/* --- marker flags ---------------------------------------------------------- */

.tl-flags { position: absolute; left: 0; right: 0; top: 0; height: 15px; }
.tl-flag {
  position: absolute; top: 0; width: 3px; height: 15px; margin-left: -1px;
  background: var(--flag, #4ea1ff); cursor: pointer;
}
/* The pennant, so a flag reads as a flag at a glance. */
.tl-flag::before {
  content: ''; position: absolute; left: 3px; top: 0;
  border-left: 9px solid var(--flag, #4ea1ff);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.tl-flag::after {
  content: ''; position: absolute; left: -3px; bottom: -3px;
  width: 9px; height: 3px; background: var(--flag, #4ea1ff); border-radius: 2px;
}
.tl-flag:hover { filter: brightness(1.35); }
.tl-flag:hover::before { border-left-width: 12px; }
.tl-flag-label {
  position: absolute; left: 13px; top: -1px; font-size: 9px; font-weight: 700;
  color: var(--flag, #4ea1ff); white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.9); max-width: 90px; overflow: hidden;
}
.tl-span { top: 30px; }


/* --- notes panel --------------------------------------------------------- */

.panel { display: flex; flex-direction: column; background: var(--panel);
  border-left: 1px solid var(--line); min-width: 0; overflow: hidden; }
.panel-head { flex: 0 0 auto; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-tabs { display: flex; gap: 2px; }
.panel-tab { padding: 5px 11px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.panel-tab:hover { background: var(--panel-2); color: var(--ink); }
.panel-tab.active { background: var(--panel-2); border-color: var(--line-2); color: var(--ink); }
.panel-body { flex: 1; overflow-y: auto; overflow-x: hidden; }
.panel-foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 10px 12px; background: var(--panel-2); }

.filter-row { display: flex; gap: 6px; margin-top: 9px; }
.filter-row select { padding: 4px 7px; font-size: 12px; }

.note {
  border-bottom: 1px solid var(--line); padding: 11px 12px; cursor: pointer;
  transition: background .1s; position: relative;
}
.note:hover { background: rgba(255,255,255,.02); }
.note.active { background: rgba(78, 161, 255, .08); }
.note.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.note.resolved { opacity: .62; }
.note-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.note-frame {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
  background: rgba(255,180,84,.1); border: 1px solid rgba(255,180,84,.28);
  border-radius: 4px; padding: 1px 6px; cursor: pointer;
}
.note-author { font-size: 12px; font-weight: 600; }
.note-time { font-size: 11px; color: var(--ink-3); }
.note-body { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.note-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--ink-3); }
.note-actions { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.note-replies { margin-top: 9px; border-left: 2px solid var(--line-2); padding-left: 10px; }
.reply { padding: 6px 0; font-size: 12px; }
.reply-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.reply-body { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-box { display: flex; gap: 6px; margin-top: 8px; }
.reply-box textarea { min-height: 34px; height: 34px; font-size: 12px; padding: 6px 8px; }
.draw-chip { color: var(--purple); font-size: 11px; font-weight: 700; }

.composer textarea { min-height: 64px; }
.composer-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.composer-row select { padding: 5px 7px; font-size: 12px; width: auto; flex: 1; }
.composer-hint { font-size: 11px; color: var(--ink-3); margin-top: 6px; }

.viewers { display: flex; gap: 4px; align-items: center; }
.viewers .avatar { border: 2px solid var(--panel); margin-left: -6px; }
.viewers .avatar:first-child { margin-left: 0; }

.kbd {
  font-family: var(--mono); font-size: 10.5px; background: #0e1116; border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--ink-2);
}
.shortcut-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; font-size: 13px; }

/* --- toasts / modal ------------------------------------------------------ */

.toast-host { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast {
  padding: 9px 15px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); font-size: 13px; opacity: 0; transform: translateY(10px);
  transition: opacity .2s, transform .2s; max-width: 78vw;
}
.toast.in { opacity: 1; transform: none; }
.toast-error { background: #2a1517; border-color: #6b2f2c; color: #ffb3ad; }
.toast-success { background: #12241b; border-color: #2c6045; color: #9ce9bd; }

.modal-shell { position: fixed; inset: 0; background: rgba(4, 6, 9, .72); z-index: 150;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px); }
.modal-card { width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 11px; box-shadow: var(--shadow); }
.modal-card.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.progress { height: 5px; background: #0e1116; border-radius: 4px; overflow: hidden; margin-top: 9px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .15s; }

.drop-zone {
  border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 26px;
  text-align: center; color: var(--ink-3); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: rgba(255,180,84,.05); color: var(--ink-2); }

@media (max-width: 1000px) {
  /* No room for the media list on a phone; the version switcher is enough. */
  .review-layout,
  .review-layout.guest,
  .review-layout.split { grid-template-columns: 1fr; grid-template-rows: 1fr 46%; }
  .media-list { display: none; }
  .panel { border-left: none; border-top: 1px solid var(--line); }

  /* Side-by-side panes are a mouse idea. Here the two rows are the layout, so
     the grips have nothing to drag - and a pane folded away on a desktop must
     not arrive here hidden with no grip left to bring it back. */
  .pane-grip { display: none; }
  .review-layout.split > .pane-off { visibility: visible; overflow: visible; pointer-events: auto; }
}

/*
 * Turn the phone sideways to give notes.
 *
 * Stacked, a landscape phone has about 150px of height left for the picture
 * once the toolbar and the notes have taken theirs, which is not enough to
 * judge anything. Rotated, the shape of the screen matches the shape of a
 * frame - so the picture takes the width it needs and the notes go beside it,
 * the way they do on a monitor.
 *
 * Keyed on height rather than width: this is about a screen that is short, and
 * a tablet in landscape is not.
 */
@media (max-width: 1000px) and (orientation: landscape) and (max-height: 560px) {
  .review-layout,
  .review-layout.guest,
  .review-layout.split {
    grid-template-columns: minmax(0, 1fr) 44%;
    grid-template-rows: 1fr;
  }
  .panel { border-top: none; border-left: 1px solid var(--line); }

  /* Every row of chrome costs the picture. Give back what can be spared. */
  .topbar { height: 40px; }
  .rail { padding: 1px 4px; }
  .rail-label { display: none; }
  .rail-btn { padding: 4px 0; }
  .stage-bar { max-height: 38vh; }
  .stage { min-height: 0; }

  /*
   * The playhead comes first and stays put.
   *
   * There is not room for every row at this height, so the toolbars scroll -
   * and the timeline, being last in the markup, scrolled away with them. On a
   * phone held sideways to give a note, the one control you cannot do without
   * was the one off the bottom of the screen. Order moves it to the top of the
   * bar and sticky keeps it there while the tools scroll underneath.
   */
  .stage-bar .timeline {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 5;
    flex: 0 0 auto;
    background: var(--bg-2);
  }
}

/* --- frame-rate fix bar --------------------------------------------------- */

.fix-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  background: #2a1f10; border: 1px solid #6b5620; border-radius: var(--radius-sm);
  color: var(--amber); font-size: 12.5px;
}
.fix-bar .fix-icon {
  width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%;
  background: var(--amber); color: #241f10; font-weight: 800;
  display: grid; place-items: center; font-size: 12px;
}
.fix-bar .fix-text { color: #ffdf9e; }

.fps-note { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.fps-note.ok { color: var(--green); }
.fps-note.warn { color: var(--amber); }

/* Animated markup reads differently from a single-frame scribble. */
.draw-chip { color: var(--purple); font-size: 11px; font-weight: 700; }

/* --- touch and small screens ---------------------------------------------- */

@media (pointer: coarse) {
  /* Fingers need bigger targets than a mouse does. */
  .tool { width: 40px; height: 38px; }
  .tool svg { width: 19px; height: 19px; }
  .swatch { width: 28px; height: 28px; }
  .btn { padding: 9px 15px; }
  .btn.sm { padding: 7px 12px; font-size: 13px; }
  .icon-btn { width: 38px; height: 38px; }
  .timeline { height: 54px; }
  .tl-mark { width: 14px; height: 20px; margin-left: -7px; }
  .tl-track { top: 26px; height: 8px; }
  .note { padding: 14px 12px; }
  .note-frame { padding: 4px 9px; font-size: 12px; }
}

@media (max-width: 760px) {
  .wrap { padding: 16px 12px 48px; }
  .page-head h1 { font-size: 20px; }
  .grid.projects, .grid.shots { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .crumbs { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }

  /*
   * The rail becomes a bottom bar. A thumb reaches the bottom of a phone far
   * more easily than the left edge, and giving the 56px back to the width is
   * the difference between a readable plate and a letterbox. The DOM order is
   * unchanged - column-reverse puts the nav under the content without moving
   * it away from the top of the tab order.
   */
  #app { flex-direction: column-reverse; }
  /* Stacked, the shell is a column flex item, and those refuse to shrink below
     their content unless told to. Without this the review grid grows past the
     screen and the plate scrolls off the top. */
  .shell { min-height: 0; }
  .rail {
    width: auto; flex: 0 0 auto; flex-direction: row; justify-content: space-around;
    gap: 0; padding: 3px 4px; border-right: 0; border-top: 1px solid var(--line);
    /* Clear of the home indicator on a phone that has one. */
    padding-bottom: calc(3px + env(safe-area-inset-bottom, 0px));
  }
  .rail-mark, .rail .spacer { display: none; }   /* the top bar carries the logo */
  .rail-btn { width: auto; flex: 1 1 0; min-width: 0; max-width: 88px; padding: 5px 0 3px; }
  .rail-btn.active::before {
    left: 22%; right: 22%; top: -3px; bottom: auto; width: auto; height: 3px;
    border-radius: 0 0 3px 3px;
  }
  .rail-label { font-size: 8px; }

  /* The studio name is on every page under the logo; the bar is not the place
     to spend a third of a phone's width repeating it. */
  /* Scoped to the bar on purpose: the plain .brand-text rule is defined further
     down this file, and at equal specificity the later one would win. */
  .topbar .brand-text { display: none; }
  .user-chip .user-name { display: none; }
  .global-search { min-width: 0; }
  .review-layout { grid-template-rows: 1fr 46%; }
  .stage-bar { padding: 6px 8px; }

  /*
   * On a phone the toolbar would otherwise wrap into six rows and squeeze the
   * plate down to nothing. Each row becomes a single horizontally scrollable
   * strip instead, and the plate keeps a guaranteed share of the screen.
   */
  .stage { min-height: 30vh; }
  .stage-bar { flex: 0 0 auto; max-height: 42vh; overflow-y: auto; }
  .tool-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tool-row::-webkit-scrollbar { display: none; }
  /* A flexible spacer inside a nowrap strip would push everything off-screen. */
  .tool-row > .spacer { display: none; }
  .tool-row > * { flex: 0 0 auto; }

  /*
   * The lists used to drop every column past the fourth on a phone. That is
   * not a narrower table, it is a broken one: the buttons live in the last
   * column, so resetting a password or editing a shot became impossible on the
   * device most likely to be in your hand on a stage. They scroll sideways
   * instead, inside their own box, and the Columns menu is still there for
   * anyone who would rather drop a column for good.
   */
  .dt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 100%; }

  /* Widths dragged out on a monitor mean nothing here, and a fixed layout with
     them would squeeze the text to nothing. Hidden columns are a choice and
     stay hidden; widths are a fit and get recalculated. */
  table.data.dt { table-layout: auto !important; }
  table.data.dt > * > tr > *:not([style*="display: none"]) { width: auto !important; }

  .modal-card { max-height: 92vh; }
}

/* The drawing surface must never be hijacked by the browser's own gestures. */
#draw-layer { touch-action: none; -webkit-user-select: none; user-select: none; }

/* Note count chip in the review toolbar - the first thing you want on opening. */
.note-count {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 10px; border-radius: 20px; cursor: pointer;
  background: #0e1116; border: 1px solid var(--line-2); font-size: 12px;
}
.note-count:hover { border-color: var(--accent); }
.note-count b { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.note-count span { color: var(--ink-3); }
.note-count em {
  font-style: normal; font-weight: 700; font-size: 11px;
  color: var(--amber); padding-left: 5px; border-left: 1px solid var(--line-2);
}
.note-count.has-open { border-color: #6b5620; }
.thumb-notes.done { color: var(--ink-2); }

/* Auto-key and laser read as modes, not as another brush. */
.tool.active svg { stroke-width: 2.1; }
.tool[title^="Auto-key is on"] { background: var(--green); color: #06210f; }
.tool[title^="Laser"].active { background: var(--red); color: #fff; }

/* --- secondary scope nav beside a list page ------------------------------- */

.page-with-nav { display: grid; grid-template-columns: 190px 1fr; min-height: 100%; }
.page-body { min-width: 0; }
.scope-nav {
  border-right: 1px solid var(--line); background: var(--bg-2);
  padding: 18px 10px; display: flex; flex-direction: column; gap: 2px;
}
.scope-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); cursor: pointer;
  font-size: 13px; text-align: left;
}
.scope-btn:hover { background: var(--panel); color: var(--ink); }
.scope-btn.active { background: var(--panel-2); color: var(--accent); font-weight: 600; }
.scope-btn span:first-child { flex: 1; }
.scope-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

@media (max-width: 760px) {
  .page-with-nav { grid-template-columns: 1fr; }
  .scope-nav {
    flex-direction: row; overflow-x: auto; border-right: 0;
    border-bottom: 1px solid var(--line); padding: 8px 10px;
  }
  .scope-btn { width: auto; white-space: nowrap; }
}

.marker-count {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 9px;
  border-radius: 20px; cursor: pointer; font-size: 11.5px;
  background: #0e1116; border: 1px solid var(--line-2); color: var(--ink-3);
}
.marker-count:hover { border-color: var(--red); color: var(--ink-2); }
.marker-count b { font-family: var(--mono); font-size: 13px; color: var(--blue); }

/* --- keyframe lane: which frames carry drawing ---------------------------- */

.tl-keys { position: absolute; left: 0; right: 0; top: 35px; height: 9px; }
.tl-key {
  position: absolute; top: 1px; height: 7px; border-radius: 2px; cursor: pointer;
  background: var(--accent); box-shadow: 0 0 4px rgba(255, 180, 84, .5);
}
/* A lone key reads as a diamond, the way a keyframe does in an animation tool. */
.tl-key.single {
  width: 7px; margin-left: -3.5px; border-radius: 1px;
  transform: rotate(45deg); box-shadow: 0 0 5px rgba(255, 180, 84, .65);
}
.tl-key.note { background: var(--purple); box-shadow: 0 0 4px rgba(192, 132, 252, .5); }
.tl-key.note.single { box-shadow: 0 0 5px rgba(192, 132, 252, .65); }
.tl-key:hover { filter: brightness(1.4); }

/* --- studio branding ------------------------------------------------------- */

.brand-logo { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 13.5px; letter-spacing: -.01em; }
.brand-text span { font-size: 10px; color: var(--ink-3); letter-spacing: .02em; }

.login-logo {
  display: block; width: 150px; margin: 0 auto 14px; object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .6));
}
.login-brand { justify-content: center; text-align: center; }

/* --- studio settings -------------------------------------------------------- */

.colour-input {
  width: 100%; height: 40px; padding: 3px; cursor: pointer;
  background: #0e1116; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.brand-preview {
  border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden;
  background: var(--bg);
}
.brand-preview-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.brand-preview-logo { width: 30px; height: 30px; object-fit: contain; }
.brand-preview-body { padding: 16px; }

/* --- zoom ------------------------------------------------------------------ */

.stage.can-pan { cursor: grab; }
.stage.panning { cursor: grabbing; }
.stage.can-pan #draw-layer,
.stage.panning #draw-layer { pointer-events: none; }
/* Crisp pixels when magnified: a review is about what is actually there. */
.stage-inner.zoomed video,
.stage-inner.zoomed img.plate { image-rendering: pixelated; }
.zoom-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border-radius: 20px; cursor: pointer; font-size: 11.5px;
  background: #0e1116; border: 1px solid var(--line-2); color: var(--ink-2);
}
.zoom-chip:hover { border-color: var(--accent); }
.zoom-chip b { font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* --- brush size indicator --------------------------------------------------- */

.brush-cursor {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  border: 1px solid var(--brush, #ff3b30);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .65), inset 0 0 0 1px rgba(0, 0, 0, .45);
  pointer-events: none; z-index: 6;
}
.brush-cursor.eraser {
  border-style: dashed; border-color: #ffffff;
  background: rgba(255, 255, 255, .10);
}
.brush-cursor.laser { border-color: #fff; background: rgba(255, 60, 48, .35); }
.brush-cursor.flash { transition: opacity .2s; }
.brush-cursor.hidden { display: none; }

/* The same ring, sitting next to the size control so the number means something. */
.brush-preview {
  width: 30px; height: 26px; display: grid; place-items: center;
  background: #0e1116; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.brush-preview i {
  display: block; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
}

/* --- other people in the room ---------------------------------------------- */

.peer-cursor {
  position: absolute; left: 0; top: 0; z-index: 7; pointer-events: none;
  display: flex; align-items: center; gap: 4px;
  transform-origin: 0 0;
}
.peer-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  background: var(--peer, #4ea1ff); box-shadow: 0 0 0 2px rgba(0, 0, 0, .55);
}
.peer-name {
  font-size: 10px; font-weight: 700; white-space: nowrap; color: #fff;
  background: var(--peer, #4ea1ff); padding: 1px 5px; border-radius: 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.peer-name.drawing::after { content: ' drawing'; opacity: .8; font-weight: 500; }
.viewers .avatar.live { box-shadow: 0 0 0 2px var(--green); }
.viewer-frame {
  font-family: var(--mono); font-size: 9px; color: var(--ink-3);
  margin-left: -4px; margin-right: 4px;
}

.peer-layer { position: absolute; inset: 0; pointer-events: none; z-index: 7; }

/* --- the live wire ------------------------------------------------------- */

/* Connection state, in the topbar. Quiet when it is working, obvious when not
   - a review tool that has silently stopped listening is worse than one that
   never listened, because you trust what you are looking at. */
.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); user-select: none; white-space: nowrap;
}
.live-dot i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3); flex: 0 0 auto;
}
.live-dot[data-state="live"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.live-dot[data-state="live"] i { background: var(--accent); animation: live-pulse 2.4s ease-in-out infinite; }
.live-dot[data-state="down"] { color: #e6a23c; border-color: #6b4b12; }
.live-dot[data-state="down"] i { background: #e6a23c; animation: live-pulse .9s ease-in-out infinite; }
.live-dot[data-state="down"] .live-text::after { content: ' \2014 reconnecting'; }

@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50%      { opacity: .55; box-shadow: 0 0 0 3px transparent; }
}

/* A number that moved while you were reading it. Brief, and it settles back to
   normal - the point is to catch the eye once, not to leave the page decorated. */
.just-changed { animation: just-changed 1.5s ease-out; border-radius: 6px; }
@keyframes just-changed {
  0%   { background: color-mix(in srgb, var(--amber) 34%, transparent); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot i, .just-changed { animation: none; }
  .just-changed { outline: 2px solid var(--accent); outline-offset: 2px; }
}

@media (max-width: 900px) { .live-dot .live-text { display: none; } }


/* --- reference images ---------------------------------------------------- */

/* Inside .stage-inner, so the plate transform carries these with the picture. */
.ref-layer {
  position: absolute; inset: 0;
  pointer-events: none;             /* only the references themselves take clicks */
  z-index: 4;
}

.ref-item {
  position: absolute;
  pointer-events: auto;
  border-radius: 3px;
  outline: 1px solid rgba(0, 0, 0, .55);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
  cursor: pointer;
  transition: opacity .12s ease;
}
.ref-item img, .ref-item .ref-canvas {
  display: block; width: 100%; height: auto;
  border-radius: 3px;
  -webkit-user-drag: none; user-select: none;
}
.ref-item.selected { outline: 2px solid var(--accent); }

/* Off its range but selected: visible enough to retime, faint enough that it
   is obviously not part of the frame. */
.ref-item.out-of-range { opacity: .3 !important; filter: grayscale(.5); }
.ref-item.out-of-range::after {
  content: 'not on this frame';
  position: absolute; left: 0; bottom: -18px;
  font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--amber); white-space: nowrap;
}

.ref-grip {
  position: absolute; inset: 0;
  cursor: move;
}
.ref-item.selected .ref-grip { cursor: move; }

.ref-size {
  position: absolute; right: -6px; bottom: -6px;
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--accent); border: 2px solid var(--bg);
  cursor: nwse-resize; opacity: 0; transition: opacity .12s ease;
}
.ref-item:hover .ref-size, .ref-item.selected .ref-size { opacity: 1; }

/* The timing menu. Scaled by 1/zoom inline so it stays readable when the plate
   is magnified rather than swelling to fill the screen. */
.ref-menu {
  position: absolute; left: 0; top: calc(100% + 8px);
  width: 268px; padding: 9px 10px 8px;
  /* .stage-inner sets line-height:0 to kill the inline gap under the video, and
     this menu is inside it - without resetting it every row collapses to
     nothing and the text piles up on itself. */
  line-height: 1.35;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
  cursor: default; z-index: 6;
}
.ref-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 7px;
}
.ref-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ref-label { font-size: 12px; color: var(--ink-2); min-width: 74px; }
.ref-value { font-size: 12px; font-family: ui-monospace, monospace; color: var(--accent); }
.ref-btn {
  background: var(--panel); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 3px 7px; font-size: 11px; cursor: pointer;
}
.ref-btn:hover { border-color: var(--accent); color: var(--ink); }
.ref-btn.danger { color: var(--red); border-color: transparent; }
.ref-btn.danger:hover { border-color: var(--red); }
.ref-slider { flex: 1; width: auto; }
.ref-hint { font-size: 11px; color: var(--ink-3); margin-top: 6px; line-height: 1.35; }

/* Dropping a file on the picture. */
.stage.drop-target { outline: 2px dashed var(--accent); outline-offset: -6px; }


/* --- profile pictures ----------------------------------------------------- */

/* The picture sits on top of the initials, so a slow or missing image shows
   the initials underneath rather than an empty circle. */
.avatar { position: relative; overflow: hidden; }
.avatar-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}


/* --- a note arriving ------------------------------------------------------ */

.note-pop-host {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 9px;
  width: min(370px, calc(100vw - 32px));
  pointer-events: none;
}
.note-pop {
  pointer-events: auto;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 9px 11px 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease;
}
.note-pop.in { opacity: 1; transform: none; }
.note-pop.clickable { cursor: pointer; }
.note-pop.clickable:hover { border-color: var(--accent); }

.note-pop-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-2); margin-bottom: 5px;
}
.note-pop-head b { color: var(--ink); }
.note-pop-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: 0 0 auto;
}
.note-pop-dot.blocker { background: var(--red); }
.note-pop-what { color: var(--ink-3); }
.note-pop-shot { color: var(--ink-2); }
.note-pop-frame { color: var(--accent); }
.note-pop-close {
  background: none; border: 0; color: var(--ink-3);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.note-pop-close:hover { color: var(--ink); }
.note-pop-body {
  font-size: 13px; color: var(--ink); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-pop-body.dim { color: var(--ink-3); font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .note-pop { transition: none; opacity: 1; transform: none; }
}


/* --- full reviews --------------------------------------------------------- */

.scope-sep {
  height: 1px; background: var(--line);
  margin: 9px 10px;
}

.grid.cuts {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.cut-card { overflow: hidden; }
.cut-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
/* The running time, because the first thing you want to know about a cut is
   how long you are committing to. */
.cut-length {
  position: absolute; right: 7px; bottom: 7px;
  background: rgba(0, 0, 0, .72); color: var(--ink);
  padding: 2px 6px; border-radius: 4px; font-size: 11px;
}
.cut-card.waiting .cut-thumb { opacity: .55; }


/* --- assembled reels ------------------------------------------------------ */

.cut-kind {
  position: absolute; left: 7px; top: 7px;
  background: rgba(0, 0, 0, .72); color: var(--ink-3);
  padding: 2px 6px; border-radius: 4px;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
}
.cut-kind.assembled { color: var(--accent); }

.reel-layout {
  display: grid; grid-template-columns: 1fr 340px;
  gap: 14px; height: 100%; min-height: 0; padding: 14px;
}
.reel-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.reel-stage-wrap {
  position: relative; flex: 1; min-height: 0;
  background: #000; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.reel-stage { position: absolute; inset: 0; }
.reel-under { padding-top: 10px; }

.reel-clip-tag {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; margin-bottom: 8px;
}

/* One bar for the whole edit, with the cuts marked on it - so a nine minute
   reel reads as a shape rather than a scrollbar. */
.reel-bar {
  position: relative; height: 30px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.reel-played { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(245, 205, 80, .14); }
.reel-cuts, .reel-pins { position: absolute; inset: 0; pointer-events: none; }
.reel-cut-mark {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--line-2);
}
.reel-pin {
  position: absolute; top: 3px; width: 7px; height: 7px; margin-left: -3px;
  border-radius: 50%; background: var(--accent);
  pointer-events: auto; cursor: pointer;
}
.reel-pin.done { background: var(--ink-3); }
.reel-pin.blocker { background: var(--red); }
.reel-head {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--ink); pointer-events: none;
}

.reel-strip {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px;
}
.reel-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel);
  font-size: 11px; white-space: nowrap; cursor: pointer;
}
.reel-chip:hover { border-color: var(--line-2); }
.reel-chip.active { border-color: var(--accent); color: var(--accent); }

.reel-side {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.reel-notes { flex: 1; overflow-y: auto; min-height: 0; }
.reel-notes-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.reel-note {
  padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.reel-note.clickable { cursor: pointer; }
.reel-note.clickable:hover { background: var(--panel-2); }
.reel-note-top { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.reel-note-at { color: var(--accent); font-size: 12px; }
.reel-note-body { font-size: 13px; line-height: 1.4; }
.reel-composer { padding: 10px 12px; border-top: 1px solid var(--line); }
.reel-composer textarea { width: 100%; resize: vertical; }

/* --- building the reel ---------------------------------------------------- */

.reel-edit-list { display: flex; flex-direction: column; gap: 6px; }
.reel-edit-row {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel);
}
.reel-edit-num { color: var(--ink-3); width: 22px; text-align: right; font-size: 12px; }
.reel-edit-thumb {
  width: 74px; aspect-ratio: 16/9; border-radius: 3px;
  background: #000 center/cover no-repeat; flex: 0 0 auto;
}

@media (max-width: 1100px) {
  .reel-layout { grid-template-columns: 1fr; }
  .reel-side { max-height: 42vh; }
}


/* Upload notes: a warning is worth reading, a refusal has to be. */
.fps-note.bad {
  border-color: var(--red);
  color: var(--ink);
  background: rgba(255, 95, 86, .07);
}
.fps-note.bad b { color: var(--red); }


/* --- the cast screen ------------------------------------------------------ */

/*
 * A television across the room, not a workstation: the picture takes the whole
 * screen and the only furniture is a strip telling you where you are. Type is
 * sized to be read at three metres, not thirty centimetres.
 */
.cast-shell {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: #000;
}
.cast-stage { flex: 1; min-height: 0; }
.cast-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: var(--bg-2); border-top: 1px solid var(--line);
  font-size: clamp(14px, 1.5vw, 22px);
}
.cast-logo { height: clamp(26px, 3vw, 44px); width: auto; }
.cast-where b { display: block; font-size: clamp(15px, 1.7vw, 26px); }
.cast-shot { color: var(--ink-3); font-size: clamp(11px, 1.1vw, 17px); }

.cast-note {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: baseline; gap: 10px;
  color: var(--ink);
  font-size: clamp(13px, 1.4vw, 21px);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cast-note-who {
  color: var(--accent); text-transform: uppercase; letter-spacing: .05em;
  font-size: .78em; flex: 0 0 auto;
}

.cast-frame {
  display: flex; align-items: baseline; gap: 10px; flex: 0 0 auto;
}
.cast-frame b { color: var(--accent); font-size: clamp(18px, 2.2vw, 34px); }
.cast-frame span { font-size: clamp(12px, 1.2vw, 18px); }

/* Quiet when it is working; obvious when the screen has stopped listening. */
.cast-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-3); flex: 0 0 auto;
}
.cast-dot[data-state="live"] { background: var(--green); }
.cast-dot[data-state="down"] { background: var(--red); }

.cast-url {
  width: 100%; font-family: var(--mono); font-size: 13px;
}
