/* 16-lightbox: the gallery detail view; history keeps its own content layout. */
#lb .lb-bg { background: rgb(32 37 48 / .43); backdrop-filter: blur(2px); }
#lb .lb-box { inset: 0; width: min(1432px,calc(100vw - 64px)); height: min(725px,calc(100dvh - 64px)); max-width: none; margin: auto; border-radius: 16px; }
#lb[data-mode=gallery] .lb-side { display: flex; flex-direction: column; width: 474px; min-width: 0; padding: 62px 36px 60px 38px; overflow: hidden; }
#lb .lb-img { margin: 18px 0 18px 18px; border-radius: 10px; background: var(--sf); }
#lb .lb-stage { max-width: 100%; max-height: 100%; }
#lb .lb-stage #lbImg { max-height: min(689px,calc(100dvh - 100px)); object-fit: contain; mix-blend-mode: normal; }
#lb .lb-img[data-img-type=pose] #lbImg { mix-blend-mode: multiply; }
#lb .lb-img .lb-nav { top: 50%; width: 45px; height: 45px; border: 0; background: rgb(42 49 58 / .46); color: #fff; box-shadow: none; font-size: 35px; font-weight: 300; }
#lb .lb-img .prev { left: 15px; }
#lb .lb-img .next { right: 15px; }
#lb .lb-x { width: 36px; height: 36px; right: 20px; top: 20px; background: transparent; color: var(--tx2); font-size: 23px; }
#lbImageCount { position: absolute; z-index: 3; left: 15px; bottom: 15px; padding: 7px 18px; border-radius: 25px; background: rgb(36 41 50 / .58); color: #fff; font-size: 17px; }
#lb[data-mode=history] #lbImageCount { display: none; }
#lb .lb-tools { left: auto; right: 15px; bottom: 15px; transform: none; gap: 0; padding: 3px 6px; background: rgb(24 27 32 / .7); border: 0; border-radius: 22px; }
#lb .lb-tools button { min-height: 32px; padding: 5px 7px; color: #fff; font-size: 13px; }
#lbZoom { width: 62px; min-height: 32px; padding: 5px 4px; border: 0; background: transparent; color: #fff; font-size: 15px; cursor: pointer; }
#lbZoom option { color: var(--tx); background: var(--bg2); }
#lb[data-mode=gallery] .lb-side h2 { flex: none; margin: 0 0 22px; font-size: 28px; line-height: 1.4; }
.lb-info-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.lb-prompt-tabs { display: flex; gap: 30px; margin-bottom: 16px; }
.lb-prompt-tabs button { position: relative; min-height: 40px; padding: 0 0 12px; border-radius: 0; background: transparent; color: var(--mu); font-size: 18px; font-weight: 500; }
.lb-prompt-tabs button[aria-selected=true] { color: var(--ac); }
.lb-prompt-tabs button[aria-selected=true]::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--ac); }
#lb[data-mode=gallery] .pbox { position: relative; margin: 0 0 40px; padding: 17px 18px 21px; border: 0; border-radius: 14px; background: var(--sf); }
#lb[data-mode=gallery] .pbox p { margin: 0; padding: 0 20px 0 0; color: var(--tx2); font: 18px/1.7 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
#lb[data-mode=gallery] .pbox-cp { position: absolute; bottom: 12px; right: 12px; display: grid; place-items: center; width: 32px; height: 32px; padding: 6px; background: transparent; color: var(--tx2); }
.lb-angles { margin-bottom: 30px; padding-top: 30px; border-top: 1px solid var(--line); }
.lb-angles h3 { margin: 0 0 20px; font-size: 19px; }
#lb[data-mode=gallery] .angsel { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 0; }
#lb[data-mode=gallery] .angsel button { position: relative; min-width: 0; padding: 0; border: 1.5px solid transparent; border-radius: 13px; background: var(--sf); overflow: hidden; }
#lb[data-mode=gallery] .angsel button.on { border-color: var(--ac); }
.lb-angles img { display: block; width: 100%; aspect-ratio: .87; object-fit: cover; }
.lb-angles button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lb-more { margin: 16px 0 22px; color: var(--mu); font-size: 13px; }
.lb-more > summary { min-height: 32px; cursor: pointer; }
.lb-more .acts { margin: 12px 0; }
.lb-primary-actions { display: grid; grid-template-columns: .61fr 1fr; flex: none; gap: 16px; margin-top: 20px; padding-top: 28px; border-top: 1px solid var(--line); }
.lb-primary-actions button { min-width: 0; min-height: 55px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: transparent; color: var(--tx); font-size: 18px; }
.lb-primary-actions button > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.lb-primary-actions svg { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lb-primary-actions .on { color: var(--ac); }
.lb-primary-actions .on svg { fill: var(--acs); }
.lb-primary-actions .pri { background: var(--ac); border-color: var(--ac); color: #fff; }
#lb button:focus-visible, #lb select:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
@media(max-width:1100px) and (min-width:901px) {
  #lb[data-mode=gallery] .lb-side { width: 370px; padding: 55px 24px 30px; }
  .lb-prompt-tabs { gap: 18px; }
}
@media(max-width:900px) {
  #lb .lb-box { inset: 12px; transform: none; width: auto; height: auto; flex-direction: column; border-radius: 16px; overflow: hidden; }
  #lb .lb-img { flex: none; height: min(45dvh,430px); margin: 12px 12px 0; border-radius: 10px; }
  #lb .lb-stage #lbImg { max-height: min(45dvh,430px); }
  #lb[data-mode=gallery] .lb-side { flex: 1; min-height: 0; width: 100%; padding: 18px 20px 16px; }
  #lb[data-mode=gallery] .lb-side h2 { margin-bottom: 12px; font-size: 23px; }
  #lb .lb-x { position: fixed; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%; background: var(--bg2); z-index: 5; }
  #lb[data-mode=gallery] .pbox { margin-bottom: 20px; }
  #lb[data-mode=gallery] .pbox p { font-size: 15px; }
  .lb-prompt-tabs { gap: 24px; }
  .lb-prompt-tabs button { flex: 1; min-width: 0; white-space: normal; font-size: 16px; }
  .lb-primary-actions { gap: 12px; margin-top: 10px; padding-top: 12px; }
  .lb-primary-actions button { min-height: 46px; font-size: 15px; }
  .lb-angles { padding-top: 20px; }
  .lb-angles img { aspect-ratio: 1; }
  #lb .lb-tools { right: 8px; bottom: 8px; max-width: calc(100% - 16px); }
  #lb .lb-tools button { width: 30px; padding: 5px; }
  #lb .lb-tools button span { display: none; }
  #lbImageCount { left: 8px; bottom: 8px; padding: 5px 10px; font-size: 12px; }
  #lb[data-mode=history] .lb-side { flex: 1; min-height: 0; overflow: auto; }
}
