/* Subtwine styles — the export dialog (R6 decision 4, T028; T039): the formats
   in three groups, the preview with the player moved into it and the style
   (only for ASS and MP4), the content settings, and the foot that stays put
   (rights reminder, file name, notes, progress, export). The dialog is as large
   as what it shows: narrow with the subtitle files and the pack, wide with the
   preview.
   Loaded from index.html in the order web_manifest.py declares. */
.export-dialog {
  width:min(560px,calc(100vw - 24px));
  /* Not `auto`: a fixed-position dialog would stretch to its largest height. */
  height:fit-content;
  max-height:calc(100vh - 24px);
  overflow:hidden;
}
.export-dialog.styled {
  width:min(1000px,calc(100vw - 24px));
}
/* Parts the chosen format does not use are not there at all. */
.export-dialog [hidden] {
  display:none !important;
}
.ex-shell {
  display:flex;
  flex-direction:column;
  width:100%;
  min-height:0;
  max-height:calc(100vh - 24px);
}
.ex-head {
  flex:none;
  padding:14px 20px;
  border-bottom:1px solid var(--line-soft);
}
.ex-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  align-items:start;
  gap:14px 18px;
  padding:16px 20px;
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
}
.export-dialog.styled .ex-layout {
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
}
.ex-main,
.ex-side {
  display:grid;
  gap:14px;
  min-width:0;
  align-content:start;
}
.ex-prev {
  min-width:0;
}
/* The stage keeps the picture's own shape here, so the cover bar's place on
   the stage is its place on the picture. */
.ex-slot {
  --ar-n:1.7778;
  position:relative;
  width:100%;
  max-width:calc(26vh * var(--ar-n));
  margin:0 auto;
}
.ex-slot .stage {
  max-height:none;
}
.ex-slot .learning-captions,
.ex-slot .fullscreen-exit {
  display:none;
}
.ex-overlay {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:6;
}
.export-dialog .subtitle-mask {
  background:#000;
}
.export-dialog .controls {
  gap:4px;
}
.exp-preview-note {
  margin-inline-start:auto;
  font-size:12px;
  color:var(--muted);
  text-align:end;
}
.exp-panel {
  min-width:0;
  align-content:start;
  display:grid;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
}
.exp-panel .ex-sec {
  padding:14px 16px;
  border-bottom:1px solid var(--line-soft);
}
.exp-panel .ex-sec:last-child {
  border-bottom:0;
}
/* The format list: a card of its own, in three groups told apart by a little
   space and a thin line (no headings). */
.ex-formats,
.ex-card {
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
}
.fmt-list {
  display:grid;
}
.fmt-group {
  display:grid;
  gap:5px;
}
.fmt-group+.fmt-group {
  margin-top:8px;
  padding-top:8px;
  border-top:1px solid var(--line-soft);
}
.fmt-list button {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  column-gap:10px;
  row-gap:2px;
  align-items:center;
  text-align:start;
  padding:7px 12px;
  border:1.5px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  min-width:0;
}
.fmt-list button::before {
  content:"";
  grid-row:1 / span 2;
  width:14px;
  height:14px;
  border-radius:50%;
  border:1.5px solid var(--line-strong);
  box-sizing:border-box;
}
.fmt-list button:hover {
  border-color:var(--line-strong);
}
.fmt-list button[aria-checked=true] {
  border-color:var(--accent);
  background:var(--row-active);
}
.fmt-list button[aria-checked=true]::before {
  border-color:var(--accent);
  background:radial-gradient(circle,var(--accent) 0 3.5px,transparent 4px);
}
.fmt-list b {
  font-size:14px;
}
.fmt-list span {
  grid-column:2;
  font-size:11.5px;
  color:var(--muted);
  line-height:1.35;
}
/* What the burned-in video will be, under the list. */
.ex-plan {
  margin:0;
  font-size:12.5px;
  line-height:1.5;
  color:var(--ink-2);
  white-space:pre-line;
  background:var(--surface-2);
  padding:8px 10px;
  border-radius:8px;
}
.with-toggle {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.ex-hint {
  margin:0;
  font-size:12.5px;
  color:var(--muted);
  line-height:1.5;
}
.ex-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font-size:13px;
  color:var(--ink-2);
  min-width:0;
}
.ex-row[hidden] {
  display:none;
}
.ex-row>span:first-child {
  flex:none;
}
.ex-row input[type=range] {
  flex:1;
  max-width:150px;
  min-width:60px;
}
.ex-row output {
  font-size:12px;
  color:var(--muted);
  width:40px;
  text-align:end;
  font-variant-numeric:tabular-nums;
}
.ex-row.check {
  justify-content:flex-start;
  gap:8px;
}
.ex-row .mini-sel {
  max-width:180px;
}
.swatches {
  display:flex;
  gap:6px;
}
.swatches button {
  width:24px;
  height:24px;
  border-radius:50%;
  border:2px solid var(--surface);
  box-shadow:0 0 0 1px var(--line-strong);
}
.swatches button[aria-pressed=true] {
  box-shadow:0 0 0 2px var(--accent);
}
.ex-foot {
  border-top:1px solid var(--line-soft);
  padding:12px 20px 14px;
  display:grid;
  gap:10px;
  background:var(--surface);
}
.ex-foot .rights {
  margin:0;
}
.ex-foot-row {
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.ex-note {
  margin:0;
  flex:2 1 260px;
  min-width:0;
  font-size:12.5px;
  line-height:1.45;
  color:var(--ink-2);
}
.ex-file {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:var(--muted);
  min-width:0;
  flex:1 1 220px;
}
.ex-file code {
  font:12px ui-monospace,Menlo,monospace;
  color:var(--ink);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width:0;
}
.ex-progress {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12.5px;
  color:var(--ink-2);
  flex:1 1 260px;
  min-width:0;
}
.ex-progress[hidden] {
  display:none;
}
.ex-progress .meter {
  flex:1;
  margin:0;
  min-width:60px;
}
/* While a video is being made, the settings it was started with stay. */
.export-dialog.busy .exp-panel,
.export-dialog.busy .ex-formats,
.export-dialog.busy .ex-prev {
  opacity:.6;
  pointer-events:none;
}

/* Phone width: the dialog is a sheet from the bottom as tall as its content (the
   whole screen with the preview), the preview stays at the top and the settings
   scroll under it. */
@media (max-width:760px) {
  .export-dialog,
  .export-dialog.styled {
    width:100vw;
    max-width:100vw;
    max-height:100vh;
    max-height:100dvh;
    margin:auto 0 0;
    border-radius:16px 16px 0 0;
  }
  .ex-shell {
    max-height:100vh;
    max-height:100dvh;
  }
  .ex-layout,
  .export-dialog.styled .ex-layout {
    grid-template-columns:minmax(0,1fr);
    padding:12px;
  }
  /* The preview and the list are the layout's own children here, so the
     preview stays in place while everything under it scrolls. */
  .ex-main,
  .ex-side {
    display:contents;
  }
  .ex-prev {
    order:-1;
    position:sticky;
    top:-12px;
    z-index:2;
    background:var(--surface);
    padding-top:12px;
    margin-top:-12px;
  }
  .exp-panel {
    overflow:visible;
  }
  .ex-foot {
    padding:10px 12px 12px;
  }
  .ex-slot {
    max-width:calc(22vh * var(--ar-n));
  }
}
