:root { color-scheme: dark; font-family: Inter, "Segoe UI", system-ui, sans-serif; background: #111315; color: #f0f1f2; }
/* Keep the layout width stable while filtering replaces a long result list. */
html { scrollbar-gutter: stable; }
html[data-preview-embedded="true"] { background: transparent; scrollbar-gutter: auto; }
html[data-preview-embedded="true"] main { display: none; }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #ccd8e0; }
/* Preserve sharp pixels in previews and when enlarging thumbnails. */
img { image-rendering: pixelated; image-rendering: crisp-edges; }
main { max-width: 1500px; padding: 56px 40px 80px; margin: auto; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 550; letter-spacing: -.03em; }
.tag-options { display: flex; flex-wrap: wrap; gap: 8px; }
[hidden] { display: none !important; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; }
#gallery[data-fixed-columns] { grid-template-columns: repeat(var(--gallery-columns), minmax(0, 1fr)); }
#gallery[data-fixed-columns] .art { container-type: inline-size; }
.art { margin: 0; animation: art-appear 360ms cubic-bezier(.22, 1, .36, 1) backwards; }
.art:nth-child(6n + 2) { animation-delay: 35ms; }
.art:nth-child(6n + 3) { animation-delay: 70ms; }
.art:nth-child(6n + 4) { animation-delay: 105ms; }
.art:nth-child(6n + 5) { animation-delay: 140ms; }
.art:nth-child(6n + 6) { animation-delay: 175ms; }
@keyframes art-appear {
  from { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .art { animation: none; } }
.load-more { min-height: 64px; padding-top: 28px; text-align: center; color: #98a2aa; font-size: 14px; }
#retry-load, #retry-tags { padding: 10px 16px; background: #262c31; color: #e0e6eb; border: 1px solid #3a4248; border-radius: 5px; cursor: pointer; }
.art-open { --card-height: 270px; --card-padding: 18px; display: flex; align-items: center; justify-content: center; width: 100%; height: var(--card-height); border: 1px solid #292d31; border-radius: 6px; background: #1b1e21; padding: var(--card-padding); cursor: zoom-in; transition: border-color .15s, background .15s; }
#gallery[data-fixed-columns] .art-open { --card-height: clamp(140px, 100cqw, 360px); --card-padding: clamp(10px, 7cqw, 18px); }
.art-open:hover { border-color: #717a81; background: #202428; }
.art-open, .preview-image { -webkit-user-select: none; user-select: none; }
button:focus-visible { outline: 2px solid #ccd8e0; outline-offset: 4px; }
.art-open img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.art-thumbnail-surface {
  width: min(100%, calc((var(--card-height) - 2 * var(--card-padding) - 2px) * var(--card-ratio, 1)));
  aspect-ratio: var(--card-ratio, 1);
}
.art-open .art-thumbnail { width: 100%; height: 100%; object-fit: contain; }
html[data-art-smoothing="on"] .art-thumbnail[data-downscaled] { image-rendering: auto; }
figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 2px 2px; }
.art-title { font-size: 14px; font-weight: 550; }
#gallery[data-fixed-columns] .art-title, #gallery[data-fixed-columns] .art-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-size { font-size: 12px; color: #a3abb2; white-space: nowrap; }
.art-detail { display: none; color: #a3abb2; font-size: 12px; margin: 4px 2px 0; }
html[data-admin-mode="true"] .art-detail { display: block; }
#gallery[data-block-layout] {
  grid-template-columns: repeat(var(--block-layout-columns, 1), var(--block-layout-unit, 96px));
  grid-auto-rows: var(--block-layout-unit, 96px);
  grid-auto-flow: row dense;
  gap: var(--block-layout-gap, 8px);
}
#gallery[data-block-layout] .art {
  grid-column: span var(--block-card-columns, 1);
  grid-row: span var(--block-card-rows, 1);
  position: relative;
  min-width: 0;
  min-height: 0;
  animation: none;
}
#gallery[data-block-layout] .art-open {
  position: relative;
  height: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px #343a40;
}
#gallery[data-block-layout] .art-open:hover, #gallery[data-block-layout] .art-open:focus-visible {
  box-shadow: 0 0 0 1px #98b4a4;
}
#gallery[data-block-layout] .art-open:focus-visible { outline: 2px solid #98b4a4; outline-offset: 2px; }
#gallery[data-block-layout] .art-thumbnail-surface {
  flex: none;
  width: var(--block-card-width, 100%);
  height: var(--block-card-height, 100%);
  aspect-ratio: auto;
}
#gallery[data-block-layout] .art[data-width-blocks="1"][data-height-blocks="1"] .art-thumbnail {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#gallery[data-block-layout] :is(figcaption, .art-detail) {
  position: absolute;
  inset-inline: 4px;
  bottom: 4px;
  margin: 0;
  padding: 4px 5px;
  border-radius: 4px;
  background: #111315eb;
  opacity: 0;
  pointer-events: none;
}
#gallery[data-block-layout] .art:has(.art-open:focus-visible) :is(figcaption, .art-detail) { opacity: 1; }
@media (hover: hover) {
  #gallery[data-block-layout] .art:hover :is(figcaption, .art-detail) { opacity: 1; }
}
#gallery[data-block-layout] figcaption {
  gap: 4px;
  line-height: 15px;
}
html[data-admin-mode="true"] #gallery[data-block-layout] figcaption { bottom: 23px; border-radius: 4px 4px 0 0; }
#gallery[data-block-layout] .art-title, #gallery[data-block-layout] .art-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#gallery[data-block-layout] .art-title { font-size: 12px; }
#gallery[data-block-layout] .art-size { font-size: 11px; }
#gallery[data-block-layout] .art-detail { padding-block: 2px 4px; border-radius: 0 0 4px 4px; line-height: 13px; }
@media (prefers-reduced-motion: no-preference) {
  #gallery[data-block-layout] .art-open::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: #1b1e21;
    opacity: 0;
    animation: block-card-reveal 260ms ease-out;
  }
  @keyframes block-card-reveal { from { opacity: 1; } }
}
dialog { width: min(1200px, 96vw); max-height: 94vh; padding: 24px; border: 1px solid #3a4248; border-radius: 10px; background: #16191c; color: inherit; }
dialog::backdrop { background: #000c; backdrop-filter: blur(5px); }
.preview-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.preview-toolbar > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.preview-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.preview-3d { padding: 10px 14px; border-radius: 6px; color: #14251b; background: #bbdeca; font-size: 13px; text-decoration: none; white-space: nowrap; }
.preview-3d:hover { background: #d0eddd; }
#preview {
  --preview-inset: 24px;
  --preview-min-width: 400px;
  --preview-nav-inset: clamp(12px, 2vw, 24px);
  --preview-nav-bottom: calc(var(--preview-nav-inset) + env(safe-area-inset-bottom, 0px));
  --preview-nav-button-height: 44px;
  --preview-nav-space: calc(var(--preview-nav-bottom) + var(--preview-nav-button-height) + 12px);
  --preview-height-limit: max(140px, min(70dvh, calc(94dvh - 232px)));
  /* Give small maps a readable long edge while retaining their aspect ratio. */
  --preview-art-width: max(var(--art-width, 0px), calc(480px * min(1, var(--art-ratio, 1))));
  --preview-width: min(var(--preview-art-width), calc(var(--preview-height-limit) * var(--art-ratio, 1)));
  width: min(1200px, calc(100vw - 24px), max(var(--preview-min-width), calc(var(--preview-width) + 2 * var(--preview-inset) + 2px)));
  max-height: min(94dvh, calc(100dvh - 24px - env(safe-area-inset-bottom, 0px)));
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
#preview[open] { display: flex; flex-direction: column; }
#preview:has(.preview-navigation:not([hidden])) {
  inset-block-end: var(--preview-nav-space);
  max-height: min(94dvh, calc(100dvh - var(--preview-nav-space) - 12px));
}
.preview-panel {
  position: relative;
  min-height: 0;
  padding: var(--preview-inset);
  border: 1px solid #3a4248;
  border-radius: 10px;
  background: #16191c;
  overflow: auto;
  overscroll-behavior: contain;
}
#preview[data-projection="true"] { width: min(880px, calc(100vw - 24px)); }
#preview[data-editing] { width: min(1160px, calc(100vw - 24px)); }
#preview[data-editing] .preview-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(275px, 335px); gap: 22px; align-items: start; }
.preview-workspace { min-width: 0; }
.preview-inspector {
  display: flex; flex-direction: column; min-width: 0; min-height: 220px; max-height: var(--preview-height-limit);
  background: #1b2822; border: 1px solid #3c5548; border-radius: 9px;
}
.inspector-tabs, .editor-pane-switch { display: flex; align-items: stretch; gap: 5px; }
.inspector-tabs { flex: none; padding: 9px; border-bottom: 1px solid #3c5548; }
.inspector-tabs button, .editor-pane-switch button {
  flex: 1; min-width: 0; min-height: 37px; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: #ccd8d0; font: inherit; font-size: 13px; cursor: pointer;
}
.inspector-tabs button:is(:hover, :focus-visible), .editor-pane-switch button:is(:hover, :focus-visible) { border-color: #90b3a1; }
.inspector-tabs button[aria-selected="true"], .editor-pane-switch button[aria-pressed="true"] {
  border-color: #bbdeca; background: #bbdeca; color: #14251b; font-weight: 550;
}
.inspector-tab-panel { min-height: 0; padding: 13px; overflow: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.preview-inspector :is(.frame-inspector, .frame-editor, .art-tag-editor) { margin: 0; padding: 10px; }
.preview-inspector .frame-editor:not([hidden]) { margin-top: 10px; }
.preview-inspector .frame-candidate { gap: 6px; padding: 7px; }
.preview-inspector .frame-candidate img { width: 42px; height: 42px; }
.preview-inspector .frame-candidate button { max-width: 100%; }
.preview-inspector .preview-tags { height: auto; min-height: 32px; margin-bottom: 10px; }
.preview-inspector .preview-tags > span:first-child { display: none; }
.preview-inspector .preview-tag-list { flex-wrap: wrap; white-space: normal; }
.preview-inspector .preview-tag-item { max-width: 100%; }
.preview-inspector .preview-tag { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.preview-inspector .art-tag-editor-row button { padding-inline: 6px; }
.preview-inspector .art-tag-suggestions { position: relative; top: auto; margin: 4px 0 0; }
.preview-inspector .art-tag-entry { flex-direction: column; }
.inspector-info { display: grid; gap: 11px; margin: 0 0 14px; font-size: 13px; }
.inspector-info > div { display: grid; grid-template-columns: auto minmax(0, 1fr); justify-content: space-between; gap: 8px; }
.inspector-info dt { color: #acbfb4; }
.inspector-info dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.preview-inspector .art-delete-action { width: 100%; padding: 10px 0 3px; text-align: left; border-top: 1px solid #3c5548; }
.editor-pane-switch { display: none; }
@media (max-width: 760px) {
  #preview[data-editing] .preview-body { display: block; }
  .editor-pane-switch { display: flex; margin-bottom: 13px; padding: 4px; border: 1px solid #3c5548; border-radius: 9px; background: #1b2822; }
  #preview[data-editing][data-editor-pane="art"] .preview-inspector,
  #preview[data-editing][data-editor-pane="inspector"] .preview-workspace { display: none; }
  .preview-inspector { max-height: min(var(--preview-height-limit), 63dvh); }
}
@media (prefers-reduced-motion: no-preference) {
  #preview[open], #preview[open]::backdrop { transition: opacity 200ms cubic-bezier(.22, 1, .36, 1); }
  #preview[open][data-closing], #preview[open][data-closing]::backdrop {
    opacity: 0;
    transition-duration: 160ms;
    transition-timing-function: ease-in;
  }
  @starting-style {
    #preview[open], #preview[open]::backdrop { opacity: 0; }
  }
}
#preview .preview-toolbar { margin-bottom: 14px; }
.preview-projection { width: 100%; height: clamp(320px, 60dvh, 560px); overflow: hidden; border-radius: 6px; background: #202428; }
.preview-projection iframe { display: block; width: 100%; height: 100%; border: 0; }
.preview-frame-mode { margin-bottom: 12px; font-size: 13px; }
.preview-loading { width: fit-content; max-width: calc(100vw - 24px); padding: 12px; }
.preview-loading-row { display: flex; align-items: center; gap: 12px; }
#preview-loading-error { margin: 0; overflow-wrap: anywhere; }
.preview-spinner, #preview[data-loading-art] .preview-toolbar::after {
  display: block; flex: none; width: 18px; height: 18px; border: 2px solid #53616a;
  border-top-color: #bbdeca; border-radius: 50%; animation: preview-spin 700ms linear infinite;
}
#preview[data-loading-art] .preview-toolbar::after { content: ""; position: absolute; top: 5px; left: calc(50% - 9px); }
@keyframes preview-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .preview-spinner, #preview[data-loading-art] .preview-toolbar::after { animation: none; }
}
h2 { font-size: 18px; font-weight: 550; margin: 0; }
.preview-details { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 7px; }
#preview-meta { font-size: 13px; color: #98a2aa; margin: 0; }
.art-delete-action { padding: 2px 0; border: 0; background: transparent; color: #f1b8ad; font: inherit; font-size: 13px; cursor: pointer; }
.art-delete-action:hover:not(:disabled) { text-decoration: underline; }
.preview-tags { position: relative; display: flex; align-items: flex-start; gap: 10px; height: 38px; color: #aebac2; font-size: 13px; line-height: 26px; }
.preview-tags:has(.preview-tag-list:empty):has(#add-art-tag[hidden]) { visibility: hidden; }
.preview-tag-list { display: flex; flex: 1; gap: 5px; min-width: 0; overflow: auto hidden; scrollbar-width: thin; white-space: nowrap; }
.preview-tag { flex: none; padding: 3px 8px; background: #22292d; color: #d8e3e9; border: 1px solid #3c4a52; border-radius: 5px; line-height: 18px; text-decoration: none; }
.preview-tag:hover { background: #303b41; }
.preview-tag:focus-visible { outline: 2px solid #bbdeca; outline-offset: -2px; }
.preview-tag-item { display: inline-flex; flex: none; }
.preview-tag-item .preview-tag { border-radius: 5px 0 0 5px; }
.remove-art-tag { padding: 0 6px; border: 1px solid #3c4a52; border-left: 0; border-radius: 0 5px 5px 0; background: #22292d; color: #e9c3b9; font: inherit; line-height: 18px; cursor: pointer; }
.remove-art-tag:hover { background: #51352e; }
.remove-art-tag:focus-visible { outline-offset: -2px; }
.art-tag-remove-error { position: absolute; top: 100%; right: 0; z-index: 2; max-width: 100%; margin: 0; padding: 6px 8px; border: 1px solid #765049; border-radius: 5px; background: #342523; color: #f2c8bd; line-height: 1.4; }
.add-art-tag { flex: none; padding: 3px 8px; background: #24322a; color: #d2eadc; border: 1px solid #425f4f; border-radius: 5px; font: inherit; line-height: 18px; cursor: pointer; }
.add-art-tag:hover, .add-art-tag[aria-expanded="true"] { background: #34483d; }
.art-tag-editor { margin-bottom: 12px; padding: 10px; border: 1px solid #425f4f; border-radius: 6px; background: #1e2b24; }
.art-tag-editor-row { display: flex; align-items: stretch; gap: 6px; }
.art-tag-entry { position: relative; display: flex; flex: 1; min-width: 0; }
#art-tag-name { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #52616b; border-radius: 5px; background: #16191c; color: inherit; font: inherit; font-size: 14px; }
.art-tag-suggestions { position: absolute; top: calc(100% + 5px); inset-inline: 0; z-index: 3; max-height: 184px; margin: 0; padding: 4px; overflow: auto; list-style: none; border: 1px solid #52616b; border-radius: 6px; background: #1b2125; box-shadow: 0 5px 15px #0007; }
.art-tag-suggestions [role="option"] { padding: 6px 8px; border-radius: 3px; color: #d8e3e9; font-size: 13px; overflow-wrap: anywhere; cursor: pointer; }
.art-tag-suggestions [role="option"]:hover, .art-tag-suggestions [aria-selected="true"] { background: #34483d; }
.art-tag-editor-row button { min-width: 36px; min-height: 36px; height: auto; padding: 0 8px; font-size: 13px; }
#art-tag-edit-status { min-height: 1.3em; margin: 6px 0 0; color: #c4e3d2; font-size: 13px; }
.dialog-close { flex-shrink: 0; width: 36px; height: 36px; background: #262c31; color: #e0e6eb; border: 1px solid #3a4248; border-radius: 5px; cursor: pointer; font-size: 16px; }
.preview-controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.preview-navigation {
  position: fixed;
  left: calc(var(--preview-nav-inset) + env(safe-area-inset-left, 0px));
  right: calc(var(--preview-nav-inset) + env(safe-area-inset-right, 0px));
  bottom: var(--preview-nav-bottom);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.preview-navigation button { min-height: var(--preview-nav-button-height); padding: 0 10px; border: 1px solid #424e56; border-radius: 6px; background: #22282c; color: #e0e6eb; font: inherit; font-size: 13px; cursor: pointer; pointer-events: auto; }
.preview-navigation button:hover:not([aria-disabled="true"]) { background: #343d44; }
.preview-navigation button[aria-disabled="true"] { opacity: .45; cursor: default; }
.preview-actions :is(a, button), .preview-controls button, .preview-navigation button { touch-action: manipulation; }
.preview-navigation-status { margin: 8px 0 0; color: #b9c5cc; font-size: 13px; }
.preview-zoom { display: flex; flex: none; gap: 4px; }
.preview-zoom button, .background-picker select { min-width: 36px; min-height: 36px; padding: 0 10px; background: #262c31; color: #e0e6eb; border: 1px solid #3a4248; border-radius: 5px; cursor: pointer; font: inherit; }
.preview-zoom button:hover:not(:disabled) { background: #343d44; }
#preview-fit { min-width: 64px; font-size: 13px; font-variant-numeric: tabular-nums; }
.background-picker { display: flex; align-items: center; gap: 8px; color: #b9c5cc; font-size: 13px; }
#preview-background-control, #preview-background { min-width: 0; }
.preview-image {
  --preview-fit-width: min(100cqw, var(--preview-art-width), calc(var(--preview-height-limit) * var(--art-ratio)));
  container-type: inline-size;
  position: relative;
  min-height: 120px;
}
/* Reserve the fitted image height while the enlarged image scrolls inside it. */
.preview-image::before { content: ""; display: block; width: var(--preview-fit-width); aspect-ratio: var(--art-ratio); }
.preview-viewport { position: absolute; inset: 0; overflow: hidden; }
.preview-viewport[data-zoomed="true"] { overflow: auto; }
.preview-viewport[data-zoomed="true"] :is(.preview-stage, .frame-tile) { cursor: grab; }
.preview-viewport[data-dragging] { cursor: grabbing; }
.preview-viewport[data-dragging] :is(.preview-stage, .frame-tile) { cursor: inherit; }
#preview:has(.preview-navigation:not([hidden])) .preview-viewport[data-zoomed="false"] { touch-action: pan-y pinch-zoom; }
.preview-canvas {
  --preview-scaled-width: calc(var(--preview-fit-width) * var(--preview-scale, 1));
  display: flex;
  min-width: max(100%, var(--preview-scaled-width));
  min-height: 100%;
}
.preview-stage { position: relative; flex: none; margin: auto; width: var(--preview-scaled-width); line-height: 0; background-color: #202428; }
.preview-stage[data-background="pumpkin"], #gallery[data-background="pumpkin"] .art-thumbnail-surface {
  background-image: url("/pumpkin_side.png");
  background-size: calc(100% / var(--art-columns, 1)) auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.preview-stage[data-background="checker"], #gallery[data-background="checker"] .art-thumbnail-surface {
  background-image: conic-gradient(#34393e 25%, #262b30 0 50%, #34393e 0 75%, #262b30 0);
  background-size: 24px 24px;
}
.preview-stage img { display: block; width: 100%; height: auto; aspect-ratio: var(--art-ratio); object-fit: contain; }
.frame-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.frame-tile { fill: transparent; stroke: #e8fff578; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: crosshair; outline: none; }
.frame-tile[data-active="true"] { fill: #bbdeca24; stroke: #c7ffdf; stroke-width: 2; }
.frame-tile:focus-visible { stroke: #c7ffdf; stroke-width: 2; stroke-dasharray: 3 2; }
.gallery-views { display: flex; gap: 4px; border-bottom: 1px solid #343c42; margin-bottom: 20px; }
.gallery-views button { padding: 10px 16px; background: transparent; color: #b9c5cc; border: 0; border-bottom: 2px solid transparent; font: inherit; cursor: pointer; }
.gallery-views button:hover { color: #f0f1f2; }
.gallery-views button[aria-pressed="true"] { color: #d0eddd; border-bottom-color: #bbdeca; }
.image-browser-toolbar { display: flex; margin-bottom: 20px; }
.image-gallery { grid-template-columns: repeat(auto-fill, minmax(min(100%, 175px), 1fr)); gap: 22px; }
.image-open { height: 175px; padding: 18px; }
.image-open img { width: 128px; height: 128px; object-fit: contain; }
.image-preview { width: min(950px, 96vw); }
.image-preview-image { display: block; max-width: 100%; width: 160px; aspect-ratio: 1; object-fit: contain; background: #202428; }
.image-preview h3 { margin: 24px 0 12px; font-size: 16px; font-weight: 550; }
.image-preview .gallery { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.image-preview .art-open { --card-height: 180px; }
.muted-detail { color: #a0abb2; font-size: 14px; overflow-wrap: anywhere; }
.gallery-action { padding: 9px 14px; background: #262c31; color: #e0e6eb; border: 1px solid #3a4248; border-radius: 6px; font: inherit; cursor: pointer; }
.gallery-action:hover { background: #343d44; }
#art-delete-dialog { width: min(420px, 94vw); }
#art-delete-description, #art-delete-status { color: #bdc9d1; font-size: 14px; line-height: 1.5; }
.art-delete-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
#confirm-art-delete { background: #713c36; border-color: #a77870; color: #fff2ef; }
#confirm-art-delete:hover:not(:disabled) { background: #884942; }
.art-delete-buttons button:disabled { opacity: .5; cursor: default; }
.frame-inspector { min-height: 80px; margin-top: 14px; padding: 12px 14px; background: #1e2b24; border: 1px solid #425f4f; border-radius: 7px; font-size: 13px; color: #c4e3d2; }
.frame-inspector-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; line-height: 1.5; }
#retry-frame-inspector { padding: 4px 8px; background: none; color: inherit; border: 1px solid #648d75; border-radius: 4px; font: inherit; cursor: pointer; }
#add-frame { margin-left: auto; padding: 7px 11px; background: #bbdeca; color: #14251b; border: 0; border-radius: 5px; font: inherit; cursor: pointer; }
.remove-frame { margin-left: auto; padding: 6px 9px; background: transparent; border: 1px solid #a77870; color: #f1b8ad; border-radius: 5px; font: inherit; font-size: 12px; cursor: pointer; }
#frame-edit-status { margin: 10px 0 0; line-height: 1.6; color: #d7e7de; }
.frame-editor { margin-top: 16px; padding: 16px; background: #1b2226; border: 1px solid #42545e; border-radius: 8px; }
.frame-editor-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.frame-editor h3 { margin: 0; font-size: 15px; font-weight: 550; }
#close-frame-editor { border: 0; background: none; color: #c2cdd4; padding: 6px; cursor: pointer; font: inherit; }
#frame-search { width: 100%; background: #111719; color: inherit; border: 1px solid #52616b; border-radius: 6px; padding: 11px; font: inherit; font-size: 14px; }
.frame-search-help, #frame-search-status { font-size: 12px; color: #a9b9c2; line-height: 1.6; margin: 8px 0; }
.frame-candidates { max-height: 330px; overflow-y: auto; overscroll-behavior: contain; }
.frame-candidate { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #35434b; }
.frame-candidate img { width: 64px; height: 64px; object-fit: contain; background: #101517; flex-shrink: 0; user-select: none; }
.frame-candidate-info { flex: 1; min-width: 0; font-size: 13px; }
.frame-candidate-info p { margin: 5px 0 0; font-size: 12px; color: #a9b9c2; overflow-wrap: anywhere; }
.frame-candidate button, #more-frame-candidates { background: #bbdeca; color: #14251b; border: 0; border-radius: 5px; padding: 9px 12px; font: inherit; font-size: 13px; cursor: pointer; }
#more-frame-candidates { margin-top: 12px; }
#preview button:disabled { opacity: .45; cursor: default; }
@media (max-width: 600px) { .frame-candidate { flex-wrap: wrap; } .frame-candidate img { width: 48px; height: 48px; } .frame-candidate button { margin-left: 60px; } }
.frame-details { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; line-height: 1.6; }
#frame-coordinates { font-variant-numeric: tabular-nums; }
#frame-dimension { color: #a5b6ad; font-size: 12px; overflow-wrap: anywhere; }
html[data-admin-mode="true"] #preview {
  --preview-min-width: 480px;
  --preview-height-limit: max(140px, min(60dvh, calc(94dvh - 324px)));
}
@media (max-width: 600px) {
  .frame-inspector { min-height: 112px; }
  #preview { --preview-inset: 16px; }
  html[data-admin-mode="true"] #preview {
    --preview-height-limit: max(140px, min(52dvh, calc(94dvh - 378px)));
  }
}
.catalog-header { display: grid; gap: 24px; margin-bottom: 16px; }
.catalog-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.intro { margin: 10px 0 0; color: #9fa9b0; font-size: 15px; }
.view-settings summary { display: inline-flex; align-items: center; min-height: 42px; padding: 0 12px; border: 1px solid #424e56; border-radius: 7px; font-size: 14px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; flex-shrink: 0; gap: 8px; }
#header-view-settings:empty, #results-view-settings:empty { display: none; }
.view-settings { position: relative; }
.view-settings summary { color: #d8e0e5; list-style: none; cursor: pointer; }
.view-settings summary::-webkit-details-marker { display: none; }
.view-settings[open] summary, .view-settings summary:hover { border-color: #91b29f; }
.view-settings-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 5; display: grid; gap: 12px; width: max-content; padding: 12px; border: 1px solid #424e56; border-radius: 8px; background: #191d20; box-shadow: 0 8px 24px #0008; }
.gallery-view-setting { margin: 0; padding: 0; min-width: 0; border: 0; }
.gallery-view-setting legend { padding: 0; margin-bottom: 6px; color: #b9c5cc; font-size: 13px; }
.gallery-view-buttons { display: flex; gap: 5px; }
.gallery-view-buttons button { min-width: 34px; min-height: 34px; padding: 0 8px; border: 1px solid #424e56; border-radius: 6px; background: #262c31; color: #e0e6eb; font: inherit; font-size: 13px; cursor: pointer; }
.gallery-view-buttons button:hover { background: #343d44; }
.gallery-view-buttons button[aria-pressed="true"] { border-color: #bbdeca; background: #bbdeca; color: #14251b; }
.view-settings-panel .background-picker { justify-content: space-between; }
.art-smoothing-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; color: #b9c5cc; font-size: 13px; cursor: pointer; }
#art-smoothing { margin: 0; accent-color: #bbdeca; cursor: pointer; }
.admin-mode { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 12px; border: 1px solid #424e56; border-radius: 7px; background: #191d20; color: #bdc9d1; font: inherit; font-size: 13px; cursor: pointer; }
.admin-mode-indicator { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: #79878f; }
#admin-mode-state { font-size: 12px; color: #9baab3; }
.admin-mode:hover { border-color: #91b29f; }
.admin-mode[aria-pressed="true"] { background: #26332d; color: #c4e3d2; border-color: #648d75; }
.admin-mode[aria-pressed="true"] .admin-mode-indicator { background: #bbdeca; }
.admin-mode[aria-pressed="true"] #admin-mode-state { color: #bbdeca; }
.search-row { display: flex; align-items: stretch; gap: 12px; }
#search-form { display: flex; flex: 1; min-width: 0; gap: 10px; }
.search-field { display: flex; align-items: center; gap: 10px; background: #191d20; border: 1px solid #424e56; border-radius: 9px; padding: 6px 10px 6px 15px; min-height: 54px; }
#search-form .search-field { flex: 1; min-width: 0; }
.catalog-submit, #done-filters { border: 0; border-radius: 7px; background: #bbdeca; color: #14251b; font: inherit; font-weight: 550; cursor: pointer; }
.catalog-submit { padding: 0 20px; }
.catalog-submit:hover, #done-filters:hover { background: #d0eddd; }
.search-icon { color: #9faeb6; font-size: 30px; line-height: 1; }
#art-search { min-width: 0; width: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 17px; padding: 9px 0; outline: none; }
input::placeholder { color: #89969e; opacity: 1; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
#clear-search { background: none; border: 0; color: #adb8bf; padding: 9px; font-size: 16px; cursor: pointer; }
.search-help { position: relative; flex-shrink: 0; }
.search-help summary { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid #52616b; border-radius: 50%; color: #a8b7c0; cursor: pointer; font-size: 13px; list-style: none; }
.search-help summary::-webkit-details-marker { display: none; }
#search-help { position: absolute; z-index: 3; right: 0; top: calc(100% + 12px); width: min(340px, 78vw); color: #d5dfe5; background: #252e34; border: 1px solid #52616b; border-radius: 8px; padding: 14px; font-size: 13px; margin: 0; line-height: 1.7; box-shadow: 0 8px 24px #0006; }
.filters-button { display: none; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; padding: 0 18px; min-height: 54px; border: 1px solid #424e56; border-radius: 9px; background: #191d20; color: #e2e9ed; font: inherit; font-size: 14px; cursor: pointer; }
.filters-button:hover, .filters-button[aria-expanded="true"] { border-color: #91b29f; background: #24322a; }
#filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 21px; height: 21px; padding: 0 5px; background: #bbdeca; color: #14251b; border-radius: 12px; font-size: 12px; }
.art-browser { display: grid; grid-template-columns: minmax(220px, 250px) minmax(0, 1fr); gap: clamp(16px, 2vw, 28px); align-items: start; }
.art-results { min-width: 0; }
.filters-sidebar { min-width: 0; position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; scrollbar-width: thin; align-self: start; }
.filters-panel { padding: 16px; border: 1px solid #3d5349; border-radius: 10px; background: #1c2924; }
.filters-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; margin-bottom: 14px; }
.filters-heading h2 { margin: 0; font-size: 16px; }
.filters-heading-actions { display: flex; align-items: center; gap: 12px; }
#close-filters { display: none; width: 42px; height: 42px; border: 1px solid #52655c; border-radius: 7px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
#close-filters:hover { background: #30423a; }
.filters-footer { display: none; }
.category-filter { display: grid; gap: 14px; color: #b2bcc3; font-size: 13px; }
.filter-field { display: flex; flex: 1; min-width: 170px; flex-direction: column; gap: 8px; }
.category-filter .filter-field { min-width: 0; }
.category-filter select, .tag-mode-field select, #tag-search { background: #22282c; color: #f0f1f2; border: 1px solid #424e56; border-radius: 6px; padding: 10px 12px; font: inherit; min-height: 42px; }
select { cursor: pointer; }
select:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid #bbdeca; outline-offset: 3px; }
#selected-tag-count, #selected-art-color { font-size: 12px; color: #a2b2bc; margin-left: 8px; }
#tag-filter, #color-filter { border: 0; padding: 0; margin: 22px 0 0; min-width: 0; }
#tag-filter legend, #color-filter legend { padding: 0; margin-bottom: 12px; font-size: 13px; color: #b2bcc3; }
.color-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; max-width: 300px; }
.color-option { display: grid; place-items: center; position: relative; min-height: 34px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #fff; font: inherit; cursor: pointer; }
.color-option::before { content: ""; width: 22px; height: 22px; border: 1px solid #ffffff5c; border-radius: 50%; background: var(--swatch); }
.color-option:hover { background: #ffffff10; }
.color-option:focus-visible, .color-option[aria-pressed="true"] { outline: 1px solid #bbdeca; outline-offset: -1px; }
.color-option[aria-pressed="true"]::after { content: "✓"; position: absolute; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #101718; font-size: 11px; }
.tag-search-field { margin-bottom: 14px; }
#tag-search { width: 100%; font-size: 13px; }
.tag-mode-field { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; color: #9eacb5; font-size: 12px; }
.tag-mode-field select { font-size: 13px; max-width: 100%; }
.tag-options { max-height: clamp(128px, 34dvh, 330px); overflow-y: auto; padding: 3px; margin: -3px; scrollbar-width: thin; }
.tag-option { max-width: 100%; }
.tag-option { position: relative; display: inline-flex; background: none; border: 0; padding: 0; cursor: pointer; }
.tag-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tag-option > span { max-width: 100%; overflow-wrap: anywhere; border: 1px solid #46515a; color: #bdc9d1; border-radius: 20px; padding: 7px 12px; font-size: 13px; transition: background .15s; }
.tag-option:hover > span { background: #303b41; }
.tag-option-count { margin-inline-start: 6px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; white-space: nowrap; }
.tag-option input:checked + span { background: #bbdeca; border-color: #bbdeca; color: #14251b; }
.tag-option input:checked + span::before { content: "✓ "; }
.tag-option input:focus-visible + span { outline: 2px solid #bbdeca; outline-offset: 1px; }
#tag-status { display: block; color: #e6baa5; margin: 14px 0; font-size: 13px; }
.results-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-bottom: 18px; min-height: 42px; }
.results-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
#results-view-settings summary { min-height: 34px; }
#sort-order { max-width: min(240px, 100%); min-width: 0; min-height: 34px; background: #191d20; color: #c7d2d8; border: 1px solid #424e56; border-radius: 7px; padding: 0 8px; font: inherit; font-size: 13px; }
#sort-order option { background: #191d20; color: #e2e9ed; }
.count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: #b9c5cc; margin: 0; }
.text-button { flex: none; background: none; border: 0; font: inherit; font-size: 13px; color: #bbdeca; cursor: pointer; padding: 5px 0; }
#reshuffle { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 36px; min-height: 34px; padding: 0 8px; border: 1px solid #424e56; border-radius: 6px; }
#reshuffle:hover { background: #26332d; border-color: #91b29f; }
.reshuffle-icon { font-size: 18px; line-height: 1; }
.active-filters { display: flex; align-items: center; min-width: 0; min-height: 36px; gap: 8px; padding: 2px 0; overflow: auto hidden; scrollbar-width: thin; }
.filter-chip { flex: none; background: #26332d; color: #c4e3d2; border: 1px solid #425f4f; border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.filter-chip:focus-visible { outline-offset: -2px; }
#status { color: #b1bfc8; padding: 36px 0 8px; line-height: 1.7; }
#empty-reset { background: #bbdeca; color: #14251b; border: 0; border-radius: 6px; padding: 12px 18px; font: inherit; cursor: pointer; margin-bottom: 32px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#filters-sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 580px);
  max-width: 100%;
  max-height: min(86dvh, 720px);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #52655c;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: #1c2924;
}
#filters-sheet::backdrop { background: #0009; backdrop-filter: none; }
#filters-sheet .filters-panel { display: flex; flex-direction: column; max-height: inherit; padding: 0; border: 0; }
#filters-sheet .filters-heading { flex-shrink: 0; margin: 0; padding: 11px 16px; border-bottom: 1px solid #3d5349; }
#filters-sheet #close-filters { display: inline-grid; place-items: center; }
#filters-sheet .filters-body { overflow: auto; overscroll-behavior: contain; padding: 16px; }
#filters-sheet .category-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#filters-sheet .category-filter select { width: 100%; padding-inline: 8px; }
#filters-sheet .color-option { min-height: 44px; }
#filters-sheet .tag-options { max-height: none; overflow: visible; }
#filters-sheet .filters-footer { display: block; flex-shrink: 0; border-top: 1px solid #3d5349; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
#done-filters { min-height: 44px; width: 100%; }
html:has(#filters-sheet[open]) { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  #filters-sheet[open] { animation: filters-slide-in 230ms cubic-bezier(.22, 1, .36, 1); }
  @keyframes filters-slide-in { from { transform: translateY(100%); } }
}
@media (min-width: 901px) {
  #gallery:not([data-fixed-columns]):not([data-block-layout]) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 22px; }
}
@media (max-width: 900px) {
  .catalog-submit, .filters-sidebar { display: none; }
  .filters-button { display: flex; }
  .art-browser { display: block; }
  .results-toolbar { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
  .active-filters { grid-row: 2; grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  main { padding: 20px 16px 48px; }
  #preview { margin-block: 12px auto; }
  .catalog-header { gap: 14px; }
  .catalog-heading { gap: 10px; }
  h1 { font-size: clamp(20px, 6vw, 28px); }
  .intro { display: none; }
  .gallery { gap: 20px; grid-template-columns: 1fr; }
  .art-open { --card-height: clamp(190px, 66vw, 275px); --card-padding: 14px; }
  .preview-actions { gap: 6px; }
  .preview-3d { padding-inline: 8px; }
  .dialog-close { width: 44px; height: 44px; }
  dialog { padding: 16px; }
  .filter-field { min-width: 100%; }
  .search-row { gap: 8px; }
  .search-field { gap: 4px; padding: 6px 8px; }
  #art-search { font-size: 16px; }
  .search-icon { display: none; }
  .filters-button { padding: 0 12px; }
  .filters-button svg { display: none; }
  .tag-mode-field select { max-width: 100%; }
  .results-toolbar { gap: 6px; margin-bottom: 10px; }
  .results-actions { gap: 6px; }
  #sort-order { padding-left: 4px; }
  .reshuffle-label { display: none; }
  .count, #sort-order { font-size: 12px; }
}
