/* Shared touch ergonomics; desktop density stays unchanged. */
@media (max-width: 1100px), (pointer: coarse) {
 .converter-page .source-panel .queue-row {
  grid-template-columns: 24px minmax(0,1fr) auto 44px;
  gap: 8px;
 }
 .converter-page .source-panel .queue-row > input { width: 24px; height: 24px; }
 .converter-page .source-panel .queue-row > .queue-remove { width: 44px; height: 44px; grid-column: 4; }
 .converter-page .source-panel .queue-file-actions { grid-column: 2 / -1; grid-row: 2; flex-wrap: wrap; }
 .converter-page .source-panel .queue-file-actions :is(button,a),
 .converter-page .source-panel .queue-order button,
 .converter-page .source-panel-actions :is(button,label),
 .converter-page .source-panel .queue-select-all { min-height: 44px; }
 .converter-page .source-panel .queue-order button { width: 44px; height: 44px; }
 .converter-page.merger-page .source-panel .queue-row > .queue-order { grid-column: 2; grid-row: 2; justify-self: start; }
 .converter-page.merger-page .source-panel .queue-file-actions { grid-column: 3 / -1; grid-row: 2; flex-direction: row; align-items: center; }
 .converter-page .source-panel .queue-row > .queue-error { overflow-wrap: anywhere; }
 .task-shell .workspace :is(.settings,.media-preview-dialog,.settings-dialog,.format-dialog) :is(button.button,button.text-link,.advanced-launcher,.format-option,.settings-tab,.video-editor-tabs button),
 .task-shell .workspace :is(.trim-editor-dialog,.crop-editor-dialog,.subtitle-editor-dialog,.audio-trim-dialog) :is(button.button,button.icon-button,.crop-ratios button),
 .task-shell .workspace dialog .icon-button { min-height: 44px; }
 .task-shell .workspace dialog .icon-button { min-width: 44px; flex-shrink: 0; }
 .task-shell .workspace dialog { overscroll-behavior: contain; scroll-padding-block: 72px 96px; }
 .task-shell .workspace :is(.trim-editor-dialog,.crop-editor-dialog,.subtitle-editor-dialog) > footer {
  position: sticky; bottom: 0; z-index: 5; background: var(--surface);
  padding-bottom: max(12px,env(safe-area-inset-bottom));
 }
 .task-shell .workspace :is(.trim-editor-dialog,.crop-editor-dialog,.subtitle-editor-dialog,.audio-trim-dialog) > header {
  position: sticky; top: 0; z-index: 6; background: var(--surface);
 }
 .task-shell .workspace :is(.crop-box,.crop-overlay) { touch-action: none; }
 .task-shell .workspace :is(.crop-corner,.crop-overlay button[data-corner]) { touch-action: none; }
}
/* Native iOS input focus must not zoom the entire workbench. */
@media (max-width: 1100px), (pointer: coarse) {
 .task-shell .workspace :is(.settings,dialog) :is(input[type=number],input[type=text],select,textarea) { font-size: 16px; min-width: 0; }
 .task-shell .workspace :is(.settings,dialog) :is(input[type=number],input[type=text],select) { min-height: 44px; }
 .task-shell .workspace dialog :is(.subtitle-preview-toolbar,.crop-frame-control) { flex-wrap: wrap; }
 .task-shell .workspace .subtitle-preview-column { min-width: 0; }
 .task-shell .workspace .subtitle-preview-toolbar input[type=range] { flex: 1 1 100%; min-width: 0; }
 .task-shell .workspace dialog .crop-frame-control input[type=range] { flex: 1 1 120px; }
}
@media (max-width: 480px) {
 .converter-page .source-panel .queue-row { grid-template-columns: 24px minmax(0,1fr) 44px; }
 .converter-page .source-panel .queue-file { grid-column: 2; }
 .converter-page .source-panel .queue-row > .queue-remove { grid-column: 3; grid-row: 1; }
 .converter-page .source-panel .queue-row > .queue-state { grid-column: 2; grid-row: 2; text-align: left; }
 .converter-page .source-panel .queue-file-actions { grid-column: 2 / -1; grid-row: 2; margin-left: 0; justify-content: flex-end; justify-self: end; width: max-content; max-width: calc(100% - 64px); }
 .converter-page.merger-page .source-panel .queue-row > .queue-order { grid-column: 2; grid-row: 3; justify-self: start; }
 .converter-page.merger-page .source-panel .queue-file-actions { grid-column: 2 / -1; grid-row: 3; justify-content: flex-end; max-width: calc(100% - 100px); }
 .converter-page .source-panel .queue-row > .queue-error { grid-column: 2 / -1; grid-row: auto; }
 .task-shell .workspace dialog :is(.subtitle-cue-times,.subtitle-style-fields,.crop-draft-fields) { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .task-shell .workspace .format-dialog-head { gap: 8px; }
 .task-shell .workspace .format-dialog-head h2 { overflow-wrap: anywhere; }
}
@media (max-height: 500px) and (max-width: 1100px) {
 .task-shell .workspace :is(.trim-editor-dialog,.crop-editor-dialog,.subtitle-editor-dialog,.audio-trim-dialog,.media-preview-dialog,.settings-dialog,.format-dialog) { max-height: calc(100dvh - 16px); }
 .task-shell .workspace .subtitle-video-stage video,
 .task-shell .workspace .crop-stage video,
 .task-shell .workspace .trim-video-stage video { height: min(35dvh,180px); }
}
/* Keep live playback visible beside parameters on tablets and landscape phones. */
@media (max-width: 1100px), (pointer: coarse) {
 .task-shell .workspace .subtitle-editor-dialog[open],
 .task-shell .workspace #source-preview-dialog:has(.editor-tools)[open] { display: flex; flex-direction: column; overflow: hidden; }
 .task-shell .workspace .subtitle-editor-dialog > :is(header,footer),
 .task-shell .workspace #source-preview-dialog > :is(header,p,footer) { flex: 0 0 auto; }
 .task-shell .workspace .subtitle-editor-layout,
 .task-shell .workspace #source-preview-dialog .edit-dialog-layout { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
}
@media (min-width: 761px) and (max-width: 1100px) {
 .task-shell .workspace .subtitle-editor-layout,
 .task-shell .workspace #source-preview-dialog .edit-dialog-layout { grid-template-rows: minmax(0,1fr); overflow: hidden; }
 .task-shell .workspace :is(.subtitle-preview-column,.subtitle-draft-controls),
 .task-shell .workspace #source-preview-dialog :is(.edit-preview-column,.edit-parameters) { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
 .task-shell .workspace #source-preview-dialog .edit-preview-column { position: static; }
 .task-shell .workspace #source-preview-dialog .edit-parameters { max-height: none; }
 .task-shell .workspace .subtitle-draft-controls { padding-right: 4px; scroll-padding-block: 12px; }
}
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 500px) {
 .task-shell .workspace #source-preview-dialog #media video { max-height: max(80px,calc(100dvh - 220px)); }
}
@media (max-width: 1100px), (pointer: coarse) {
 .task-shell .mobile-tool-picker select { min-height: 44px; font-size: 16px; }
 .task-shell .workspace .settings input[type=range],
 .task-shell .workspace dialog input[type=range]:not(.trim-handle):not(.audio-trim-boundary) { min-height: 44px; touch-action: pan-y; }
}
@media (max-width: 1100px), (pointer: coarse) {
 .task-shell .workspace .crop-overlay > button { width: 28px; height: 28px; }
 .task-shell .workspace .crop-overlay [data-corner=nw] { top: 0; left: 0; }
 .task-shell .workspace .crop-overlay [data-corner=ne] { top: 0; right: 0; }
 .task-shell .workspace .crop-overlay [data-corner=sw] { bottom: 0; left: 0; }
 .task-shell .workspace .crop-overlay [data-corner=se] { bottom: 0; right: 0; }
 .task-shell .workspace .crop-editor-dialog .crop-corner { width: 32px; height: 32px; }
}
