/* Two-panel presentation extends the existing workspace and transport. */
@scope (.app, .experience-startup) {
  .comparison-layout-control {display:flex;align-items:center;justify-content:center;gap:10px;min-width:0;padding:0 0 8px;color:var(--ui-muted);font-size:11px;}
  .comparison-layout-control[hidden] {display:none;}
  .comparison-layout-buttons {display:flex;gap:2px;padding:3px;border:1px solid var(--ui-line);border-radius:9px;background:var(--ui-panel);}
  .comparison-layout-buttons button {min-height:28px;padding:4px 12px;border:0;background:transparent;font-size:11px;color:var(--ui-muted);}
  .comparison-layout-buttons button[aria-pressed="true"] {background:var(--ui-raised);color:var(--ui-text);}
  :scope:not(.single-video-mode) .video-column {grid-template-rows:42px minmax(0,1fr) auto auto auto auto;}
  :scope.single-video-mode .two-video-layout-setting {display:none;}
  .analysis-transport .mobile-full-screen-button {display:block;}
  .video-column:fullscreen {box-sizing:border-box;width:100vw;height:100dvh;padding:12px;min-height:0;overflow:hidden;background:var(--ui-bg);}
  .video-column::backdrop {background:var(--ui-bg);}
  .video-grid[data-two-video-layout]:not(.single-video):not(.ghost-mode) {grid-template-columns:repeat(2,var(--comparison-panel-width,minmax(0,1fr)));grid-template-rows:minmax(0,1fr);justify-content:center;align-content:center;align-items:center;gap:10px;}
  .video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode) {grid-template-columns:var(--comparison-panel-width,minmax(0,1fr));grid-template-rows:repeat(2,max-content);align-content:center;overflow:hidden;}
  .video-grid[data-two-video-layout]:not(.single-video):not(.ghost-mode) .video-panel {grid-template-rows:auto var(--comparison-panel-height,minmax(0,1fr)) auto;align-self:center;width:100%;}
  .video-grid[data-two-video-layout]:not(.single-video):not(.ghost-mode) .video-stage {display:block;width:100%;height:var(--comparison-panel-height,100%);min-height:0;aspect-ratio:auto;border-radius:var(--comparison-panel-radius,10px);box-shadow:inset 0 0 0 1px #d3e1ec80,0 6px 14px #15212b40;}
  .video-grid[data-two-video-layout]:not(.single-video):not(.ghost-mode) .video-stage>video:not(.video-bg) {inset:var(--comparison-panel-inset,3px);width:calc(100% - 2 * var(--comparison-panel-inset,3px));height:calc(100% - 2 * var(--comparison-panel-inset,3px));object-fit:contain;}
  .video-grid[data-two-video-layout]:not(.single-video):not(.ghost-mode) .video-stage.has-video>canvas.video-backdrop {display:block;filter:none;}
  /* Share the existing timeline footer rather than spend a separate 42px row
     above Stacked videos. Keep the original controls, source clocks and order. */
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode)) {grid-template-columns:minmax(0,1fr) max-content;grid-template-rows:minmax(0,1fr) auto auto auto auto;column-gap:10px;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.video-grid {grid-row:1;grid-column:1/-1;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.automatic-analysis-rail {grid-row:2;grid-column:1/-1;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.native-frame-readout {grid-row:4;grid-column:1/-1;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.analysis-transport {grid-row:3;grid-column:1/-1;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.control-strip {grid-row:5;grid-column:1;min-width:0;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.comparison-layout-control {grid-row:5;grid-column:2;padding:0;}
  .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode))>.comparison-layout-control>span {display:none;}
  @media(max-width:700px), (max-width:1000px) and (max-height:600px) {
    :scope:not(.single-video-mode) .video-column {grid-template-rows:42px minmax(0,1fr) auto auto auto auto;}
    .video-column:has(.analysis-transport):has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode)) {grid-template-rows:minmax(0,1fr) auto auto auto auto;column-gap:6px;}
    .comparison-layout-control {padding-bottom:4px;gap:8px;}
    .comparison-layout-buttons {padding:2px;}
    .comparison-layout-buttons button {min-height:34px;padding:4px 12px;}
    .video-grid[data-two-video-layout]:not(.single-video):not(.ghost-mode) {gap:6px;}
    /* Keep video titles visible in both compact layouts. */
    .video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode) .video-source-label {display:flex;}
    .video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode) .video-panel {grid-template-rows:auto var(--comparison-panel-height,minmax(0,1fr)) 0;}
    .video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode) .video-stage {grid-row:2;}
    .comparison-source-controls {display:none;order:-6;gap:6px;padding:8px 0;}
    :scope:is([data-active-tool="sync"],[data-phone-tool="sync"]) .comparison-source-controls:not([hidden]) {display:grid;}
    .comparison-source-controls>div {display:grid;grid-template-columns:48px minmax(0,1fr);align-items:center;gap:4px;min-width:0;}
    .comparison-source-controls>div[hidden] {display:none;}
    .comparison-source-controls strong {font-size:11px;color:var(--ui-muted);}
    .comparison-source-controls .phone-source-transport output {position:static;grid-column:2;grid-row:2;padding:0;background:transparent;text-align:center;}
    /* Single-source review uses the same dock, so wrapping status text cannot
       squeeze the video underneath a redundant reserved transport row. */
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])) .video-grid.single-video .video-panel {grid-template-rows:auto minmax(0,1fr);}
    /* Compact Side by Side shares the established Stacked inspector/footer
       arrangement while Sync is open, leaving a real row for both videos. */
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column {grid-template-columns:minmax(0,1fr) max-content;grid-template-rows:minmax(0,1fr) auto auto auto auto;column-gap:6px;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column>.video-grid {grid-row:1;grid-column:1/-1;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column>.automatic-analysis-rail {grid-row:2;grid-column:1/-1;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column>.analysis-transport {grid-row:3;grid-column:1/-1;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column>.native-frame-readout {grid-row:4;grid-column:1/-1;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column>.control-strip {grid-row:5;grid-column:1;min-width:0;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .video-column>.comparison-layout-control {grid-row:5;grid-column:2;padding:0;}
    :scope:is([data-phone-tool="sync"],[data-active-tool="sync"]:not([data-tool-open="false"])):has(.video-grid[data-two-video-layout="side-by-side"]:not(.single-video):not(.ghost-mode)) .comparison-layout-control>span {display:none;}
    @media(orientation:portrait) {
      :scope.experience:not(.analysis-focus)[data-tool-open="true"]:has(.video-grid[data-two-video-layout="stacked"]:not(.single-video):not(.ghost-mode)) .workspace-layout {grid-template-rows:44px minmax(0,1fr) min(20dvh,160px);}
    }
  }
}
