/* =========================================================================
   Video editor (video-editor.html). Builds on image-editor.css for the
   shell: top bar, tool rail, stage, properties, and the phone sheet.
   Adds the toolbar under the stage, the timeline, and the export panel.
   ========================================================================= */

.is-video .ed-stage { min-height: 160px; }
.vd-replace-icon { display: none; }
.vd-transport-history { display: none; }

.vd-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.vd-loading[hidden] { display: none; }
.vd-loading span {
  background: var(--surface);
  color: var(--ink-2);
  font: 500 14px/20px var(--font-body);
  padding: 8px 14px;
  border-radius: var(--r-control);
  box-shadow: 0 1px 2px rgba(20, 20, 20, .08);
}

/* ---- Toolbar under the stage ----------------------------------------- */
.vd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 4px 16px 14px;
  min-height: 50px;
}
.vd-tool-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.vd-tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vd-toolbar .segmented { background: var(--surface); box-shadow: inset 0 0 0 1px var(--control-border); }
.vd-toolbar .segmented button { height: 34px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.vd-toolbar .segmented button[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
.vd-toolbar .segmented button:disabled { color: var(--disabled-ink); cursor: not-allowed; }
.vd-toolbar .btn-sm .icon { margin-left: -2px; }
.vd-hint, .vd-meta { font-size: 13px; line-height: 18px; color: var(--muted); }
.vd-cap-text { width: 300px; max-width: 100%; height: 36px; font-size: 14px; }
.vd-cap-row { flex-wrap: nowrap; }
.vd-toolbar .ed-swatches .swatch { width: 32px; height: 32px; }
/* Touch: 44 px swatches, as the image editor's. */
@media (max-width: 760px), (any-pointer: coarse) { .vd-toolbar .ed-swatches .swatch { width: 44px; height: 44px; } }
.vd-toolbar .ed-handoffs .chip .icon { margin-left: -2px; }

/* ---- Timeline -------------------------------------------------------- */
.vd-timeline {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
}
.vd-transport { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vd-transport-left { display: flex; align-items: center; gap: 6px; }
.vd-step { width: 36px; height: 36px; border-radius: 8px; }
.vd-play {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.vd-play:hover { background: var(--ink-2); }
.vd-time { font-size: 13px; line-height: 18px; margin-left: 6px; white-space: nowrap; }
.vd-time b { font-weight: 600; font-variant-numeric: tabular-nums; }
.vd-time span { color: var(--muted); }
.vd-keep { font-size: 13px; line-height: 18px; color: var(--muted); }

.vd-tracks { display: flex; gap: 10px; }
.vd-labels {
  width: 76px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 22px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}
.vd-labels span { display: flex; align-items: center; }
.vd-label-video { height: 52px; }
.vd-label-cap, .vd-label-lane { height: 32px; }
.vd-labels [hidden] { display: none; }

/* The lanes scroll sideways when the timeline is zoomed in. Pinch, Ctrl or
   Command and the wheel, and the zoom control set the lanes' width. */
.vd-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: none;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.vd-scroll.is-zoomed { touch-action: pan-x; }
.vd-lanes {
  width: 100%;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  touch-action: none;
  cursor: pointer;
}
.vd-ruler { position: relative; height: 12px; }
.vd-tick {
  position: absolute;
  top: 0;
  font-size: 11px;
  line-height: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.vd-tick.is-end { transform: translateX(-100%); }

.vd-strip { position: relative; height: 52px; }
/* The thumbnail canvas covers only the part on screen; drawThumbs moves it as the lanes scroll. */
.vd-thumbs { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; }
.vd-shade { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 62%, transparent); pointer-events: none; }
.vd-shade-l { left: 0; }
.vd-shade-r { right: 0; }
/* Cut segments: hatched so they read as removed even in grayscale. */
.vd-cut {
  position: absolute;
  top: 0; bottom: 0;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 55%, transparent) 0 4px, color-mix(in srgb, var(--surface) 70%, transparent) 4px 9px);
  pointer-events: none;
}
.vd-seam { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.vd-segsel { position: absolute; top: 0; bottom: 0; outline: 2px solid var(--selection); outline-offset: -2px; border-radius: 4px; background: color-mix(in srgb, var(--selection) 12%, transparent); pointer-events: none; }
.vd-keepbox {
  position: absolute;
  top: -3px; bottom: -3px;
  border: 3px solid var(--marker);
  border-radius: 6px;
  pointer-events: none;
}
.vd-handle {
  position: absolute;
  top: 8px;
  width: 16px; height: 36px;
  margin-left: -8px;
  border: 0;
  padding: 0;
  border-radius: 4px;
  background: var(--marker);
  cursor: ew-resize;
  touch-action: none;
}
.vd-handle::before { content: ""; position: absolute; inset: -10px -12px; }
.vd-handle::after {
  content: "";
  position: absolute;
  left: 50%; top: 11px; bottom: 11px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--on-marker) 75%, transparent);
}
.vd-handle:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }

.vd-lane { position: relative; height: 32px; background: var(--paper); border-radius: 6px; }
.vd-lane[hidden] { display: none; }
.vd-block {
  position: absolute;
  top: 3px; bottom: 3px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--control-border);
  background: var(--surface);
  color: var(--ink);
  font: 500 12px/16px var(--font-body);
  text-align: left;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.vd-block span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.vd-block.is-sel { background: var(--marker-tint); border: 1.5px solid var(--marker); font-weight: 600; }
.vd-block:focus-visible { outline: 2px solid var(--selection); outline-offset: 1px; }
.vd-block.is-lifted { box-shadow: var(--shadow-popover); transform: translateY(-2px); cursor: grabbing; }

/* Timeline zoom and the shortcuts button, at the right of the transport row. */
.vd-transport-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.vd-zoomctl { display: flex; align-items: center; gap: 2px; }
.vd-zoom-range { width: 110px; accent-color: var(--ink); }
.vd-transport-right + .vd-transport-history { margin-left: 0; }

/* Coarse pointers get taller lanes so blocks are easy to grab. */
@media (pointer: coarse) {
  .vd-lane { height: 44px; }
  .vd-label-cap, .vd-label-lane { height: 44px; }
  .vd-block { top: 4px; bottom: 4px; }
}

.vd-head {
  position: absolute;
  top: 16px; bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  pointer-events: none;
}
.vd-head span { position: absolute; left: -5px; top: -4px; width: 12px; height: 12px; border-radius: 3px; background: var(--ink); }

/* ---- New toolbar controls (Frame, Zoom, Blur, Captions) --------------- */
.vd-slider { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; }
.vd-slider input { width: 110px; accent-color: var(--ink); }
.vd-font { display: flex; align-items: center; width: 200px; max-width: 100%; }
.vd-font .select { min-height: 36px; font-size: 14px; }
/* Device tool: a label beside each select. */
.vd-select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; }
.vd-select .select { width: auto; min-width: 120px; max-width: 240px; min-height: 36px; height: 36px; font-size: 14px; padding-left: 10px; padding-right: 30px; background-position: right 8px center; }
.vd-kbd {
  display: inline-block;
  min-width: 24px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--control-border);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--ink);
  font: 600 12px/18px var(--font-body);
  text-align: center;
}

/* The font picker from font-picker.js, restyled to Marker. Its panel is
   appended to the body, so these rules are not scoped to the toolbar. */
.is-video .msfp { flex: 1; min-width: 0; }
.is-video .msfp-trigger {
  width: 100%;
  min-height: 36px;
  padding: 0 32px 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--field-border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%235E5E5A'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") no-repeat right 10px center / 16px 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.is-video .msfp-trigger:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.is-video .msfp-panel {
  position: fixed;
  z-index: 9999;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}
.is-video .msfp-panel.show { display: flex; }
.is-video .msfp-search {
  flex: 0 0 auto;
  margin: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--field-border);
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/20px var(--font-body);
}
.is-video .msfp-search:focus-visible { outline: 2px solid var(--selection); outline-offset: 1px; }
.is-video .msfp-list { flex: 1; overflow-y: auto; padding: 0 6px 6px; }
.is-video .msfp-group { padding: 10px 8px 4px; font: 600 12px/16px var(--font-body); color: var(--muted); }
.is-video .msfp-row {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-size: 16px;
  line-height: 22px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  opacity: .55;
  transition: opacity .18s ease;
}
.is-video .msfp-row.loaded { opacity: 1; }
.is-video .msfp-row:hover, .is-video .msfp-row.active { background: var(--raised); }
.is-video .msfp-row.on { background: var(--marker-tint); font-weight: 600; }
.is-video .msfp-empty { padding: 14px 10px; text-align: center; color: var(--muted); font-size: 13px; }

/* Keyboard shortcuts sheet. */
dialog.vd-keys { width: min(480px, calc(100vw - 32px)); }
dialog.vd-keys[open] { display: flex; flex-direction: column; gap: 14px; }
.vd-keylist { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.vd-keylist > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14px; line-height: 20px; }
.vd-keylist dt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex-shrink: 0; }
.vd-keylist dd { margin: 0; color: var(--ink-2); text-align: right; }
.vd-or { font-size: 12px; color: var(--muted); padding: 0 2px; }

/* ---- Export settings ------------------------------------------------- */
.is-video .ed-props { flex: 1 1 300px; max-width: 320px; }
.is-video .ed-props-body { gap: 18px; min-height: 100%; box-sizing: border-box; }
.vd-head-est { display: none; font-size: 13px; color: var(--muted); }
.vd-presets { display: flex; flex-direction: column; gap: 6px; }
.vd-preset {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 500 14px/20px var(--font-body);
  text-align: left;
  cursor: pointer;
}
.vd-preset:hover { border-color: var(--control-border); }
.vd-preset[aria-pressed="true"] { border: 1.5px solid var(--ink); font-weight: 600; padding: 5.5px 11.5px; }
.vd-preset-text { display: flex; flex-direction: column; min-width: 0; }
.vd-preset-note { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted); }
.vd-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--marker);
  color: var(--on-marker);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vd-check .icon { width: 12px; height: 12px; }
.is-video .ed-props input[type="range"] { width: 100%; accent-color: var(--ink); }
.is-video .ed-props .input-group { height: 44px; }
.is-video .ed-props .input-group input { width: 100%; }

.vd-est {
  margin-top: auto;
  background: var(--paper);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vd-est-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.vd-est-label { color: var(--muted); }
.vd-est-size { font-weight: 700; }
.vd-est-size.is-over { color: var(--danger); }
.vd-est-meta, .vd-est-note { font-size: 12px; line-height: 17px; color: var(--muted); }
.vd-fit { align-self: flex-start; }
.vd-fitw { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: -8px; }
.vd-sound-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 13px; line-height: 18px; color: var(--warning); }
.vd-sound-note .icon { flex-shrink: 0; margin-top: 1px; }
.vd-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; display: flex; }
.vd-bar span { background: var(--success); }
.vd-bar.is-over span { background: var(--danger); }

/* ---- Export dialog --------------------------------------------------- */
dialog.vd-export { width: min(560px, calc(100vw - 32px)); }
/* While a file is being made the dialog sits at the bottom, over the
   timeline, so the video on the stage stays in view. */
dialog.vd-export.is-working { margin-top: auto; margin-bottom: 24px; }
dialog.vd-export.is-working::backdrop { background: rgba(10, 10, 10, .2); }
@media (max-width: 760px) { dialog.vd-export.is-working { margin-bottom: 16px; } }
.vd-export-in { display: flex; flex-direction: column; gap: 16px; }
#edExportBody { display: flex; flex-direction: column; gap: 14px; }
.vd-progress { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.vd-progress-label { font-size: 14px; color: var(--ink-2); }
.vd-progress .vd-bar { height: 8px; }
.vd-progress .vd-bar span { background: var(--ink); transition: width .15s linear; }
#edExportBody > .btn-outline { align-self: flex-start; }
.vd-result { background: var(--canvas); border-radius: 12px; padding: 16px; display: flex; justify-content: center; }
.vd-result img {
  display: block;
  max-width: 100%;
  max-height: 46vh;
  width: auto;
  height: auto;
  image-rendering: auto;
  box-shadow: 0 1px 2px rgba(20, 20, 20, .08), 0 8px 24px rgba(20, 20, 20, .12);
}
.vd-result-meta { font-size: 14px; color: var(--ink-2); margin: 0; text-align: center; }
.vd-result-warn { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; color: var(--warning); margin: 0; }
.vd-result-warn .icon { flex-shrink: 0; margin-top: 2px; }
.vd-result-actions { display: flex; gap: 8px; }
.vd-result-actions .btn-primary { flex: 1; }
.vd-result-help { text-align: center; }

/* ---- Phones ---------------------------------------------------------- */
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .vd-replace { width: 44px; padding: 0; }
  .vd-replace-label { display: none; }
  .vd-replace-icon { display: block; }

  .is-video .ed-stage { min-height: 140px; }
  .vd-transport-history { display: flex; gap: 2px; margin-left: auto; }
  .vd-toolbar { padding: 2px 12px 10px; gap: 8px; min-height: 0; }
  .vd-tool-controls { gap: 8px; width: 100%; }
  .vd-tool-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  /* Rows scroll sideways on phones, so nothing in them squeezes or wraps. */
  .vd-tool-row > * { flex-shrink: 0; }
  .vd-tool-row .ed-swatches { flex-wrap: nowrap; padding: 4px; }
  .vd-cap-text { width: 100%; min-width: 0; flex: 1; }
  .vd-cap-row { width: 100%; }
  .vd-toolbar .segmented button { height: 36px; padding: 0 10px; }
  .vd-toolbar .ed-handoffs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .vd-toolbar .ed-handoffs .chip { flex-shrink: 0; }
  .vd-hint { font-size: 12px; line-height: 16px; }

  .vd-timeline { padding: 8px 12px 10px; gap: 8px; }
  .vd-labels { display: none; }
  .vd-transport { gap: 4px 10px; }
  .vd-keep { font-size: 12px; width: 100%; order: 2; }
  .vd-step { width: 44px; height: 44px; }
  .vd-play { width: 44px; height: 44px; }
  .vd-lanes { gap: 8px; }
  .vd-strip { height: 44px; }
  .vd-handle { top: 6px; height: 32px; }
  .vd-lane { height: 44px; }
  .vd-head { top: 14px; }
  .vd-transport-right { margin-left: 0; }
  .vd-zoom-range { width: 80px; }
  .vd-keys-btn { display: none; }
  .vd-slider input { width: 90px; }
  .vd-font { width: 180px; flex-shrink: 0; }
  .vd-select .select { min-height: 44px; height: 44px; max-width: 200px; }
  /* The Device tool's device and model selects wrap, so the model starts on screen. */
  .vd-tool-row:has(> .vd-select + .vd-select) { flex-wrap: wrap; }

  .is-video .ed-props { max-width: none; flex: 0 0 auto; max-height: 46dvh; overflow-y: auto; margin-top: 0; }
  .is-video .ed-props-body { min-height: 0; }
  .vd-head-est { display: inline; }
  /* While the export sheet is open, the video and timeline keep the room. */
  .is-video .ed-body:has(.ed-props:not(.is-collapsed)) .vd-toolbar { display: none; }
  .is-video .ed-main { overflow: hidden; }
  .vd-est { margin-top: 0; }
  .vd-result-actions { flex-direction: column; }
  /* Stacked, each button keeps its own height. */
  .vd-result-actions .btn { flex: none; }
}

/* ---- App Store Preview Videos checklist -------------------------------- */
.vd-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vd-check-row { display: flex; gap: 8px; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.vd-check-row .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--success); }
.vd-check-row.is-off { color: var(--ink); }
.vd-check-row.is-off .icon { color: var(--warning); }

/* ---- Camera controls in the editor toolbar ------------------------------ */
.vd-switch-row { display: inline-flex; align-items: center; gap: 10px; font: 600 14px/20px var(--font-body); color: var(--ink); white-space: nowrap; }
/* Each corner button is the whole cell it sits in (28 x 24, or 44 x 44 on
   touch), with the small corner drawn inside it. */
.vd-corners { display: grid; grid-template-columns: repeat(2, 28px); grid-template-rows: repeat(2, 24px); gap: 0; padding: 2px; border-radius: var(--r-control); background: var(--raised); flex-shrink: 0; }
.vd-corners button { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; position: relative; }
.vd-corners button::before { content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 14px; margin: -7px 0 0 -10px; box-sizing: border-box; border: 1px solid var(--control-border); border-radius: 3px; background: var(--surface); }
.vd-corners button[aria-pressed="true"]::before { background: var(--ink); border-color: var(--ink); }
.vd-corners button:focus-visible { outline: 2px solid var(--selection); outline-offset: -2px; }
@media (max-width: 760px), (any-pointer: coarse) {
  .vd-corners { grid-template-columns: repeat(2, 44px); grid-template-rows: repeat(2, 44px); }
}

/* ---- Screen Recorder setup (recorder.js) -------------------------------- */
.is-recorder .ed-body { display: flex; }
.rc-main { position: relative; }
.rc-stage { flex: 1 1 auto; position: relative; min-height: 0; }
.rc-tag {
  position: absolute;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(20, 20, 20, .78);
  color: #FFFFFF;
  font: 600 12px/16px var(--font-body);
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
}
.rc-tag.is-live::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #FF6A3D; vertical-align: 0; }
.rc-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 160px/1 var(--font-head);
  letter-spacing: -.04em;
  color: #FFFFFF;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .45);
  background: rgba(20, 20, 20, .35);
}
.rc-count[hidden] { display: none; }
.rc-under { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 0 24px 24px; min-height: 0; }
.rc-under:empty { display: none; }
.rc-help { font-size: 13px; line-height: 18px; color: var(--muted); text-align: center; }

.rc-panel .ed-props-body { flex: 1 1 auto; }
.rc-rescue { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: var(--marker-tint); font-size: 14px; line-height: 20px; color: var(--ink); }
.rc-rescue b { font-weight: 600; }
.rc-rescue > span { color: var(--ink-2); }
.rc-rescue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rc-sec .switch:disabled { opacity: .45; cursor: not-allowed; }
.rc-fields { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.rc-fields[disabled] { opacity: .55; }
.rc-sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rc-source {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 76px;
  padding: 10px 4px;
  border: 1px solid var(--control-border);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: 600 13px/16px var(--font-body);
  text-align: center;
  cursor: pointer;
}
.rc-source:hover { border-color: var(--field-border); }
.rc-source[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--raised); }
.rc-source:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.rc-source-icon { width: 22px; height: 22px; }
.rc-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.rc-sec-head { display: flex; justify-content: space-between; align-items: center; font: 600 14px/20px var(--font-body); color: var(--ink); }
.rc-sec .select { font-size: 14px; }
.rc-row { display: flex; align-items: center; gap: 10px; }
.rc-row .segmented { flex: 1; }
.rc-check { align-self: flex-start; gap: 6px; }
.rc-meter { display: flex; align-items: center; gap: 10px; }
.rc-meter-track { flex: 1; height: 6px; border-radius: 99px; background: var(--raised); overflow: hidden; }
.rc-meter-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--success); transition: width .08s linear; }
.rc-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.rc-info { display: flex; gap: 10px; padding: 12px; border-radius: var(--r-control); background: var(--raised); font-size: 13px; line-height: 18px; color: var(--ink-2); }
.rc-info .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.rc-start { width: 100%; gap: 10px; }
.rc-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.rc-note { font-size: 14px; line-height: 21px; color: var(--ink-2); }

.rc-bar { display: flex; align-items: center; gap: 6px; background: #141414; color: #FFFFFF; border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); font: 600 14px/20px var(--font-body); white-space: nowrap; }
.rc-bar .rc-rec { width: 10px; height: 10px; border-radius: 50%; background: #FF6A3D; flex-shrink: 0; }
.rc-bar.is-paused .rc-rec { background: #A3A39D; }
.rc-bar .rc-time { min-width: 44px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.rc-lvl { display: flex; align-items: center; gap: 2px; height: 18px; margin-right: 6px; }
.rc-lvl span { width: 3px; height: 18px; border-radius: 2px; background: #7FD1A1; transform: scaleY(.2); transition: transform .08s linear; }
.rc-bar button { font: 600 13px/18px var(--font-body); height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: #2C2C2A; color: #FFFFFF; cursor: pointer; }
.rc-bar button:hover { background: #3A3A38; }
.rc-bar button:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.rc-bar .rc-stop { background: #FF6A3D; color: #141414; font-weight: 700; }
.rc-bar .rc-stop:hover { background: #FF8A63; }

@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .rc-count { font-size: 96px; }
  .rc-under { padding: 0 12px 28px; }
  .is-recorder .ed-props { max-height: 52dvh; margin-top: 0; }
  .rc-bar { padding-left: 12px; }
  .rc-bar button { padding: 0 10px; }
}

/* ---- Before and After Wipe (wipe.js) ------------------------------------ */
.is-wipe .wp-bar { padding-top: 10px; padding-bottom: 12px; }
.wp-transport { flex: 1; min-width: 0; gap: 10px; }
.wp-scrub { flex: 1; min-width: 60px; max-width: 420px; height: 44px; margin: 0; accent-color: var(--ink); }
.wp-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wp-pic { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wp-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--canvas); border: 1px solid var(--line); color: var(--warning); }
.wp-thumb.is-broken { border-color: var(--warning); }
.wp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wp-pic-name { font-size: 13px; line-height: 18px; margin-top: 2px; }
.wp-pic-acts { display: flex; flex-wrap: wrap; gap: 0 2px; margin-left: -8px; }
.wp-pic-acts .btn { padding: 0 8px; }
.wp-help { margin-top: -12px; }
.wp-swap { align-self: flex-start; margin-top: -10px; }
.wp-sub { padding-top: 16px; border-top: 1px solid var(--line); margin-bottom: -6px; }
.wp-sub h3 { font-size: 16px; line-height: 22px; letter-spacing: -.01em; margin: 0; }
.wp-label-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -10px; }
.wp-label-row .input { font-size: 14px; min-width: 0; }
.is-wipe .ed-stage.can-move { cursor: grab; touch-action: none; }
.is-wipe .ed-stage.is-moving { cursor: grabbing; }
/* A saved picture that did not open (preview only). */
.wp-broken { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: none; }
.wp-broken[hidden] { display: none; }
.wp-broken-in { pointer-events: auto; max-width: 420px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(20, 20, 20, .10); color: var(--warning); }
.wp-broken-in p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }
/* Export options */
dialog.wp-export { max-height: calc(100dvh - 32px); overflow-y: auto; }
.wp-exp { display: flex; flex-direction: column; gap: 16px; }
.wp-exp .ed-group { display: flex; flex-direction: column; gap: 8px; }
.wp-exp .helper { font-size: 13px; line-height: 18px; color: var(--muted); }
.wp-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wp-exp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.wp-exp .vd-est { margin-top: 0; }
.wp-exp .vd-est .btn-ghost { margin-left: 4px; }
.wp-bar-work span { background: var(--ink); }
.wp-slider-view { display: block; width: 100%; max-height: 46vh; border: 0; background: var(--surface); }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .wp-help, .wp-swap, .wp-label-row { margin-top: -6px; }
}
@media (max-width: 520px) {
  .wp-presets, .wp-exp-row { grid-template-columns: 1fr; }
  .wp-transport .vd-time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .vd-block.is-lifted { transform: none; }
  .is-video .msfp-row { transition: none; }
  .vd-progress .vd-bar span { transition: none; }
}

/* ---- GIF settings and timeline extras ------------------------------------ */
.vd-cover-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.vd-cover-row .helper { flex: 1 1 160px; }
/* A segment's own speed, at its start on the video strip. */
.vd-segspeed {
  position: absolute; top: 4px; z-index: 1;
  padding: 0 5px; border-radius: 4px;
  background: var(--ink); color: var(--paper);
  font: 600 11px/16px var(--font-body); pointer-events: none;
}
/* Lane icons show on phones only, where the lane names do not fit. */
.vd-lane-icon {
  display: none; position: sticky; left: 4px; top: 0; z-index: 2;
  width: 24px; height: 100%; align-items: center; justify-content: center;
  color: var(--muted); pointer-events: none;
}
.vd-lane-icon .icon { width: 16px; height: 16px; }
.vd-strip .vd-lane-icon { position: absolute; left: auto; }
/* Without the lane names on phones, each lane starts with its tool's icon. */
@media (max-width: 760px) {
  .vd-lane-icon { display: flex; }
}
/* A suggested zoom, kept or deleted from its block. */
.vd-block.is-suggest { border-style: dashed; background: var(--paper); color: var(--ink-2); }
.vd-block.is-suggest.is-sel { background: var(--marker-tint); color: var(--ink); }
/* A camera part that shows the camera full frame or hides it. */
.vd-block[data-block="cam"] .icon { width: 14px; height: 14px; margin-right: 6px; flex-shrink: 0; pointer-events: none; }
/* A video that did not open: the message and a way to pick another. */
.vd-loading.is-failed { flex-direction: column; gap: 12px; padding: 24px; text-align: center; pointer-events: auto; background: var(--canvas); }
.vd-loading.is-failed p { margin: 0; max-width: 440px; font-size: 14px; line-height: 20px; color: var(--ink-2); }

/* Download as Recorded sits under the size estimate. */
.vd-asrec { align-self: flex-start; margin-top: 8px; }

/* ---- App Store preview: poster frame, taps, Export Every Size ---------- */
.vd-sound-note[hidden] { display: none; }
.vd-poster {
  position: absolute;
  top: 13px;
  z-index: 3;
  width: 18px; height: 18px;
  margin-left: -9px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  cursor: ew-resize;
  touch-action: none;
}
.vd-poster[hidden] { display: none; }
.vd-poster .icon { width: 12px; height: 12px; pointer-events: none; }
.vd-poster:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
@media (pointer: coarse) {
  .vd-poster { width: 28px; height: 28px; margin-left: -14px; top: 8px; }
  .vd-poster .icon { width: 16px; height: 16px; }
}
.vd-every { border: 0; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vd-every legend { padding: 0; margin-bottom: 8px; }
.vd-every-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 20px; cursor: pointer; }
.vd-every-row input { margin: 2px 0 0; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--ink); }
.vd-file-head { margin-top: 12px; }
.vd-file-checks { margin: 8px 0 16px; }

/* ---- Longer languages (A-17) ------------------------------------------
   The loader in video-editor.html puts ms-i18n on the root only when the
   page is in another language (or ?pseudo), so English keeps every rule
   above as it is. The toolbar's controls, labels, and buttons wrap onto a
   second line where longer words need it, and long words break. */
:root.ms-i18n .vd-toolbar,
:root.ms-i18n .vd-est,
:root.ms-i18n .vd-keys { overflow-wrap: break-word; }
/* Longer descriptions read under their keys instead of squeezed beside them. */
:root.ms-i18n .vd-keylist > div { flex-direction: column; align-items: flex-start; gap: 4px; }
:root.ms-i18n .vd-keylist dt { flex-shrink: 1; }
:root.ms-i18n .vd-keylist dd { text-align: left; }
:root.ms-i18n .vd-toolbar .segmented { flex-wrap: wrap; }
:root.ms-i18n .vd-toolbar .segmented button { height: auto; min-height: 34px; white-space: normal; line-height: 16px; padding-top: 4px; padding-bottom: 4px; }
:root.ms-i18n .vd-slider,
:root.ms-i18n .vd-select,
:root.ms-i18n .vd-switch-row { white-space: normal; flex-wrap: wrap; }
:root.ms-i18n .vd-toolbar .btn { height: auto; min-height: 36px; white-space: normal; text-align: center; line-height: 18px; padding-top: 6px; padding-bottom: 6px; }
:root.ms-i18n .vd-toolbar .btn-icon { height: 36px; min-height: 0; padding-top: 0; padding-bottom: 0; }
:root.ms-i18n .vd-preset-text { min-width: 0; overflow-wrap: break-word; }
:root.ms-i18n .vd-est-row { flex-wrap: wrap; row-gap: 2px; }
:root.ms-i18n .rc-bar { white-space: normal; flex-wrap: wrap; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  :root.ms-i18n .vd-toolbar .segmented button { min-height: 36px; }
  :root.ms-i18n .vd-toolbar .btn { min-height: 44px; }
  :root.ms-i18n .vd-toolbar .btn-icon { height: 44px; }
}
