/* Transcript panel (owner player + shared-link player). Self-contained; matches the marker list look. */
.tp-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
}
.tp-tabs[hidden], .tp-panel[hidden] { display: none !important; }
.tp-tabs-spacer { flex: 1; }

.tp-tab {
  appearance: none;
  border: 1px solid #2c2313;
  background: #0b0a08;
  color: var(--muted, #b2a47c);
  border-radius: 8px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tp-tab:hover { color: var(--ink, #f5f0df); border-color: #4a3912; }
.tp-tab.is-active {
  color: var(--ink, #f5f0df);
  border-color: color-mix(in srgb, var(--accent, #b88916) 70%, #1a1309 30%);
  background: color-mix(in srgb, var(--accent, #b88916) 16%, #0b0a08 84%);
}
.tp-tab-badge {
  font-size: 0.68rem;
  line-height: 1;
  padding: 0.14rem 0.38rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent, #b88916) 35%, #0b0a08 65%);
  color: var(--ink, #f5f0df);
}

.tp-pill {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent, #b88916) 60%, #1a1309 40%);
  background: color-mix(in srgb, var(--accent, #b88916) 14%, #0b0a08 86%);
  color: var(--ink, #f5f0df);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: tp-pulse 2.4s ease-in-out infinite;
}
.tp-pill.is-warn { border-color: #b57a31; color: #f0c98a; animation: none; }
@keyframes tp-pulse { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #b88916) 22%, transparent); } }

/* Rail: wraps tabs + marker list + panel so the player grid sees a single item. */
.tp-rail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
@media (min-width: 940px) {
  .preview-shell > .tp-rail, .share-player > .tp-rail { grid-area: markers; align-self: stretch; height: 100%; min-height: 220px; }
  .tp-rail > .tp-tabs { margin-top: 0; }
  .tp-rail > .marker-list { flex: 1 1 auto; height: auto !important; min-height: 0; max-height: none !important; }
  .tp-rail > .tp-panel { flex: 1 1 auto; min-height: 0; max-height: none !important; }
}

/* Real tabs (wide layout): the active tab is part of the panel below it; inactive ones sit on its top edge.
   Phone keeps its big launcher buttons (those open the sheet). */
.tp-rail:not(.is-phone) > .tp-tabs {
  gap: 0.1rem;
  align-items: flex-end;
  margin-bottom: -1px;          /* tabs overlap the panel's top border so the active one can open into it */
  padding-inline: 0.55rem;
  position: relative;
  z-index: 1;
}
.tp-rail:not(.is-phone) > .tp-tabs .tp-tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  border-radius: 9px 9px 0 0;
  padding: 0.46rem 1rem 0.44rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  position: relative;
  transition: color 120ms, background 120ms;
}
.tp-rail:not(.is-phone) > .tp-tabs .tp-tab:hover { color: var(--ink, #f5f0df); background: rgba(255, 255, 255, 0.035); border-color: transparent; }
.tp-rail:not(.is-phone) > .tp-tabs .tp-tab.is-active {
  color: var(--ink, #f5f0df);
  background: #0b0a08;           /* same as the panel: no seam */
  border-color: #2c2313;
  padding-bottom: calc(0.44rem + 1px);
  box-shadow: inset 0 2px 0 var(--accent, #b88916);
}
.tp-rail:not(.is-phone) > .tp-tabs .tp-tab:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent, #b88916) 70%, transparent); outline-offset: -2px; }
.tp-rail:not(.is-phone) > .tp-tabs .tp-pill { margin-bottom: 0.32rem; }
.tp-rail:not(.is-phone) > .marker-list,
.tp-rail:not(.is-phone) > .tp-panel { margin-top: 0; }

/* Panel */
.tp-panel {
  container-type: inline-size;
  container-name: tp;
  display: flex;
  flex-direction: column;
  margin: 0.55rem 0 0;
  border: 1px solid #2c2313;
  border-radius: 10px;
  background: #0b0a08;
  min-height: 0;
  overflow: hidden;
}
.tp-head { padding: 0.55rem 0.6rem; border-bottom: 1px solid #211b10; flex: 0 0 auto; }
.tp-head:empty { display: none; }
.tp-listwrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.tp-listwrap[hidden] { display: none !important; }
.tp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
  position: relative; /* offsetTop of rows is measured against this */
}

.tp-row {
  display: grid;
  /* Stacked by default (narrow rail): timecode + speaker on top, text on its own full-width line. */
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "tc spk" "text text";
  column-gap: 0.5rem;
  row-gap: 0.12rem;
  align-items: center;
  position: relative;
  padding: 0.42rem 0.6rem;
  border-bottom: 1px solid #211b10;
  transition: background-color 120ms ease;
}
.tp-row:not(:has(.tp-spk)) { grid-template-areas: "tc tc" "text text"; }
.tp-tc { grid-area: tc; }
.tp-spk { grid-area: spk; justify-self: start; }
.tp-text { grid-area: text; }
/* Wide enough rail: everything on one line. */
@container tp (min-width: 470px) {
  .tp-row { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "tc spk text"; align-items: start; }
  .tp-row:not(:has(.tp-spk)) { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "tc text"; }
}
.tp-row:last-child { border-bottom: 0; }
.tp-row:hover { background: color-mix(in srgb, var(--accent, #b88916) 9%, #0b0a08 91%); }
.tp-row.is-active {
  background: color-mix(in srgb, var(--accent, #b88916) 20%, #0b0a08 80%);
  box-shadow: inset 3px 0 0 0 var(--accent, #b88916);
}
.tp-row.is-live .tp-text { opacity: 0.8; font-style: italic; }

.tp-tc {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-2, #d4aa32);
  font: inherit;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.12rem 0;
  cursor: pointer;
  white-space: nowrap;
}
.tp-tc:hover { text-decoration: underline; }
.tp-spk {
  font-size: 0.7rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--c, #d4aa32);
  color: var(--c, #d4aa32);
  white-space: nowrap;
  margin-top: 0.1rem;
}
.tp-text { cursor: pointer; line-height: 1.38; font-size: 0.9rem; color: var(--ink, #f5f0df); min-width: 0; overflow-wrap: anywhere; }
.tp-text mark { background: color-mix(in srgb, var(--accent-2, #d4aa32) 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.tp-edited { color: var(--muted, #b2a47c); font-size: 0.72rem; }
.tp-none { padding: 1.2rem; text-align: center; color: var(--muted, #b2a47c); font-size: 0.85rem; }

.tp-actions {
  position: absolute;
  right: 0.4rem;
  top: 0.2rem;
  display: inline-flex;
  gap: 0.1rem;
  padding: 2px;
  border-radius: 8px;
  background: #14110bf2;
  border: 1px solid #3a2f17;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.tp-row:hover .tp-actions, .tp-row:focus-within .tp-actions { opacity: 1; pointer-events: auto; }
@media (hover: none) {
  .tp-actions { display: none; }
  .tp-row.is-sel .tp-actions { display: inline-flex; position: static; grid-column: 1 / -1; justify-self: end; opacity: 1; pointer-events: auto; }
  .tp-row.is-sel { background: color-mix(in srgb, var(--accent, #b88916) 12%, #0b0a08 88%); }
}
.tp-actions button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #b2a47c);
  border-radius: 6px;
  /* explicit sizing: the app's global button styles must not inflate these */
  box-sizing: border-box;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  cursor: pointer;
}
.tp-actions button:hover { color: var(--ink, #f5f0df); border-color: #4a3912; background: #14110b; }

.tp-edit {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 3.2rem;
  background: #14110b;
  color: var(--ink, #f5f0df);
  border: 1px solid #4a3912;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.9rem;
}
.tp-editbtns { display: flex; gap: 0.4rem; margin-top: 0.35rem; }

/* Toolbar */
.tp-toolbar { display: flex; align-items: center; gap: 0.35rem; flex-wrap: nowrap; }
.tp-search { display: flex; align-items: center; gap: 0.3rem; flex: 1 1 0; min-width: 110px; }
.tp-q {
  flex: 1 1 auto;
  min-width: 0;
  background: #14110b;
  color: var(--ink, #f5f0df);
  border: 1px solid #2c2313;
  border-radius: 8px;
  padding: 0.32rem 0.55rem;
  font: inherit;
  font-size: 0.85rem;
}
.tp-q:focus { outline: none; border-color: color-mix(in srgb, var(--accent, #b88916) 70%, #1a1309 30%); }
.tp-qcount { font-size: 0.74rem; color: var(--muted, #b2a47c); min-width: 1.6rem; text-align: right; }
.tp-meta { margin-top: 0.4rem; font-size: 0.72rem; color: var(--muted, #b2a47c); }

.tp-btn {
  appearance: none;
  border: 1px solid #2c2313;
  background: #14110b;
  color: var(--ink, #f5f0df);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.tp-btn:hover { border-color: #4a3912; background: #1b160d; }
.tp-btn-icon { padding: 0.3rem 0.5rem; min-width: 30px; }
.tp-btn-quiet { background: transparent; color: var(--muted, #b2a47c); }
.tp-btn-primary, .tp-btn-primary-solid {
  border-color: color-mix(in srgb, var(--accent, #b88916) 70%, #1a1309 30%);
  background: color-mix(in srgb, var(--accent, #b88916) 70%, #1f1a0f 30%);
  color: var(--accent-ink, #120e03);
  font-weight: 600;
}
.tp-btn-primary:hover, .tp-btn-primary-solid:hover { background: var(--accent-2, #d4aa32); }
.tp-linkbtn { appearance: none; border: 0; background: none; color: var(--accent-2, #d4aa32); text-decoration: underline; cursor: pointer; font: inherit; padding: 0 0.2rem; }

.tp-menuwrap { position: relative; }
.tp-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 248px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface, #101010) 96%, var(--accent, #b88916) 4%), color-mix(in srgb, var(--bg-soft, #0b0b0b) 96%, #000));
  border: 1px solid color-mix(in srgb, var(--accent, #b88916) 38%, var(--line, #2a2517) 62%);
  border-radius: 14px;
  padding: 0.35rem;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  transform-origin: top right;
  animation: tp-menu-in 0.14s ease-out;
}
@keyframes tp-menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.tp-mgroup { display: grid; gap: 1px; }
.tp-mgroup + .tp-mgroup { margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid color-mix(in srgb, var(--line, #2a2517) 85%, transparent); }
.tp-menu button.tp-mi {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink, #f5f0df);
  font: inherit;
  padding: 0.45rem 0.6rem 0.45rem 0.45rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s;
}
.tp-mi-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-2, #d4aa32);
  background: color-mix(in srgb, var(--accent, #b88916) 14%, transparent);
  transition: background 0.12s, color 0.12s;
}
.tp-mi-ico svg { width: 17px; height: 17px; }
.tp-mi-txt { display: grid; gap: 1px; min-width: 0; }
.tp-mi-label { font-size: 0.86rem; font-weight: 600; line-height: 1.25; }
.tp-mi-desc { font-size: 0.72rem; color: var(--muted, #b2a47c); line-height: 1.25; }
.tp-menu button.tp-mi:hover, .tp-menu button.tp-mi:focus-visible { outline: none; background: color-mix(in srgb, var(--accent, #b88916) 16%, transparent); }
.tp-menu button.tp-mi:hover .tp-mi-ico, .tp-menu button.tp-mi:focus-visible .tp-mi-ico { background: var(--accent-2, #d4aa32); color: var(--accent-ink, #120e03); }
.tp-menu button.tp-mi.is-danger { color: #f0a0a0; }
.tp-menu button.tp-mi.is-danger .tp-mi-ico { color: #f08a8a; background: color-mix(in srgb, #d46a6a 16%, transparent); }
.tp-menu button.tp-mi.is-danger:hover, .tp-menu button.tp-mi.is-danger:focus-visible { background: color-mix(in srgb, #d46a6a 18%, transparent); }
.tp-menu button.tp-mi.is-danger:hover .tp-mi-ico { background: #e07575; color: #1b0505; }
@media (prefers-reduced-motion: reduce) { .tp-menu { animation: none; } }

/* Speaker / track chips */
.tp-trkchips { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.3rem; margin-top: 0.4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tp-trkchips::-webkit-scrollbar { display: none; }
.tp-spkchip, .tp-showall { flex: 0 0 auto; white-space: nowrap; }
.tp-spkchip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--c, #d4aa32);
  color: var(--c, #d4aa32);
  border-radius: 999px;
  padding: 0.14rem 0.6rem;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}
.tp-spkchip.is-off { opacity: 0.38; text-decoration: line-through; }
.tp-trkchip {
  font-size: 0.72rem;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #3a2f17;
  color: var(--muted, #b2a47c);
}
.tp-trkchip.is-silent { opacity: 0.55; }

/* Status / progress */
.tp-status-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-size: 0.88rem; }
.tp-status.is-warn .tp-status-row strong { color: #f0c98a; }
.tp-bar { height: 6px; border-radius: 999px; background: #1d170c; overflow: hidden; margin: 0.5rem 0 0.2rem; }
.tp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent, #b88916), var(--accent-2, #d4aa32)); transition: width 400ms ease; }
.tp-hint { font-size: 0.74rem; color: var(--muted, #b2a47c); margin-top: 0.4rem; }
.tp-warnline { color: #e0b878; }
.tp-error {
  font-size: 0.82rem;
  color: #f0b4b4;
  background: color-mix(in srgb, #b53131 18%, #0b0a08 82%);
  border: 1px solid color-mix(in srgb, #b53131 55%, #0b0a08 45%);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.5rem;
}

.tp-empty { text-align: center; padding: 0.9rem 0.6rem 0.7rem; display: grid; gap: 0.45rem; justify-items: center; }
.tp-empty-art {
  width: min(170px, 52%);
  height: auto;
  aspect-ratio: 801 / 772;
  margin-bottom: 0.15rem;
  border-radius: 50%;
  /* soft lit disc: the artwork has a very dark navy that would vanish on the near-black panel */
  background: radial-gradient(circle at 50% 46%, #2a2312 0%, #1b160b 62%, rgba(27, 22, 11, 0) 72%);
  padding: 0.35rem;
  box-sizing: border-box;
  user-select: none;
  pointer-events: none;
}
.tp-empty-title { font-weight: 600; font-size: 0.95rem; color: var(--ink, #f5f0df); }
.tp-empty-text { font-size: 0.82rem; color: var(--muted, #b2a47c); max-width: 440px; line-height: 1.4; }

.tp-jump {
  position: absolute;
  right: 0.8rem;
  bottom: 0.7rem;
  z-index: 5;
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent, #b88916) 70%, #1a1309 30%);
  background: color-mix(in srgb, var(--accent, #b88916) 78%, #1f1a0f 22%);
  color: var(--accent-ink, #120e03);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  box-shadow: 0 6px 18px #000000a0;
}
.tp-jump[hidden] { display: none !important; }

/* Dialog */
.tp-dialog { width: min(460px, 100%); gap: 0.55rem; }
.tp-dlg-body { display: grid; gap: 0.5rem; }
.tp-lbl { display: grid; gap: 0.25rem; font-size: 0.8rem; color: var(--muted, #b2a47c); margin-top: 0.15rem; }
.tp-lbl select {
  background: #14110b;
  color: var(--ink, #f5f0df);
  border: 1px solid #2c2313;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  font: inherit;
}
.tp-dim { color: var(--muted, #b2a47c); font-size: 0.76rem; }
.tp-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.tp-cards-4 { grid-template-columns: repeat(2, 1fr); }
.tp-card {
  appearance: none;
  display: grid;
  gap: 0.1rem;
  text-align: left;
  border: 1px solid #2c2313;
  background: #0f0d09;
  color: var(--ink, #f5f0df);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  cursor: pointer;
}
.tp-card span { font-size: 0.72rem; color: var(--muted, #b2a47c); }
.tp-card em { font-style: normal; font-size: 0.78rem; color: var(--accent-2, #d4aa32); min-height: 1em; }
.tp-card.is-on { border-color: var(--accent, #b88916); background: color-mix(in srgb, var(--accent, #b88916) 16%, #0b0a08 84%); }
.tp-radio, .tp-check { display: flex; align-items: flex-start; gap: 0.45rem; font-size: 0.85rem; color: var(--ink, #f5f0df); cursor: pointer; }
.tp-tracklist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.25rem 0.8rem; padding-left: 1.4rem; }

@media (max-width: 640px) {
  .tp-cards { grid-template-columns: 1fr; }
}

/* Speaker naming */
.tp-namebtn { padding: 0.14rem 0.55rem; font-size: 0.74rem; border-style: dashed; }
.tp-spk.is-editable { cursor: pointer; }
.tp-spk.is-editable:hover { background: color-mix(in srgb, var(--c, #d4aa32) 18%, transparent); }
.tp-spklist { display: grid; gap: 0.4rem; margin: 0.3rem 0 0.2rem; }
.tp-spkrow { display: flex; align-items: center; gap: 0.55rem; }
.tp-spkdot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.tp-spkrow input {
  flex: 1 1 auto;
  min-width: 0;
  background: #14110b;
  color: var(--ink, #f5f0df);
  border: 1px solid #2c2313;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font: inherit;
}
.tp-spkrow input:focus { outline: none; border-color: color-mix(in srgb, var(--accent, #b88916) 70%, #1a1309 30%); }

/* Duplicate lines (same words on a quieter microphone) */
.tp-dupbar { margin-top: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 8px; background: #17140c; border: 1px solid #3a2f17; font-size: 12px; color: var(--muted, #b2a47c); display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.tp-dupbar.is-warn { color: #f0b4b4; border-color: #5a2424; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2, #d4aa32); display: inline-block; margin-right: 0.45rem; animation: tp-pulse2 1.2s ease-in-out infinite; }
@keyframes tp-pulse2 { 50% { opacity: 0.25; } }
.tp-toggle { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; color: var(--ink, #f5f0df); position: relative; }
.tp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.tp-toggle i { width: 30px; height: 18px; border-radius: 999px; background: #2a2518; border: 1px solid #3a3220; position: relative; transition: background 140ms; }
.tp-toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #8a7e5c; transition: transform 140ms, background 140ms; }
.tp-toggle input:checked + i { background: color-mix(in srgb, var(--accent, #b88916) 60%, #1a1508); border-color: var(--accent, #b88916); }
.tp-toggle input:checked + i::after { transform: translateX(12px); background: #fff3c9; }
.tp-row.is-dup .tp-text { opacity: 0.5; }
.tp-row.is-dup .tp-spk { opacity: 0.55; }
.tp-dupmark { font-style: normal; font-size: 10.5px; padding: 1px 6px; margin-left: 6px; border-radius: 999px; border: 1px solid #5a4713; color: #c9a94e; vertical-align: 1px; }

/* Transcribe dialog options */
.tp-opt { align-items: flex-start; padding: 0.55rem 0.65rem; border: 1px solid #2c2313; border-radius: 10px; background: #0f0d09; }
.tp-opt input { margin-top: 0.2rem; }
.tp-opt.is-off { opacity: 0.55; }
.tp-opt strong { font-weight: 600; }
.tp-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid #5a4713; color: #c9a94e; margin-left: 4px; }
.tp-sub { margin-left: 0.2rem; }

/* ═════════ Phone layout (< 940 px): launcher row + bottom sheet ═════════ */
.tp-sheet { display: none; }
/* the app has a global mobile `button { width: 100% }`; our compact buttons must size themselves */
:where(.tp-sheet, .tp-rail) button { width: auto; }
@media (max-width: 939px) {
  /* launcher: two big buttons under the player; the content opens in the sheet */
  .tp-rail.is-phone { flex: 0 0 auto; }
  .tp-rail.is-phone > .tp-tabs { margin-top: 0.7rem; gap: 0.5rem; }
  .tp-rail.is-phone > .tp-tabs .tp-tabs-spacer { display: none; }
  .tp-rail.is-phone > .tp-tabs .tp-tab { flex: 1 1 0; justify-content: center; min-height: 46px; font-size: 15px; border-radius: 12px; }
  .tp-rail.is-phone > .tp-tabs .tp-tab.is-active { color: var(--muted, #b2a47c); border-color: #2c2313; background: #0b0a08; }
  .tp-rail.is-phone > .tp-tabs .tp-tab[data-count]:not([data-count=""])::after {
    content: attr(data-count); font-size: 11px; line-height: 1; padding: 0.16rem 0.45rem; border-radius: 999px;
    background: color-mix(in srgb, var(--accent, #b88916) 35%, #0b0a08 65%); color: var(--ink, #f5f0df);
  }
  .tp-rail.is-phone > .tp-tabs .tp-pill { flex: 0 1 auto; min-height: 46px; padding-inline: 0.9rem; }

  .tp-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1350;                       /* above the player modal (1300), below dialogs (1400) */
    width: min(720px, 100%);
    margin: 0 auto;
    height: 60vh;
    background: linear-gradient(180deg, #16130c, #0a0906);
    border: 1px solid #4a3912;
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -14px 44px #000000c8;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(104%);
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.2, 0.85, 0.25, 1), visibility 0s linear 0.28s, height 0.22s ease;
    overscroll-behavior: contain;
  }
  .tp-sheet.is-open { transform: none; visibility: visible; transition: transform 0.28s cubic-bezier(0.2, 0.85, 0.25, 1), visibility 0s, height 0.22s ease; }
  .tp-sheet.is-dragging, .tp-sheet.no-anim { transition: none; }

  .tp-sheet-head { flex: 0 0 auto; padding: 0.15rem 0.8rem 0.65rem; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
  .tp-sheet.is-dragging .tp-sheet-head { cursor: grabbing; }
  .tp-sheet-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 24px; }
  .tp-grab { appearance: none; border: 0; background: transparent; width: 84px; height: 24px; position: relative; padding: 0; cursor: inherit; }
  .tp-grab::after { content: ""; position: absolute; left: 50%; top: 9px; width: 44px; height: 5px; border-radius: 999px; background: #6a5528; transform: translateX(-50%); }
  .tp-sheet-tc { justify-self: end; font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent-2, #d4aa32); }
  .tp-sheet-bar { display: flex; align-items: center; gap: 0.5rem; }
  .tp-sheet-tabs { flex: 1 1 auto; display: flex; gap: 4px; padding: 3px; background: #0d0b07; border: 1px solid #2c2313; border-radius: 13px; min-width: 0; }
  .tp-stab { appearance: none; flex: 1 1 0; min-height: 40px; border: 0; background: transparent; color: var(--muted, #b2a47c); border-radius: 10px; font: inherit; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; cursor: pointer; }
  .tp-stab.is-active { color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--accent, #b88916) 24%, #0e0d09); }
  .tp-stab .tp-count { font-style: normal; font-size: 11px; padding: 0.14rem 0.42rem; border-radius: 999px; background: #2a2518; }
  .tp-stab .tp-count:empty { display: none; }
  .tp-sheet-play, .tp-sheet-close { appearance: none; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #3a3220; background: #14110b; color: var(--accent-2, #d4aa32); display: grid; place-items: center; cursor: pointer; font-size: 16px; padding: 0; }
  .tp-sheet-play svg { width: 20px; height: 20px; fill: currentColor; }
  .tp-sheet-close { color: var(--muted, #b2a47c); }

  .tp-sheet-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid #211b10; overflow: hidden; }
  .tp-sheet-body > .marker-list {
    flex: 1 1 auto; min-height: 0; height: auto !important; max-height: none !important;
    margin: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  .tp-sheet-body > .marker-list[hidden] { display: none !important; }
  .tp-sheet-body > .tp-panel {
    flex: 1 1 auto; min-height: 0; max-height: none !important; margin: 0 !important;
    border: 0 !important; border-radius: 0 !important; background: transparent !important;
  }
  .tp-sheet-body > .tp-panel[hidden] { display: none !important; }
  .tp-sheet-body .tp-list { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

  /* marker rows: two lines (badge/time/actions, then the note), like the desktop rail */
  .tp-sheet .marker-list li:not(.marker-empty) {
    grid-template-columns: 14px auto minmax(0, 1fr) auto;
    grid-template-areas: "swatch kind at actions" "note note note note";
    column-gap: 0.55rem; row-gap: 0.3rem; align-items: center; padding: 0.65rem 0.9rem;
  }
  .tp-sheet .marker-list li:not(.marker-empty) .marker-swatch { grid-area: swatch; }
  .tp-sheet .marker-list li:not(.marker-empty) .marker-kind { grid-area: kind; }
  .tp-sheet .marker-list li:not(.marker-empty) .marker-at { grid-area: at; justify-self: start; }
  .tp-sheet .marker-list li:not(.marker-empty) .marker-actions { grid-area: actions; justify-self: end; }
  .tp-sheet .marker-list li:not(.marker-empty) .marker-note { grid-area: note; width: 100%; font-size: 15px; }
  .tp-sheet .marker-btn { min-width: 38px; min-height: 38px; }

  /* transcript inside the sheet: bigger text and touch targets */
  .tp-sheet .tp-head { padding: 0.6rem 0.8rem; }
  .tp-sheet .tp-text { font-size: 15px; line-height: 1.45; }
  .tp-sheet .tp-tc { font-size: 13px; padding: 0.3rem 0; }
  .tp-sheet .tp-row { padding: 0.6rem 0.8rem; }
  .tp-sheet .tp-btn { min-height: 38px; }
  .tp-sheet .tp-btn-icon { min-width: 40px; }
  .tp-sheet .tp-actions button { width: 38px; min-width: 38px; height: 38px; min-height: 38px; }
  .tp-sheet .tp-spkchip { padding: 0.28rem 0.8rem; font-size: 13px; }
  .tp-sheet .tp-namebtn { padding: 0.28rem 0.8rem; font-size: 13px; }
}
@media (min-width: 940px) { .tp-sheet { display: none !important; } }

/* iOS zooms into inputs smaller than 16 px — keep touch devices at 16 */
@media (pointer: coarse) {
  .tp-q, .tp-edit, .tp-dialog select, .tp-dialog input[type="text"], .tp-spkrow input, .tp-lbl select { font-size: 16px; }
}

/* compact transcript header inside the phone sheet */
@media (max-width: 939px) {
  .tp-sheet .tp-toolbar { flex-wrap: nowrap; gap: 0.4rem; }
  .tp-sheet .tp-search { flex: 1 1 auto !important; min-width: 0; }
  .tp-sheet .tp-search + .tp-menuwrap { margin-left: 0 !important; }
  .tp-sheet .tp-search [data-act="prev-match"], .tp-sheet .tp-search [data-act="next-match"] { display: none; } /* Enter in the search box jumps to the next match */
  .tp-sheet .tp-trkchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-top: 0.5rem; padding-bottom: 2px; }
  .tp-sheet .tp-trkchips::-webkit-scrollbar { display: none; }
  .tp-sheet .tp-spkchip, .tp-sheet .tp-namebtn { flex: 0 0 auto; white-space: nowrap; }
  .tp-sheet .tp-meta { display: none; }
  .tp-sheet .tp-dupbar { margin-top: 0.5rem; padding: 0.3rem 0.6rem; flex-wrap: nowrap; gap: 0.5rem; }
  .tp-sheet .tp-dupbar > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tp-sheet .tp-head { padding: 0.5rem 0.8rem 0.6rem; }
}

/* speaker chips: line counts, faint (leaky) tracks, bleed sensitivity */
.tp-spkn { opacity: 0.6; font-size: 0.68rem; margin-left: 0.15rem; }
.tp-spkchip.is-faint { border-style: dashed; }
.tp-showall { align-self: center; font-size: 0.74rem; }
.tp-dupctl { display: inline-flex; align-items: center; gap: 0.6rem; }
.tp-sel { background: #0f0d09; color: var(--ink, #f5f0df); border: 1px solid #2c2313; border-radius: 6px; padding: 0.12rem 0.3rem; font: inherit; font-size: 0.74rem; }

/* folded cleanup controls: one button next to the search box, details only when opened */
.tp-cleanupbtn { position: relative; font-size: 0.95rem; line-height: 1; }
.tp-cleanupbtn.is-on { border-color: #4a3912; background: #241d0e; color: var(--accent-2, #d4aa32); }
.tp-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent, #b88916); color: var(--accent-ink, #120e03); font-size: 0.64rem; font-weight: 700; line-height: 16px; text-align: center; box-sizing: border-box; }
.tp-cleanup { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.4rem; }
.tp-cleanup .tp-dupbar { margin-top: 0; padding: 0.25rem 0.55rem; flex-wrap: nowrap; }
.tp-menumeta { padding: 0.5rem 0.6rem 0.2rem; margin-top: 0.3rem; border-top: 1px solid color-mix(in srgb, var(--line, #2a2517) 85%, transparent); font-size: 0.68rem; line-height: 1.4; color: var(--muted, #b2a47c); text-wrap: balance; }
.tp-menu { max-width: min(300px, 90vw); }
.tp-menu:not([hidden]) { display: block; }

/* subtitles over the video (CC button) */
.tp-subs { position: absolute; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; text-align: center; box-sizing: border-box; padding: 0 4%; }
.tp-subs[hidden] { display: none; }
.tp-sub { max-width: 100%; background: rgba(0, 0, 0, 0.72); color: #fff; padding: 0.12em 0.55em 0.16em; border-radius: 0.3em; line-height: 1.32; font-weight: 500; text-shadow: 0 1px 2px #000; text-wrap: balance; }
.tp-sub b { font-weight: 700; margin-right: 0.15em; }
/* the word being spoken: a pill (no weight / size change, so the line never re-wraps); spoken words stay white, coming words are dimmer */
.tp-w { transition: color 0.1s linear, background-color 0.1s linear; border-radius: 0.22em; }
.tp-w.is-next { color: rgba(255, 255, 255, 0.66); }
.tp-w.is-past { color: #fff; }
.tp-w.is-now { color: var(--accent-ink, #120e03); background: var(--accent-2, #d4aa32); box-shadow: 0 0 0 0.1em var(--accent-2, #d4aa32); text-shadow: none; }
@media (prefers-reduced-motion: reduce) { .tp-w { transition: none; } }
.tp-ccbtn { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.02em; min-width: 34px; }
.tp-ccbtn.is-on { color: var(--accent-ink, #120e03); background: var(--accent, #b88916); border-color: var(--accent, #b88916); }

/* "Who is speaking here?" dialog */
.tp-spkpick { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tp-spkname { width: 100%; box-sizing: border-box; background: #14110b; color: var(--ink, #f5f0df); border: 1px solid #2c2313; border-radius: 8px; padding: 0.4rem 0.6rem; font: inherit; }
.tp-spkname:focus { outline: none; border-color: color-mix(in srgb, var(--accent, #b88916) 70%, #1a1309 30%); }
.tp-scope { display: grid; gap: 0.3rem; font-size: 0.85rem; }
.tp-scope label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* the longer text under a marker's name (e.g. the transcript text a range was made from) */
.marker-sub { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 2px; font-size: 0.72rem; line-height: 1.28; font-weight: 400; color: var(--muted, #b2a47c); white-space: normal; overflow-wrap: anywhere; }

/* ═════════ Transcribe dialog (compact cards, fine-tune option, phone bottom sheet) ═════════ */
.tp-dialog.tp-tr {
  width: min(500px, 100%);
  gap: 0.75rem;
  padding: 1.1rem 1.1rem 0;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--accent, #b88916) 34%, var(--line, #2a2517) 66%);
  background:
    radial-gradient(120% 40% at 0% 0%, color-mix(in srgb, var(--accent, #b88916) 8%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface, #101010) 94%, var(--accent, #b88916) 6%), var(--bg-soft, #0b0b0b));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  max-height: min(92dvh, 900px);
}
.tp-tr h3 { margin: 0; font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
.tp-tr .tp-dlg-body { gap: 0.85rem; }
.tp-tr .tp-sec { display: grid; gap: 0.4rem; }
.tp-tr .tp-field { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted, #b2a47c); }
.tp-tr label.tp-field { cursor: default; }
.tp-tr .tp-select { width: 100%; height: 44px; padding: 0 0.8rem; border-radius: 12px; font: inherit; font-size: 1rem; color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--bg, #030303) 70%, var(--surface, #101010) 30%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); outline: none; }
.tp-tr .tp-select:focus { border-color: var(--accent-2, #d4aa32); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #b88916) 24%, transparent); }
.tp-tr .tp-note { padding: 0.45rem 0.7rem; border-radius: 10px; font-size: 0.8rem; color: var(--muted, #b2a47c); background: color-mix(in srgb, var(--ink, #f5f0df) 5%, transparent); border: 1px solid color-mix(in srgb, var(--ink, #f5f0df) 8%, transparent); }
.tp-tr .tp-note.is-warn { color: #e8bd78; background: color-mix(in srgb, #e39a2d 10%, transparent); border-color: color-mix(in srgb, #e39a2d 30%, transparent); }

/* quality cards: two compact columns */
.tp-tr .tp-qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.tp-tr .tp-q { appearance: none; position: relative; display: grid; gap: 0.1rem; min-height: 54px; padding: 0.55rem 0.7rem; text-align: left; font: inherit; cursor: pointer; color: var(--ink, #f5f0df); border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 20%, var(--line, #2a2517) 80%); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); transition: border-color 0.14s, background 0.14s; width: auto; }
.tp-tr .tp-q:hover { border-color: color-mix(in srgb, var(--accent, #b88916) 55%, var(--line, #2a2517) 45%); }
.tp-tr .tp-q.is-on { border-color: var(--accent-2, #d4aa32); background: color-mix(in srgb, var(--accent, #b88916) 16%, var(--bg, #030303) 84%); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2, #d4aa32) 50%, transparent); }
.tp-tr .tp-q-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 0.4rem; row-gap: 0; min-width: 0; }
.tp-tr .tp-q strong { font-size: 0.95rem; font-weight: 650; }
.tp-tr .tp-q em { font-style: normal; font-size: 0.78rem; font-weight: 600; color: var(--accent-2, #d4aa32); white-space: nowrap; }
.tp-tr .tp-q-sub { font-size: 0.74rem; color: var(--muted, #b2a47c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-tr .tp-q-tag { position: absolute; top: -8px; right: 10px; font-style: normal; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.08rem 0.45rem; border-radius: 999px; color: var(--accent-ink, #120e03); background: var(--accent-2, #d4aa32); }

/* option rows (toggle + title + description) */
.tp-tr .tp-tog { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.6rem 0.7rem; border-radius: 12px; cursor: pointer; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 16%, var(--line, #2a2517) 84%); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); }
.tp-tr .tp-tog input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent-2, #d4aa32); cursor: pointer; }
.tp-tr .tp-tog-txt { display: grid; gap: 0.15rem; min-width: 0; }
.tp-tr .tp-tog-txt strong { font-size: 0.9rem; font-weight: 650; }
.tp-tr .tp-tog-txt > span { font-size: 0.76rem; line-height: 1.4; color: var(--muted, #b2a47c); }
.tp-tr .tp-tog.is-off { opacity: 0.55; cursor: default; }
.tp-tr .tp-pill-exp { font-style: normal; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.06rem 0.4rem; margin-left: 0.3rem; border-radius: 999px; color: #e8bd78; border: 1px solid color-mix(in srgb, #e39a2d 40%, transparent); vertical-align: 1px; }
.tp-tr .tp-sub-row { display: grid; gap: 0.3rem; margin-top: 0.1rem; }

/* text fine tune box (Lithuanian model) */
.tp-tr .tp-ftbox { gap: 0; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 22%, var(--line, #2a2517) 78%); background: color-mix(in srgb, var(--accent, #b88916) 6%, var(--bg, #030303)); overflow: hidden; }
.tp-tr .tp-ftbox .tp-tog { border: 0; background: transparent; border-radius: 0; }
.tp-tr .tp-ftbox.is-on { border-color: color-mix(in srgb, var(--accent-2, #d4aa32) 55%, var(--line, #2a2517) 45%); }
.tp-tr .tp-ftsub { display: grid; gap: 0.6rem; padding: 0.1rem 0.8rem 0.8rem 2.7rem; }
.tp-tr .tp-seg2 { display: inline-flex; width: max-content; max-width: 100%; padding: 3px; gap: 2px; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); background: color-mix(in srgb, var(--bg, #030303) 65%, var(--surface, #101010) 35%); }
.tp-tr .tp-seg2 button { appearance: none; border: 0; border-radius: 8px; min-height: 34px; padding: 0 0.85rem; font: inherit; font-size: 0.85rem; font-weight: 650; cursor: pointer; background: transparent; color: var(--muted, #b2a47c); width: auto; }
.tp-tr .tp-seg2 button small { font-weight: 500; font-size: 0.68rem; opacity: 0.8; margin-left: 0.2rem; }
.tp-tr .tp-seg2 button.is-on { background: var(--accent-2, #d4aa32); color: var(--accent-ink, #120e03); }
.tp-tr .tp-ftnames { font-size: 0.84rem; }
.tp-tr .tp-check, .tp-tr .tp-radio { display: flex; align-items: flex-start; gap: 0.55rem; font-size: 0.88rem; cursor: pointer; }
.tp-tr .tp-check input, .tp-tr .tp-radio input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent-2, #d4aa32); flex: 0 0 auto; }
.tp-tr .tp-radio .tp-dim { display: block; }
.tp-tr .tp-tracklist { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 1.6rem; }

.tp-tr .tp-foot { font-size: 0.76rem; color: var(--muted, #b2a47c); }
.tp-tr .tp-dactions { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 0.6rem; margin: 0 -1.1rem; padding: 0.8rem 1.1rem calc(0.95rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid color-mix(in srgb, var(--line, #2a2517) 85%, transparent); background: color-mix(in srgb, var(--surface, #101010) 96%, #000); }
.tp-tr .tp-dactions button { min-height: 46px; padding: 0 1.2rem; border-radius: 12px; font: inherit; font-size: 0.95rem; font-weight: 650; cursor: pointer; width: auto; }
.tp-tr .tp-dactions .ghost-btn { color: var(--accent-2, #d4aa32); background: transparent; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 34%, var(--line, #2a2517) 66%); }
.tp-tr .tp-go { flex: 1 1 auto; max-width: 260px; color: var(--accent-ink, #120e03); border: 0; background: linear-gradient(120deg, var(--accent, #b88916), var(--accent-2, #d4aa32)); }
.tp-tr .tp-go:disabled { opacity: 0.6; cursor: default; }

/* phones: bottom sheet, full width, large touch targets */
@media (max-width: 640px) {
  .tp-dialog-wrap-tr { align-items: flex-end; padding: 0; }
  .tp-dialog.tp-tr { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; padding: 1rem 0.95rem 0; border-bottom: 0; }
  .tp-tr .tp-dactions { margin: 0 -0.95rem; padding: 0.75rem 0.95rem calc(0.8rem + env(safe-area-inset-bottom, 0px)); }
  .tp-tr .tp-dactions .ghost-btn { flex: 0 0 auto; }
  .tp-tr .tp-go { max-width: none; }
  .tp-tr .tp-qgrid { gap: 0.4rem; }
  .tp-tr .tp-q { padding: 0.55rem 0.6rem; }
  .tp-tr .tp-ftsub { padding-left: 0.8rem; }
  .tp-tr .tp-tracklist { grid-template-columns: 1fr; }
  .tp-tr .tp-seg2 { width: 100%; }
  .tp-tr .tp-seg2 button { flex: 1; }
}

/* a shared link can switch the Markers tab off: only the Transcript tab is left */
.tp-no-markers .tp-tab[data-tab="markers"], .tp-no-markers .tp-stab[data-tab="markers"] { display: none !important; }

/* ───────── Translations: language bar, progress, CC language menu, Translate + Export dialogs ───────── */
.tp-langsel { appearance: none; -webkit-appearance: none; flex: 0 0 auto; height: 32px; min-width: 56px; width: auto !important; max-width: 76px; padding: 0 1.55rem 0 0.65rem; border-radius: 9px; font: inherit; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; cursor: pointer; color: var(--ink, #f5f0df); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m2.5 4.5 3.5 3.5 3.5-3.5' fill='none' stroke='%23d4aa32' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.5rem center / 10px; }
.tp-langsel:hover { border-color: color-mix(in srgb, var(--accent, #b88916) 60%, var(--line, #2a2517) 40%); }
.tp-langsel:focus-visible { outline: 2px solid var(--accent-2, #d4aa32); outline-offset: 2px; }
.tp-langsel option { background: #151209; color: #f5f0df; }
.tp-tlbar { flex-wrap: wrap; position: relative; padding-bottom: 0.7rem; }
.tp-tlinfo small { color: var(--muted, #b2a47c); margin-left: 0.2rem; }
.tp-tlinfo b { color: var(--ink, #f5f0df); font-variant-numeric: tabular-nums; }
.tp-tlprog { position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0.3rem; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--ink, #f5f0df) 10%, transparent); overflow: hidden; }
.tp-tlprog i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent, #b88916), var(--accent-2, #d4aa32)); transition: width 0.5s ease; }
.tp-row.is-untranslated .tp-text { opacity: 0.55; font-style: italic; }
.tp-editlang { display: block; margin-bottom: 0.25rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-2, #d4aa32); }
.tp-linkbtn.is-danger { color: #f08a8a; }

/* CC button: current language + long-press menu */
.tp-ccbtn { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tp-ccbtn { position: relative; }
.tp-ccbtn.has-lang { padding-bottom: 7px !important; }
.tp-cc-lang { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); margin: 0; padding: 0 0.22rem; border-radius: 4px; font-size: 0.5rem; font-weight: 800; line-height: 1.35; letter-spacing: 0.02em; background: color-mix(in srgb, currentColor 20%, transparent); }
.tp-ccmenu { position: fixed; z-index: 100000; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: min(70vh, 420px); overflow-y: auto; padding: 6px; border-radius: 14px; background: color-mix(in srgb, var(--surface, #101010) 96%, #000 4%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 30%, var(--line, #2a2517) 70%); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55); color: var(--ink, #f5f0df); animation: tp-ccin 0.14s ease-out; }
@keyframes tp-ccin { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.tp-ccmenu-title { padding: 0.45rem 0.7rem 0.3rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted, #b2a47c); }
.tp-ccmenu-sep { height: 1px; margin: 5px 6px; background: color-mix(in srgb, var(--line, #2a2517) 90%, transparent); }
.tp-ccitem { appearance: none; width: 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; min-height: 40px; }
.tp-ccitem:hover, .tp-ccitem:focus-visible { background: color-mix(in srgb, var(--accent, #b88916) 18%, transparent); outline: none; }
.tp-ccitem-check { flex: 0 0 18px; width: 18px; height: 18px; color: var(--accent-2, #d4aa32); }
.tp-ccitem-check svg { width: 18px; height: 18px; }
.tp-ccitem-txt { display: grid; gap: 1px; min-width: 0; }
.tp-ccitem-txt b { font-size: 0.9rem; font-weight: 600; }
.tp-ccitem-txt small { font-size: 0.72rem; color: var(--muted, #b2a47c); }
.tp-ccitem.is-on .tp-ccitem-txt b { color: var(--accent-2, #d4aa32); }

/* Translate dialog */
.tp-tl-from { font-size: 0.9rem; color: var(--muted, #b2a47c); }
.tp-tl-from b { color: var(--ink, #f5f0df); }
.tp-tl-from .tp-select { margin-top: 0.35rem; width: 100%; }
.tp-tlgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.tp-tlchip { appearance: none; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; width: auto; min-height: 42px; padding: 0 0.7rem; border-radius: 11px; font: inherit; font-size: 0.86rem; font-weight: 600; text-align: left; cursor: pointer; color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 20%, var(--line, #2a2517) 80%); transition: border-color 0.14s, background 0.14s; }
.tp-tlchip:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent, #b88916) 60%, var(--line, #2a2517) 40%); }
.tp-tlchip.is-on { border-color: var(--accent-2, #d4aa32); background: color-mix(in srgb, var(--accent, #b88916) 16%, var(--bg, #030303) 84%); box-shadow: 0 0 0 1px var(--accent-2, #d4aa32) inset; }
.tp-tlchip:disabled { opacity: 0.38; cursor: default; }
.tp-tlchip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-tlchip-code { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; color: var(--muted, #b2a47c); }
.tp-tlchip-tick { display: inline-flex; width: 16px; height: 16px; color: #7bc47f; }
.tp-tlchip-tick svg { width: 16px; height: 16px; }
.tp-tlsaved { display: grid; gap: 0.3rem; }
.tp-tlsaved-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 10px; background: color-mix(in srgb, var(--ink, #f5f0df) 4%, transparent); border: 1px solid color-mix(in srgb, var(--ink, #f5f0df) 8%, transparent); }
.tp-tlsaved-code { flex: 0 0 auto; min-width: 34px; text-align: center; padding: 0.15rem 0.3rem; border-radius: 6px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; color: var(--accent-2, #d4aa32); background: color-mix(in srgb, var(--accent, #b88916) 16%, transparent); }
.tp-tlsaved-txt { display: grid; gap: 1px; min-width: 0; flex: 1 1 auto; }
.tp-tlsaved-txt b { font-size: 0.88rem; font-weight: 600; }
.tp-tlsaved-txt small { font-size: 0.72rem; color: var(--muted, #b2a47c); }
.tp-tr .tp-radio.is-off { opacity: 0.55; }

/* Export dialog */
.tp-exlangs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tp-exlang { appearance: none; display: grid; gap: 1px; width: auto; min-width: 104px; padding: 0.5rem 0.8rem; border-radius: 11px; font: inherit; text-align: left; cursor: pointer; color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 20%, var(--line, #2a2517) 80%); transition: border-color 0.14s, background 0.14s; }
.tp-exlang b { font-size: 0.9rem; font-weight: 650; }
.tp-exlang small { font-size: 0.7rem; color: var(--muted, #b2a47c); }
.tp-exlang:hover { border-color: color-mix(in srgb, var(--accent, #b88916) 60%, var(--line, #2a2517) 40%); }
.tp-exlang.is-on { border-color: var(--accent-2, #d4aa32); background: color-mix(in srgb, var(--accent, #b88916) 16%, var(--bg, #030303) 84%); box-shadow: 0 0 0 1px var(--accent-2, #d4aa32) inset; }
.tp-exfmts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.tp-exfmt { appearance: none; display: flex; align-items: center; gap: 0.65rem; width: auto; min-height: 56px; padding: 0.55rem 0.75rem; border-radius: 12px; font: inherit; text-align: left; cursor: pointer; color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 20%, var(--line, #2a2517) 80%); transition: border-color 0.14s, background 0.14s; }
.tp-exfmt:hover { border-color: color-mix(in srgb, var(--accent, #b88916) 60%, var(--line, #2a2517) 40%); }
.tp-exfmt.is-on { border-color: var(--accent-2, #d4aa32); background: color-mix(in srgb, var(--accent, #b88916) 16%, var(--bg, #030303) 84%); box-shadow: 0 0 0 1px var(--accent-2, #d4aa32) inset; }
.tp-exfmt-ico { flex: 0 0 auto; display: inline-flex; width: 26px; height: 26px; color: var(--accent-2, #d4aa32); }
.tp-exfmt-ico svg { width: 26px; height: 26px; }
.tp-exfmt-txt { display: grid; gap: 1px; min-width: 0; }
.tp-exfmt-txt b { font-size: 0.9rem; font-weight: 650; }
.tp-exfmt-txt b em { font-style: normal; font-weight: 500; font-size: 0.76rem; color: var(--muted, #b2a47c); }
.tp-exfmt-txt small { font-size: 0.72rem; color: var(--muted, #b2a47c); }
.tp-tr .tp-tog-slim { align-items: center; padding: 0.5rem 0.7rem; }
.tp-tr .tp-tog-slim input { margin: 0; }
@media (max-width: 640px) {
  .tp-tlgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-exfmts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
  .tp-exfmt { min-height: 50px; padding: 0.45rem 0.6rem; gap: 0.5rem; }
  .tp-exfmt-txt small { display: none; }
  .tp-exfmt-ico, .tp-exfmt-ico svg { width: 22px; height: 22px; }
  .tp-exlang { flex: 1 1 calc(50% - 0.4rem); }
}
.tp-tlmore { margin-top: 0.35rem; justify-self: start; font-size: 0.82rem; }

/* ───────── Captions to video ───────── */
.tp-capdone { gap: 0.6rem; }
.tp-capdone small { color: var(--muted, #b2a47c); margin-left: 0.3rem; }
.tp-capdone-btns { display: inline-flex; align-items: center; gap: 0.6rem; }
.tp-capdone .tp-btn { text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; padding: 0 0.9rem; border-radius: 9px; font-weight: 650; }
.tp-dialog.tp-cap { width: min(1060px, 97vw); max-height: min(92vh, 900px); overflow-y: auto; }
.tp-cap .tp-cap-head { margin: -0.2rem 0 0.2rem; }
.tp-cap-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.tp-cap-left { position: sticky; top: 0; display: grid; gap: 0.55rem; }
.tp-cap-prev { position: relative; width: min(100%, calc(62vh * var(--ar, 0.5625))); aspect-ratio: var(--ar, 0.5625); margin: 0 auto; border-radius: 14px; overflow: hidden; background: #000 linear-gradient(135deg, #15110a, #060606); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); }
.tp-cap-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; }
.tp-cap-img:not([src]) { visibility: hidden; }
.tp-cap-spin { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: var(--accent-2, #d4aa32); opacity: 0; transition: opacity 0.15s; animation: tp-spin 0.8s linear infinite; pointer-events: none; }
.tp-cap-prev.is-busy .tp-cap-spin { opacity: 1; }
@keyframes tp-spin { to { transform: rotate(360deg); } }
.tp-cap-preverr { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 0.4rem 0.6rem; border-radius: 8px; font-size: 0.76rem; color: #f0b4b4; background: rgba(40, 12, 12, 0.88); border: 1px solid #5a2424; }
.tp-cap-preverr[hidden] { display: none; }
.tp-cap-safe { position: absolute; inset: 0; pointer-events: none; }
.tp-cap-safe[hidden] { display: none; }
.tp-cap-safe[data-o="portrait"] { background: linear-gradient(rgba(255, 60, 60, 0.22), rgba(255, 60, 60, 0.22)) top / 100% 14% no-repeat, linear-gradient(rgba(255, 60, 60, 0.22), rgba(255, 60, 60, 0.22)) bottom / 100% 24% no-repeat, linear-gradient(rgba(255, 60, 60, 0.22), rgba(255, 60, 60, 0.22)) right center / 14% 62% no-repeat; }
.tp-cap-safe:not([data-o="portrait"]) { inset: 5%; border: 1.5px dashed rgba(255, 255, 255, 0.55); border-radius: 4px; }
.tp-cap-time { display: flex; align-items: center; gap: 0.4rem; }
.tp-cap-slider { flex: 1 1 auto; min-width: 0; accent-color: var(--accent-2, #d4aa32); }
.tp-capnav { appearance: none; flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border-radius: 8px; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--accent-2, #d4aa32); background: transparent; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 30%, var(--line, #2a2517) 70%); }
.tp-capnav:hover { background: color-mix(in srgb, var(--accent, #b88916) 18%, transparent); }
.tp-cap-timelbl { flex: 0 0 auto; min-width: 2.6rem; text-align: right; font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--muted, #b2a47c); }
.tp-cap-tools { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8rem; }
.tp-cap-right { display: grid; gap: 0.85rem; min-width: 0; }
.tp-cap-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.tp-cappreset { appearance: none; display: grid; gap: 0.12rem; width: auto; padding: 0.5rem 0.7rem; border-radius: 11px; font: inherit; text-align: left; cursor: pointer; color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 20%, var(--line, #2a2517) 80%); transition: border-color 0.14s, background 0.14s; }
.tp-cappreset strong { font-size: 0.88rem; font-weight: 650; }
.tp-cappreset small { font-size: 0.7rem; color: var(--muted, #b2a47c); line-height: 1.3; }
.tp-cappreset:hover { border-color: color-mix(in srgb, var(--accent, #b88916) 60%, var(--line, #2a2517) 40%); }
.tp-cappreset.is-on { border-color: var(--accent-2, #d4aa32); background: color-mix(in srgb, var(--accent, #b88916) 16%, var(--bg, #030303) 84%); box-shadow: 0 0 0 1px var(--accent-2, #d4aa32) inset; }
.tp-caprow { display: flex; align-items: center; gap: 0.6rem; }
.tp-caprow .tp-select { flex: 1 1 auto; min-width: 0; }
.tp-caprow2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.5rem; }
.tp-capsel { display: grid; gap: 0.2rem; font-size: 0.74rem; color: var(--muted, #b2a47c); }
.tp-capsel .tp-select { width: 100%; }
.tp-caprange { display: grid; grid-template-columns: 7.5rem 1fr 3rem; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--muted, #b2a47c); }
.tp-caprange input { width: 100%; accent-color: var(--accent-2, #d4aa32); }
.tp-caprange b { text-align: right; font-weight: 650; color: var(--ink, #f5f0df); font-variant-numeric: tabular-nums; }
.tp-capcolors { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.1rem; }
.tp-capcolor { position: relative; display: inline-flex; align-items: center; gap: 0.45rem; height: 34px; padding: 0 0.7rem 0 0.4rem; border-radius: 999px; font-size: 0.78rem; cursor: pointer; color: var(--ink, #f5f0df); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); }
.tp-capcolor:hover { border-color: var(--accent-2, #d4aa32); }
.tp-capcolor-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.tp-capcolor input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.tp-capswatches { display: flex; gap: 0.4rem; margin-top: 0.1rem; }
.tp-capsw { appearance: none; width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--sw); border: 2px solid rgba(255, 255, 255, 0.35); cursor: pointer; }
.tp-capsw.is-on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent-2, #d4aa32); }
.tp-cap .tp-seg2 { flex-wrap: wrap; }
@media (max-width: 760px) {
  .tp-dialog.tp-cap { width: 100%; max-height: 94vh; }
  .tp-cap-grid { grid-template-columns: 1fr; gap: 0.7rem; }
  .tp-cap-left { z-index: 3; padding: 0.35rem 0 0.5rem; background: color-mix(in srgb, var(--surface, #101010) 97%, #000); border-bottom: 1px solid color-mix(in srgb, var(--line, #2a2517) 80%, transparent); }
  .tp-cap-prev { width: min(100%, calc(30vh * var(--ar, 0.5625))); }
  .tp-cap-prev:not(.is-portrait) { width: 100%; }
  .tp-cap-tools { font-size: 0.74rem; }
  .tp-caprange { grid-template-columns: 6rem 1fr 2.6rem; }
}

/* ───────── Captions to video: v2 (tabs, chips, boxes) ───────── */
.tp-cap .tp-cap-head { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: -0.1rem 0 0.35rem; }
.tp-capchip { display: inline-flex; align-items: center; height: 26px; padding: 0 0.65rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; color: var(--muted, #b2a47c); background: color-mix(in srgb, var(--ink, #f5f0df) 6%, transparent); border: 1px solid color-mix(in srgb, var(--ink, #f5f0df) 10%, transparent); }
.tp-capchip b { color: var(--ink, #f5f0df); font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-capchip.is-gpu { color: #7bc47f; border-color: color-mix(in srgb, #7bc47f 35%, transparent); background: color-mix(in srgb, #7bc47f 10%, transparent); }
.tp-capchip.is-eta { color: var(--accent-2, #d4aa32); border-color: color-mix(in srgb, var(--accent, #b88916) 40%, transparent); background: color-mix(in srgb, var(--accent, #b88916) 12%, transparent); }
.tp-captabs { display: flex; gap: 0.25rem; padding: 3px; border-radius: 12px; overflow-x: auto; scrollbar-width: none; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); background: color-mix(in srgb, var(--bg, #030303) 65%, var(--surface, #101010) 35%); }
.tp-captabs::-webkit-scrollbar { display: none; }
.tp-captab { appearance: none; flex: 1 0 auto; width: auto; min-height: 36px; padding: 0 0.85rem; border: 0; border-radius: 9px; font: inherit; font-size: 0.86rem; font-weight: 650; cursor: pointer; white-space: nowrap; color: var(--muted, #b2a47c); background: transparent; transition: background 0.14s, color 0.14s; }
.tp-captab:hover { color: var(--ink, #f5f0df); }
.tp-captab.is-on { background: var(--accent-2, #d4aa32); color: var(--accent-ink, #120e03); }
.tp-captab:focus-visible { outline: 2px solid var(--accent-2, #d4aa32); outline-offset: 1px; }
.tp-cap-pane { display: grid; gap: 0.7rem; align-content: start; min-height: 220px; }
.tp-capbox { display: grid; gap: 0.6rem; padding: 0.8rem; border-radius: 13px; border: 1px solid var(--line, #2a2517); background: color-mix(in srgb, var(--surface, #101010) 55%, transparent); }
.tp-capbox-title { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted, #b2a47c); }
.tp-cap-pane .tp-note { margin: 0; }
.tp-cappreset-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.tp-cappreset-dots { display: inline-flex; gap: 3px; }
.tp-cappreset-dots i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }
.tp-cappreset em { font-style: normal; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-2, #d4aa32); margin-top: 0.15rem; }
.tp-cap .tp-dactions { align-items: center; }
.tp-cap-sum { margin-right: auto; font-size: 0.78rem; color: var(--muted, #b2a47c); }
.tp-capwarn { display: block; margin: 0.15rem 0 0 !important; color: #f0b4b4; }
.tp-capdone .tp-tlinfo small { display: inline; }
.tp-capdone .tp-capdone-btns .tp-btn { cursor: pointer; }
@media (max-width: 760px) {
  .tp-cap-sum { display: none; }
  .tp-cap-pane { min-height: 0; }
}
@media (max-width: 760px) {
  .tp-cap .tp-seg2 { display: flex; width: 100%; }
  .tp-cap .tp-seg2 button { flex: 1 1 0; padding: 0 0.2rem; min-width: 0; }
}

/* the Export window can be opened from Editor mode, which sits at z-index 1600 */
.marker-modal.tp-dialog-wrap { z-index: 1800; }

/* ───────── Speaking statistics ───────── */
.tp-dialog.tp-st { width: min(620px, 100%); }
.tp-st-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.tp-st-tiles > div { display: grid; gap: 0.1rem; padding: 0.65rem 0.7rem; border-radius: 12px; border: 1px solid var(--line, #2a2517); background: color-mix(in srgb, var(--surface, #101010) 60%, transparent); }
.tp-st-tiles b { font-size: 1.3rem; font-weight: 800; color: var(--ink, #f5f0df); font-variant-numeric: tabular-nums; }
.tp-st-tiles span { font-size: 0.72rem; color: var(--muted, #b2a47c); }
.tp-st-bars { display: grid; gap: 0.6rem; }
.tp-st-bar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.25rem; font-size: 0.86rem; }
.tp-st-name { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; font-weight: 650; color: var(--ink, #f5f0df); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-st-name i { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tp-st-val { color: var(--muted, #b2a47c); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-st-val b { color: var(--ink, #f5f0df); }
.tp-st-track { height: 10px; border-radius: 10px; background: color-mix(in srgb, var(--ink, #f5f0df) 9%, transparent); overflow: hidden; }
.tp-st-track span { display: block; height: 100%; border-radius: 10px; background: var(--c); }
.tp-st-lanes { display: grid; gap: 0.35rem; }
.tp-st-lane { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.tp-st-lane:not(:has(em)) { grid-template-columns: minmax(0, 1fr); }
.tp-st-lane em { font-style: normal; width: 5.5rem; font-size: 0.74rem; font-weight: 600; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-st-lane-bar { position: relative; height: 18px; border-radius: 6px; cursor: pointer; background: color-mix(in srgb, var(--ink, #f5f0df) 6%, transparent); }
.tp-st-lane-bar i { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: var(--c); opacity: 0.9; }
.tp-st-lane-bar i:hover { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.tp-st-axis { display: flex; justify-content: space-between; margin-left: 6rem; font-size: 0.68rem; color: var(--muted, #b2a47c); font-variant-numeric: tabular-nums; }
.tp-st-lanes:not(:has(em)) .tp-st-axis { margin-left: 0; }
.tp-st-table { display: grid; gap: 0; border: 1px solid var(--line, #2a2517); border-radius: 12px; overflow: hidden; }
.tp-st-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 0.8fr 0.8fr 0.9fr 0.6fr 1fr; gap: 0.5rem; align-items: center; padding: 0.5rem 0.7rem; font-size: 0.84rem; color: var(--muted, #b2a47c); border-top: 1px solid color-mix(in srgb, var(--line, #2a2517) 70%, transparent); font-variant-numeric: tabular-nums; }
.tp-st-row:first-child { border-top: 0; }
.tp-st-head { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; background: color-mix(in srgb, var(--ink, #f5f0df) 5%, transparent); }
.tp-st-row .tp-linkbtn { padding: 0; }
.tp-st-facts { display: grid; gap: 0.3rem; font-size: 0.86rem; color: var(--muted, #b2a47c); }
.tp-st-facts b { color: var(--ink, #f5f0df); }
@media (max-width: 640px) {
  .tp-st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-st-row { grid-template-columns: minmax(0, 1.5fr) 0.8fr 0.8fr 0.7fr; }
  .tp-st-row > span:nth-child(5), .tp-st-row > span:nth-child(6) { display: none; }
}

/* ───────── Remembered voices ───────── */
.tp-spkrow2 { display: grid; gap: 0.3rem; }
.tp-spksug { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.5rem; margin-left: 1.5rem; padding: 0.3rem 0.6rem; border-radius: 9px; font-size: 0.8rem; color: var(--muted, #b2a47c); background: color-mix(in srgb, var(--accent, #b88916) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 30%, transparent); }
.tp-spksug b { color: var(--ink, #f5f0df); }
.tp-spksug span { font-weight: 700; color: var(--accent-2, #d4aa32); }
.tp-spkmem { display: flex; align-items: center; gap: 0.45rem; margin-left: 1.5rem; font-size: 0.8rem; color: var(--muted, #b2a47c); cursor: pointer; }
.tp-spkmem[hidden] { display: none; }
.tp-spkmem input { accent-color: var(--accent-2, #d4aa32); width: 16px; height: 16px; }
.tp-spkmem.is-off { opacity: 0.5; cursor: default; }
.tp-spkvoicehint { font-size: 0.78rem; line-height: 1.45; color: var(--muted, #b2a47c); }
.tp-spkvoicehint[hidden] { display: none; }
.tp-spkvoicehint .tp-linkbtn { padding: 0 0.15rem; }
.tp-voicebar { gap: 0.6rem; }
.tp-voicebar b { color: var(--ink, #f5f0df); }
.tp-dialog.tp-vc { width: min(520px, 100%); }
.tp-vc-ico { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50% !important; font-size: 0.95rem !important; }

/* ── Re-transcribe selection dialog ── */
.tp-rt .tp-rt-sel { display: grid; gap: 0.35rem; padding: 0.65rem 0.75rem; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent, #b88916) 22%, var(--line, #2a2517) 78%); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); }
.tp-rt .tp-rt-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 0.6rem; font-size: 0.8rem; color: var(--muted, #b2a47c); }
.tp-rt .tp-rt-meta b { color: var(--ink, #f5f0df); font-size: 0.92rem; }
.tp-rt .tp-rt-quote { font-size: 0.86rem; line-height: 1.45; color: var(--ink, #f5f0df); max-height: 5.6em; overflow: auto; overflow-wrap: anywhere; }
.tp-rt .tp-input { width: 100%; box-sizing: border-box; height: 44px; padding: 0 0.8rem; border-radius: 12px; font: inherit; font-size: 1rem; color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--bg, #030303) 70%, var(--surface, #101010) 30%); border: 1px solid color-mix(in srgb, var(--accent, #b88916) 26%, var(--line, #2a2517) 74%); outline: none; }
.tp-rt .tp-input:focus { border-color: var(--accent-2, #d4aa32); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #b88916) 24%, transparent); }

/* designer caption looks: group headings in the preset gallery */
.tp-cap-group { margin: 0.7rem 0 0.35rem; }
.tp-cap-group:first-child { margin-top: 0; }

/* ── "Who is speaking these words?" (Editor mode) ── */
.tp-spkdlg { width: min(440px, 100%); }
.tp-spkdlg .tp-spkquote { margin: 0; padding: 0.55rem 0.75rem; border-radius: 10px; border: 1px solid var(--line, #2a2517); background: color-mix(in srgb, var(--bg, #030303) 60%, var(--surface, #101010) 40%); color: var(--ink, #f5f0df); font-size: 0.86rem; line-height: 1.4; display: grid; gap: 0.25rem; overflow-wrap: anywhere; }
.tp-spkdlg .tp-spkquote span { color: var(--muted, #b2a47c); font-size: 0.74rem; }
.tp-spkdlg .tp-spkpick { max-height: 132px; overflow: auto; }
.tp-spkdlg .tp-spkchip { display: inline-flex; align-items: center; gap: 0.35rem; }
.tp-spkdlg .tp-spkchip i { font-style: normal; font-size: 0.66rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.03em; }
.tp-spkdlg .tp-spkchip.is-current { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, #d4aa32) 70%, transparent); }
.tp-spkdlg .tp-spkchip.is-picked { background: color-mix(in srgb, var(--c, #d4aa32) 28%, transparent); border-color: var(--c, #d4aa32); }
.tp-spkdlg .tp-scope { gap: 0.5rem; }
.tp-spkdlg .tp-scope label { align-items: flex-start; }
.tp-spkdlg .tp-scope input { margin-top: 0.2rem; flex: none; }
.tp-spkdlg .tp-scope em { font-style: normal; color: var(--muted, #b2a47c); font-size: 0.78rem; }
.tp-spkdlg .tp-foot { font-size: 0.74rem; color: var(--muted, #b2a47c); margin: 0; }

/* ═════════ Export dialog: compact layout (Segments → Include → Format dropdown) ═════════ */
.tp-ex .tp-dlg-body { gap: 0.8rem; }
.tp-tr .tp-seg2.tp-seg-full { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 2px; }
.tp-tr .tp-seg2.tp-seg-full button { flex: none; min-width: 0; padding: 0 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-tr .tp-seg2.tp-seg-full.is-off { opacity: 0.45; }
.tp-tr .tp-seg2.tp-seg-full button:disabled { cursor: default; }
.tp-seg-desc { font-size: 0.78rem; line-height: 1.35; color: var(--muted, #b2a47c); }
.tp-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tp-chip { position: relative; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 38px; padding: 0 0.85rem 0 0.7rem; border-radius: 999px; border: 1px solid var(--line, #2a2517); background: transparent; color: var(--muted, #b2a47c); font-size: 0.84rem; font-weight: 600; cursor: pointer; user-select: none; -webkit-user-select: none; transition: border-color 0.14s, background 0.14s, color 0.14s; }
.tp-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tp-chip::before { content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0.75; box-sizing: border-box; }
.tp-chip:hover { color: var(--ink, #f5f0df); border-color: color-mix(in srgb, var(--accent, #b88916) 55%, var(--line, #2a2517) 45%); }
.tp-chip:has(input:checked) { color: var(--accent-ink, #120e03); background: var(--accent-2, #d4aa32); border-color: var(--accent-2, #d4aa32); }
.tp-chip:has(input:checked)::before { opacity: 1; background: var(--accent-ink, #120e03); border-color: var(--accent-ink, #120e03); box-shadow: inset 0 0 0 2.5px var(--accent-2, #d4aa32); }
.tp-chip:has(input:focus-visible) { outline: 2px solid var(--accent-2, #d4aa32); outline-offset: 2px; }
.tp-exrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.6rem; }
.tp-exrow .tp-sec { min-width: 0; }
.tp-tr .tp-select { color-scheme: dark; }
.tp-tr .tp-select option, .tp-tr .tp-select optgroup { background: #14110b; color: #f5f0df; }
.tp-tr .tp-select option:disabled { color: #7d7355; }
@media (max-width: 480px) {
  .tp-tr .tp-seg2.tp-seg-full { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-tr .tp-seg2.tp-seg-full button { min-height: 40px; }
  .tp-chip { min-height: 40px; }
  .tp-tr .tp-select { font-size: 16px; }
}

/* voice dialog: states of a saved voice, and the hint under the "people speaking" choice */
.tp-tr .tp-tlsaved-txt small.is-warn { color: #e8bd78; }
.tp-tr .tp-tlsaved-txt small.is-busy { color: var(--muted, #b2a47c); font-style: italic; }
.tp-tr .tp-sub-hint { display: block; margin-top: 0.3rem; font-size: 0.76rem; font-weight: 400; color: var(--muted, #b2a47c); line-height: 1.35; }

/* voice recognition progress: the bar always has a moving highlight, so it never looks frozen between two updates */
.tp-tlprog.is-live { position: absolute; }
.tp-tlprog.is-live::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 244, 204, 0.55), transparent); transform: translateX(-100%); animation: tp-sweep 1.5s ease-in-out infinite; }
@keyframes tp-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .tp-tlprog.is-live::after { animation: none; opacity: 0; } }

/* ── Transcript status (wide layout): cut like a tab and sitting on the tab baseline, with a quiet pulsing dot instead of a glowing capsule ── */
.tp-rail:not(.is-phone) > .tp-tabs .tp-pill {
  display: inline-block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  margin: 0 0 0 0.25rem;
  padding: 0.46rem 0.7rem 0.44rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: inherit;
  color: color-mix(in srgb, var(--ink, #f5f0df) 90%, var(--accent, #b88916) 10%);
  border: 1px solid color-mix(in srgb, var(--accent, #b88916) 36%, #2c2313);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent, #b88916) 15%, #0b0a08), color-mix(in srgb, var(--accent, #b88916) 5%, #0b0a08));
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--accent, #b88916) 50%, transparent);
  animation: none;
  transition: background 120ms, color 120ms;
}
.tp-rail:not(.is-phone) > .tp-tabs .tp-pill:hover { color: var(--ink, #f5f0df); background: color-mix(in srgb, var(--accent, #b88916) 20%, #0b0a08); }
.tp-rail:not(.is-phone) > .tp-tabs .tp-pill::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.4rem;
  vertical-align: 1px;
  border-radius: 50%;
  background: var(--accent-2, #d4aa32);
  animation: tp-dot 1.3s ease-in-out infinite;
}
.tp-rail:not(.is-phone) > .tp-tabs .tp-pill.is-warn { color: #f0c98a; border-color: color-mix(in srgb, #e39a2d 45%, #2c2313); box-shadow: inset 0 2px 0 color-mix(in srgb, #e39a2d 55%, transparent); }
.tp-rail:not(.is-phone) > .tp-tabs .tp-pill.is-warn::before { background: #e39a2d; animation: none; }
/* while a job runs, the tabs give the chip room: tighter padding, and no segment count (it is about to change anyway) */
.tp-rail:not(.is-phone) > .tp-tabs:has(.tp-pill:not([hidden])) .tp-tab { padding-inline: 0.75rem; }
.tp-rail:not(.is-phone) > .tp-tabs:has(.tp-pill:not([hidden])) .tp-tab-badge { display: none; }
@keyframes tp-dot { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .tp-rail:not(.is-phone) > .tp-tabs .tp-pill::before { animation: none; } }
