.gallery-detail-layout { --gallery-panel-top-space: 24px; grid-template-columns: minmax(0, 1fr) 290px; gap: 30px; }
.gallery-character-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.gallery-character-heading h1 { margin: 0; line-height: 1.18; }
.gallery-character-heading > p.gallery-character-franchise { margin: 0; padding-left: 2px; color: #b3aaa0; font-size: clamp(.9rem, 1.6vw, 1.1rem); line-height: 1.35; letter-spacing: .01em; }
.gallery-comparison { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; min-width: 0; overflow-anchor: none; }
.gallery-reference-panel, .gallery-carousel { --gallery-panel-color: #f5f3f0; position: relative; width: 100%; min-width: 0; margin-top: var(--gallery-panel-top-space); padding: 32px 12px 12px; background: transparent; border: 2px solid var(--gallery-panel-color); border-radius: 22px; }
.gallery-carousel { --media-ratio: .625; --gallery-panel-color: #efb7d5; }
.gallery-carousel__frame { position: relative; aspect-ratio: var(--media-ratio); max-height: 65vh; overflow: hidden; border-radius: 16px; background: transparent; touch-action: pan-y pinch-zoom; }
.gallery-carousel__frame img { -webkit-user-drag: none; user-select: none; }
.gallery-carousel__frame.is-dragging { cursor: grabbing; user-select: none; }
.gallery-reference-masonry { display: flex; gap: 8px; align-items: flex-start; }
.gallery-reference-masonry > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.gallery-reference-masonry > a { flex: 1; min-width: 0; }
.gallery-reference-masonry a { display: block; overflow: hidden; border-radius: 12px; }
.gallery-reference-masonry img { display: block; width: 100%; height: auto; }
.gallery-carousel__slide { position: absolute; inset: 0; }
.gallery-carousel__slide[hidden] { display: none; }
.gallery-carousel__slide > a { position: relative; display: block; width: 100%; height: 100%; }
.gallery-carousel__slide img, .gallery-carousel__slide video { position: absolute; inset: 0; margin: auto; display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 16px; }
.gallery-media-caption { position: absolute; z-index: 3; top: -1px; left: 50%; transform: translate(-50%, -50%); max-width: calc(100% - 16px); }
.gallery-media-pill { margin: 0; padding: 11px 24px; border-radius: 999px; background: var(--gallery-panel-color); color: #252329; font-size: clamp(.9rem, 1.8vw, 1.15rem); font-weight: 800; line-height: 1.2; letter-spacing: .02em; }
.gallery-carousel__position { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 7px; min-height: 12px; margin-top: 12px; }
.gallery-carousel__dot { display: grid; place-items: center; flex: 0 0 auto; width: auto; height: 8px; padding: 0; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.gallery-carousel__dot::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: #ffffff55; transition: width 180ms ease, background 180ms ease; }
.gallery-carousel__dot[data-active="true"]::before { width: 23px; background: #fff; }
.gallery-carousel__dot:hover::before { background: #ffffffbb; }
.gallery-carousel__dot:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.gallery-video-expand { position: absolute; z-index: 2; top: 10px; right: 10px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #0006; color: white; backdrop-filter: blur(8px); cursor: pointer; }
.gallery-video-expand:hover { background: #0009; }
.gallery-video-expand:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.gallery-carousel__slide video[data-gallery-autoplay] { cursor: zoom-in; }
.gallery-lightbox video { display: block; width: auto; height: auto; max-width: 90vw; max-height: 90dvh; border-radius: 16px; }
.gallery-lightbox [hidden] { display: none; }

.gallery-lightbox-media-view {
  --gallery-lightbox-panel-width: clamp(16rem, 29vw, 23rem);
  display: grid;
  place-items: center;
  color: #f5f5f5;
}
.gallery-lightbox-media-stage { position: relative; min-width: 0; }
.gallery-lightbox-media-stage :is(img, video) { object-fit: contain; touch-action: pan-y pinch-zoom; }
.gallery-lightbox-media-stage:has([data-lightbox-direction]:not([hidden])) img { cursor: grab; }
.gallery-lightbox-media-stage:has([data-lightbox-direction]:not([hidden])) img:active { cursor: grabbing; }
.gallery-lightbox-media-stage [data-lightbox-image-status]:not([hidden]) {
  display: grid;
  place-items: center;
  min-width: 3rem;
  min-height: 3rem;
}
.gallery-lightbox-media-stage:has([data-lightbox-direction]:not([hidden])) [data-lightbox-image-status] {
  min-width: min(16rem, 90vw);
}
@media (prefers-reduced-motion: reduce) {
  [data-lightbox-image-status] .loading { animation: none; }
}
.gallery-generation-copy,
.gallery-generation-prompt-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: .8rem;
}
.gallery-generation-copy {
  color: var(--gallery-prompt-color);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem;
  border-radius: .45rem;
  white-space: nowrap;
}
.gallery-generation-copy:hover,
.gallery-generation-copy:focus-visible { background: #363636; }
.gallery-generation-prompt-toggle:hover { text-decoration: underline; }
.gallery-generation-copy:focus-visible,
.gallery-generation-prompt-toggle:focus-visible { outline: 2px solid #e3e3e3; outline-offset: 2px; }
.gallery-generation-panel .tooltip::before,
.gallery-generation-panel .tooltip::after {
  position: fixed;
  inset: auto auto calc(100% - var(--gallery-tooltip-y) + .5rem) clamp(5rem, var(--gallery-tooltip-x), 100vw - 5rem);
  transform: translateX(-50%);
  transition: none;
}
.gallery-generation-panel .tooltip::after {
  bottom: calc(100% - var(--gallery-tooltip-y) + .25rem);
}
.gallery-generation-panel .tooltip[data-tooltip-below]::before,
.gallery-generation-panel .tooltip[data-tooltip-below]::after {
  top: calc(var(--gallery-tooltip-y) + .5rem);
  bottom: auto;
}
.gallery-generation-panel .tooltip[data-tooltip-below]::after {
  top: calc(var(--gallery-tooltip-y) + .25rem);
  transform: translateX(-50%) rotate(180deg);
}
.gallery-lightbox-panels {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: var(--gallery-lightbox-panel-width);
  max-height: 88dvh;
}
.gallery-lightbox-panels:not(:has(> :not([hidden]))) { display: none; }
.gallery-lightbox-panel {
  padding: 1rem;
  overflow: auto;
  border: 1px solid #363636;
  border-radius: .875rem;
  background: #1a1a1a;
  overflow-wrap: anywhere;
}
.gallery-lightbox-panel h2 {
  font-size: 1.3rem;
  line-height: 1.25;
  font-weight: 700;
}
.gallery-lightbox-reference h2 > span {
  display: block;
  margin-bottom: .3rem;
  color: #b4b4b4;
  font-size: .85rem;
  font-weight: 500;
}
.gallery-lightbox-reference h2 > strong {
  display: block;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .025em;
}
.gallery-lightbox-reference p {
  margin-top: .65rem;
  color: #ddd;
  font-size: .9rem;
  line-height: 1.5;
}
.gallery-generation-panel {
  --gallery-generation-control: #252525;
  --gallery-prompt-color: #ddd;
  --color-neutral: #363636;
  --color-neutral-content: #f5f5f5;
}
.gallery-generation-actions { display: flex; align-items: center; gap: .25rem; }
.gallery-generation-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0; }
.gallery-generation-software {
  width: fit-content;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: #3b3043;
  color: #f5d8fb;
  font-size: .75rem;
}
.gallery-generation-software[data-generator="comfyui"] { background: #213e3c; color: #b8f0e5; }
.gallery-generation-software-h3 { background: #56311b; color: #ffbe88; }
.gallery-generation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: .85rem 0 .3rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.gallery-generation-textbox {
  padding: .6rem .75rem;
  border-radius: .5rem;
  background: var(--gallery-generation-control);
}
.gallery-generation-prompt { white-space: pre-wrap; color: var(--gallery-prompt-color); font-size: .85rem; }
.gallery-generation-prompt-clamped {
  max-height: calc(var(--gallery-prompt-lines) * 1lh);
  overflow: hidden;
}
.gallery-generation-prompt-clamped[data-prompt-overflow] {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1lh), transparent);
}
.gallery-generation-prompt-toggle { margin-top: .3rem; padding: 0; color: #aaa; }
.gallery-generation-settings {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .85rem 0;
}
.gallery-generation-settings div {
  display: flex;
  gap: .35rem;
  padding: .2rem .45rem;
  border-radius: .35rem;
  background: var(--gallery-generation-control);
  font-size: .75rem;
}
.gallery-generation-settings dt { color: #c4c4c4; }

@media (min-width: 701px) {
  .gallery-lightbox-media-view:has(.gallery-lightbox-panel:not([hidden])) {
    width: calc(100vw - 2rem);
    grid-template-columns: minmax(0, 1fr) auto minmax(min-content, 1fr);
    gap: 1rem;
  }
  .gallery-lightbox-media-stage { grid-column: 2; grid-row: 1; }
  .gallery-lightbox-panels { grid-column: 3; grid-row: 1; justify-self: start; }
  .gallery-lightbox-media-view:has(.gallery-lightbox-panel:not([hidden])) :is(img, video) {
    max-width: calc(100vw - var(--gallery-lightbox-panel-width) - 4rem);
  }
}
@media (max-width: 700px) {
  .gallery-lightbox-media-view:has(.gallery-lightbox-panel:not([hidden])) {
    width: calc(100vw - 2rem);
    height: calc(100dvh - 2rem);
    grid-template-rows: minmax(0, 1fr) auto minmax(min-content, 1fr);
    gap: .65rem;
  }
  .gallery-lightbox-media-stage { grid-row: 2; }
  .gallery-lightbox-panels {
    grid-row: 3;
    align-self: start;
    width: min(100%, 28rem);
    max-height: min(45dvh, calc(100dvh - 7rem));
  }
  .gallery-lightbox-media-view:has(.gallery-lightbox-panel:not([hidden])) :is(img, video) {
    max-height: min(43dvh, calc(55dvh - 3.3rem));
  }
}
.gallery-carousel__arrow { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: #ffffff73; color: #343039bb; box-shadow: none; backdrop-filter: blur(8px); line-height: 1; cursor: pointer; transition: background .15s, color .15s; }
.gallery-carousel__arrow:hover { background: #ffffffb3; color: #343039; }
.gallery-carousel__arrow--previous { left: 10px; }
.gallery-carousel__arrow--next { right: 10px; }
.gallery-carousel:focus-visible, .gallery-carousel__arrow:focus-visible { outline: 3px solid #d193b6; outline-offset: 4px; }
.gallery-carousel__empty, .gallery-media-empty { padding: 25px 10px; text-align: center; font-size: .85rem; line-height: 1.8; color: #aaa29a; }
.gallery-carousel__empty { position: absolute; inset: 0; display: grid; place-items: center; }
@media (min-width: 801px) {
  .gallery-sidebar { margin-top: var(--gallery-panel-top-space); }
}
@media (max-width: 1000px) and (min-width: 801px) {
  .gallery-detail-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
  .gallery-comparison { gap: 12px; }
  .gallery-carousel__arrow { width: 34px; height: 34px; }
}
@media (max-width: 800px) {
  .gallery-detail-layout { display: flex; }
  .gallery-comparison { width: 100%; gap: 12px; }
  .gallery-reference-panel, .gallery-carousel { padding: 28px 8px 10px; }
  .gallery-media-pill { padding: 10px 15px; }
}
@media (max-width: 640px) {
  .gallery-comparison { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .gallery-media-pill { font-size: 1.05rem; padding: 11px 24px; }
}
@media (prefers-reduced-motion: reduce) { .gallery-carousel__arrow, .gallery-carousel__dot::before { transition: none; } }
