/* ReviewMyEdit. Edit-bay slate with one grease-pencil yellow; reviewer colors do the rest. */
:root {
  --bg: #162125;
  --panel: #1c2a2f;
  --raised: #25373f;
  --well: #111a1d;
  --line: #2f454d;
  --line-soft: #253940;
  --text: #e9f0ee;
  --muted: #93a8ad;
  --faint: #8298a0;
  --accent: #f2c230;
  --accent-ink: #1b1602;
  --danger: #ff7a6b;
  --ok: #9be564;
  --font-ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-brand: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- brand mark: a note tick on a strip ---------- */
.brand {
  font: 800 22px/1 var(--font-brand);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand::before {
  content: '';
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: var(--accent);
}
.brand.small { font-size: 17px; }
.brand.small::before { height: 16px; width: 4px; }

/* ---------- controls ---------- */
.btn {
  font: 600 14px/1.2 var(--font-ui);
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ffd24a; }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--text); }
.btn.quiet:hover { background: var(--raised); }
.btn.danger { background: var(--danger); color: #2a0d09; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 11px 14px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font-size: 13.5px;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}
.link:hover { text-decoration-color: var(--text); }
.link.subtle { color: var(--muted); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--faint); line-height: 1.4; }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.select { width: auto; padding: 8px 30px 8px 12px; font-weight: 600; font-size: 14px; }

.more {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.more:hover { background: var(--raised); color: var(--text); }

/* ---------- menu, dialog, toast ---------- */
.menu {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  padding: 5px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(6, 13, 15, 0.55);
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}
.menu-item:hover, .menu-item:focus-visible { background: #314952; outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }

.dlg {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.dlg::backdrop { background: rgba(8, 14, 16, 0.68); }
.dlg-form { display: grid; gap: 14px; padding: 22px; }
.dlg-title { font: 800 20px/1.2 var(--font-brand); letter-spacing: -0.01em; }
.dlg-body { color: var(--muted); font-size: 14px; }
.dlg-err { color: var(--danger); font-size: 13.5px; }
.dlg-err:empty { display: none; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  max-width: calc(100vw - 32px);
  transform: translate(-50%, 8px);
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #2a0d09; }

/* ---------- signed-out page ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 500px) 1fr;
}
.auth-copy { padding: 44px 48px 48px; display: flex; flex-direction: column; }
.auth-head {
  margin-top: 13vh;
  font: 800 clamp(36px, 4.4vw, 54px)/1.02 var(--font-brand);
  letter-spacing: -0.03em;
}
.auth-sub { margin-top: 16px; color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 40ch; }
.auth-form { margin-top: 30px; display: grid; gap: 14px; max-width: 360px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-msg { color: var(--danger); font-size: 13.5px; }
.auth-msg.ok { color: var(--ok); }
.auth-msg:empty { display: none; }

.auth-demo {
  background: var(--panel);
  border-left: 1px solid var(--line-soft);
  display: grid;
  place-items: center;
  padding: 48px;
}
.demo-frame { width: min(540px, 100%); }
.demo-screen {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: var(--well);
  display: grid;
  place-items: center;
}
.demo-play {
  width: 0;
  height: 0;
  border-left: 22px solid var(--line);
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  margin-left: 6px;
}
.demo-strip { margin-top: 12px; cursor: default; }
.demo-notes { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 11px; }
.demo-notes li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.demo-notes i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.demo-notes b { font-size: 12.5px; font-variant-numeric: tabular-nums; background: var(--raised); padding: 2px 8px; border-radius: 12px; }
.demo-notes em { font-style: normal; font-weight: 600; margin-right: 6px; }

/* ---------- workspace ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100vh; }
.side {
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 10px 14px;
  min-height: 0;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 16px; }
.tree { flex: 1; overflow: auto; display: grid; align-content: start; gap: 1px; }
.tree-row { display: flex; align-items: center; border-radius: 7px; padding-right: 4px; }
.tree-row:hover { background: #213238; }
.tree-row.active { background: var(--raised); }
.tree-row.drop { outline: 2px solid var(--accent); outline-offset: -2px; }
.tree-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 6px;
  font-size: 14.5px;
  border-radius: 7px;
}
.tree-row.active .tree-item { font-weight: 600; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-ico {
  flex: none;
  width: 16px;
  height: 12px;
  border-radius: 2px 3px 3px 3px;
  background: var(--faint);
  position: relative;
}
.folder-ico::before { content: ''; position: absolute; left: 0; top: -3px; width: 7px; height: 4px; border-radius: 2px 2px 0 0; background: inherit; }
.tree-row.active .folder-ico { background: var(--accent); }
.tree-row .more { opacity: 0; }
.tree-row:hover .more, .tree-row .more:focus-visible, .tree-row.active .more { opacity: 1; }
.side-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 8px 0;
  margin-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
}
.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { overflow: auto; padding: 26px 32px 40px; }
.main-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.main-head h1 { font: 800 26px/1.15 var(--font-brand); letter-spacing: -0.02em; overflow-wrap: anywhere; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 24px 18px; }
.card { min-width: 0; }
.card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--well);
  box-shadow: 0 0 0 1px var(--line-soft);
}
.card-thumb:hover { box-shadow: 0 0 0 2px var(--muted); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(17, 26, 29, 0.88);
  font-size: 12px;
  font-weight: 600;
}
.badge.reel { left: auto; right: 8px; }
.dot-open {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 26, 29, 0.8);
}
.card-meta { display: flex; align-items: flex-start; gap: 6px; padding-top: 9px; }
.card-text { flex: 1; min-width: 0; }
.card-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-notes { margin-top: 2px; font-size: 13px; color: var(--muted); }

.empty { max-width: 430px; margin: 12vh 0 0; }
.empty h2 { font: 800 24px/1.15 var(--font-brand); letter-spacing: -0.02em; }
.empty p { margin: 10px 0 20px; color: var(--muted); }

/* ---------- review page ---------- */
body.rv { height: 100vh; display: flex; flex-direction: column; }
.rv-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.rv-back { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.rv-back::before { content: '‹'; margin-right: 6px; font-size: 18px; line-height: 0; }
.rv-back:hover { color: var(--text); }
.rv-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.rv-title h1 { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-by { font-size: 13px; color: var(--muted); white-space: nowrap; }
.rv-actions { display: flex; align-items: center; gap: 8px; }

.rv-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 388px; }
.stage { min-width: 0; overflow: auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 12px; }

.player-shell { display: flex; justify-content: center; background: #0b1214; border-radius: 8px; overflow: hidden; }
.player-box { aspect-ratio: 16 / 9; width: min(100%, max(320px, calc((100vh - 372px) * 16 / 9))); }
.player-shell.portrait .player-box { aspect-ratio: 9 / 16; width: auto; height: min(calc(100vh - 372px), 760px); min-height: 380px; max-width: 100%; }
.player-box iframe, .player-box > div { width: 100%; height: 100%; border: 0; display: block; }
.player-msg { padding: 10px 12px; border-radius: 8px; background: #3a2320; color: #ffd9d2; font-size: 14px; }

/* The strip: film leader with a grease-pencil tick for every note. */
.strip {
  position: relative;
  height: 32px;
  border-radius: 6px;
  background-color: var(--panel);
  background-image:
    repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 13px),
    repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 13px);
  background-size: 100% 3px, 100% 3px;
  background-position: 0 4px, 0 calc(100% - 4px);
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}
.playhead {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: #fff;
  pointer-events: none;
  z-index: 2;
}
.tick {
  position: absolute;
  top: 9px;
  bottom: 9px;
  width: 7px;
  margin-left: -3.5px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--c, var(--accent));
  z-index: 1;
}
button.tick:hover, button.tick:focus-visible { top: 6px; bottom: 6px; box-shadow: 0 0 0 2px var(--bg); }
.tick.done { opacity: 0.35; }
.strip-times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.composer { display: grid; gap: 10px; padding: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; }
.who-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compose-row { display: flex; align-items: flex-start; gap: 10px; }
.chip {
  flex: none;
  min-width: 66px;
  height: 41px;
  padding: 0 13px;
  border: 0;
  border-radius: 21px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="false"] { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.compose-row textarea { flex: 1; min-height: 41px; resize: vertical; padding: 9px 12px; line-height: 1.4; }
.compose-row .btn { height: 41px; }
.compose-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); min-height: 18px; }
.compose-err { color: var(--danger); text-align: right; }

.notes { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line-soft); }
.notes-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 15px 16px 10px; }
.notes-head h2 { font-size: 15px; font-weight: 600; }
.count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.seg { display: inline-flex; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.seg-btn { background: none; border: 0; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg-btn.on { background: var(--raised); color: var(--text); }
.list { flex: 1; overflow: auto; padding: 2px 8px 24px; }
.list-empty { padding: 26px 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.note { padding: 12px 8px 13px; border-bottom: 1px solid var(--line-soft); border-radius: 8px; }
.note:last-child { border-bottom: 0; }
.note.flash { animation: flash 1.3s ease-out; }
@keyframes flash { from { background: rgba(242, 194, 48, 0.2); } to { background: transparent; } }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.author { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: 11.5px; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); border-radius: 4px; padding: 0 5px; }
.time { flex: none; border: 0; background: var(--raised); border-radius: 12px; padding: 2px 9px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
button.time:hover { background: var(--accent); color: var(--accent-ink); }
.time.general { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.ago { margin-left: auto; flex: none; font-size: 12px; color: var(--faint); }
.note-body { margin: 6px 0 0 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.note.done > .note-body { color: var(--muted); }
.reply { margin: 11px 0 0 18px; padding-left: 12px; border-left: 2px solid var(--line); }
.reply .ago { margin-left: 0; }
.reply .link { margin-left: auto; font-size: 12.5px; }
.note-actions { display: flex; align-items: center; gap: 14px; margin: 9px 0 0 18px; }
.note-actions .link { font-size: 13px; }
.done-tag { color: var(--ok); font-size: 12.5px; font-weight: 600; }
.reply-box { display: grid; gap: 8px; margin: 10px 0 0 18px; }
.reply-box textarea { resize: vertical; padding: 8px 10px; }
.reply-actions { display: flex; justify-content: flex-end; gap: 8px; }

.gone { max-width: 470px; margin: 16vh auto 0; padding: 0 24px; }
.gone h2 { font: 800 28px/1.1 var(--font-brand); letter-spacing: -0.02em; }
.gone p { margin-top: 12px; color: var(--muted); font-size: 16px; }

/* ---------- transport: our own controls under the player ---------- */
.deck { display: flex; flex-direction: column; gap: 10px; }
.transport:focus { outline: none; }
.transport { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tp-main { display: flex; align-items: center; gap: 6px; }
.tp-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--raised);
  color: var(--text);
}
.tp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.tp-btn:hover { background: #314952; }
.tp-btn.on { background: var(--accent); color: var(--accent-ink); }
.tp-play { width: 48px; height: 48px; background: var(--text); color: var(--bg); }
.tp-play:hover { background: #fff; }
.tp-play svg { width: 24px; height: 24px; }
.tp-play .ico-pause, .tp-play.on .ico-play { display: none; }
.tp-play.on .ico-pause { display: block; }
.tp-speed {
  min-width: 52px;
  height: 32px;
  margin-left: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.tp-speed:hover { background: var(--raised); }
.tp-speed.hot { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.tp-time { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-time .tp-of, .tp-time #t-dur { color: var(--muted); font-weight: 500; }
.tp-keys { margin-left: auto; font-size: 12.5px; color: var(--faint); }
kbd {
  display: inline-block;
  min-width: 20px;
  margin: 0 2px 0 8px;
  padding: 1px 5px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--line);
  font: 600 11.5px/1.5 var(--font-ui);
  color: var(--muted);
  text-align: center;
}
kbd + kbd { margin-left: 0; }

/* ---------- drawing on a screen grab ---------- */
#btn-draw { display: inline-flex; align-items: center; gap: 7px; }
#btn-draw svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.attach { display: flex; align-items: center; gap: 12px; }
.attach img { height: 62px; max-width: 150px; border-radius: 5px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.attach-text { display: grid; gap: 3px; font-size: 13.5px; }
.attach-text span { display: flex; gap: 12px; }

.draw {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.draw[open] { display: flex; flex-direction: column; }
.draw::backdrop, .lightbox::backdrop { background: rgba(8, 14, 16, 0.78); }
.draw-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.draw-title { font: 800 17px/1.2 var(--font-brand); letter-spacing: -0.01em; margin-right: auto; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.draw-edit { display: flex; gap: 6px; }
.draw-wrap { position: relative; flex: 1; min-height: 220px; display: grid; place-items: center; padding: 14px; background: var(--well); overflow: auto; }
.draw-canvas { max-width: 100%; max-height: calc(100vh - 210px); border-radius: 4px; cursor: crosshair; touch-action: none; }
.draw-drop { max-width: 420px; padding: 28px 12px; text-align: center; }
.draw-drop h3 { margin: 0; font: 800 20px/1.2 var(--font-brand); letter-spacing: -0.01em; }
.draw-drop p { margin: 10px 0 18px; color: var(--muted); }
.draw-drop .btn { display: inline-block; cursor: pointer; }
.draw-text {
  position: absolute;
  width: 190px !important;
  padding: 5px 8px !important;
  background: rgba(17, 26, 29, 0.9) !important;
  border: 1px dashed var(--muted) !important;
  font-weight: 600;
}
.draw-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.draw-foot .link { cursor: pointer; }
.draw-err { margin-right: auto; color: var(--danger); font-size: 13.5px; }
.draw-foot .link + .draw-err:empty { margin-right: auto; }

.grab { display: block; margin: 8px 0 0 18px; padding: 0; border: 0; background: none; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.grab img { display: block; width: 100%; max-width: 320px; max-height: 240px; object-fit: contain; background: var(--well); }
.grab:hover { box-shadow: 0 0 0 2px var(--muted); }
.lightbox { max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 100px); }
.lightbox-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: 14px; }

/* ---------- front page and sharing ---------- */
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-head.small { font-size: clamp(28px, 3vw, 36px); }
.fineprint { font-size: 13px; color: var(--muted); }
.auth-form .btn.quiet.wide { margin-top: -4px; }
.keep { display: grid; gap: 10px; margin-bottom: 22px; padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.keep-text { font-size: 14.5px; max-width: 70ch; }
.keep-row { display: flex; gap: 8px; flex-wrap: wrap; }
.keep-row input { flex: 1; min-width: 220px; max-width: 360px; }
.share-row { display: flex; gap: 8px; }
.share-link { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.share-note { font-size: 13.5px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line-soft); }
dialog.share { width: min(520px, calc(100vw - 32px)); }

/* ---------- small screens ---------- */
@media (max-width: 920px) {
  .auth { grid-template-columns: 1fr; }
  .auth-copy { padding: 28px 22px 36px; }
  .auth-head { margin-top: 40px; }
  .auth-demo { border-left: 0; border-top: 1px solid var(--line-soft); padding: 28px 22px 40px; }

  .shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .side { border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 14px 10px 12px; }
  .tree { max-height: 30vh; }
  .tree-row .more { opacity: 1; }
  .main { overflow: visible; padding: 20px 16px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; }

  body.rv { height: auto; min-height: 100vh; }
  .rv-top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
  .rv-title { flex-basis: 60%; flex-direction: column; align-items: flex-start; gap: 1px; }
  .rv-title h1 { max-width: 100%; }
  .rv-actions { flex-wrap: wrap; }
  .rv-body { grid-template-columns: 1fr; }
  .stage { overflow: visible; padding: 14px 14px 18px; }
  .player-box { width: 100%; }
  .player-shell.portrait .player-box { height: min(56vh, 560px); min-height: 0; }
  .notes { border-left: 0; border-top: 1px solid var(--line-soft); }
  .list { overflow: visible; }
  .who-fields { grid-template-columns: 1fr; }
  .tick { width: 11px; margin-left: -5.5px; top: 6px; bottom: 6px; }
  .strip { height: 38px; }
  .compose-row { flex-wrap: wrap; }
  .compose-row textarea { flex-basis: calc(100% - 80px); }
  .compose-row .btn { width: 100%; }
  /* Phone: the video, strip and controls stay pinned while the notes scroll under them. */
  .stage { display: contents; }
  .deck { position: sticky; top: 0; z-index: 5; padding: 10px 14px; background: var(--bg); gap: 8px; box-shadow: 0 1px 0 var(--line-soft); }
  .composer { margin: 12px 14px 16px; }
  .deck:has(.portrait) { position: static; }
  .player-shell { border-radius: 6px; }
  .transport { gap: 10px; justify-content: space-between; }
  .tp-keys { display: none; }
  .tp-btn { width: 44px; height: 44px; }
  .tp-play { width: 52px; height: 52px; }
  #btn-draw { flex: 1; justify-content: center; height: 41px; }
  .compose-row #post { flex: 1; width: auto; }
  .draw { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .draw-bar { padding: 10px 12px; gap: 8px 10px; }
  .draw-title { flex-basis: 100%; font-size: 16px; }
  .draw-wrap { padding: 8px; }
  .draw-canvas { max-height: calc(100dvh - 230px); }
  .draw-foot { flex-wrap: wrap; padding: 10px 12px; }
  .draw-foot .btn { flex: 1; }
  .swatch { width: 30px; height: 30px; }
  .grab img { max-width: 100%; }

}
@media (hover: none) { .tree-row .more { opacity: 1; } .tp-keys { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .note.flash { animation: none; }
}
