/* The shared shell owns the viewport; editors and result lists own their overflow. */
body:has(.route-shell[data-tool-page]) .nav-shell { min-height: 3.5rem; }
body:has(.route-shell[data-tool-page]) .language-notice {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
body:has(.route-shell[data-tool-page]) .site-header:has(.language-picker:focus-within) .language-notice {
  top: 100%; right: 1rem; width: auto; height: auto; clip-path: none;
  margin: 0; padding: .5rem .75rem; background: var(--tt-surface); border: 1px solid var(--tt-line);
}
.route-shell[data-tool-page] { width: calc(100% - 2rem); padding: 0 0 1rem; }
.route-shell[data-tool-page] .tool-intro {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: .25rem 1rem; padding: .5rem 0; border: 0;
}
.route-shell[data-tool-page] .tool-intro h1 {
  max-width: none; margin: 0; font-size: clamp(1.1rem, 2vw, 1.5rem); line-height: 1.25;
}
.route-shell[data-tool-page] .tool-disclosure {
  grid-column: 1 / -1; margin: 0; font-size: .75rem; line-height: 1.4;
}
.tool-help-toggle, .tool-help-panel > header button {
  min-height: 44px; min-width: 44px; padding: .5rem .75rem;
  border: 1px solid var(--tt-line); border-radius: 8px;
  color: var(--tt-ink); background: var(--tt-surface); font-size: .85rem;
}
.tool-help-panel {
  position: fixed; inset: 4rem 1rem 1rem auto; width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 5rem); margin: 0; overflow: auto; overscroll-behavior: contain;
  padding: 1.25rem; border: 1px solid var(--tt-line-strong); border-radius: 12px;
  background: var(--tt-surface); color: var(--tt-ink); box-shadow: 0 12px 48px #0003;
}
.tool-help-panel::backdrop { background: #0003; }
.tool-help-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tool-help-panel > header h2 { margin: 0; font-size: 1.25rem; }
.tool-help-panel > p { margin-block: 1rem; }
.route-shell[data-tool-page] .tool-support-grid { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 1.5rem; }
.tool-help-panel .site-footer { width: 100%; display: block; margin-top: 1.5rem; padding-block: 1rem; }
.tool-help-panel .site-footer nav { justify-content: start; margin-top: .5rem; }
.route-shell[data-tool-page] .tool-layout { padding: 0; gap: 1rem; }
.route-shell[data-tool-page] .tool-stage { padding: 0; background: transparent; box-shadow: none; }
#tool [data-tool-app] { min-width: 0; }
#tool :is(.json-formatter-tool__pane, .svg-viewer-tool__source, .svg-viewer-tool__viewer,
  .meta-preview-tool__input, .meta-preview-tool__output, .instagram-size-tool__input,
  .instagram-size-tool__output, .moviecut-tool__preview-panel, .moviecut-tool__controls-panel) { padding: 1rem; min-height: 0; }
#tool :is(.json-formatter-tool__section-head, .svg-viewer-tool__section-head,
  .meta-preview-tool__section-head, .instagram-size-tool__section-head, .moviecut-tool__section-head) { margin-bottom: .5rem; }
#tool :is(.json-formatter-tool__command-bar, .img2pdf-tool__preview-section) { padding: .75rem; }
#tool .json-formatter-tool__command-bar { gap: .5rem; }
#tool .json-formatter-tool__stats div { padding: .4rem .5rem 0; }
#tool .svg-viewer-tool__dropzone { min-height: 0; padding: .75rem; gap: .25rem; }
#tool .svg-viewer-tool__or { margin-block: .5rem; }
#tool .svg-viewer-tool__status { min-height: 0; margin-top: .5rem; }
#tool .instagram-size-tool__preview { min-height: 0; height: clamp(7rem, 23vh, 12rem); padding: .5rem; }
#tool .instagram-size-tool__preview img { height: 100%; max-height: 100%; }
#tool .instagram-size-tool__actions { gap: .5rem; }
#tool .moviecut-tool__range-card { padding: .75rem; gap: .5rem; margin-bottom: .75rem; }
#tool .moviecut-tool__frame-stepper { gap: .25rem; }
#tool .moviecut-tool__video { min-height: 0; max-height: 46dvh; }
#tool .img2pdf-tool__dropzone-container { padding: 1rem; min-height: 0; }
#tool .img2pdf-tool__dropzone-content { gap: .5rem; }
#tool .img2pdf-tool__image-grid { overflow: auto; max-height: 32dvh; overscroll-behavior: contain; }
#tool .img2pdf-tool__pdf-settings { padding: .75rem; margin-bottom: .5rem; }
#tool .img2pdf-tool__mix-help { margin-block: .4rem; }
#tool .img2pdf-tool__status:empty { display: none; }
#tool .img2pdf-tool__mode-switch { margin-bottom: .75rem; }
#tool .img2pdf-tool__preview-header { margin-bottom: .5rem; }
#tool .img2pdf-tool__action-footer { margin-top: .5rem; padding-top: .5rem; }
#tool .file-transfer-tool .app { gap: .75rem; }
#tool .file-transfer-tool :is(.lobby-create, .join-form, .invite-card) { padding: 1rem; }
#tool .file-transfer-tool .create-room { margin-top: 1rem; min-height: 44px; }
#tool .file-transfer-tool .lobby-note { padding: .5rem; }
#tool .file-transfer-tool .share-dropzone { padding: .75rem; gap: .5rem; }
#tool .file-transfer-tool :is(.share-files, .transfer-section) { padding: .75rem .75rem 0; }
#tool .file-transfer-tool .section-title { padding-bottom: .5rem; }
#tool .file-transfer-tool .empty-state { padding: 1rem; }
#tool .file-transfer-tool .shared-row { padding-block: .5rem; }
#tool .file-transfer-tool :is(.shared-list, .transfer-list) { max-height: 22dvh; overflow: auto; overscroll-behavior: contain; }
#tool .watch-room-tool__lobby { padding: 0; }
#tool .watch-room-tool__lobby-form { gap: .75rem; }

@media (min-width: 1024px) and (min-height: 600px) {
  body:has(.route-shell[data-tool-page]) {
    height: 100dvh; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
  }
  .route-shell[data-tool-page] { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
  .route-shell[data-tool-page] :is(.tool-layout, .tool-main, .tool-stage, .artifact-host) { min-height: 0; height: 100%; }
  .route-shell[data-tool-page] .tool-layout { align-items: stretch; }
  #tool > [data-tool-app] { height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .tool-rail { position: static; max-height: 100%; overflow: auto; }
  .tool-rail .tt-ad { margin: 0; }
  #tool :is(.json-formatter-tool, .img2pdf-tool) { display: flex; flex-direction: column; }
  #tool .json-formatter-tool__workbench { flex: 1; min-height: 0; }
  #tool .json-formatter-tool__pane { display: flex; flex-direction: column; min-height: 0; }
  #tool .json-formatter-tool__field { flex: 1; min-height: 0; }
  #tool :is(.json-formatter-tool__field textarea, .json-formatter-tool__output) { height: 100%; min-height: 0; max-height: none; resize: none; }
  #tool .json-formatter-tool__output { flex: 1; }
  #tool .json-formatter-tool__command-bar { flex: none; }
  #tool :is(.svg-viewer-tool__workbench, .meta-preview-tool__layout, .instagram-size-tool__layout) { height: 100%; min-height: 0; }
  #tool .svg-viewer-tool__source { display: flex; flex-direction: column; min-height: 0; }
  #tool .svg-viewer-tool__field { flex: 1; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
  #tool .svg-viewer-tool__field textarea { min-height: 0; height: 100%; resize: none; }
  #tool .svg-viewer-tool__viewer { display: flex; flex-direction: column; min-height: 0; }
  #tool .svg-viewer-tool__canvas { height: auto; flex: 1; min-height: 0; }
  #tool .meta-preview-tool__input { min-height: 0; gap: .75rem; }
  #tool .meta-preview-tool__field textarea { min-height: 0; resize: none; }
  #tool :is(.meta-preview-tool__output, .instagram-size-tool__output) { overflow: auto; overscroll-behavior: contain; }
  #tool .instagram-size-tool__input { overflow: auto; }
  #tool .img2pdf-tool__mode-switch { flex: none; align-self: flex-start; }
  #tool .img2pdf-tool > :is([data-role="image-mode"], [data-role="pdf-mode"]) { min-height: 0; flex: 1; }
  #tool .img2pdf-tool :is([data-role="image-mode"]:has([data-role="preview"]:not([hidden])), [data-role="pdf-mode"]:has([data-role="pdf-preview"]:not([hidden]))) {
    display: grid; grid-template-columns: minmax(13rem, .55fr) minmax(0, 1.45fr); gap: .75rem;
    grid-template-rows: auto minmax(0, 1fr);
  }
  #tool .img2pdf-tool :is([data-role="image-mode"]:has([data-role="preview"]:not([hidden])), [data-role="pdf-mode"]:has([data-role="pdf-preview"]:not([hidden]))) .img2pdf-tool__dropzone-container { grid-column: 1; grid-row: 1 / 3; margin: 0; }
  #tool .img2pdf-tool :is([data-role="preview"], [data-role="pdf-preview"]) { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; min-height: 0; }
  #tool .img2pdf-tool :is([data-role="image-grid"], [data-role="pdf-page-grid"]) { flex: 1; min-height: 0; max-height: none; }
  #tool .file-transfer-tool .app:has(.room-toolbar) {
    height: 100%; grid-template-columns: 19rem minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) minmax(0, .65fr) auto; align-items: start;
  }
  #tool .file-transfer-tool .room-pin { font-size: 2rem; }
  #tool .file-transfer-tool .qr-preview canvas { width: 104px; height: 104px; }
  #tool .file-transfer-tool :is([aria-labelledby="send-title"], .share-files, .transfer-section) { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
  #tool .file-transfer-tool :is(.shared-list, .transfer-list) { min-height: 0; max-height: none; }
  #tool .file-transfer-tool :is(.share-dropzone, .section-title) { flex: none; }
  #tool .file-transfer-tool .devices-details { grid-row: 4; max-height: 6rem; overflow: auto; }
  #tool .file-transfer-tool .session-note { grid-row: 4; }
  #tool .file-transfer-tool .room-toolbar { grid-column: 1 / -1; }
  #tool .file-transfer-tool .invite-card { grid-column: 1; grid-row: 2 / 4; grid-template-columns: minmax(0, 1fr); grid-template-areas: "heading" "info" "qr" "actions"; gap: .75rem; }
  #tool .file-transfer-tool .share-files { grid-column: 3; }
  #tool .file-transfer-tool .transfer-section { grid-column: 2 / -1; }
  #tool .file-transfer-tool .devices-details { grid-column: 1; }
}

@media (max-width: 1023px), (max-height: 599px) {
  .route-shell[data-tool-page] { width: calc(100% - 1rem); }
  #tool :is(.json-formatter-tool__field textarea, .json-formatter-tool__output) { min-height: 10rem; height: 20dvh; max-height: 20rem; }
  #tool .json-formatter-tool__section-head { flex-direction: row; gap: .5rem; }
  #tool .json-formatter-tool__section-head p { max-width: 50%; }
  #tool .json-formatter-tool__actions { display: flex; flex-wrap: wrap; }
  #tool .json-formatter-tool__button { flex: 1 1 auto; }
  #tool .json-formatter-tool__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #tool .json-formatter-tool__stats div { flex-direction: column; gap: 0; border: 0; }
  #tool .svg-viewer-tool__field textarea { min-height: 6rem; height: 14dvh; }
  #tool .svg-viewer-tool__canvas { height: 26dvh; min-height: 10rem; padding: .5rem; }
  #tool .svg-viewer-tool__viewer-bar { gap: .5rem; }
  #tool .svg-viewer-tool__viewer-bar :is(dl,dd) { margin-bottom: 0; }
  #tool .meta-preview-tool__field textarea { min-height: 8rem; height: 18dvh; }
  #tool .meta-preview-tool__empty { min-height: 7rem; padding: 1rem; }
  #tool .meta-preview-tool__output { max-height: 50dvh; overflow: auto; }
  #tool .instagram-size-tool__preview { height: 7rem; }
  #tool .instagram-size-tool__empty { min-height: 5rem; padding: 1rem; }
  #tool .instagram-size-tool__output { max-height: 50dvh; overflow: auto; }
  #tool .moviecut-tool__video { max-height: 25dvh; }
  #tool .img2pdf-tool__settings-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tool .img2pdf-tool__image-grid { max-height: 27dvh; }
  #tool .file-transfer-tool .invite-card { grid-template-columns: minmax(0, 1fr) 88px; gap: .5rem; }
  #tool .file-transfer-tool .qr-preview canvas { width: 80px; height: 80px; }
  #tool .file-transfer-tool .room-pin { font-size: 1.75rem; }
  #tool .file-transfer-tool .share-dropzone { grid-template-columns: minmax(0, 1fr) auto; text-align: left; }
  #tool .file-transfer-tool .upload-symbol { display: none; }
  #tool .file-transfer-tool .dropzone-note { grid-column: 1 / -1; }
  #tool .file-transfer-tool .share-dropzone .primary { min-width: 0; }
}
@media (max-width: 512px) {
  body:has(.route-shell[data-tool-page]) .nav-shell { display: flex; flex-wrap: nowrap; gap: .25rem; }
  body:has(.route-shell[data-tool-page]) .nav-links { display: flex; flex-wrap: nowrap; }
  body:has(.route-shell[data-tool-page]) .nav-links > a:not(:first-child) { display: none; }
  body:has(.route-shell[data-tool-page]) .brand span { display: none; }
  body:has(.route-shell[data-tool-page]) .language-picker select { max-width: 8rem; }
  #tool :is(input:not([type="range"]), textarea, select) { font-size: 1rem; }
}
/* Once a file is loaded, the editor's change-file action replaces the large drop target. */
#tool .moviecut-tool:has([data-role="workspace"]:not([hidden])) > .moviecut-tool__dropzone { display: none; }
#tool .moviecut-tool__controls-panel { align-self: start; }
#tool .moviecut-tool__controls-panel .moviecut-tool__section-head p { display: none; }
#tool .file-transfer-tool [aria-labelledby="send-title"] { min-width: 0; }
#tool :is(.metatool-tool, .youtube-info-tool) .shell { padding-bottom: 0; }
#tool .instagram-downloader-tool .ig-caption { max-height: 4.5em; overflow: auto; }
#tool .instagram-downloader-tool .ig-toolbar { margin-block: .5rem; padding: .5rem; }
#tool .instagram-downloader-tool .ig-preview { aspect-ratio: auto; height: clamp(7rem, 20dvh, 12rem); }
#tool .instagram-downloader-tool .ig-preview :is(img, video) { max-height: 100%; }
#tool .instagram-downloader-tool .ig-item-info { padding: .5rem; gap: .35rem; }
#tool .instagram-downloader-tool .ig-rights { margin-top: .5rem; padding-top: .5rem; }
#tool .ninonedo-tool .console-toolbar { min-height: 72px; }
#tool .ninonedo-tool .console-nav { padding-block: .5rem; }
#tool .ninonedo-tool .join-view { min-height: 0; padding-top: 1rem; }
#tool .ninonedo-tool :is(.join-intro, .join-form) { padding: 1.5rem; }
#tool .ninonedo-tool .join-form { gap: 1rem; }

@media (min-width: 1024px) and (min-height: 600px) {
  #tool .file-transfer-tool [aria-labelledby="send-title"] { grid-column: 2; grid-row: 2; }
  #tool .file-transfer-tool .share-files { grid-row: 2; }
  #tool .file-transfer-tool .session-note { grid-column: 2 / -1; }
  #tool :is(.metatool-tool, .youtube-info-tool) .shell { height: 100%; display: flex; flex-direction: column; }
  #tool :is(.metatool-tool, .youtube-info-tool) .result { min-height: 0; overflow: auto; overscroll-behavior: contain; }
  #tool .instagram-downloader-tool { display: flex; flex-direction: column; }
  #tool .instagram-downloader-tool .ig-results { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 0; }
  #tool .instagram-downloader-tool .ig-grid { min-height: 0; overflow: auto; overscroll-behavior: contain; }
  #tool .instagram-downloader-tool .ig-status { margin-block: .4rem; }
  #tool .ninonedo-tool { height: calc(100dvh - 2rem); min-height: 0; margin-block: 1rem; padding-bottom: 1rem; }
  #tool .ninonedo-tool .ninonedo-content { min-height: 0; overflow: auto; }
  #tool .ninonedo-tool .join-view { height: 100%; grid-template-rows: minmax(0, 1fr) auto; }
  #tool .ninonedo-tool .join-intro { min-height: 0; overflow: auto; }
  .live-shell { height: calc(100dvh - 4.5rem); padding-block: .25rem; display: flex; flex-direction: column; }
  .live-context { min-height: 2.75rem; flex: none; }
  .artifact-host--live { min-height: 0; flex: 1; overflow: auto; }
}
@media (max-width: 1023px), (max-height: 599px) {
  #tool :is(.json-formatter-tool__pane, .svg-viewer-tool__source, .svg-viewer-tool__viewer,
    .meta-preview-tool__input, .meta-preview-tool__output, .instagram-size-tool__input,
    .instagram-size-tool__output, .moviecut-tool__preview-panel, .moviecut-tool__controls-panel) { padding: .75rem; }
  #tool .json-formatter-tool__button { width: auto; flex-basis: 45%; }
  #tool :is(.json-formatter-tool__field textarea, .json-formatter-tool__output) { min-height: 7rem; height: 16dvh; }
  #tool .svg-viewer-tool__dropzone :is(strong, span) { display: none; }
  #tool .svg-viewer-tool__actions { flex-direction: row; }
  #tool .svg-viewer-tool__actions button { width: auto; flex: 1; }
  #tool .svg-viewer-tool__section-head--viewer { flex-direction: row; align-items: center; }
  #tool .svg-viewer-tool__canvas { height: 20dvh; }
  #tool .svg-viewer-tool__backgrounds { width: auto; }
  #tool .svg-viewer-tool__backgrounds button { padding-inline: .5rem; }
  #tool .meta-preview-tool__input { gap: .5rem; }
  #tool .meta-preview-tool__actions { display: grid; grid-template-columns: 1fr 1fr; }
  #tool .meta-preview-tool__actions button:last-child { grid-column: 1 / -1; }
  #tool .instagram-size-tool__preview { height: 5rem; }
  #tool .instagram-size-tool__picker-actions { flex-direction: row; align-items: center; }
  #tool .instagram-size-tool__picker-actions button { width: auto; flex: none; }
  #tool .instagram-size-tool__dimension-grid, #tool .instagram-size-tool__summary { grid-template-columns: 1fr 1fr; }
  #tool .instagram-size-tool__actions { display: grid; grid-template-columns: 1fr 1fr; }
  #tool .instagram-size-tool__actions button { width: auto; }
  #tool .instagram-size-tool__actions button:last-child { grid-column: 1 / -1; }
  #tool .moviecut-tool__time-grid { grid-template-columns: 1fr 1fr; }
  #tool .moviecut-tool__section-head { flex-direction: row; gap: .5rem; }
  #tool .moviecut-tool__section-head .moviecut-tool__button { width: auto; flex: none; }
  #tool .moviecut-tool__transport { display: grid; grid-template-columns: auto 1fr auto; gap: .25rem; }
  #tool .moviecut-tool__player-time { grid-column: 2 / -1; min-width: 0; text-align: right; }
  #tool .moviecut-tool__player-audio { grid-column: 1 / 3; min-width: 0; }
  #tool .moviecut-tool__frame-stepper span { flex: none; min-height: 0; }
  #tool .moviecut-tool__video { max-height: 20dvh; }
  #tool .moviecut-tool__preset-field { margin-bottom: .5rem; }
  #tool .img2pdf-tool :is([data-role="image-mode"]:has([data-role="preview"]:not([hidden])), [data-role="pdf-mode"]:has([data-role="pdf-preview"]:not([hidden]))) .img2pdf-tool__dropzone-container { margin-bottom: .5rem; padding: .5rem; }
  #tool .img2pdf-tool :is([data-role="image-mode"]:has([data-role="preview"]:not([hidden])), [data-role="pdf-mode"]:has([data-role="pdf-preview"]:not([hidden]))) .img2pdf-tool__dropzone-content > :is(svg,h2,p) { display: none; }
  #tool .img2pdf-tool__image-grid { max-height: 22dvh; }
  #tool .instagram-downloader-tool .ig-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  #tool .instagram-downloader-tool .ig-item-info { font-size: .85rem; }
  #tool .instagram-downloader-tool .ig-item .ig-button { padding-inline: .5rem; }
  #tool .ninonedo-tool .join-intro { min-height: 0; padding: 1rem; }
  #tool .ninonedo-tool .join-intro .lede { margin-top: .5rem; }
}
#tool :is(.metatool-tool, .youtube-info-tool) :is(h2, h3) { margin-block: 0 .5rem; }
#tool :is(.metatool-tool, .youtube-info-tool) .description { max-height: 4.5em; overflow: auto; margin-block: .5rem; }
#tool :is(.metatool-tool, .youtube-info-tool) .meta-grid { margin-block: .5rem; }
#tool :is(.metatool-tool, .youtube-info-tool) .meta-grid :is(dt, dd) { padding-block: .35rem; }
#tool .youtube-info-tool .thumb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#tool .youtube-info-tool .thumb-item { padding: .5rem; }
#tool .youtube-info-tool .thumb-item img { max-height: 7rem; }
#tool .youtube-info-tool .thumb-item .small { margin-block: .25rem; }
#tool .youtube-info-tool .caption-controls { grid-template-columns: auto minmax(0, 1fr); padding: .5rem; }
#tool .youtube-info-tool .transcript-head { margin-top: .25rem; }
#tool .youtube-info-tool .transcript { min-height: 3rem; max-height: 16dvh; margin-block: 0; }
@media (min-width: 1024px) and (min-height: 600px) {
  #tool .youtube-info-tool .result { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: .5rem 1rem; align-content: start; }
  #tool .youtube-info-tool .result > :is(h2, .description) { grid-column: 1; }
  #tool .youtube-info-tool .result > .meta-grid { grid-column: 1; grid-row: 3 / 9; align-self: start; }
  #tool .youtube-info-tool .result > h3:first-of-type { grid-column: 2; grid-row: 1; }
  #tool .youtube-info-tool .thumb-grid { grid-column: 2; grid-row: 2 / 4; }
  #tool .youtube-info-tool .result > :is(h3:not(:first-of-type), .caption-controls, .transcript-head, .transcript, .empty, .status) { grid-column: 2; }
  #tool .moviecut-tool:has([data-role="workspace"]:not([hidden])) { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: minmax(0, 1fr) auto auto; gap: .5rem 1rem; }
  #tool .moviecut-tool__workspace:not([hidden]) { display: contents; }
  #tool .moviecut-tool__preview-panel { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; }
  #tool .moviecut-tool__player { min-height: 0; flex: 1; display: flex; flex-direction: column; }
  #tool .moviecut-tool__video { flex: 1; max-height: none; }
  #tool .moviecut-tool__transport { flex: none; }
  #tool :is(.moviecut-tool__progress, .moviecut-tool__result) { grid-column: 1; margin: 0; padding: .5rem .75rem; }
  #tool .moviecut-tool__progress { grid-row: 2; }
  #tool .moviecut-tool__result { grid-row: 3; }
  #tool .moviecut-tool__controls-panel { grid-column: 2; grid-row: 1 / 4; padding: .75rem; }
  #tool .moviecut-tool__frame-stepper { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr auto; }
  #tool .moviecut-tool__frame-stepper :is(button, span) { min-width: 0; padding-inline: .4rem; font-size: .75rem; }
  #tool .moviecut-tool__range-card { padding: .5rem; }
  #tool .moviecut-tool__preset-field { margin-bottom: .5rem; }
}
@media (max-width: 1023px), (max-height: 599px) {
  #tool .svg-viewer-tool__source { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
  #tool .svg-viewer-tool__source .svg-viewer-tool__section-head { display: block; margin: 0; }
  #tool .svg-viewer-tool__section-head > div > p { display: none; }
  #tool .svg-viewer-tool__section-head h2 { font-size: 1rem; }
  #tool .svg-viewer-tool__dropzone { padding: 0; border: 0; background: none; }
  #tool .svg-viewer-tool__or { display: none; }
  #tool :is(.svg-viewer-tool__field, .svg-viewer-tool__actions, .svg-viewer-tool__status) { grid-column: 1 / -1; margin: 0; }
  #tool .svg-viewer-tool__field textarea { height: 6rem; }
  #tool .svg-viewer-tool__viewer-bar { margin-top: .5rem; }
  #tool .moviecut-tool__duration { display: none; }
  #tool .moviecut-tool__video { max-height: 16dvh; }
  #tool .moviecut-tool__frame-stepper span { padding: .2rem; }
  #tool .moviecut-tool__preview-panel .moviecut-tool__section-head { align-items: center; }
  #tool .moviecut-tool__preview-panel .moviecut-tool__section-head p { font-size: .75rem; }
  #tool .moviecut-tool__preview-panel .moviecut-tool__button { font-size: .75rem; padding-inline: .5rem; }
  #tool .moviecut-tool__range-card { padding: .5rem; margin-bottom: .5rem; }
  #tool .img2pdf-tool__image-grid { max-height: 18dvh; margin-bottom: .5rem; }
  #tool .meta-preview-tool__output, #tool .instagram-size-tool__output { max-height: 34dvh; }
  #tool .youtube-info-tool .thumb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 28dvh; overflow: auto; }
  #tool :is(.metatool-tool, .youtube-info-tool) .meta-grid { grid-template-columns: minmax(6rem, .4fr) minmax(0, 1fr); }
  #tool :is(.metatool-tool, .youtube-info-tool) .result { max-height: 65dvh; overflow: auto; }
}
@media (min-width: 1024px) and (min-height: 600px) {
  #tool .instagram-downloader-tool .ig-preview { height: clamp(3rem, calc(100dvh - 680px), 8rem); }
  #tool .youtube-info-tool .caption-controls { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); }
  #tool .youtube-info-tool .thumb-item img { max-height: 5rem; }
  #tool .watch-room-tool, #tool .watch-room-tool > div { height: 100%; min-height: 0; }
  #tool .watch-room-tool__live { height: 100%; grid-template-rows: auto minmax(0, 1fr); gap: .5rem; }
  #tool .watch-room-tool__live:has(.watch-room-tool__room-notice) { grid-template-rows: auto auto minmax(0, 1fr); }
  #tool .watch-room-tool__live-grid { min-height: 0; grid-template-columns: minmax(0, 1fr) 19rem; }
  #tool .watch-room-tool__stage { display: flex; flex-direction: column; min-height: 0; padding: .75rem; gap: .5rem; }
  #tool .watch-room-tool__player-wrap { flex: 1; min-height: 0; aspect-ratio: auto; }
  #tool .watch-room-tool__side { min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: .5rem; }
  #tool .watch-room-tool__participants > ul { max-height: 6rem; }
  #tool .watch-room-tool__chat { min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; }
}
@media (max-width: 1023px), (max-height: 599px) {
  #tool :is(.moviecut-tool__progress, .moviecut-tool__result) { margin-top: .5rem; padding: .5rem; gap: .25rem; }
  #tool .moviecut-tool__progress > div { flex-direction: row; align-items: center; }
  #tool .moviecut-tool__result { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #tool .moviecut-tool__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .5rem; }
  #tool .moviecut-tool__actions:not(:has([data-role="download"]:not([hidden]))) { grid-template-columns: 1fr; }
  #tool .moviecut-tool__actions > * { min-width: 0; padding-inline: .5rem; }
  #tool .moviecut-tool__actions, #tool .img2pdf-tool__action-footer {
    position: sticky; bottom: max(.5rem, env(safe-area-inset-bottom)); z-index: 2;
    background: var(--tt-surface); border-radius: 8px;
  }
  #tool .moviecut-tool__frame-stepper { flex-wrap: nowrap; align-items: center; }
  #tool .moviecut-tool__frame-stepper button { flex: 1 1 0; min-width: 0; padding: .25rem; font-size: .7rem; }
  #tool .moviecut-tool__frame-stepper span { font-size: .65rem; }
  #tool .instagram-downloader-tool .ig-form { gap: .5rem; }
  #tool .instagram-downloader-tool .ig-input-row { flex-direction: row; }
  #tool .instagram-downloader-tool .ig-input-row button { width: auto; max-width: 40%; font-size: .85rem; padding: .5rem; }
  #tool .instagram-downloader-tool .ig-actions { flex-wrap: nowrap; gap: .25rem; }
  #tool .instagram-downloader-tool .ig-actions .ig-hint { font-size: .75rem; }
  #tool .instagram-downloader-tool .ig-preview { height: 6rem; }
  #tool .instagram-downloader-tool .ig-results-head { gap: .25rem; margin-bottom: .5rem; }
  #tool .instagram-downloader-tool .ig-caption { margin-block: .5rem; font-size: .8rem; }
  #tool .instagram-downloader-tool .ig-toolbar { padding: .5rem; }
  #tool .watch-room-tool__room-bar { gap: .5rem; padding-block: .5rem; }
  #tool .watch-room-tool__stage { padding: .75rem; gap: .5rem; }
  #tool .watch-room-tool__player-wrap { max-height: 25dvh; }
  #tool .watch-room-tool__side { gap: .5rem; }
  #tool .watch-room-tool__participants > ul { max-height: 4rem; }
  #tool .watch-room-tool__chat { min-height: 0; height: 16rem; grid-template-rows: auto minmax(0, 1fr) auto; }
  #tool .watch-room-tool__youtube-form > div, #tool .watch-room-tool__chat-form > div { grid-template-columns: minmax(0, 1fr) auto; }
}
body:has(.route-shell[data-tool-page]) .brand { min-width: 44px; }
#tool .img2pdf-tool__page-card img { height: clamp(3rem, 10dvh, 7rem); object-fit: contain; }
