/* hyd-photo-lab.css
   Three related surfaces, behaviour in hyd-photo-lab.js: (1) the lab and wallpaper buttons on the
   desktop photo viewer (.desktop-photo-tools); (2) the full photo lab dialog (#hyd-photo-lab: preview
   canvas, preset tiles, sliders, photo library, footer); (3) the inline editor shown beside a
   photograph (.photo-inline-editor: home viewer, player sidebar and cinema).
   Most rules carry the html[data-theme] #world prefix so they outrank the theme sheets.
   --desktop-font comes from other site sheets; --photo-zoom is set by script on the player canvas. */

/* A photo tool within the existing early Mac desktop, not another site shell. */
html[data-theme] #world #home #desk-view .desktop-photo-tools {
  flex-wrap: wrap;
  gap: 5px 9px;
  padding: 6px 7px;
}

html[data-theme] #world #home #desk-view .desktop-photo-tools > span {
  flex: 1 0 auto;
}

html[data-theme] #world #home #desk-view .desktop-photo-tools > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

html[data-theme]
  #world
  #home
  #desk-view
  .desktop-photo-tools
  :is(.desktop-photo-lab, .desktop-photo-wallpaper) {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 27px;
  padding: 4px 8px;
  flex: 0 0 auto;
  font: calc(11 * var(--px))/1.3 var(--desktop-font);
  white-space: nowrap;
}

/* --- Photo lab dialog: frame and titlebar --- */
html[data-theme] #hyd-photo-lab,
#hyd-photo-lab {
  width: 960px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #65656c;
  border-radius: 9px 9px 5px 5px;
  background: #29272c;
  color: #f4f2f5;
  box-shadow:
    0 0 0 2px #d6d5da,
    0 12px 45px #0007;
  font: 12px/1.45 var(--desktop-font,"Lucida Grande","Lucida Sans Unicode",sans-serif);
  overflow: auto;
}

#hyd-photo-lab::backdrop {
  background: #1110188c;
}

#hyd-photo-lab * {
  box-sizing: border-box;
}

/* Script toggles hidden inside the dialog; !important stops any display rule from showing those
   parts anyway. */
#hyd-photo-lab [hidden] {
  display: none !important;
}

#hyd-photo-lab .photo-lab-titlebar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 39px;
  margin: 0;
  padding: 6px 12px;
  background: linear-gradient(#f2f2f2, #cbcbce 48%, #b5b5ba);
  color: #26252a;
  border-bottom: 1px solid #75757c;
  box-shadow: inset 0 1px #fff;
}

#hyd-photo-lab .photo-lab-titlebar h2 {
  padding: 0;
  margin: 0;
  text-align: center;
  color: inherit;
  font: 400 14px/1.2 var(--desktop-font,"Lucida Grande",sans-serif);
  letter-spacing: 0;
  text-shadow: 0 1px #fff9;
}

#hyd-photo-lab button {
  font: inherit;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

#hyd-photo-lab .photo-lab-titlebar button {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  padding: 0;
  min-height: 0;
  background: linear-gradient(#ffe2d9, #d58b80);
  color: #633a37;
  border: 1px solid #966a63;
  border-radius: 50%;
  font:
    700 16px/1 Arial,
    sans-serif;
  box-shadow:
    inset 0 1px #fff,
    0 1px #fff8;
  text-shadow: none;
}

#hyd-photo-lab .photo-lab-body {
  padding: 15px 18px 0;
}

/* Keep the retained editor's titlebar outside its scrolling work area. */
html[data-theme] #hyd-photo-lab {
  overflow: hidden;
}

#hyd-photo-lab[open] {
  display: flex;
  flex-direction: column;
}

#hyd-photo-lab .photo-lab-titlebar {
  position: static;
  flex: none;
}

#hyd-photo-lab .photo-lab-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

@media (pointer: coarse), (max-width: 620px) {
  #hyd-photo-lab .photo-lab-titlebar {
    min-height: 46px;
    padding-block: 0;
  }

  /* Touch and narrow screens: the close button must be at least 44px whatever size other sheets give
     window buttons, hence the !important sizes. */
  html[data-theme] body #hyd-photo-lab .photo-lab-titlebar [data-lab-close] {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  #hyd-photo-lab #photo-lab-search {
    font-size: 16px;
  }
}

/* --- Toolbar --- */
#hyd-photo-lab .photo-lab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#hyd-photo-lab .photo-lab-source {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#hyd-photo-lab .photo-lab-source strong {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#hyd-photo-lab .photo-lab-source > span {
  font-size: 11px;
  color: #c4bfc9;
}

#hyd-photo-lab .photo-lab-toolbar > button,
#hyd-photo-lab [data-lab-reset],
#hyd-photo-lab .photo-lab-footer button {
  min-height: 29px;
  padding: 4px 11px;
  background: linear-gradient(#f1f0f2, #c4c3c8);
  border: 1px solid #89888f;
  border-radius: 4px;
  box-shadow:
    inset 0 1px #fff,
    0 1px 1px #0005;
  color: #25242a;
  white-space: nowrap;
}

#hyd-photo-lab button:disabled,
#hyd-photo-lab input:disabled {
  cursor: default;
  opacity: 0.45;
}

#hyd-photo-lab button:focus-visible,
#hyd-photo-lab summary:focus-visible,
#hyd-photo-lab input:focus-visible {
  outline: 3px solid #a8c7ec;
  outline-offset: 2px;
}

/* --- Workspace: preview canvas, presets and sliders --- */
#hyd-photo-lab .photo-lab-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  align-items: start;
  gap: 17px;
}

#hyd-photo-lab .photo-lab-preview {
  min-width: 0;
}

#hyd-photo-lab .photo-lab-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  height: clamp(270px, 42vh, 415px);
  padding: 7px;
  overflow: hidden;
  background: #17161a;
  border: 1px solid #68646e;
  box-shadow: inset 0 0 0 1px #08080a;
  border-radius: 2px;
}

#hyd-photo-lab #photo-lab-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 2px 8px #0005;
}

#hyd-photo-lab #photo-lab-preview-message {
  padding: 15px;
  max-width: 30ch;
  text-align: center;
  color: #d3ced7;
  font-size: 12px;
  margin: 0;
}

#hyd-photo-lab .photo-lab-original-label {
  position: absolute;
  left: 14px;
  top: 13px;
  padding: 3px 7px;
  background: #101015c9;
  color: white;
  border: 1px solid #ded9e46b;
  font-size: 10px;
}

#hyd-photo-lab .photo-lab-compare {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 9px 5px 0;
  color: #d7d2dc;
  font-size: 11px;
  cursor: pointer;
}

#hyd-photo-lab .photo-lab-compare input {
  margin: 0;
  accent-color: #93b2d7;
}

#hyd-photo-lab .photo-lab-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#hyd-photo-lab .photo-lab-presets > button {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 4px 4px 6px;
  border: 1px solid #76717d;
  border-radius: 3px;
  background: #343039;
  color: #f4f1f7;
  box-shadow: inset 0 1px #ffffff10;
  font-size: 11px;
}

#hyd-photo-lab .photo-lab-presets > button[aria-pressed='true'] {
  outline: 2px solid #a8c4e5;
  outline-offset: -1px;
  background: #4d535f;
}

#hyd-photo-lab .photo-lab-presets canvas {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
  background: #222025;
  border: 1px solid #18161b;
}

#hyd-photo-lab .photo-lab-sliders {
  display: grid;
  gap: 15px;
  min-height: 118px;
  padding: 19px 2px 12px;
}

#hyd-photo-lab .photo-lab-sliders label {
  display: grid;
  gap: 7px;
  font-size: 11px;
}

#hyd-photo-lab .photo-lab-sliders label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#hyd-photo-lab .photo-lab-sliders output {
  color: #c2cbdc;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

#hyd-photo-lab .photo-lab-sliders input {
  width: 100%;
  margin: 0;
  accent-color: #aac2df;
  cursor: ew-resize;
}

#hyd-photo-lab .photo-lab-sliders p {
  margin: 0;
  color: #c4bfc9;
  font-size: 11px;
}

#hyd-photo-lab [data-lab-reset] {
  width: 100%;
  font-size: 11px;
}

/* --- Photo library: search and grid --- */
#hyd-photo-lab .photo-lab-library {
  margin-top: 15px;
  padding: 12px 0;
  border-top: 1px solid #5c5662;
  border-bottom: 1px solid #5c5662;
}

#hyd-photo-lab .photo-lab-library > summary {
  font-size: 12px;
  cursor: pointer;
  color: #e6e0ed;
  list-style: revert;
}

#hyd-photo-lab #photo-lab-library-total {
  color: #ada4b6;
  font-size: 10px;
  margin-left: 5px;
}

#hyd-photo-lab .photo-lab-search-label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0 10px;
  font-size: 11px;
}

#hyd-photo-lab #photo-lab-search {
  height: 29px;
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font: 11px/1.4 var(--desktop-font);
  border: 1px solid #8b8495;
  background: #1e1c22;
  color: #eee9f4;
  border-radius: 4px;
  box-shadow: inset 0 1px 3px #0006;
}

#hyd-photo-lab #photo-lab-photo-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  max-height: 254px;
  overflow: auto;
  padding: 3px;
  scrollbar-width: thin;
}

#hyd-photo-lab #photo-lab-photo-grid > button {
  display: grid;
  grid-template-rows: 64px auto;
  gap: 5px;
  padding: 4px;
  min-width: 0;
  border: 1px solid #6b6572;
  border-radius: 2px;
  background: #37323c;
  color: #e9e3ee;
  text-align: left;
  font-size: 10px;
  line-height: 1.3;
}

#hyd-photo-lab #photo-lab-photo-grid > button[aria-pressed='true'] {
  outline: 2px solid #a8c4e5;
  outline-offset: -1px;
}

#hyd-photo-lab #photo-lab-photo-grid img {
  width: 100%;
  height: 64px;
  object-fit: cover;
}

#hyd-photo-lab #photo-lab-photo-grid span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 26px;
}

#hyd-photo-lab #photo-lab-search-status {
  margin: 7px 0 0;
  color: #d1c8da;
  font-size: 11px;
}

#hyd-photo-lab #photo-lab-search-status:empty {
  display: none;
}

/* --- Footer actions --- */
#hyd-photo-lab .photo-lab-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 0;
  margin: 0;
}

#hyd-photo-lab .photo-lab-footer > p {
  margin: 0;
  color: #c4bfc9;
  font-size: 10px;
  max-width: 36ch;
}

#hyd-photo-lab .photo-lab-footer > div {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

#hyd-photo-lab .photo-lab-footer [data-lab-download] {
  background: linear-gradient(#d9e9fc, #a0bada);
  border-color: #6888b0;
  color: #192b43;
}

/* --- Narrow screens --- */
@media (max-width: 650px) {
  html[data-theme] #hyd-photo-lab,
  #hyd-photo-lab {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 20px);
  }

  #hyd-photo-lab .photo-lab-body {
    padding: 12px 12px 0;
  }

  #hyd-photo-lab .photo-lab-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  #hyd-photo-lab .photo-lab-canvas-wrap {
    min-height: 210px;
    height: 32vh;
    max-height: 300px;
  }

  #hyd-photo-lab .photo-lab-presets {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  #hyd-photo-lab .photo-lab-presets > button {
    font-size: 9px;
    gap: 4px;
    padding: 3px;
  }

  #hyd-photo-lab .photo-lab-presets canvas {
    height: 49px;
  }

  #hyd-photo-lab .photo-lab-sliders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    padding: 13px 0;
    gap: 13px;
  }

  #hyd-photo-lab .photo-lab-sliders p {
    grid-column: 1/-1;
  }

  #hyd-photo-lab [data-lab-reset] {
    width: auto;
    min-height: 27px;
    padding: 3px 10px;
  }

  #hyd-photo-lab #photo-lab-photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 238px;
  }

  #hyd-photo-lab .photo-lab-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #hyd-photo-lab .photo-lab-footer > div {
    justify-content: flex-end;
  }

  #hyd-photo-lab .photo-lab-footer > p {
    max-width: none;
  }
}

/* Reduced motion: the wildcard has lower specificity than the class rules inside the dialog, so
   !important is what makes it cancel their scrolling, transitions and animations. */
@media (prefers-reduced-motion: reduce) {
  #hyd-photo-lab * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* The same tools live beside the photograph; no second editor window is needed. */
html[data-theme] #world .photo-inline-editor {
  box-sizing: border-box;
  padding: 8px 10px;
  background: #302f34;
  color: #eeeef1;
  border-top: 1px solid #55545a;
  font: calc(11 * var(--px))/1.35 var(--desktop-font,"Lucida Grande","Lucida Sans Unicode",sans-serif);
  text-align: left;
}

html[data-theme] #world .photo-inline-editor * {
  box-sizing: border-box;
}

/* Script toggles hidden inside the inline editor; !important stops any display rule from showing
   those parts anyway. */
html[data-theme] #world .photo-inline-editor [hidden] {
  display: none !important;
}

html[data-theme] #world .photo-inline-top {
  display: flex;
  gap: 9px;
  align-items: center;
}

html[data-theme] #world .photo-inline-label {
  color: #bbb9c3;
  font-size: calc(10 * var(--px));
}

html[data-theme] #world .photo-inline-presets {
  display: flex;
  min-width: 0;
}

html[data-theme] #world .photo-inline-editor button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 26px;
  width: auto;
  height: auto;
  padding: 4px 10px;
  margin: 0;
  border: 1px solid #8d8e94;
  border-radius: 3px;
  background: linear-gradient(#eeeeef, #c5c6ca);
  color: #26272b;
  box-shadow:
    inset 0 1px #fff,
    0 1px 1px #0006;
  font: calc(11 * var(--px))/1.25 var(--desktop-font,"Lucida Grande",sans-serif);
  letter-spacing: 0;
  text-shadow: 0 1px #fff6;
  transform: none;
  white-space: nowrap;
  cursor: pointer;
}

html[data-theme] #world .photo-inline-presets button {
  border-radius: 0;
  margin-right: -1px;
  flex: 1;
}

html[data-theme] #world .photo-inline-presets button:first-child {
  border-radius: 3px 0 0 3px;
}

html[data-theme] #world .photo-inline-presets button:last-child {
  border-radius: 0 3px 3px 0;
  margin-right: 0;
}

html[data-theme] #world .photo-inline-presets button[aria-pressed='true'] {
  background: #627e9a;
  border-color: #96b5d5;
  color: #fff;
  text-shadow: 0 1px #233b54;
  box-shadow: inset 0 1px 3px #203d5366;
}

html[data-theme] #world .photo-inline-editor :is(button, input, summary):focus-visible {
  outline: 2px solid #b6d8ff;
  outline-offset: 2px;
}

html[data-theme] #world .photo-inline-editor :is(button, input):disabled {
  opacity: 0.45;
  cursor: default;
}

html[data-theme] #world .photo-inline-adjustments {
  margin: 7px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

html[data-theme] #world .photo-inline-adjustments > summary {
  list-style: revert;
  cursor: pointer;
  color: #cfced4;
  font: calc(10 * var(--px))/1.6 var(--desktop-font,"Lucida Grande",sans-serif);
}

html[data-theme] #world .photo-inline-sliders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 20px;
  padding: 9px 1px 4px;
  max-width: 900px;
}

html[data-theme] #world .photo-inline-sliders > label {
  display: grid;
  gap: 4px;
  color: #e2e0e6;
  font-size: calc(10 * var(--px));
  min-width: 0;
}

html[data-theme] #world .photo-inline-sliders > label > span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

html[data-theme] #world .photo-inline-sliders output {
  font-size: calc(9 * var(--px));
  color: #acbfd5;
  font-variant-numeric: tabular-nums;
}

html[data-theme] #world .photo-inline-sliders input {
  width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  height: 18px;
  accent-color: #acc2da;
  cursor: ew-resize;
}

html[data-theme] #world .photo-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  flex-wrap: wrap;
}

html[data-theme] #world .photo-inline-actions > label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #dedce3;
  font-size: calc(10 * var(--px));
  cursor: pointer;
  white-space: nowrap;
}

html[data-theme] #world .photo-inline-actions input {
  width: 12px;
  height: 12px;
  min-width: 12px;
  margin: 0;
  accent-color: #a9c3df;
}

html[data-theme] #world .photo-inline-export {
  display: inline-flex;
  gap: 5px;
  margin-left: auto;
}

html[data-theme] #world .photo-inline-editor .photo-inline-status {
  padding: 0;
  margin: 6px 0 0;
  color: #d2cadc;
  font: calc(10 * var(--px))/1.35 var(--desktop-font,"Lucida Grande",sans-serif);
}

/* A narrow inspector for the player. Its host owns placement and scrolling. */
html[data-theme] #world .photo-inline-editor.photo-inline-sidebar {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border-top: 0;
  background: #302f34;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-section {
  display: block;
  margin: 0 0 7px;
  padding: 0;
  min-width: 0;
  border: 1px solid #58585f;
  border-radius: 3px;
  background: #29282d;
  color: #eeeef1;
  overflow: visible;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-section > summary {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 1px 6px;
  align-items: center;
  list-style: none;
  min-height: 31px;
  padding: 7px 8px;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(#e5e5e7, #bfc0c4);
  color: #2b2b30;
  box-shadow: inset 0 1px #fff9;
  font: calc(11 * var(--px))/1.45 var(--desktop-font,"Lucida Grande",sans-serif);
  cursor: pointer;
  user-select: none;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-section[open] > summary {
  border-bottom: 1px solid #5c5c62;
  border-radius: 2px 2px 0 0;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-section > summary::marker {
  content: '';
}

html[data-theme]
  #world
  .photo-inline-sidebar
  .photo-inline-section
  > summary::-webkit-details-marker {
  display: none;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-section > summary:before {
  content: '';
  grid-column: 1;
  grid-row: 1;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #54545b;
  justify-self: center;
  transform-origin: center;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-section[open] > summary:before {
  transform: rotate(90deg);
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-summary-label {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-current {
  display: block;
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  color: #575760;
  font-size: calc(9 * var(--px));
  line-height: 1.4;
  overflow-wrap: anywhere;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-presets button {
  width: 100%;
  min-height: 29px;
  padding: 4px 5px;
  margin: 0;
  border-radius: 3px;
  font-size: calc(10 * var(--px));
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-sliders {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
  max-height: none;
  overflow: visible;
  gap: 14px;
  padding: 12px 9px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-sliders > label {
  gap: 6px;
  font-size: 11px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-sliders output {
  font-size: 10px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-sliders input {
  height: 22px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin: 12px 0 0;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-actions > label {
  min-height: 24px;
  white-space: normal;
  font-size: calc(10 * var(--px));
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-actions > label input {
  flex: none;
  width: 13px;
  height: 13px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-actions > [data-inline-reset] {
  justify-self: start;
  min-height: 27px;
  padding-inline: 12px;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-export {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  margin: 3px 0 0;
  padding-top: 10px;
  border-top: 1px solid #55545b;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-export button {
  padding: 5px 3px;
  min-height: 30px;
  font-size: calc(10 * var(--px));
  white-space: normal;
}

html[data-theme] #world .photo-inline-sidebar .photo-inline-status {
  overflow-wrap: anywhere;
}

/* --- Overlay canvas and per-host adjustments: home viewer, then the cinema player --- */
html[data-theme] #world .photo-inline-media {
  position: relative;
  overflow: hidden;
}

html[data-theme] #world #home #desk-view .photo-inline-media img {
  object-fit: contain;
}

html[data-theme] #world #home #desk-view .photo-inline-media .photo-inline-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

html[data-theme] #world #home #desk-view .photo-inline-editor {
  padding: 7px 8px;
}

html[data-theme] #world #home #desk-view .photo-inline-label {
  display: none;
}

html[data-theme] #world #home #desk-view .photo-inline-presets {
  flex: 1;
}

html[data-theme] #world #home #desk-view .photo-inline-editor button {
  font-size: calc(10 * var(--px));
  padding: 4px 7px;
  min-height: 25px;
}

html[data-theme] #world #home #desk-view .photo-inline-sliders {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 13px;
  max-height: 92px;
  overflow: auto;
  scrollbar-width: thin;
  padding-right: 4px;
}

html[data-theme] #world #home #desk-view .photo-inline-actions {
  gap: 5px;
}

html[data-theme] #world #home #desk-view .photo-inline-actions > label {
  font-size: calc(9 * var(--px));
}

html[data-theme]
  #world
  #home
  #desk-view
  .photo-inline-editor
  .photo-inline-actions
  [data-inline-reset] {
  padding-inline: 5px;
  font-size: calc(9 * var(--px));
}

/* Bigger text (see --px in hyd-platform.css): the look and export buttons wrap onto more lines, each as wide as
   its word, instead of running into each other. */
@container not style(--px: 1px) {
  html[data-theme] #world #home #desk-view :is(.photo-inline-presets, .photo-inline-export) {
    display: flex;
    flex-wrap: wrap;
  }

  html[data-theme] #world #home #desk-view :is(.photo-inline-presets, .photo-inline-export) button {
    flex: 1 0 auto;
  }

  html[data-theme] #world #home #desk-view .photo-inline-actions > label {
    white-space: normal;
  }
}

/* --- Cinema player --- */
html[data-theme] #world #cinema .player-photo-editing {
  flex: none;
  min-width: 0;
}

html[data-theme] #world #cinema #big-screen .photo-inline-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  object-fit: contain;
  pointer-events: none;
  transform: scale(var(--photo-zoom,1));
  transform-origin: center;
  transition: transform 0.12s linear;
}

html[data-theme] #world #cinema.photo-paused #big-screen .photo-inline-canvas {
  transition: none;
}

html[data-theme] #world #cinema.photo-mode:has(.photo-inline-adjustments[open]) #play-preview {
  visibility: hidden;
  pointer-events: none;
}

html[data-theme]
  .cinema-expanded
  #world
  #cinema
  .photo-inline-editor:not(.photo-inline-sidebar)
  .photo-inline-sliders {
  max-height: 140px;
  overflow: auto;
}

/* --- Narrow screens --- */
@media (max-width: 620px) {
  html[data-theme] #world #cinema .photo-inline-editor {
    padding: 6px 8px;
  }

  html[data-theme] #world .photo-inline-sliders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
  }

  html[data-theme] #world .photo-inline-label {
    display: none;
  }

  html[data-theme] #world .photo-inline-presets {
    flex: 1;
  }

  html[data-theme] #world .photo-inline-editor button {
    padding-inline: 8px;
    font-size: calc(10 * var(--px));
  }

  html[data-theme] #world .photo-inline-actions {
    gap: 6px;
  }
}

/* Motion preferences: the zoom transition on the player canvas is dropped when reduced motion is
   requested or the site's motion-off class is set. */
@media (prefers-reduced-motion: reduce) {
  html[data-theme] #world #cinema #big-screen .photo-inline-canvas {
    transform: none;
    transition: none;
  }
}

html[data-theme] body.motion-off #world #cinema #big-screen .photo-inline-canvas {
  transform: none;
  transition: none;
}

/* Keep finishing an edit in the same aligned group as its other photo actions. */
html[data-theme] #world :is(#home, #cinema) .photo-inline-editor .photo-inline-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

html[data-theme]
  #world
  :is(#home, #cinema)
  .photo-inline-editor
  .photo-inline-actions
  .photo-inline-export {
  display: grid;
  grid-column: 1/-1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  margin: 0;
}

html[data-theme]
  #world
  :is(#home, #cinema)
  .photo-inline-editor
  .photo-inline-actions
  .photo-inline-export:has([data-inline-done]:not([hidden])) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Home viewer: an edit ended by a press elsewhere keeps its rows until the viewer closes (the phone viewer and the player editor are unchanged). */
@media (min-width: 621px) {
  html[data-theme]
    #world
    #home
    #desk-view
    .photo-inline-editor
    .photo-inline-actions
    .photo-inline-export:has([data-inline-done][data-reserved]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Reserved slot: Done stays laid out but invisible so the other buttons do not shift. The rule
     above also uses !important to hide [hidden] parts, so this one needs it too, and wins by being
     more specific. */
  html[data-theme]
    #world
    #home
    #desk-view
    .photo-inline-editor
    .photo-inline-actions
    [data-inline-done][data-reserved][hidden] {
    display: block !important;
    visibility: hidden;
  }
}

html[data-theme] #world :is(#home, #cinema) .photo-inline-editor .photo-inline-export button {
  width: 100%;
  white-space: normal;
}

html[data-theme]
  #world
  :is(#home #desk-view, #cinema)
  .photo-inline-editor
  .photo-inline-actions
  :is(button, label) {
  min-height: 32px;
}

@media (min-width: 621px) {
  html[data-theme] #world #cinema .player-photo-editing:not([hidden]) {
    overflow-y: auto;
  }
}

/* Touch targets: 44px minimum for the editor's buttons and labels on phones and coarse pointers.
   !important beats the compact 25px to 32px sizes set for the editor in the home viewer and player. */
@media (max-width: 620px), (any-pointer: coarse) {
  html[data-theme] #world .photo-inline-editor .photo-inline-actions :is(button, label) {
    min-height: 44px !important;
  }
}

/* Touch screens: after "save png" the copy also shows as a plain <img>, large, so a long press
   can save it where the download did not start (savedCopy in hyd-photo-lab.js). Inline it sits
   under the editor’s status line; in the Lab it lies over the preview, on the preview’s own
   ground. */
.photo-inline-saved {
  display: block;
  width: 100%;
  height: auto;
}

#hyd-photo-lab #photo-lab-saved {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  object-fit: contain;
  background: #17161a;
}
