* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-interface, system-ui, sans-serif);
  color: var(--fg);
  background: var(--bg);
}

body {
  display: flex;
  flex-direction: column;
}

/* UA link color is off-palette in both themes, periwinkle under color-scheme: dark */
a { color: var(--accent); }

#transcript {
  font-family: var(--font-transcript, system-ui, sans-serif);
  font-variation-settings: var(--font-transcript-variations, normal);
}

#settingsDlg, #saveDlg, #analysisDlg, #docSettingsDlg {
  min-width: 360px;
  max-width: 440px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--fg);
}
#settingsDlg { max-width: 660px; }
#settingsDlg::backdrop, #saveDlg::backdrop, #analysisDlg::backdrop,
#docSettingsDlg::backdrop { background: var(--backdrop); }
#settingsDlg h2, #saveDlg h2, #analysisDlg h2, #docSettingsDlg h2 { margin: 0 0 12px; font-size: 16px; }

#analysisSummary { font-size: 13px; margin-bottom: 12px; }
#analysisSummary div { margin: 2px 0; }
#analysisBody { border-collapse: collapse; width: 100%; font-size: 14px; }
#analysisBody th { text-align: left; font-weight: 600; color: var(--muted); padding: 2px 16px 4px 0; }
#analysisBody td { padding: 2px 16px 2px 0; }
#analysisBody th:nth-child(n+2), #analysisBody td:nth-child(n+2) { text-align: right; }
#analysisBody tr.total td { font-weight: 600; }
#analysisBody tr.total + tr:not(.total) td { border-top: 1px solid var(--line-faint); padding-top: 4px; }
#analysisDlg form { margin-top: 14px; text-align: right; }

/* non-modal bottom panel: a flex row between the transcript and the footer */
#logDlg {
  position: static;
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 6px 12px 8px;
  border: none;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-panel);
  color: inherit;
}
#logDlg .loghead { display: flex; gap: 16px; align-items: baseline; }
#logDlg .loghead h2 { margin: 0; font-size: 14px; }
#logBody {
  margin-top: 6px;
  max-height: 10.5em;   /* 7 rows at line-height 1.5 */
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--fg-dim);
}
#logBody .log-err { color: var(--err); }
#logBody .log-warn { color: var(--warn); }
#logBody .log-ok { color: var(--ok); }
.helpbody { font-size: 14px; line-height: 1.45; }
.helpbody p { margin: 10px 0; }
.helpbody .keys td { padding: 2px 12px 2px 0; }
.helpbody kbd, #helpCard kbd {
  padding: 1px 5px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-sunken);
}

/* the /help guide, rendered in the transcript pane like the index pages */
#transcript .guide { max-width: 64ch; font-size: 15px; line-height: 1.55; }
#transcript .guide h2 {
  display: block;
  margin: 26px 0 4px;
  font-size: 17px;
  font-weight: 700;
  cursor: default;
  border-bottom: none;
  padding-bottom: 0;
}

/* first-visit card: in the page flow above the transcript, not over it */
#helpCard {
  flex: 0 0 auto;
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-panel);
  font-size: 13px;
  color: var(--fg-dim);
}
#helpCard[hidden] { display: none; }
#helpCard .tips {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
}
#helpCard .tips span { white-space: nowrap; }
#helpCard .tips span:not(:last-child)::after { content: " ·"; color: var(--line); }
#helpCard a { color: var(--accent); white-space: nowrap; }
#helpCard button {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
  white-space: nowrap;
}
#helpCard button:hover { background: var(--hover); }

/* ? shortcuts: a corner panel, not a modal — keys work while it is open */
#keysPanel {
  position: fixed;
  right: 12px;
  bottom: 44px;
  z-index: 50;
  padding: 10px 16px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}
#keysPanel[hidden] { display: none; }
#keysPanel h2 { margin: 0 0 6px; font-size: 14px; }
#settingsDlg .field, #clipDlg .field, #saveDlg .field, #exportDlg .field,
#docSettingsDlg .field { display: block; margin: 10px 0; font-size: 14px; }
#settingsDlg .fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 9px 12px;
  margin: 12px 0;
}
#settingsDlg .field { display: contents; }
#settingsDlg .flabel { white-space: nowrap; font-size: 14px; }
#settingsDlg .fnote { color: var(--muted); font-size: 12px; }
#settingsDlg #authorInput { width: 14ch; }
#settingsDlg #ghLoginBtn { justify-self: start; }
#settingsDlg #aiProviderInput { width: 100%; }
#settingsDlg #aiKeyStatus { max-width: 150px; }
#saveDlg .check, #exportDlg .check { display: flex; gap: 8px; align-items: baseline; margin: 12px 0; font-size: 13px; }
#saveDlg .check[hidden], #exportDlg .check[hidden] { display: none; }
#saveDlg .check:has(input:disabled) { opacity: .45; }
#saveDlg .field select, #exportDlg .field select { display: block; margin-top: 4px; font-size: 13px; max-width: 100%; }
#saveDlg .field.inline, #exportDlg .field.inline { display: flex; align-items: baseline; gap: 8px; }
#saveDlg .field.inline select, #exportDlg .field.inline select { display: inline-block; margin-top: 0; }
#saveDlg .field[hidden], #exportDlg .field[hidden] { display: none; }
/* every text field: UA fill under color-scheme: dark sits above the dialog, not in it */
#settingsDlg .field input, #clipDlg .field input {
  background: var(--bg-sunken);
  color: var(--fg);
}
#settingsDlg .field input, #clipDlg .field input, #ingestDlg .field input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
#settingsDlg .field input { margin-top: 0; }
#settingsDlg .keyrow { display: flex; align-items: center; gap: 6px; }
#settingsDlg .keyrow input { flex: 1; min-width: 0; }
#settingsDlg .keyshow {
  display: flex;
  padding: 3px 4px;
  border: none;
  background: none;
  color: var(--fg);
  opacity: .45;
  cursor: pointer;
}
#settingsDlg .keyshow:hover, #settingsDlg .keyshow.on { opacity: 1; }
#settingsDlg .ghrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
#settingsDlg .ghavatar { width: 22px; height: 22px; border-radius: 50%; }
#settingsDlg .ghstatus { font-size: 13px; color: var(--fg); }
#settingsDlg .ghstatus.muted { color: var(--muted); }
#settingsDlg .field button:not(.keyshow) {
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
  white-space: nowrap;
}
/* dialog position + .dlgclose live in chrome.css (shared with static pages) */
#settingsDlg .check {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 12px 0;
  font-size: 14px;
}
#settingsDlg form, #clipDlg form, #saveDlg form,
#docSettingsDlg form { margin-top: 14px; text-align: right; }
#settingsDlg form button, #clipDlg form button, #saveDlg form button,
#docSettingsDlg form button {
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
}
#clipDlg .cliptimes { display: flex; gap: 12px; align-items: baseline; }
#clipDlg .cliptimes input { width: 64px; display: inline-block; margin-left: 4px; }
#clipDlg .cliptimes-note { color: var(--muted); font-size: 12px; }
#clipDlg .hint, #saveDlg .hint, #exportDlg .hint,
#suggestSecDlg .hint, #aiSuggestDlg .hint { color: var(--muted); font-size: 12px; }
#suggestSecDlg, #aiSuggestDlg { max-width: 420px; }
#docSettingsDlg { width: 480px; max-width: 480px; }
#docSettingsDlg .field.inline { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
#docSettingsDlg select { font-size: 13px; width: 5.5em; }
#docSettingsDlg select.off { width: auto; }   /* fit "Do not shorten pauses" */
#docSettingsDlg #docPauseLen {
  width: 4.5em;
  padding: 2px 6px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-sunken);
  color: var(--fg);
}
#docPausePreview { color: var(--muted); font-size: 12px; }
#docSettingsDlg .orignames { display: flex; gap: 8px; margin-top: 4px; }
#docSettingsDlg .orignames input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-sunken);
  color: var(--fg);
}
#docSettingsDlg .orignames button {
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
  white-space: nowrap;
}
#aiSuggestDlg .check { display: flex; gap: 8px; align-items: baseline; margin: 6px 0 0 14px; font-size: 13px; cursor: pointer; }
#exportDlg #exportFormatNote { margin: 4px 0 10px; }
#saveDlg .scopeline { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
#clipErr, #docSettingsErr { color: var(--err); font-size: 13px; white-space: pre-wrap; }
#settingsDlg .keysnote { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.keystatus { font-size: 12px; color: var(--muted); }
.keystatus.ok, #settingsDlg .ghstatus.ok { color: var(--ok); }
.keystatus.bad, #settingsDlg .ghstatus.bad { color: var(--err); }
/* wizard progress: stage headings the transcript fills with as loading runs */
#clipYtdlp {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-sunken);
  padding: 6px 8px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

#toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

#toolbar button {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
}

#toolbar button:hover { background: var(--hover); }
#toolbar select {
  font-size: 13px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
}
#toolbar[hidden] { display: none; }
#toolbar .tblabel { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
#toolbar .tblabel[hidden] { display: none; }
#audioProg { width: 90px; }
#toolbar .sep { width: 1px; height: 20px; background: var(--line-soft); }

/* which transcript: leads the toolbar, the titlebar is menus only */
#project {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#project[hidden] { display: none; }
#projectRepo { font-size: 13px; color: var(--muted); white-space: nowrap; }
#projectSel {
  font-size: 13px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  max-width: 40ch;
  cursor: pointer;
}

#assemblySources {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-panel);
}
#assemblySources[hidden] { display: none; }
#assemblySources .srcrow { display: flex; gap: 6px; align-items: center; }
#assemblySources .srcname { color: var(--muted); max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#assemblySources a.srcname {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  text-decoration: none;
  cursor: pointer;
}
#assemblySources a.srcname:hover { text-decoration: underline; color: var(--accent); }
#assemblySources .srcname.srcgone { text-decoration: line-through; }
#assemblySources .driftbadge {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--amber-line-strong);
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--amber-fg);
  cursor: pointer;
  white-space: nowrap;
}
#assemblySources .driftbadge:hover { border-color: var(--accent); }

#driftDiff { max-height: 50vh; overflow-y: auto; margin: 8px 0; }
#driftDiff .driftrow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: baseline; padding: 3px 0; }
#driftDiff .diffcell { font-size: 15px; }
#driftDiff .diffcell.st-cut { color: var(--muted); text-decoration: line-through; }
#driftDiff .diffcell.st-highlight { background: var(--hl-bg); color: var(--hl-fg); }
#driftDiff .diffarrow { color: var(--muted); }

#syncVersion { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
#syncVersion[hidden] { display: none; }
#layers { display: flex; gap: 4px; align-items: center; margin-left: auto; }
/* two auto margins would split the free space: version's alone right-aligns */
#syncVersion:not([hidden]) ~ #layers { margin-left: 0; }
#layers .layerchip {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raised);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
#layers .layerchip:hover { border-color: var(--accent); }
#layers .layerchip.off {
  color: var(--muted);
  background: var(--bg-inactive);
  border-style: dashed;
  text-decoration: line-through;
}
#layers .unsavedbadge { color: var(--err); font-weight: 600; margin-left: 5px; }

#transcript {
  --tr-offset: -7ch;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 15% 40vh;
  line-height: 1.9;
  font-size: 21px;
  outline: none;
  caret-color: var(--accent);
  position: relative;
}

#transcript:has(> .row) {
  font-size: var(--tr-size, 21px);
  line-height: var(--tr-leading, 1.9);
}
#transcript > .row {
  position: relative;
  box-sizing: border-box;
  width: calc(100% - var(--tr-gutter, 0px));
  max-width: var(--tr-measure, 100%);
  margin: 0 auto var(--tr-row-gap, 8px);
  left: calc(var(--tr-gutter, 0px) / 2 + var(--tr-offset));
}
#transcript > .row > .ts {
  font-size: var(--tr-ts-size, 13px);
  font-family: var(--tr-label-font, inherit);
  font-variation-settings: var(--tr-label-variations, inherit);
}
#transcript > .row > .spk {
  text-transform: var(--tr-spk-transform, none);
  font-weight: var(--tr-spk-weight, 600);
  font-family: var(--tr-label-font, inherit);
  font-variation-settings: var(--tr-label-variations, inherit);
}
#transcript[data-ts-display="gutter"] > .row > .ts {
  display: inline-block;
  position: relative;
  left: -0.5em;
  width: 0;
  margin-right: 0;
  white-space: nowrap;
}
#transcript[data-ts-display="gutter"] > .row > .ts > span {
  display: inline-block;
  transform: translateX(-100%);
}
#transcript[data-ts-display="none"] > .row > .ts { display: none; }
#transcript[data-spk-display="block"] > .row > .spk:not([hidden]),
#transcript[data-spk-display="block"] > .row > .repldraft:has(+ .spk[hidden]) {
  display: inline-block;
  width: 100%;
  padding-left: 25%;
  margin-right: 0;
}
#transcript[data-spk-display="gutter"] > .row > .spk {
  float: left;
  width: var(--tr-gutter);
  margin-left: calc(-1 * var(--tr-gutter));
  box-sizing: border-box;
  padding-right: 8px;
  overflow-wrap: anywhere;
}
#transcript[data-spk-display="gutter"][data-ts-display="gutter"] > .row > .spk {
  padding-top: calc(var(--tr-size) * var(--tr-leading));
}
#transcript:has(> .row) > h2 {
  box-sizing: border-box;
  width: calc(100% - var(--tr-h2-indent, -7%));
  margin-left: var(--tr-h2-indent, -7%);
  font-family: inherit;
  font-variation-settings: inherit;
  font-size: inherit;
  line-height: 1.3;
  font-weight: inherit;
  border-bottom-color: var(--tr-h2-rule, transparent);
}
#transcript:has(> .row) > h2 .sectitle {
  font-family: var(--font-header, system-ui, sans-serif);
  font-variation-settings: var(--font-header-variations, normal);
  font-size: var(--tr-h2-size, 24px);
  font-weight: var(--tr-h2-weight, 800);
  text-transform: var(--tr-h2-transform, none);
}
#transcript:has(> .row) > h2.collapsed { border-bottom-color: var(--line-soft); }
@media (max-width: 600px) {
  #transcript:has(> .row) { --tr-gutter: 0px !important; --tr-offset: 0ch; padding-inline: 20px; }
  #transcript[data-ts-display="gutter"] > .row > .ts {
    position: static;
    display: inline;
    width: auto;
    margin-right: 4px;
  }
  #transcript[data-ts-display="gutter"] > .row > .ts > span { transform: none; }
  #transcript[data-spk-display="gutter"][data-ts-display] > .row > .spk {
    float: none;
    width: auto;
    margin-left: 0;
    padding: 0;
  }
  #transcript:has(> .row) > h2 { margin-inline: auto; width: 100%; max-width: var(--tr-measure); }
  #transcript:has(> .row) > h2 > .sectimestamp { width: auto; }
  #transcript:has(> .row) > .closelink { margin-left: 0; }
}

#transcript .hint { color: var(--muted); }
#transcript .issuelist h2 { margin: 0 0 12px; font-size: 18px; }
#transcript .issuelist p { margin: 6px 0; }
#transcript .localproject {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
#transcript .issuelist .unsynced { color: var(--err); font-weight: 600; font-size: 14px; }
#transcript .issuelist .decache {
  margin-right: 8px;
  cursor: pointer;
  opacity: 0.45;
  user-select: none;
}
#transcript .issuelist .decache:hover { opacity: 1; }
#transcript .sources table { border-collapse: collapse; margin-top: 12px; font-size: 14px; }
#transcript .sources th, #transcript .sources td { padding: 3px 12px 3px 0; text-align: left; }
#transcript .sources button {
  font-size: 13px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
}
#transcript .sources button:hover:not(:disabled) { background: var(--hover); border-color: var(--accent); }
#transcript .sources h3 { margin: 20px 0 0; font-size: 15px; }
#transcript .sources .emptytrash { margin-top: 8px; }
#transcript .sources .notsynced { color: var(--err); font-size: 13px; }
#transcript .sources .inuse td:nth-child(3), #transcript .sources .trash td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
button.armed, button.armed:hover, #transcript .sources button.armed:hover:not(:disabled) { background: var(--err); border-color: var(--err); color: var(--bg-raised); }
#transcript .hint button {
  font-size: 14px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-raised);
  cursor: pointer;
}
#transcript .hint button:hover { background: var(--hover); border-color: var(--accent); }

#transcript h2 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 24px;
  font-weight: 800;
  color: var(--fg-strong);
  margin: 14px 0 6px -7%;
  line-height: 1.3;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
/* line beneath the header only when collapsed; transparent border above keeps
   the whitespace identical between states */
#transcript h2.collapsed { border-bottom-color: var(--line-soft); }
#transcript .sectoggle {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 5px;
  cursor: pointer;
  user-select: none;
}
#transcript .sectoggle:hover {
  background: var(--hover);
  border-color: var(--accent);
  color: var(--accent);
}
#transcript h2.sec-cut .sectoggle { color: var(--muted); border-color: var(--line-soft); }
#transcript h2 > .sectimestamp {
  flex: none;
  display: flex;
  width: 0;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
  user-select: none;
}
#transcript h2.sec-cut > .sectimestamp { visibility: hidden; }
#transcript h2 > .sectimes { flex: none; margin-left: auto; }
#transcript .sectimes {
  display: flex;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
}
#transcript .sectimes span { min-width: 2.6em; text-align: right; }
#transcript .sectimes span:empty { display: none; }
#transcript .sectimes .st-cut { text-decoration: line-through; }
#transcript .sectimes .st-hl:not(:empty) {
  background: var(--hl-bg);
  color: var(--hl-fg);
  border-radius: 2px;
  padding: 0 3px;
}
#transcript .seccomments {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
}
#transcript h2.sec-cut .sectitle {
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.7;
}

.closelink {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  margin: 2px 0 6px var(--tr-h2-indent, -7%);
  width: max-content;
}
.closelink:hover { color: var(--accent); }
.closelink.hidden { display: none; }

.row {
  margin: 0 0 8px;
  padding: 1px 0;
}

.row .ts {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
  user-select: none;
}
.row .spk {
  font-weight: 600;
  margin-right: 6px;
  cursor: pointer;
  border-radius: 2px;
}
.row .spk:hover { background: var(--edit-bg); color: var(--edit); }

.spkmenu {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-right: 6px;
}
.spkmenu-to { color: var(--edit); font-weight: 600; }
.spkmenu button {
  font: inherit;
  font-size: 12px;
  padding: 0 6px;
  background: var(--edit-bg-soft);
  border: 1px solid var(--edit);
  border-radius: 3px;
  color: var(--edit);
  cursor: pointer;
}
.spkmenu button:hover, .spkmenu button:focus { background: var(--edit-bg); outline: none; }

.word { border-radius: 2px; }
.w-cut { color: var(--muted); text-decoration: line-through; opacity: 0.75; }
.w-hl  { background: var(--hl-bg); color: var(--hl-fg); }
/* cut + highlighted: --muted is unreadable on --hl-bg, so strike + opacity carry the cut */
.w-cut.w-hl { color: var(--hl-fg); }
/* selection overpaints the yellow: selected+highlighted must still read as highlighted */
.w-hl::selection { background: var(--hl-sel); }
.w-commented { border-bottom: 2px dotted var(--cmt-mark); }
.w-replaced, .w-replacing { display: none; }

.repl { color: var(--edit); border-radius: 2px; cursor: pointer; }
.repl.w-cut { color: var(--muted); }
.repl:hover { background: var(--edit-bg); }
.repl .opmark::after { color: var(--edit); }

.repldraft input {
  font: inherit;
  color: var(--edit);
  padding: 0 2px;
  margin-right: 4px;
  border: 1px solid var(--edit);
  border-radius: 3px;
  background: var(--edit-bg-soft);
  outline: none;
}

/* cuts collapse to a struck grayed '[...]' at each seam (strikethrough = cut
   from the output, matching .w-cut); .peek reveals a run in place */
.cutmark {
  display: inline;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.cutmark:hover, .cutmark.on { color: var(--accent); }
.cutmark.shortened { color: var(--edit); }

/* derived pause marker between same-speaker words; glyph via ::before so it
   never enters the text stream (no copy/paste, not read as punctuation).
   muted = ambient rule, --edit = a stored author op (pin / kept-natural) */
.pausedot {
  position: relative;
  cursor: default;
  user-select: none;
}
.pausedot::before {
  content: "\B7\B7";           /* rule dot: short glyph for a shortened pause */
  color: var(--muted);
  font-size: 0.85em;
  letter-spacing: 1px;
  opacity: 0.7;
  margin: 0 1px;
}
.pausedot.pinned::before {
  content: "\B7\2013\B7";      /* dot-dash-dot: a hand-pinned pinch */
  color: var(--edit);
  opacity: 1;
}
.pausedot.except::before {
  content: "\B7\B7\B7";        /* full-width glyph: pause kept at full length */
  letter-spacing: 4px;
  color: var(--edit);
  opacity: 1;
}
/* hover / caret adjacency swaps the glyph for the chip (below) */
.pausedot:hover::before, .pausedot.caret-near::before { visibility: hidden; }
.w-off.peek { display: inline; }
.row.p-cut.peek { display: block; }
.closelink.sec-cut.peek { display: block; }

.spk[data-author]::after {
  content: attr(data-author);
  vertical-align: super;
  font-size: 0.62em;
  font-weight: 700;
  color: var(--accent);
  margin-left: 1px;
  user-select: none;
}
/* stance/edit marks are elements — the op's click handle; glyph via ::after
   keeps it out of the text/copy stream */
.opmark { cursor: pointer; user-select: none; }
.opmark::after {
  content: attr(data-author);
  vertical-align: super;
  font-size: 0.62em;
  font-weight: 700;
  color: var(--accent);
  /* tuck-back over the word's trailing space: -0.45em eats it all, 0px gap */
  margin-left: -0.25em;
  margin-right: 2px;
}
.opmark:hover::after { color: var(--accent-hi); text-decoration: underline; }
/* clip chips / section titles end in glyphs, not a space: no tuck-back */
.clip .opmark::after, .sectitle .opmark::after { margin-left: 2px; margin-right: 0; }
/* handle glue: the tag must never wrap away from its word (wrap between
   words is still allowed — the break rule follows the common ancestor) */
.word[data-author], .repltail { white-space: nowrap; }

.comment {
  position: absolute;
  right: 1%;
  width: 13%;
  background: var(--cmt-bg);
  border: 1px solid var(--cmt-line);
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 1px 3px var(--shadow-sm);
}
.comment-who {
  display: flex;
  overflow-wrap: anywhere;
  justify-content: space-between;
  font-weight: 600;
  color: var(--cmt-fg);
  font-size: 11px;
  margin-bottom: 2px;
}
.comment-del { cursor: pointer; color: var(--cmt-ctl); }
.comment-del:hover { color: var(--err); }
.comment-dismiss { cursor: pointer; color: var(--cmt-ctl); }
.comment-dismiss:hover { color: var(--accent); }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.dismissed { opacity: 0.55; border-style: dashed; }
/* n / sidebar navigation just landed here: a brief accent pulse */
.comment.target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }

/* diff mode: unchanged words recede, changed regions keep full contrast with a
   marker underline — green-ish for edits added since a, red-ish for removed */
.w-dim { opacity: 0.35; }
.w-chg-add { box-shadow: inset 0 -2px 0 var(--diff-add); }
.w-chg-del { box-shadow: inset 0 -2px 0 var(--diff-del); }
:root { --diff-add: #3fb95066; --diff-del: #f8514966; }

/* change list: same shell as the comments sidebar */
#diffPanel {
  position: fixed;
  top: 92px;
  right: 12px;
  bottom: 44px;
  z-index: 25;
  width: 290px;
  display: flex;
  flex-direction: column;
  padding: 10px 0 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}
#diffPanel[hidden] { display: none; }
#diffPanel h2 { margin: 0 14px 6px; font-size: 14px; }
#diffList { flex: 1 1 auto; overflow-y: auto; padding: 0 8px; }
#diffList .diffitem {
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}
#diffList .diffitem:hover { background: var(--cmt-bg); }
#diffList .diffdoc { cursor: default; color: var(--muted); font-style: italic; }
#diffList .difftc { font-variant-numeric: tabular-nums; color: var(--muted); }
#diffList .cmtempty { color: var(--muted); font-size: 13px; padding: 4px 6px; }

/* all-comments sidebar: fixed panel over the margin-note column */
#commentsPanel {
  position: fixed;
  top: 92px;
  right: 12px;
  bottom: 44px;
  z-index: 25;
  width: 290px;
  display: flex;
  flex-direction: column;
  padding: 10px 0 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
}
#commentsPanel[hidden] { display: none; }
#commentsPanel h2 { margin: 0 14px 6px; font-size: 14px; }
#commentsList { flex: 1 1 auto; overflow-y: auto; padding: 0 8px; }
#commentsList .cmtempty { color: var(--muted); font-size: 13px; padding: 4px 6px; }
#commentsList .cmtitem {
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}
#commentsList .cmtitem:hover { background: var(--cmt-bg); }
#commentsList .cmtitem.dismissed { opacity: 0.55; }
#commentsList .cmtitem .comment-who { cursor: inherit; }
#commentsList .cmtbody { white-space: pre-wrap; }
#commentsList .cmtquote { color: var(--muted); font-style: italic; margin-top: 2px; }

.commentdraft {
  position: absolute;
  right: 1%;
  width: 13%;
  z-index: 20;
  background: var(--cmt-bg);
  border: 1px solid var(--cmt-line);
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 2px 8px var(--shadow);
}
.commentdraft textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 3px 0 5px;
  padding: 3px 5px;
  font: inherit;
  border: 1px solid var(--cmt-line);
  border-radius: 3px;
  background: var(--cmt-field);
  resize: vertical;
}
.commentdraft .draft-btns { display: flex; gap: 6px; justify-content: flex-end; }
.commentdraft .draft-btns button {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-raised);
  cursor: pointer;
}
.commentdraft .draft-btns button:hover { background: var(--hover); }

.clip {
  display: inline-block;
  margin: 0 5px;
  padding: 1px 9px;
  border: 1px solid var(--clip-line);
  border-radius: 10px;
  background: var(--clip-bg);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.clip:hover { border-color: var(--accent); }
.clip .clip-dur { color: var(--muted); font-variant-numeric: tabular-nums; }
.clip a { color: var(--accent); text-decoration: none; margin-left: 5px; }
.clip.playing { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.clip.playing .clip-dur, .clip.playing a { color: var(--on-accent); }
.clip.playing .opmark::after { color: var(--on-accent); }
.clip.clip-missing { border-style: dashed; background: var(--bg-inactive); color: var(--muted); }

/* assembly clip boundaries: a rule between clips, a bar of controls under it */
.clipbound { border-top: 1px solid var(--line); margin: 14px 0 0; }
.moveseam { border-top-style: dashed; }
.clipbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 2px 0 6px; font-size: 12px; color: var(--muted); user-select: none;
}
.clipbar .clipsrc { font-weight: 600; color: var(--accent); margin-right: 4px; }
a.clipsrc {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
a.clipsrc:hover { text-decoration: underline; }
.clipbar .clipbtn {
  border: 1px solid var(--clip-line); background: var(--clip-btn-bg); border-radius: 6px;
  padding: 0 6px; font-size: 12px; line-height: 1.6; cursor: pointer; color: var(--clip-btn-fg);
}
.clipbar .clipbtn:hover:not(:disabled) { border-color: var(--accent); }
.clipbar .clipbtn:disabled { opacity: .4; cursor: default; }
.clip.clipblock { margin-left: 8px; }
.clip.clipblock.bed { background: var(--amber-bg); border-color: var(--amber-line); }
.clip.clipblock.bed:hover { border-color: var(--amber-line-strong); }
.clip .clip-bedinfo { color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }

/* #transcript scope outranks the 3-class .peek reveals inside a collapsed section */
#transcript .row.hidden { display: none; }
#transcript .closelink.hidden { display: none; }
.w-off { display: none; }
.row.p-cut { display: none; }
/* struck heading stays as the whole-section-cut trace, except in Highlights */
#transcript[data-mode="highlights"] h2.sec-cut:not(.peek) { display: none; }
.closelink.sec-cut { display: none; }

/* playhead underline via ::highlight: the range excludes the trailing space;
   accent color literal — var() doesn't resolve in highlight pseudos everywhere */
::highlight(playhead) {
  text-decoration: underline solid #1971c2 2px;
  text-underline-offset: 3px;
}
[data-theme="dark"] ::highlight(playhead) { text-decoration-color: #6cb0f0; }
@supports not selector(::highlight(x)) {
  .word.playhead, .repl.playhead {
    text-decoration: underline solid var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
  }
}
.word.playhead { opacity: 1; }

#selMenu, .floatmenu {
  position: fixed;
  z-index: 40;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 8px var(--shadow-sm);
}
#selMenu[hidden] { display: none; }
#selMenu button, .floatmenu button {
  font-size: 13px;
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  white-space: nowrap;
}
#selMenu button:hover, .floatmenu button:hover { background: var(--hover); }
/* every dot carries a chip (revert / rejoin-rule): on hover or caret adjacency
   it overlays the glyph's own slot — no reserved space, text never shifts */
.pausedot .pause-revert {
  position: absolute;
  inset: 0;
  text-align: center;
  color: var(--edit);
  font-size: 0.8em;
  cursor: pointer;
  user-select: none;
  visibility: hidden;
}
.pausedot:hover .pause-revert,
.pausedot.caret-near .pause-revert { visibility: visible; }
.pausedot .pause-revert:hover { color: var(--err); }

#status {
  flex: 0 0 auto;
  display: flex;
  gap: 18px;
  padding: 6px 12px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-panel);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
}
#playTime { font-variant-numeric: tabular-nums; white-space: nowrap; }
#playPos { font-weight: 600; color: var(--accent); }
#playTotal { color: var(--muted); }
#flashMsg {
  flex: 1 1 0;
  min-width: 0;
  text-align: right;
  font-size: 13px;
  color: var(--fg-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#flashMsg.err { color: var(--err); }
#flashMsg.ok { color: var(--ok); }
#flashMsg.running { color: var(--muted); font-style: italic; }
#status #storageInfo { color: var(--muted); white-space: nowrap; text-decoration: none; }
#status #storageInfo:hover { color: var(--fg); text-decoration: underline; }
#status #storageInfo.low { color: var(--err); }
#status #selInfo { color: var(--accent); white-space: nowrap; }
#status #logCount { color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
#status #logCount:hover { color: var(--accent); }
#status #logCount.haserr { color: var(--err); font-weight: 600; }

.library { margin-bottom: 2rem; }
.library input[type="search"] { display: block; width: 100%; margin-top: 1rem; }
.library summary { cursor: pointer; font-weight: 600; }
#transcript .library h2 { display: block; }
#transcript .library .library-listing { line-height: 1.4; }
#transcript .library .library-listing p,
#transcript .library .library-listing details { margin: 0; }
#transcript .library .library-listing details > :not(summary) { margin-left: 1.25rem; }

#editorWorkspace { display: flex; flex: 1 1 auto; min-height: 0; }
#editorWorkspace > #transcript { min-width: 0; }
/* filmstrip: the edit's picture along its timeline; the live pane rides in it while playing */
#filmstrip { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 6px; padding: 4px 12px; border-bottom: 1px solid var(--line-soft); background: var(--bg-panel); }
#filmstrip[hidden] { display: none; }
#filmstripView { position: relative; flex: 1 1 auto; min-width: 0; height: 86px; }
#filmstrip[data-mode="scroll"]:not(.playing) #filmstripView { height: auto; }
#filmstripCanvas { position: absolute; left: 0; top: 0; height: 86px; pointer-events: none; }
#filmstripScroll { position: relative; overflow-x: hidden; overflow-y: hidden; cursor: pointer; }
#filmstrip[data-mode="scroll"]:not(.playing) #filmstripScroll { overflow-x: auto; }
#filmstripSpacer { height: 86px; }
#filmstrip[data-mode="scroll"]:not(.playing) #filmstripSpacer { height: 100px; }  /* room for an overlay scrollbar below the axis */
#filmstrip.playing #filmstripScroll { cursor: default; }
#filmstripModeBtn, #previewPopBtn { flex: 0 0 auto; font-size: 12px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-raised); cursor: pointer; }
#filmstripModeBtn:hover, #previewPopBtn:hover { background: var(--hover); }
#filmstripModeBtn[data-mode="fit"]::before { content: "▦"; }
#filmstripModeBtn[data-mode="scroll"]::before { content: "⇹"; }
#filmstripModeBtn[data-mode="sliver"]::before { content: "‖"; }
#previewPopBtn[hidden] { display: none; }
#videoPane { display: none; position: absolute; top: 0; left: 0; width: 128px; height: 72px; background: #000; }
#filmstrip.playing #videoPane, #videoPane.popped { display: block; }
/* playing in a script project: over the top of the script pane */
#videoPane.docked { display: block; position: fixed; height: auto; z-index: 20; }
#videoPane.docked > :is(#videoPreview, #audio, #takeVideo, #graphicCanvas, #previewIdle) { width: 100%; height: auto; aspect-ratio: 16 / 9; }
#videoPreview, #audio, #takeVideo, #graphicCanvas, #previewIdle { display: block; width: 128px; height: 72px; object-fit: contain; background: #000; }
#videoPreview[hidden], #audio[hidden], #takeVideo[hidden], #previewIdle[hidden] { display: none; }
#videoPane:not(.gfx-frame) > #graphicCanvas,
#videoPane.gfx-frame > :is(#audio, #takeVideo, #videoPreview, #previewIdle) { display: none; }
/* popped out into a Picture-in-Picture window: the frame fills it */
body.pip { margin: 0; background: #000; overflow: hidden; }
#videoPane.popped { position: static; width: 100vw; height: 100vh; }
#videoPane.popped > #videoMessage { display: none; }
#videoPane.popped > :is(#videoPreview, #audio, #takeVideo, #graphicCanvas, #previewIdle) { width: 100vw; height: 100vh; }
#videoMessage { position: absolute; left: 0; top: 0; width: 128px; margin: 0; padding: 2px; font-size: 11px; color: #fff; }
#videoMessage:empty { display: none; }
.assembly-end { min-height: 1.5em; cursor: text; }

@media (max-width: 760px) {
  #editorWorkspace { flex-direction: column; }
}

/* script pane: the project's sections on the left, take margin per section */
#editorWorkspace { --script-split: 80%; }
#scriptPane { flex: 0 0 var(--script-split); min-width: 0; overflow-y: auto; padding: 12px 20px 40vh; border-right: 1px solid var(--line); }
#editorWorkspace.emph-assembly > #scriptPane { padding-inline: 8px; }
/* script emphasis: reading margins and a capped line length */
#editorWorkspace.emph-script > #scriptPane { padding-inline: max(6%, 48px); }
#editorWorkspace.emph-script > #scriptPane .scpage { max-width: 46em; margin-inline: auto; }
/* a narrow assembly: no gutters, timestamps, or heading outdent */
/* layout presets set these inline on #transcript; a narrow pane overrides them */
#editorWorkspace.narrow-assembly > #transcript { padding-inline: 10px; --tr-gutter: 0px !important; --tr-offset: 0px; --tr-measure: 100% !important; --tr-h2-indent: 0px !important; }
#editorWorkspace.narrow-assembly > #transcript h2 { margin-left: 0; }
#editorWorkspace.narrow-assembly > #transcript h2 > .sectimestamp, #editorWorkspace.narrow-assembly > #transcript .row .ts { display: none; }
#editorWorkspace.narrow-assembly > #transcript .closelink { margin-left: 0; }
#paneDivider { flex: none; width: 7px; margin: 0 -3px; cursor: col-resize; z-index: 1; }
#paneDivider:hover, #paneDivider.dragging { background: var(--accent); }
#editorWorkspace:has(#scriptPane:not([hidden])):not(.narrow-assembly) > #transcript { padding-inline: max(8%, 120px); }
#scriptPane { --sc-margin: 44px; }
#scriptPane .scpage { position: relative; }
#scriptPane .scdoc { margin-right: calc(var(--sc-margin) + 4px); outline: none; }
#scriptPane .scdoc { font-family: var(--font-transcript); font-size: 17px; line-height: var(--tr-leading, 1.9); caret-color: var(--accent); }
#scriptPane .scdoc h2 { font-size: 20px; font-weight: 800; color: var(--fg-strong); line-height: 1.3; margin: 0 0 4px; min-height: 1.3em; }
#scriptPane .scdoc h2:not(:first-child) { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
#scriptPane .scdoc p { margin: 0 0 var(--tr-row-gap, 8px); white-space: pre-wrap; }
#scriptPane .scdoc p.direction { color: var(--fg-dim); font-style: italic; }
#scriptPane .scmargins { position: absolute; top: 0; right: 0; width: var(--sc-margin); height: 100%; }
#scriptPane .scmargin { position: absolute; left: 0; right: 0; box-sizing: border-box; padding-top: 2px; }
#scriptPane .scgrip { display: block; color: var(--muted); cursor: grab; opacity: 0; user-select: none; text-align: center; }
#scriptPane .scmargin:hover .scgrip { opacity: 1; }
#scriptPane .scmargin { display: flex; align-items: flex-start; gap: 2px; }
#scriptPane .scmargin .scgrip { width: 16px; line-height: 22px; }
#scriptPane .sctool { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--fg-dim); font-size: 10px; line-height: 1; cursor: pointer; opacity: 0; }
#scriptPane .scmargin:hover .sctool:not(:disabled), #scriptPane .sccut.on { opacity: 1; }
#scriptPane .scmargin:hover .sctool:disabled { opacity: .35; cursor: default; }
#scriptPane .sctool:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
#scriptPane .sccut.on { color: var(--err); border-color: var(--err); }
#scriptPane .scdoc .scfolded { display: none; }
#scriptPane .scdoc h2 { padding-right: 110px; }
#scriptPane .scfolds { position: absolute; top: 0; left: 0; right: calc(var(--sc-margin) + 4px); height: 0; }
#scriptPane .scclose, #scriptPane .scopen { position: absolute; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; line-height: 20px; cursor: pointer; user-select: none; }
#scriptPane .scclose, #scriptPane .scopen { right: 0; line-height: 26px; }
#scriptPane .scclose:hover, #scriptPane .scopen:hover { color: var(--accent); }
/* take strip: under each assembly heading, record plus the section's takes */
#transcript .takestrip { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 10px; font-size: 13px; line-height: 1; user-select: none; }
#transcript .takestrip.hidden { display: none; }
#transcript .seclead { display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; font-size: 13px; font-weight: 400; line-height: 1; cursor: default; user-select: none; }
#transcript .screc, #transcript .secplay { position: relative; flex: none; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); overflow: hidden; cursor: pointer; }
#transcript .recmark { position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--err); }
#transcript .screc.on { border-color: var(--err); }
#transcript .screc.on .recmark { border-radius: 1px; }
#transcript .reclevel { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--err); opacity: .2; }
#transcript .screc:disabled, #transcript .secplay:disabled { opacity: .35; cursor: default; }
#transcript .screc:hover:not(:disabled) { border-color: var(--err); }
#transcript .secplay { font-size: 11px; color: var(--fg-dim); }
#transcript .secplay:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
#transcript .takestrip { align-items: center; }
#transcript .sechandle { flex: none; padding: 0 4px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--muted); font-size: 14px; line-height: 20px; cursor: pointer; user-select: none; }
#transcript .sechandle:hover { border-color: var(--accent); color: var(--accent); }
/* project sections are ruled apart like the script's */
#transcript h2.projsec ~ h2.projsec { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
#transcript h2.projsec .sectitle { display: none; }
#transcript h2.projsec.h-selected { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
#transcript h2.projsec, #transcript:has(> .row) > h2.projsec { border-bottom-color: transparent; }   /* the next section's rule is the line */
/* a section's strip sits in its heading, after the title; narrow panes wrap it */
#transcript h2:has(> .takestrip) { flex-wrap: wrap; align-items: center; }
#transcript h2 > .takestrip { flex: 1 1 auto; flex-wrap: wrap; margin: 0 0 0 6px; font-weight: 400; cursor: default; }
#transcript .rectime { font-variant-numeric: tabular-nums; color: var(--err); }
#transcript .takesel { min-width: 0; max-width: 100%; font-size: 13px; padding: 2px 4px; }
#transcript .tkretry, #transcript .tkdel, #transcript .tkstar { font-size: 12px; padding: 0 4px; color: var(--muted); border: 0; background: none; cursor: pointer; }
#transcript .tkdel:hover { color: var(--err); }
#transcript .tkstar:hover, #transcript .tkstar.on { color: var(--accent); }
#transcript .tkretry:hover { color: var(--accent); }
#transcript .tkstatus { color: var(--muted); }
#transcript .takesel.unused { color: var(--muted); }
/* assembly emphasis: the script is an outline, headings with their takes */
#editorWorkspace.emph-assembly #scriptPane .scdoc p { display: none; }
#editorWorkspace.emph-assembly #scriptPane .scdoc h2 { font-size: 16px; }
#editorWorkspace.emph-assembly #scriptPane .scdoc h2:not(:first-child) { margin-top: 8px; padding-top: 6px; }
@media (max-width: 760px) {
  #scriptPane { flex: 0 0 auto; max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--line); }
  #paneDivider { display: none; }
  #editorWorkspace.emph-assembly #scriptPane .scdoc p { display: block; }
}

/* graphics: covered words carry a band; a mark before the first word opens the dialog */
#transcript .word.w-gfx { box-shadow: inset 0 -3px 0 var(--accent); }
#transcript .gfxmark {
  display: inline-block; font-size: 11px; line-height: 1.4; padding: 0 5px; margin-right: 4px;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; cursor: pointer;
  user-select: none; vertical-align: 2px; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#transcript .gfxmark:hover { background: var(--hover); }
#graphicDlg textarea { width: 100%; box-sizing: border-box; font-size: 14px; }
#graphicDlg .field.inline { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
#graphicDlg #graphicSize { width: 5em; }
#moveSecDlg #moveSecList { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; max-height: 50vh; overflow: auto; }
#moveSecDlg #moveSecList button { text-align: left; }
#sendHlDlg .pickList { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; max-height: 50vh; overflow: auto; }
#sendHlDlg .pickList button { text-align: left; }
#takeDlg #takeList { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-height: 50vh; overflow: auto; }
#takeDlg .takeopt { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
#takeDlg .takeopt.off { opacity: .5; cursor: default; }
#takeDlg .takename { font-weight: 600; white-space: nowrap; }
#takeDlg .takewords { color: var(--muted); }
#takeDlg .takeplay { flex: none; font-size: 11px; padding: 0 5px; }
#installDlg { max-width: 480px; }

#transcript .library .library-hit {
  padding: .3rem 0 .4rem 1.25rem;
  max-width: 65ch;
}
.library-hit a {
  display: block;
  color: var(--fg);
  text-decoration: none;
}
.library-hit a:hover .library-hit-quote {
  text-decoration: underline;
}
.library-hit-meta {
  display: block;
  color: var(--muted);
  font-size: .8em;
}
.library-hit [data-field="speaker"]:not([hidden])::before {
  content: " · ";
}
.library-hit-quote {
  display: block;
  overflow-wrap: anywhere;
}
.library-hit mark {
  background: var(--accent);
  color: var(--bg);
}
