/* Caption editor panels: subtitle rows and style controls. */
.ed-panel-head {
    position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between;
    min-height: 52px; padding: 6px 14px; background: var(--ed-panel); border-bottom: 1px solid var(--ed-line);
}
.ed-panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ed-hint { margin: 14px; color: var(--ed-dim); font-size: 13px; }
.ed-settings { width: 270px; padding: 8px; }
.ed-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 4px 6px; }
.ed-setting small { display: block; margin-top: 2px; color: var(--ed-faint); font-size: 12px; }

/* Translate: pills under the Subtitles title, a small view in place of the list, and a wait with pulsing cards. */
.ed-panel-head.has-translate { flex-wrap: wrap; row-gap: 6px; }
.ed-translate-bar { display: flex; flex: 1 0 100%; flex-wrap: wrap; gap: 8px; padding-bottom: 4px; }
.ed-translate-bar[hidden], .ed-translate-bar [hidden], .ed-translate-view[hidden], .ed-translate-wait[hidden] { display: none; }
.ed-pill {
    display: inline-flex; align-items: center; gap: 6px; min-height: var(--ed-hit); padding: 0 12px; border: 0; border-radius: 999px;
    background: var(--ed-field); color: var(--ed-ink); font-size: 13px; touch-action: manipulation;
}
.ed-pill:not(:disabled):hover { background: #333; }
.ed-pill:disabled { opacity: .5; }
.ed-pill .ed-ic { width: 15px; height: 15px; color: var(--ed-dim); }
.ed-spinner-small:not([hidden]) { display: inline-block; width: 14px; height: 14px; border-width: 2px; }
.ed-translate-menu { min-width: 220px; }
.ed-translate-row { display: flex; align-items: center; gap: 4px; min-height: var(--ed-hit); }
.ed-translate-row.is-running { gap: 8px; padding: 0 10px; color: var(--ed-dim); }
.ed-translate-pick {
    display: flex; flex: 1; align-items: center; gap: 8px; min-height: var(--ed-hit); padding: 0 10px;
    border: 0; border-radius: 6px; background: none; color: var(--ed-ink); text-align: start; touch-action: manipulation;
}
.ed-translate-pick:hover, .ed-translate-pick[aria-checked=true] { background: var(--ed-field); }
.ed-translate-pick[aria-checked=true] { color: #fff; font-weight: 600; }
.ed-translate-menu .ed-translate-pick[aria-checked=true]::after { content: none; }
.ed-translate-pick small { padding: 1px 6px; border-radius: 4px; background: var(--ed-field); color: var(--ed-faint); font-size: 11px; }
.ed-translate-view { display: grid; gap: 16px; padding: 14px; }
.ed-translate-head { display: flex; align-items: center; gap: 6px; }
.ed-translate-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ed-translate-foot { position: sticky; bottom: 0; padding: 10px 0; background: var(--ed-panel); }
.ed-translate-go { width: 100%; background: var(--ed-field); color: var(--ed-ink); font-weight: 600; }
.ed-translate-go:disabled { opacity: .5; }
.ed-translate-bolt { display: inline-flex; }
.ed-translate-bolt[hidden] { display: none; }
.ed-translate-go .ed-ic { width: 15px; height: 15px; color: var(--ed-upgrade); }
.ed-translate-view .ed-hint { margin: 0; }
.ed-translate-view [hidden] { display: none; }
.is-translate-view [data-role=list], .is-translate-view [data-role=empty], .is-translate-view [data-role=job],
.is-translating [data-role=list], .is-translating [data-role=empty], .is-translating [data-role=job] { display: none; }
.ed-translate-wait { display: grid; gap: 12px; padding: 18px 12px; }
.ed-translate-wait p { margin: 0; color: var(--ed-dim); font-size: 13px; }
.ed-translate-wait i {
    display: grid; align-content: center; gap: 10px; height: 64px; padding: 0 14px; border-radius: 12px; background: var(--ed-card);
    animation: ed-pulse 1.4s ease-in-out infinite;
}
.ed-translate-wait b { height: 8px; width: 25%; border-radius: 4px; background: rgba(255, 255, 255, .08); }
.ed-translate-wait b + b { width: 75%; }
@keyframes ed-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .ed-translate-wait i { animation: none; } }

/* Subtitle rows. Merge and Add sit on the seam above each row. */
.ed-rows { list-style: none; margin: 0; padding: 18px 12px 12px; display: grid; gap: 14px; }
.ed-row { position: relative; padding: 8px 10px 10px; border: 1px solid var(--ed-line); border-radius: 10px; background: var(--ed-card); }
.ed-row.is-active { border-color: var(--ed-active); }
.ed-row.is-selected { box-shadow: inset 0 0 0 1px var(--ed-active); }
.ed-row.is-detached .ed-row-more { color: var(--ed-head); }
.ed-seam { position: absolute; top: -15px; right: 10px; z-index: 2; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.ed-row:hover .ed-seam, .ed-row:focus-within .ed-seam, .ed-row.is-selected .ed-seam { opacity: 1; }
.ed-seam-btn {
    display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--ed-line);
    border-radius: 50%; background: var(--ed-panel); color: var(--ed-dim);
}
.ed-seam-btn:hover { color: var(--ed-ink); border-color: #555; }
.ed-seam-btn .ed-ic { width: 14px; height: 14px; }
.ed-row-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 30px; }
.ed-times { display: flex; align-items: center; gap: 2px; color: var(--ed-faint); font: 12px ui-monospace, Menlo, Consolas, monospace; }
.hide-times .ed-times { display: none; }
.hide-times .ed-row-head { position: absolute; top: 4px; right: 6px; min-height: 0; }
.ed-time { width: 62px; min-height: 30px; padding: 0 4px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--ed-dim); font: inherit; }
.ed-time:hover, .ed-time:focus { border-color: var(--ed-line); background: var(--ed-field); color: var(--ed-ink); }
.ed-row-more { width: 30px; height: 30px; margin-left: auto; opacity: 0; }
.ed-row:hover .ed-row-more, .ed-row:focus-within .ed-row-more, .ed-row-more[aria-expanded=true] { opacity: 1; }
.ed-row-menu { top: 34px; left: auto; right: 0; }
.ed-row-menu.opens-up { top: auto; bottom: calc(100% - 28px); }
.ed-text {
    display: block; width: 100%; min-height: 34px; margin-top: 2px; padding: 6px 8px; resize: none; overflow: hidden;
    field-sizing: content; border: 1px solid transparent; border-radius: 6px; background: none; font-size: 14.5px; line-height: 1.45;
}
.ed-text:hover { background: var(--ed-field); }
.ed-text:focus { border-color: var(--ed-line); background: var(--ed-field); outline: none; }
.ed-empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--ed-dim); }
.ed-job { display: grid; justify-items: center; gap: 10px; margin: 24px 16px; padding: 20px 16px; border: 1px solid var(--ed-line); border-radius: 12px; background: var(--ed-card); text-align: center; }
.ed-job[hidden], .ed-job [hidden] { display: none !important; }
.ed-job p { margin: 0; color: var(--ed-ink); }
.ed-job progress { width: 128px; height: 4px; accent-color: #fff; }
.ed-spinner { display: none; width: 22px; height: 22px; border: 3px solid #3a3a3a; border-top-color: var(--ed-accent); border-radius: 50%; animation: ed-spin .8s linear infinite; }
.ed-job.is-working .ed-spinner { display: block; }
@keyframes ed-spin { to { transform: rotate(360deg); } }
.ed-empty[hidden] { display: none; }
.ed-empty p { margin: 0; }

/* Style controls */
.ed-controls { display: grid; gap: 10px; padding: 12px; }
.ed-card { display: grid; gap: 12px; min-width: 0; padding: 12px; border: 1px solid var(--ed-line); border-radius: 10px; background: var(--ed-card); }
.ed-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ed-card.is-inline { padding: 10px 12px; }
.ed-card-title { font-weight: 600; font-size: 13px; }
.ed-card .ed-hint { margin: -6px 0 0; font-size: 12px; }
.ed-card-more { display: grid; gap: 12px; padding-top: 4px; }
.ed-card-more[hidden], .ed-card[hidden] { display: none; }
.ed-ctl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ed-field { display: grid; flex: 1 1 100%; gap: 6px; min-width: 0; }
.ed-field.is-grow { flex: 1 1 140px; }
.ed-field.is-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ed-field.is-inline select { width: auto; min-width: 110px; }
.ed-label { color: var(--ed-dim); font-size: 12.5px; }
.ed-input { min-width: 0; min-height: var(--ed-hit); padding: 0 10px; border: 1px solid var(--ed-line); border-radius: var(--ed-radius); background: var(--ed-field); }
select.ed-input { width: 100%; }
.ed-num { width: 64px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.ed-slider { display: grid; flex: 1 1 100%; gap: 6px; min-width: 0; }
.ed-slider-row { display: flex; align-items: center; gap: 8px; }
.ed-suffix { min-width: 10px; margin-left: -4px; color: var(--ed-faint); font-size: 12px; }
.ed-slider-row input[type=range] {
    flex: 1; min-width: 0; height: var(--ed-hit); margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.ed-slider-row input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3d3d3d; }
.ed-slider-row input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #3d3d3d; }
.ed-slider-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 0; }
.ed-slider-row input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; }
.ed-chip-btn {
    display: inline-grid; place-items: center; min-width: var(--ed-hit); min-height: var(--ed-hit); padding: 0 9px;
    border: 1px solid var(--ed-line); border-radius: var(--ed-radius); background: var(--ed-field); color: var(--ed-dim); font-weight: 600;
}
.ed-chip-btn[aria-pressed=true] { background: #3a3a3a; border-color: #555; color: #fff; }
.ed-chip-btn .ed-ic { width: 16px; height: 16px; }
.ed-italic { font-style: italic; font-family: Georgia, serif; }
.ed-seg { display: inline-flex; gap: 2px; }
.ed-toggle-row { display: flex; flex: 1 1 100%; align-items: center; justify-content: space-between; gap: 12px; }
.ed-color {
    display: inline-flex; align-items: center; gap: 8px; min-height: var(--ed-hit); padding: 0 12px 0 5px;
    border: 1px solid var(--ed-line); border-radius: var(--ed-radius); background: var(--ed-field); color: var(--ed-ink);
    font: 12.5px ui-monospace, Menlo, Consolas, monospace;
}
.ed-color.is-chip-only { padding: 0; justify-content: center; }
.ed-color-chip { width: 26px; height: 26px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 6px; flex: none; }
.ed-color.is-none .ed-color-chip, .ed-picker-chip.is-none {
    background: repeating-conic-gradient(#8a8a8a 0 25%, #e5e5e5 0 50%) 50% / 10px 10px !important;
}
.ed-pro-btn {
    display: inline-flex; align-items: center; gap: 6px; min-height: var(--ed-hit); padding: 0 10px; border: 1px solid var(--ed-line);
    border-radius: var(--ed-radius); background: var(--ed-field); color: var(--ed-ink); text-decoration: none;
}
.ed-pro-btn:disabled { color: var(--ed-dim); cursor: default; }
/* Upload your own font: a paid mark for a visitor without a plan, and a note with Remove under the font row. */
.ed-font-bolt { display: inline-flex; }
.ed-font-bolt[hidden] { display: none; }
.ed-font-bolt .ed-ic { width: 14px; height: 14px; color: var(--ed-upgrade); }
.ed-ctl-row:has(> .ed-font-own[hidden]) { display: none; }
.ed-font-own { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; color: var(--ed-dim); font-size: 12.5px; }
.ed-font-own[hidden] { display: none; }
.ed-link-btn { min-height: var(--ed-hit); padding: 0; border: 0; background: none; color: var(--ed-ink); font-weight: 600; text-decoration: underline; cursor: pointer; }
.ed-link-btn[hidden] { display: none; }
.ed-switch { position: relative; display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; cursor: pointer; }
.ed-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ed-switch-track { position: relative; pointer-events: none; width: 38px; height: 22px; border-radius: 999px; background: #454545; transition: background .15s; }
.ed-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.ed-switch input:checked + .ed-switch-track { background: var(--ed-active); }
.ed-switch input:checked + .ed-switch-track::after { transform: translateX(16px); }
.ed-switch input:focus-visible + .ed-switch-track { outline: 2px solid var(--ed-focus); outline-offset: 2px; }

@media (pointer: coarse) {
    .ed-time { min-height: 44px; width: 72px; }
    .ed-row-head { min-height: 44px; }
    .ed-seam { opacity: 1; top: 8px; right: 56px; }
    .ed-seam-btn { width: 44px; height: 44px; border-radius: 10px; background: var(--ed-card); }
    .ed-text { min-height: 44px; }
    .ed-row-more { width: 44px; height: 44px; opacity: 1; }
    .ed-text, .ed-input, .ed-time { font-size: 16px; }
    .ed-rows { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .ed-switch-track, .ed-switch-track::after, .ed-seam { transition: none; }
    .ed-spinner { animation-duration: 2.4s; }
}
