:root { --gallery-serif: "Noto Serif SC", "Songti SC", "STSong", SimSun, "Palatino Linotype", Georgia, serif; }
@media (pointer: fine) and (forced-colors: none) {
  :is(html, #detail, #aboutDialog) {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb,var(--iris) 38%,var(--line)) var(--bg);
  }
  @supports not (scrollbar-width: thin) {
    :is(html, #detail, #aboutDialog)::-webkit-scrollbar { width: 7px; }
    :is(html, #detail, #aboutDialog)::-webkit-scrollbar-track { background: var(--bg); }
    :is(html, #detail, #aboutDialog)::-webkit-scrollbar-thumb {
      background: color-mix(in srgb,var(--iris) 38%,var(--line));
      border-radius: 999px;
    }
  }
}
.catalog .folio #explore {
  background: transparent;
  color: var(--iris);
  border: 1px solid color-mix(in srgb, var(--iris) 60%, var(--line));
  border-radius: 7px;
  transition: background-color 180ms, color 180ms;
}
.catalog .folio #explore:is(:hover,:focus-visible) {
  background: var(--iris);
  color: var(--bg);
}
.catalog .folio-description { color: color-mix(in srgb,var(--text) 65%,var(--muted)); }
.catalog .folio-orbit {
  translate: var(--orbit-x, 0px) var(--orbit-y, 0px);
  transition: translate 360ms ease-out;
}
.catalog .folio-orbit-track { animation: atlas-track-drift 74s ease-in-out infinite alternate; }
.catalog .folio-orbit-track:nth-child(3) { animation-duration: 89s; animation-direction: alternate-reverse; }
.catalog .folio-orbit-track:nth-child(4) { animation-duration: 68s; }
@keyframes atlas-track-drift {
  from { transform: rotate(calc(var(--tilt) - 7deg)) scaleY(var(--flatten)); }
  to { transform: rotate(calc(var(--tilt) + 7deg)) scaleY(var(--flatten)); }
}
.catalog #library { padding-bottom: clamp(58px, 7vw, 100px); }
.catalog #cards .card {
  border: 1px solid color-mix(in srgb,var(--line) 56%,transparent);
  border-radius: 9px;
  padding: 9px;
  background: color-mix(in srgb,var(--panel) 47%,var(--bg));
  box-shadow: 0 3px 12px color-mix(in srgb,var(--text) 4%,transparent);
}
.catalog #cards .card-image { border-radius: 6px; padding: 3px; }
.catalog #cards :is(.scene,.sheet) .card-image { padding: 5px; }
.catalog #cards .card-image img { border-radius: 4px; }
.catalog #cards .favorite {
  top: 15px; left: 15px;
  color: #3d405d; background: #fbfaffef;
  border: 1px solid #c9c8dc;
  box-shadow: 0 2px 8px #17162622;
}
.catalog #cards .favorite[aria-pressed=true] { color: #934655; }
.catalog #cards .card-title button { transition: color 180ms; }
.catalog #cards .card:is(:hover,:focus-within) .card-title button { color: var(--violet); }
@media (hover:hover) {
  .catalog #cards .card:hover .card-image img { transform: scale(1.02); }
}
.catalog #cards .tags span {
  border: 1px solid transparent;
  border-radius: 4px;
  background: color-mix(in srgb,var(--text) 5%,var(--bg));
  color: color-mix(in srgb,var(--muted) 70%,var(--text));
}
.catalog #library .toolbar :is(#workFilter,.search) {
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb,var(--muted) 42%,var(--line));
  border-radius: 0;
  background: transparent;
}
.catalog #library #workFilter { padding-inline: 8px; }
.catalog #library .search { box-sizing: border-box; padding-inline: 8px; }
.catalog #library .search input { border: 0; }
.catalog #library .search:focus-within,
.catalog #library #workFilter:focus-visible { border-bottom-color: var(--iris); }
@media (max-width: 600px) {
  .catalog #library .search { width: 100%; }
  .catalog #library .search input { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .catalog .folio-orbit { translate: none; transition: none; }
  .catalog .folio-orbit-track, .catalog .folio-orbit-track > span { animation: none; }
  .catalog #cards .card:hover .card-image img { transform: none; }
  .catalog .folio #explore, .catalog #cards .card-title button { transition: none; }
}
.header .view-switch button, #galleryTitle {
  font-family: var(--gallery-serif);
}
.header .view-switch button { font-weight: 600; }
#galleryTitle {
  font-weight: 600;
  letter-spacing: .10em;
  line-height: 1.36;
}
.header .header-tools :is(.theme-toggle, .my-stars) {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-inline: 6px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 700;
}
.header .header-tools #favCount { font-size: 12px; font-weight: 600; }
.header .header-tools :is(.theme-toggle, .my-stars):is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}
#imageGallery { position: relative; isolation: isolate; padding-top: clamp(20px, 4vw, 44px); }
#imageGallery::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 0 0 auto;
  height: min(78vh, 650px);
  color: var(--accent);
  background:
    radial-gradient(circle at 8px 13px, currentColor 0 .75px, transparent 1.2px) 6px 8px / 137px 103px,
    radial-gradient(circle at 22px 17px, currentColor 0 1px, transparent 1.5px) 58px 41px / 173px 151px;
  opacity: .13;
  mask-image: linear-gradient(#000 5%, #0008 55%, transparent);
}
#imageGrid { --gallery-gap: clamp(20px, 2vw, 24px); columns: 210px; column-gap: var(--gallery-gap); column-fill: balance; }
#imageGrid .gallery-frame {
  position: relative;
  isolation: isolate;
  display: block;
  border-radius: 6px;
  margin: 0 0 var(--gallery-gap);
  overflow: hidden;
  break-inside: avoid;
}
#imageGrid .gallery-surface {
  display: grid; width: 100%; place-items: center; overflow: hidden;
  padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: zoom-in;
}
#imageGrid .gallery-frame[data-state="loading"] .gallery-surface {
  aspect-ratio: var(--gallery-ratio, 4 / 5);
  background: linear-gradient(110deg, var(--panel) 30%, color-mix(in srgb,var(--accent) 13%,var(--panel)) 50%, var(--panel) 70%);
  background-size: 240% 100%;
  animation: gallery-shimmer 2.6s ease-in-out infinite;
}
#imageGrid .gallery-frame[data-state="loading"] img { opacity: 0; }
#imageGrid .gallery-frame[data-state="error"] .gallery-surface {
  min-height: 108px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
#imageGrid .gallery-image { transition: transform 380ms ease, filter 380ms ease; }
#imageGrid .gallery-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 25px 12px 10px;
  background: linear-gradient(transparent, #101020df);
  color: #fff;
  font: 600 15px/1.4 var(--gallery-serif);
  letter-spacing: .055em;
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 240ms ease, transform 240ms ease;
}
#imageGrid .gallery-caption small {
  display: block;
  margin-bottom: 3px;
  font: 10px/1.35 Georgia, serif;
  letter-spacing: .14em;
}
#imageGrid .gallery-frame[data-state="ready"]:is(:hover,:focus-within) .gallery-image { transform: scale(1.02); filter: brightness(.91); }
#imageGrid .gallery-frame[data-state="ready"]:is(:hover,:focus-within) .gallery-caption { opacity: 1; transform: none; }
#imageGrid .gallery-surface:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.gallery-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 0 0 22px; }
#galleryFilters { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-filter {
  border: 1px solid var(--line); background: transparent; color: var(--text);
  border-radius: 999px; padding: 4px 13px; min-height: 33px;
  font: 500 12px/1 var(--gallery-serif); letter-spacing: .05em;
}
.gallery-filter:is(:hover,[aria-pressed="true"]) {
  border-color: var(--accent); background: color-mix(in srgb,var(--accent) 10%,var(--bg)); color: var(--accent);
}
#galleryCount { font: 12px/1.4 var(--gallery-serif); color: var(--muted); margin: 0; }
html:has(#galleryLightbox[open]) { overflow: hidden; }
#galleryLightbox {
  position: fixed; inset: 0; margin: 0; padding: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; border: 0; border-radius: 0;
  background: transparent; color: white; overflow: hidden; box-shadow: none;
}
#galleryLightbox[open] {
  display: grid;
  grid-template-columns: minmax(48px, 7vw) minmax(0, 1fr) minmax(48px, 7vw);
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
}
#galleryLightbox::backdrop {
  background: rgba(10,15,30,.47);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}
#galleryLightFrame {
  display: grid; justify-items: center; align-content: center; gap: 12px;
  margin: 0; min-width: 0; min-height: 0;
}
#galleryLightImage {
  display: block; width: auto; height: auto;
  max-width: min(100%, 72vw, 860px);
  max-height: min(65dvh, 680px);
  object-fit: contain;
  border-radius: 6px;
}
#galleryLightFrame:not([data-state="ready"]) img,
#galleryLightFrame:not([data-state="loading"]) .light-loading,
#galleryLightFrame:not([data-state="error"]) .light-error { display: none; }
#galleryLightCaption { padding: 0 6px; text-align: center; color: #eceeff; font: 14px/1.5 var(--gallery-serif); letter-spacing: .09em; overflow-wrap: anywhere; }
#galleryLightCaption a { color: inherit; text-decoration: underline; }
#galleryFacets {display:flex;flex-wrap:wrap;gap:8px 14px;margin:12px 0;}
#galleryFacets .work-filter {min-width:0;max-width:100%;}
#galleryFacets select {min-width:0;max-width:min(260px,68vw);}
.gallery-pagination {display:flex;justify-content:center;margin:20px 0 0;}
#imageGrid .gallery-image-retry {margin:8px;min-height:44px;}
#galleryLightbox button {
  z-index: 1; justify-self: center; display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 50%; border: 1px solid #ffffff3d; color: #fff; background: #ffffff0a;
  font: 26px/1 Georgia,serif; cursor: pointer;
}
#galleryLightbox button:is(:hover,:focus-visible) { background: #ffffff24; }
#galleryLightbox button:disabled { opacity: .3; cursor: default; }
#galleryLightClose { position: absolute; top: 13px; right: 16px; }
#galleryLightbox[open]:has(> #galleryLightSurface) { display: block; padding: 0; height: 100dvh; }
#galleryLightSurface {
  position: relative;
  display: grid;
  grid-template-columns: minmax(44px, 7vw) minmax(0, 1fr) minmax(44px, 7vw);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%; height: 100%;
  padding: max(3.8rem, calc(env(safe-area-inset-top) + 3rem)) 0 max(.65rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
}
#galleryLightSurface:fullscreen { background: #101220; }
#galleryLightSurface :is(#galleryLightClose, #gallerySave) { position: absolute; }
#galleryLightSurface #galleryLightClose { top: max(.6rem, env(safe-area-inset-top)); right: max(.75rem, env(safe-area-inset-right)); }
#galleryLightSurface #gallerySave { width: auto; font: 500 .9rem/1.2 system-ui, sans-serif; }
#galleryLightbox #galleryLightSurface #galleryLightFrame {
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: stretch;
  align-content: stretch;
  min-width: 0; height: 100%;
  touch-action: auto;
}
#galleryLightViewport {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0; min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
#galleryLightbox #galleryLightSurface #galleryLightImage {
  /* Fit the unzoomed image to the viewport, independent of the grid item's intrinsic size. */
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
}
#galleryLightViewport[data-zoomed] { cursor: grab; }
#galleryLightViewport[data-zoomed]:active { cursor: grabbing; }
#galleryLightSurface #galleryLightCaption { max-height: min(5.5rem, 21dvh); overflow: auto; }
.gallery-light-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .4rem;
  padding: .35rem .4rem 0;
}
.gallery-light-zoom,
#galleryLightSurface #galleryImmersiveControls { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; position: static; }
#galleryLightbox #galleryLightSurface button { min-width: 44px; min-height: 44px; }
#galleryLightbox #galleryLightSurface :is(#galleryZoomReset, #galleryLightFullscreen, #galleryImmersiveControls button) {
  width: auto; border-radius: .6rem; padding: 0 .55rem;
  font: 500 .85rem/1.2 system-ui, sans-serif;
}
#galleryViewportStatus { position: absolute; right: .75rem; top: 3rem; margin: .35rem; }
#galleryViewportStatus:empty { display: none; }
@keyframes gallery-shimmer { from { background-position: 150% 0; } to { background-position: -70% 0; } }
@media (max-width: 600px) {
  #galleryLightImage { max-width: 100%; max-height: 65dvh; }
  #imageGrid { --gallery-gap: 12px; columns: 2; }
  .header .header-tools :is(.theme-toggle,.my-stars) { min-width: 36px; min-height: 36px; }
}
@media (hover: none) {
  #imageGrid .gallery-frame[data-state="ready"] .gallery-caption { opacity: 1; transform: none; font-size: 13px; padding: 16px 8px 6px; }
  #imageGrid .gallery-caption small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #imageGrid .gallery-frame[data-state="loading"] .gallery-surface { animation: none; }
  #imageGrid .gallery-image, #imageGrid .gallery-caption { transition: none; }
  #imageGrid .gallery-frame[data-state="ready"]:is(:hover,:focus-within) .gallery-image { transform: none; }
}
