.video-trim-dialog {
  width: min(740px, calc(100vw - 20px));
  max-height: calc(100dvh - 18px);
  padding: 0;
  overflow: auto;
  border: 1px solid #373447;
  border-radius: 15px;
  color: #f4f5fa;
  background: #14151e;
  box-shadow: 0 28px 100px rgba(0, 0, 0, .8);
}
.clip-trim-open { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; margin: -3px 0 12px; padding: 4px 10px; border: 1px solid rgba(150, 125, 235, .42); border-radius: 8px; background: rgba(116, 87, 238, .12); color: #ddd4ff; font: 700 10px "Noto Kufi Arabic", sans-serif; cursor: pointer; }
.clip-trim-open[hidden] { display: none; }
.clip-trim-open:hover { border-color: #ab91fa; background: rgba(116, 87, 238, .22); }
.clip-trim-open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.video-trim-dialog::backdrop { background: rgba(4, 6, 12, .78); backdrop-filter: blur(6px); }
.video-trim-dialog [hidden] { display: none !important; }
.video-trim-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px 10px; }
.video-trim-header > div { min-width: 0; }
.video-trim-header span { display: none; }
.video-trim-header h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.video-trim-header p { overflow: hidden; margin: 3px 0 0; color: #a9a5b8; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.video-trim-header button { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; padding: 0; border: 1px solid #403b50; border-radius: 8px; color: #ddd9e8; background: #22212d; font-size: 18px; line-height: 1; cursor: pointer; }
.video-trim-header button:hover { border-color: #9475e9; background: #302844; }
.video-trim-stage { display: grid; place-items: center; height: min(40dvh, 340px); min-height: 180px; margin: 0 14px; overflow: hidden; border: 1px solid #343345; border-radius: 10px; background: radial-gradient(circle at center, #171622, #0b0c13 72%); }
.video-trim-frame { position: relative; width: 100%; height: 100%; max-width: 100%; max-height: 100%; overflow: hidden; }
.video-trim-stage video { display: block; width: 100%; height: 100%; object-fit: fill; }
.video-trim-dialog.is-audio .video-trim-stage { height: 116px; min-height: 116px; }
.video-trim-audio-visual { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #a992f5; background: radial-gradient(circle at 50% 50%, rgba(103, 76, 195, .13), transparent 72%); }
.video-trim-audio-visual audio { display: none; }
.video-trim-audio-visual svg { width: min(170px, 70%); height: 48px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.video-trim-audio-visual span { color: #bfc1d0; font-size: 11px; font-weight: 700; }
.video-trim-body { padding: 11px 14px 10px; }
.video-trim-playback { display: flex; align-items: center; gap: 8px; min-height: 30px; direction: ltr; }
html[dir="rtl"] .video-trim-playback, html[dir="rtl"] #videoTrimSeek { direction: rtl; }
.video-trim-playback button { width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid #8d70e5; border-radius: 8px; color: #fff; background: #644cc0; font: 700 14px/1 Arial, sans-serif; cursor: pointer; }
.video-trim-playback button:hover { background: #795fe0; }
.video-trim-playback span { min-width: 70px; color: #e7e3ef; font: 800 12px/1.3 ui-monospace, Consolas, monospace; text-align: center; font-variant-numeric: tabular-nums; }
.video-trim-playback input { min-width: 0; flex: 1; accent-color: #a58df6; cursor: pointer; }
.video-trim-range { position: relative; height: 28px; margin: 14px 10px 12px; border: 1px solid #454155; border-radius: 8px; background: #242534; direction: ltr; touch-action: none; cursor: crosshair; }
.video-trim-selected { position: absolute; top: 0; bottom: 0; border-top: 1px solid #74d5aa; border-bottom: 1px solid #74d5aa; background: rgba(92, 184, 145, .17); pointer-events: none; }
.video-trim-playhead { position: absolute; z-index: 2; top: -5px; bottom: -5px; width: 2px; background: #f8f9ff; box-shadow: 0 0 6px rgba(255, 255, 255, .85); pointer-events: none; }
.video-trim-handle { position: absolute; z-index: 3; top: -9px; width: 28px; height: 46px; padding: 0; border: 0; background: transparent; transform: translateX(-50%); cursor: ew-resize; touch-action: none; }
.video-trim-handle::before { content: ''; position: absolute; top: 1px; left: 7px; width: 14px; height: 42px; box-sizing: border-box; border: 1px solid #a2e7c2; border-radius: 5px; background: #43a676; box-shadow: 0 3px 10px rgba(0, 0, 0, .4), inset 0 1px rgba(255,255,255,.2); }
.video-trim-handle::after { content: ''; position: absolute; top: 13px; left: 13px; width: 2px; height: 17px; border-radius: 2px; background: rgba(255,255,255,.9); }
.video-trim-handle.end::before { border-color: #f1aeb9; background: #c6516b; }
.video-trim-handle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.video-trim-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; max-width: 540px; margin-inline: auto; }
.video-trim-field { min-width: 0; display: grid; justify-items: stretch; gap: 5px; padding: 8px; border: 1px solid #393748; border-radius: 9px; background: #1b1c27; }
.video-trim-field.is-start { border-top-color: #59b98e; }
.video-trim-field.is-end { border-top-color: #d46a7e; }
.video-trim-field label { display: flex; align-items: center; gap: 5px; min-width: 0; color: #cbc6d7; font-size: 10px; font-weight: 700; }
.video-trim-field label::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #59c696; }
.video-trim-field.is-end label::before { background: #e4778b; }
.video-trim-field input { width: 100%; min-width: 0; box-sizing: border-box; height: 32px; padding: 5px 7px; border: 1px solid #454052; border-radius: 7px; outline: none; color: #fff; background: #14151e; direction: ltr; font: 700 11px ui-monospace, Consolas, monospace; text-align: center; font-variant-numeric: tabular-nums; }
.video-trim-fields input:focus { border-color: #c5a5fb; }
.video-trim-fields button { justify-self: center; min-height: 23px; padding: 2px 8px; border: 0; border-radius: 6px; color: #bdaaf8; background: transparent; font-family: inherit; font-size: 10px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.video-trim-fields button:hover { background: rgba(148, 112, 235, .15); color: #fff; }
.video-trim-summary { display: flex; width: max-content; max-width: 100%; box-sizing: border-box; justify-content: center; align-items: center; gap: 10px; min-height: 30px; margin: 9px auto 0; padding: 5px 10px; border: 1px solid #373447; border-radius: 8px; color: #d3cfdf; background: #1b1b27; font-size: 11px; }
.video-trim-summary b { color: #d2bcff; font: 800 12px ui-monospace, Consolas, monospace; }
.video-trim-status { margin: 8px 0 0; color: #ffd0b9; font-size: 11px; text-align: center; }
.video-trim-actions { display: flex; justify-content: center; gap: 8px; padding: 11px 14px 13px; border-top: 1px solid #2d2b39; }
.video-trim-actions button { min-width: 78px; min-height: 33px; padding: 5px 13px; border: 1px solid #464052; border-radius: 8px; color: #ded9ea; background: #252432; font-family: inherit; font-size: 10px; font-weight: 800; cursor: pointer; }
.video-trim-actions button:last-child { min-width: 124px; border-color: #8764e0; color: #fff; background: linear-gradient(120deg, #6f53d9, #9b62e5); }
.video-trim-actions button:hover { filter: brightness(1.12); }
.video-trim-actions button:disabled { opacity: .5; cursor: not-allowed; filter: none; }

@media (max-width: 580px) {
  .video-trim-stage { height: min(38dvh, 300px); min-height: 160px; margin: 0 11px; }
  .video-trim-header, .video-trim-actions { padding-inline: 12px; }
  .video-trim-body { padding-inline: 11px; }
  .video-trim-playback { gap: 5px; }
  .video-trim-playback span { min-width: 69px; font-size: 12px; }
}
@media (max-width: 580px) and (max-height: 650px) {
  .video-trim-stage { height: min(29dvh, 200px); min-height: 150px; }
}

@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .video-trim-dialog[open] {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 10px;
    align-items: stretch;
    width: min(900px, calc(100vw - 12px));
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    margin: auto;
    padding: 7px;
    overflow: hidden;
    border-radius: 11px;
  }
  .video-trim-dialog .video-trim-header {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    padding: 2px 4px 6px;
  }
  .video-trim-dialog .video-trim-header h2 { font-size: 13px; }
  .video-trim-dialog .video-trim-header p { margin-top: 1px; font-size: 9px; }
  .video-trim-dialog .video-trim-header button { width: 25px; height: 25px; flex-basis: 25px; }
  .video-trim-dialog .video-trim-stage,
  .video-trim-dialog.is-audio .video-trim-stage {
    grid-column: 2;
    grid-row: 1 / span 3;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    border-radius: 8px;
  }
  .video-trim-dialog .video-trim-body {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    min-width: 0;
    padding: 5px 4px;
  }
  .video-trim-dialog .video-trim-playback {
    display: grid;
    grid-template-columns: 29px repeat(2, minmax(0, 1fr));
    grid-template-rows: 27px 15px;
    gap: 2px 4px;
    min-height: 0;
  }
  .video-trim-dialog .video-trim-playback button { grid-column: 1; grid-row: 1; width: 27px; height: 27px; }
  .video-trim-dialog .video-trim-playback input { grid-column: 2 / span 2; grid-row: 1; width: 100%; }
  .video-trim-dialog .video-trim-playback span { min-width: 0; font-size: 10px; }
  .video-trim-dialog #videoTrimCurrent { grid-column: 2; grid-row: 2; text-align: start; }
  .video-trim-dialog #videoTrimTotal { grid-column: 3; grid-row: 2; text-align: end; }
  .video-trim-dialog .video-trim-range { height: 24px; margin: 6px 9px 7px; }
  .video-trim-dialog .video-trim-fields { gap: 4px; }
  .video-trim-dialog .video-trim-field { gap: 2px; padding: 4px; }
  .video-trim-dialog .video-trim-field input { height: 26px; font-size: 10px; }
  .video-trim-dialog .video-trim-fields button { min-height: 18px; padding: 1px 2px; font-size: 9px; }
  .video-trim-dialog .video-trim-summary { min-height: 24px; margin-top: 4px; padding: 3px 7px; font-size: 10px; }
  .video-trim-dialog .video-trim-summary b { font-size: 11px; }
  .video-trim-dialog .video-trim-actions {
    grid-column: 1;
    grid-row: 3;
    gap: 5px;
    padding: 4px 4px 1px;
  }
  .video-trim-dialog .video-trim-actions button { min-width: 0; min-height: 29px; padding: 3px 7px; font-size: 9px; }
  .video-trim-dialog .video-trim-actions button:last-child { min-width: 0; flex: 1; }
}
