@media (min-width: 700px) and (min-height: 550px) {
  .work {
    height: calc(100svh - var(--tablet-bar-height, 64px) - var(--top));
    height: calc(100dvh - var(--tablet-bar-height, 64px) - var(--top));
    min-height: 0;
    padding-block: clamp(16px, 2.5vh, 28px) max(20px, var(--bottom));
  }
  .work .stage-head { margin-bottom: 10px; }
  .work .stage-head h1 { font-size: clamp(21px, 2.6vw, 28px); }
  .work .stage-head .count { margin-inline-start: auto; }
  .work .meter { margin-bottom: clamp(14px, 2vh, 22px); }
  .work .frame { border-radius: 8px; }

  .selection-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 42%);
    align-items: center;
    gap: 5px 24px;
    padding-top: 16px;
  }
  .selection-controls .photo-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px 10px;
    min-width: 0;
    padding: 0;
  }
  .selection-controls .file-name { min-width: 0; max-width: 100%; font-size: 17px; }
  .selection-controls .group-name { flex: 1 0 100%; max-width: 100%; margin: 0; }
  .selection-controls .swipe-hint { grid-column: 2; padding: 0; }
  .selection-controls .button { min-height: 52px; }
  .compare-controls .file-name { color: var(--ink); }
  .compare-controls .pair-decisions { grid-column: 2; margin-top: 0; }
  .compare-controls .pair-decisions .button { min-height: 46px; }
  .compare-cut {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 7px;
    line-height: 1.4;
    white-space: nowrap;
  }
  .compare-layout {
    min-height: 44px;
    padding-inline: 14px;
    margin-inline-start: 4px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 550;
  }
  .compare-layout:active { background: var(--panel); }
}

@media (min-width: 700px) and (min-height: 550px) and (orientation: landscape) {
  .work:not(.is-paired) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(188px, 21vw, 270px);
    grid-template-rows: auto 2px minmax(0, 1fr);
    column-gap: clamp(20px, 2.5vw, 40px);
  }
  .work:not(.is-paired) > .frame,
  .work:not(.is-paired) > .compare-stage { grid-area: 1 / 1 / -1 / 2; }
  .work:not(.is-paired) .stage-head {
    grid-area: 1 / 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-block: 3px 14px;
  }
  .work:not(.is-paired) .stage-head h1 { font-size: clamp(19px, 1.8vw, 26px); }
  .work:not(.is-paired) .compare-layout { grid-column: span 2; justify-self: start; margin: 0; }
  .work:not(.is-paired) .meter { grid-area: 2 / 2; margin: 0; }
  .work:not(.is-paired) .selection-controls {
    grid-area: 3 / 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 18px;
  }
  .work:not(.is-paired) .photo-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 6px;
  }
  .work:not(.is-paired) .file-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
  }
  .work:not(.is-paired) .vote-actions { grid-template-columns: 1fr; margin-top: auto; }
  .work:not(.is-paired) .pair-decisions { grid-template-columns: 1fr 1fr; }
  .work:not(.is-paired) .final-undo { grid-column: 1 / -1; }
  .compare-work:not(.is-paired) .stage-head { grid-template-columns: 1fr; gap: 5px; }
  .compare-work:not(.is-paired) .stage-head .count { justify-self: start; margin: 0; }
  .compare-work:not(.is-paired) .compare-layout { grid-column: 1; }
  .work:not(.is-paired) .swipe-hint { text-wrap: balance; }
}

@media (min-width: 768px) and (min-height: 550px) {
  .is-paired .compare-controls { display: flex; justify-content: center; }
  .is-paired .pair-decisions { width: min(100%, 30rem); }
  .compare-work.is-paired .compare-stage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 28px);
  }
  .is-paired .compare-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
  }
  .is-paired .compare-panel .frame { position: relative; inset: auto; }
  .pair-caption {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
  }
  .pair-caption .button { width: auto; min-height: 48px; padding-inline: clamp(12px, 2vw, 24px); }
}

/* Keep the voting controls in the same place when the first pick appears. */
.compare-work {
  --strip-room: 126px;
  height: calc(100svh - var(--tablet-bar-height, 58px) - var(--top) - var(--strip-room));
  height: calc(100dvh - var(--tablet-bar-height, 58px) - var(--top) - var(--strip-room));
  padding-bottom: 8px;
}
.pick-strip {
  --pick-width: 74px;
  margin-inline: var(--edge);
  padding-bottom: var(--bottom);
  border-top: 1px solid var(--line);
}
.pick-strip-head, .pick-pager { display: flex; align-items: center; }
.pick-strip-head { min-height: 44px; justify-content: space-between; gap: 8px; }
.pick-strip-head h2 { font-size: 15px; }
.pick-total { margin-left: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.pick-pager { gap: 2px; }
.pick-pager button { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 5px; padding: 0; }
.pick-pager button:disabled { opacity: .3; cursor: default; }
.pick-pager button[name="previous-picks"] svg { transform: rotate(180deg); }
.pick-pager svg { width: 16px; height: 16px; }
.pick-range { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pick-list { display: flex; align-items: flex-start; gap: 8px; }
.pick-tile { display: grid; gap: 3px; width: var(--pick-width); min-width: 0; padding: 0; text-align: left; }
.pick-cover { position: relative; display: block; width: 100%; height: 51px; background: var(--well); border-radius: 4px; overflow: hidden; }
.pick-cover img { width: 100%; height: 100%; object-fit: cover; }
.pick-badge { position: absolute; bottom: 2px; left: 2px; padding: 1px 4px; border-radius: 3px; background: #151515db; color: #fff; font-size: 10px; line-height: 1.4; }
.pick-badge.confirmed { background: #f3f2ef; color: #212121; }
.pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.4; }
.pick-strip-head h2 { min-width: 0; overflow-wrap: anywhere; }
.pick-pager { flex: none; }
.review-view { padding-bottom: 20px; }
.review-view .count { display: block; margin-top: 8px; }
.review-grid { --pick-width: 96px; padding-bottom: 18px; }
.result-files .pick-strip { margin-inline: 0; }
.review-sections { padding: 0 var(--edge) var(--bottom); }
.review-sections .pick-strip { margin-inline: 0; }
.review-grid .pick-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(var(--pick-width),1fr)); gap: 12px 8px; }
.review-grid .pick-list > .note { grid-column: 1 / -1; }
.review-grid .pick-tile { width: 100%; }
.review-grid .pick-cover { height: auto; aspect-ratio: 4 / 3; }
.review-grid .pick-cover img { display: block; }
.review-sections .finish-group { margin-top: 18px; }
.finish-dialog p { margin: 12px 0 18px; }

@media (min-width: 700px) and (min-height: 550px) {
  .work.compare-work {
    height: calc(100dvh - var(--tablet-bar-height) - var(--top) - 144px);
    min-height: 350px;
    padding-bottom: 10px;
  }
  .pick-strip { --pick-width: 92px; }
  .pick-cover { height: 64px; }
  .pick-strip-head h2 { font-size: 17px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .compare-work { --strip-room: 64px; }
}
@media (orientation: landscape) and (min-width: 540px) and (max-height: 540px) {
  .compare-work {
    height: auto;
    min-height: max(240px, calc(100dvh - 58px - var(--top) - var(--strip-room)));
    grid-template-rows: auto 2px minmax(min-content, 1fr);
  }
}
@media (orientation: landscape) and (min-width: 700px) and (min-height: 550px) {
  .work.compare-work:not(.is-paired) {
    height: auto;
    min-height: max(350px, calc(100dvh - var(--tablet-bar-height) - var(--top) - 144px));
    grid-template-rows: auto 2px minmax(min-content, 1fr);
  }
}
