:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  color: #f4f4f5;
  background: #000;
  --surface: #18181b;
  --surface-raised: #27272a;
  --line: #27272a;
  --muted: #a1a1aa;
  --accent: #adf04b;
  --accent-surface: #273416;
  --accent-border: #566d32;
  --drawer-width: min(384px, calc(100vw - 20px));
  --drawer-duration: 220ms;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; }
body { margin: 0; min-height: 100vh; }
body:has(dialog[open]) { overflow: hidden; }
button, select, input, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding-inline: 16px;
  gap: 12px;
  background: #000a;
  backdrop-filter: blur(14px);
}
.toolbar-brand, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-right { gap: 9px; }
.wordmark { color: #fff; font: 950 27px/.9 "Arial Black", Arial, sans-serif; letter-spacing: -.075em; text-decoration: none; white-space: nowrap; }
.wordmark strong { color: var(--accent); font-weight: inherit; }
.icon-button { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; text-decoration: none; touch-action: manipulation; }
.icon-button:hover:not(:disabled) { background: var(--surface-raised); color: #fff; }
.icon-button:disabled { opacity: .24; }
.icon-button[aria-pressed="true"] { color: var(--accent); }
.bookmark-button[aria-pressed="true"] svg, #viewer-save[aria-pressed="true"] svg { fill: currentColor; }
.toolbar .icon-button { height: 36px; width: 36px; }
#open-browse svg { translate: 0 1px; }
.toolbar .search-toggle { width: 48px; }
.search-toggle svg { width: 24px; height: 24px; }
.search-toggle.has-query::after { position: absolute; top: 5px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); content: ""; }
.header-select { position: relative; display: flex; align-items: center; width: 102px; height: 48px; }
.header-select:has(#type-filter) { width: 96px; }
.header-select:has(#scope-filter) { width: 119px; }
.dropdown-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 38px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #c3c6c3; font-size: .875rem; text-align: left; }
.dropdown-trigger:hover { background: var(--surface); }
.dropdown-trigger[aria-expanded="true"] { color: #eef8da; border-color: var(--accent-border); background: var(--accent-surface); }
.dropdown-value { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dropdown-trigger svg, .dropdown-item svg { width: 15px; height: 15px; }
.dropdown-trigger[aria-expanded="true"] svg { transform: rotate(180deg); color: var(--accent); }
.dropdown-list { position: absolute; z-index: 6; top: calc(100% + 4px); right: 0; min-width: max(100%, 166px); padding: 5px; border: 1px solid #303a33; border-radius: 10px; background: #141916; box-shadow: 0 8px 26px #000b; }
.dropdown-list:not([hidden]) { animation: dropdown-in 150ms ease-out; }
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 36px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: #e1e5e2; font-size: .875rem; text-align: left; white-space: nowrap; }
.dropdown-item[aria-selected="true"] { color: #cef88d; background: var(--accent-surface); }
.dropdown-item:hover, .dropdown-item:focus-visible { background: #343e29; outline-offset: -2px; }
.dropdown-item svg { color: var(--accent); visibility: hidden; }
.dropdown-item[aria-selected="true"] svg { visibility: visible; }
.notice-icon { display: inline-grid; place-items: center; width: 28px; color: #e6bf77; }
.notice { width: fit-content; max-width: calc(100% - 24px); margin: 16px auto; padding: 10px 14px; border: 1px solid #513742; border-radius: 8px; background: #261b22; color: #f0c4d2; text-align: center; }

.grid { --tile-columns: 2; --tile-gap: 2px; --tile-tools-height: 62px; position: relative; width: min(calc(100% - 24px), 900px); margin: 13px auto 0; }
.grid.show-tile-tools:not(:empty) { margin-bottom: var(--tile-tools-height); }
.tile { position: absolute; top: 0; left: 0; z-index: 0; isolation: isolate; transition: z-index 0s 180ms; }
.tile-open { position: relative; z-index: 0; display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; color: #777987; background: #171719; }
.tile-art { display: grid; place-items: center; position: relative; overflow: hidden; aspect-ratio: var(--group-ratio, var(--media-ratio, 1.5)); }
.tile-art > svg { width: 28px; height: 28px; }
.tile-thumbnail, .tile-motion { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile-motion { z-index: 1; pointer-events: none; opacity: 0; }
.tile-motion.has-frame { opacity: 1; }
.tile-tools { position: absolute; z-index: 1; inset: 100% 0 auto; height: var(--tile-tools-height); overflow: hidden; border-radius: 0 0 8px 8px; visibility: hidden; pointer-events: none; transition: visibility 0s 180ms; }
.tile-tools-row { display: flex; align-items: stretch; height: 100%; background: #191919; transform: translateY(-100%); transition: transform 180ms cubic-bezier(.2, .75, .3, 1); }
.tile-tools .icon-button { width: 100%; height: 100%; flex: 1 1 0; border-radius: 0; }
.tile-tools svg { width: 27px; height: 27px; }
.show-tile-tools .tile:has(:focus-visible) { z-index: 1; transition-delay: 0s; }
.show-tile-tools .tile:is(:hover, .is-pointer-hovered) { z-index: 2; transition-delay: 0s; }
.show-tile-tools .tile:is(:hover, :has(:focus-visible), .is-pointer-hovered) .tile-open { border-radius: 8px 8px 0 0; }
.show-tile-tools .tile:is(:hover, :has(:focus-visible), .is-pointer-hovered) .tile-tools { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.show-tile-tools .tile:is(:hover, :has(:focus-visible), .is-pointer-hovered) .tile-tools-row { transform: translateY(0); }
.tile-playback {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  visibility: hidden;
  pointer-events: none;
}
.tile:is(:hover, :focus-within, .is-pointer-hovered) .tile-playback { visibility: visible; }
.tile-playback .icon-button { width: 30px; height: 30px; color: #fff; background: #0c0c0cc4; pointer-events: auto; }
.tile-playback .icon-button:hover { color: var(--accent); background: #111e0be8; }
.tile-playback .icon-button svg { width: 17px; height: 17px; }
.tile-playback .icon-button use[href="#i-play"] { fill: currentColor; }
.tile-audio { display: flex; align-items: center; gap: 4px; min-width: 0; pointer-events: auto; }
.tile-volume { order: -1; width: 76px; min-width: 0; margin: 0; accent-color: var(--accent); visibility: hidden; cursor: pointer; }
.tile-audio:is(:hover, :focus-within) { padding-left: 7px; border-radius: 6px; background: #0c0c0cc4; }
.tile:is(:hover, :focus-within, .is-pointer-hovered) .tile-audio:is(:hover, :focus-within) .tile-volume { visibility: visible; }
.empty { display: grid; min-height: min(58vh, 500px); place-items: center; }
.empty-icon { display: grid; place-items: center; width: 62px; height: 62px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.empty-icon svg { width: 25px; height: 25px; }
.more { display: flex; justify-content: center; padding-block: 14px; }
.more-button { border: 1px solid var(--line); background: var(--surface); }
.is-loading svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { position: fixed; margin: 0; padding: 0; max-width: 100vw; max-height: 100dvh; border: 0; color: #f4f4f5; background: #000; }
.panel[open] { display: flex; flex-direction: column; }
.panel::backdrop { background: #0009; backdrop-filter: blur(4px); opacity: 0; transition: opacity var(--drawer-duration), display var(--drawer-duration) allow-discrete, overlay var(--drawer-duration) allow-discrete; }
.panel[open]::backdrop { opacity: 1; }
.panel:is(.panel-left, .panel-right) { width: var(--drawer-width); height: 100dvh; background: #0c0c0c; transform: translateX(var(--drawer-offset)); transition: transform var(--drawer-duration) cubic-bezier(.2, .75, .3, 1), display var(--drawer-duration) allow-discrete, overlay var(--drawer-duration) allow-discrete; }
.panel-left { --drawer-offset: -100%; inset: 0 auto 0 0; border-right: 1px solid #222; }
.panel-right { --drawer-offset: 100%; inset: 0 0 0 auto; border-left: 1px solid #222; }
.panel:is(.panel-left, .panel-right)[open] { transform: translateX(0); }
@starting-style {
  .panel:is(.panel-left, .panel-right)[open] { transform: translateX(var(--drawer-offset)); }
  .panel[open]::backdrop { opacity: 0; }
}
.panel-header { display: flex; align-items: center; min-height: 64px; padding-inline: 16px; gap: 12px; border-bottom: 1px solid #242426; }
.panel-header h2 { margin: 0; font-size: 1.25rem; font-weight: 720; }
.panel-header [data-close-panel] { margin-left: auto; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 16px; }
.panel-footer { flex: 0 0 auto; border-top: 1px solid #242426; }
.browse-body { padding-top: 18px; }
.browse-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 53px; padding: 0 13px; border: 0; border-radius: 7px; color: inherit; background: none; text-align: left; }
.browse-row:hover { background: #ffffff19; }
.browse-row svg { width: 18px; height: 18px; color: var(--muted); }
.panel hr { border: 0; border-top: 1px solid #333; margin-block: 12px; }
.panel:is(.panel-left, .panel-right) .panel-header { height: 76px; padding-inline: 20px; }
.search-body { padding: 20px; }
.search-body input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid #3c5947; border-radius: 8px; color: #fff; background: #111c15; font-size: .875rem; outline-offset: 1px; }
.search-body input::placeholder { color: #c7c9d0; }
.search-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 26px; }
.panel-select { position: relative; min-width: 0; }
.panel-select .dropdown-trigger { border-color: #333; background: #101412; }
.panel-select .dropdown-trigger[aria-expanded="true"] { border-color: var(--accent-border); background: var(--accent-surface); }
.panel-select:nth-child(odd) .dropdown-list { right: auto; left: 0; }
.panel-right .panel-footer { padding: 20px; }
.search-submit { width: 100%; min-height: 44px; border: 0; border-radius: 6px; background: var(--accent); color: #0a2012; font-size: .875rem; font-weight: 650; }
.search-submit:hover { background: #c3f776; }
.settings-panel .panel-header h2 { font-size: 1.0625rem; }
.settings-body section + section { margin-top: 24px; }
.settings-body h3 { margin: 0 4px 8px; color: #8c8d96; font-size: .75rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
.settings-options { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-options button { min-width: 39px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; color: var(--muted); background: #27272a; font-size: .875rem; }
.settings-options button:hover { color: #fff; background: #3a3b3a; }
.settings-options button[aria-pressed="true"] { color: #cef88d; background: var(--accent-surface); }
.switches { overflow: hidden; border: 1px solid #262628; border-radius: 11px; background: #181818; }
.switches label { display: flex; justify-content: space-between; align-items: center; min-height: 55px; padding: 0 16px; color: #e4e4e7; font-size: .875rem; cursor: pointer; }
.switches label + label { border-top: 1px solid #282828; }
.switches input { appearance: none; width: 39px; height: 22px; margin: 0; border-radius: 22px; background: #46464c; cursor: pointer; }
.switches input::after { display: block; width: 17px; height: 17px; margin: 2.5px; border-radius: 50%; background: #fafafa; content: ""; }
.switches input:checked { background: #668f2b; }
.switches input:checked::after { margin-left: 19px; }
.dismiss { width: 100%; min-height: 46px; border: 0; background: none; color: #f4f4f5; }
.dismiss:hover { background: #ffffff0e; }

.metadata-panel .panel-header { justify-content: flex-start; }
.panel-right .metadata-header { min-height: 50px; height: 50px; padding-inline: 12px; border-bottom: 0; }
.metadata-body { padding: 22px clamp(16px, 4vw, 29px); }
.metadata-body > section:not([hidden]) ~ :is(section, #post-suggestion) { margin-top: 21px; }
.metadata-body h3, .metadata-form h3 { margin: 0 0 12px; color: #d7dbe3; font-size: 1.125rem; }
.post-empty { display: grid; justify-items: start; gap: 12px; margin-block: 18px; }
.post-empty p { margin: 0; color: var(--muted); font-size: .9375rem; }
.metadata-chips { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.metadata-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  max-width: 100%;
  padding: 5px 12px;
  border: 1px solid #405065;
  border-radius: 999px;
  color: #f0f3f8;
  background: #344356;
  font-size: .875rem;
  overflow-wrap: anywhere;
}
.metadata-chip svg { width: 14px; height: 14px; color: #b7c8db; }
button.metadata-chip:hover { background: #45566d; }
.metadata-chip--author { border-color: #315ff2; background: #1c47cd; }
.metadata-chip--author svg { color: #a7bcff; }
button.metadata-chip--author:hover { background: #2b55dc; }
.metadata-chip[aria-pressed="true"] { border-color: var(--accent); color: #e6fac7; background: var(--accent-surface); }
.chip-usage { color: #d3dae6; font-size: .75rem; }
.quick-metadata { margin-top: 6px; }
.quick-metadata .metadata-chips { max-height: 132px; overflow-y: auto; padding: 2px 3px 4px; }
.search-filters { margin-top: 22px; }
.metadata-picker { position: relative; min-width: 0; }
.metadata-picker > label { margin-bottom: 6px; }
.search-body .metadata-picker > input { height: 38px; padding: 0 34px 0 11px; border-color: #333; background: #101412; outline-offset: 0; }
.search-body .metadata-picker > input[aria-expanded="true"] { border-color: var(--accent-border); background: var(--accent-surface); }
.metadata-toggle { position: absolute; right: 3px; bottom: 1px; display: grid; place-items: center; width: 30px; height: 36px; border: 0; background: transparent; color: var(--muted); }
.metadata-toggle svg { width: 15px; height: 15px; }
.metadata-picker > input[aria-expanded="true"] + .metadata-toggle svg { transform: rotate(180deg); color: var(--accent); }
.metadata-options { width: 100%; min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
.metadata-options.opens-above { top: auto; bottom: calc(100% + 4px); }
.metadata-options .dropdown-item { white-space: normal; overflow-wrap: anywhere; }
.metadata-filter { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; min-height: 38px; padding: 3px 14px; background: #192311; color: #d7f0b9; font-size: .875rem; overflow-wrap: anywhere; }
.metadata-filter .icon-button { width: 28px; height: 28px; }
.metadata-filter svg { width: 16px; height: 16px; }
.metadata-form { display: grid; gap: 12px; }
.metadata-form label { display: grid; gap: 6px; color: #d7dbe3; font-size: .875rem; }
.metadata-form input, .metadata-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #354050;
  border-radius: 8px;
  color: #f4f4f5;
  background: #111827;
}
.metadata-form textarea { resize: vertical; }
.accent-button, .admin-button { display: inline-flex; align-items: center; width: fit-content; min-height: 36px; padding: 7px 12px; border: 1px solid transparent; border-radius: 7px; color: #111c07; background: var(--accent); font-size: .875rem; font-weight: 650; text-decoration: none; }
.accent-button:hover { background: #c3f776; }
.admin-button { border-color: #37373b; color: #f4f4f5; background: #232326; }
.admin-button:hover { background: #303034; }
.accent-button:disabled, .admin-button:disabled { opacity: .5; }
.metadata-status { margin: 10px 0 0; color: #b8bdc9; font-size: .875rem; overflow-wrap: anywhere; }
.metadata-status:empty { display: none; }
.admin-toolbar .dismiss { width: auto; padding: 0 12px; }
.admin-page { width: min(1070px, calc(100% - 28px)); margin: 26px auto; }
.admin-login { width: min(100%, 390px); margin: 9vh auto 0; gap: 18px; padding: 24px; border: 1px solid #303a39; border-radius: 16px; background: #101714; }
.admin-page h1, .admin-card h2 { margin: 0; overflow-wrap: anywhere; }
.admin-page h1 { font-size: 1.35rem; }
.admin-heading, .admin-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-heading { justify-content: space-between; margin-bottom: 15px; padding: 16px 18px; border: 1px solid #28352d; border-radius: 13px; background: #101812; }
.admin-search { max-width: 420px; margin-bottom: 13px; }
.admin-list { display: grid; gap: 12px; }
.admin-list[data-mode="posts"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.admin-card { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 15px; padding: 12px; border: 1px solid #282f35; border-radius: 12px; background: #0d1318; }
.admin-card-art { position: relative; align-self: start; aspect-ratio: 1.4; background: #171d23; border-radius: 8px; overflow: hidden; }
button.admin-card-art { padding: 0; border: 1px solid #293138; }
button.admin-card-art:hover { border-color: var(--accent); }
.admin-card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.admin-card-body { display: grid; gap: 10px; align-content: start; }
.admin-card h2 { color: #eceef2; font-size: .9375rem; }
.admin-views { margin: 0; color: var(--muted); font-size: .8125rem; }
#admin-more { margin-top: 13px; }
.admin-page:has(.admin-login:not([hidden])) > .metadata-status { max-width: 390px; margin-inline: auto; }
.view-count { position: absolute; z-index: 2; top: 6px; left: 6px; display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 6px; background: #080a0bd9; color: #f1f3f5; font-size: .75rem; font-variant-numeric: tabular-nums; pointer-events: none; }
.view-count svg { width: 15px; height: 15px; }

.shell:has(.has-stream) { height: 100dvh; }
.has-stream { display: flex; flex-direction: column; height: 100%; }
.has-stream .toolbar { flex: 0 0 auto; }
.stream { position: relative; display: flex; flex: 1; min-height: 0; width: 100%; transition: width var(--drawer-duration) cubic-bezier(.2, .75, .3, 1); }
.stream-feed { position: relative; width: 100%; min-height: 0; overflow: hidden auto; overscroll-behavior-y: contain; scrollbar-width: none; scroll-snap-type: y mandatory; background: #000; }
.stream-slide { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always; }
.stream-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.stream-poster, .stream-original { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stream-original.is-loading-original { visibility: hidden; }
.stream-slide.is-active .stream-placeholder { visibility: hidden; }
.stream-unavailable { position: absolute; z-index: 1; bottom: 12px; display: none; margin: 0; padding: 8px 12px; border-radius: 8px; color: #eef4f3; background: #18181beb; }
.stream-slide.is-unavailable:not(:has(.stream-poster)) .stream-unavailable { display: block; }
.stream-slide:has(.carousel-controls) .stream-unavailable { bottom: 42px; }
.stream-actions, .viewer-actions { position: absolute; right: 11px; bottom: 17%; display: grid; gap: 9px; }
.stream-actions .icon-button, .viewer-actions .icon-button { width: 43px; height: 43px; color: #d6d6d9; text-shadow: 0 1px 5px #000a; }
.stream-actions svg, .viewer-actions svg { width: 27px; height: 27px; filter: drop-shadow(0 1px 3px #000c); }
.stream-actions .icon-button:first-child svg, .stream-actions .icon-button:nth-child(2) svg, .viewer-nav svg { width: 17px; height: 17px; }

.carousel-swipe { touch-action: pan-y; }
.carousel-dragging > :is(.tile-art, .stream-original, .stream-placeholder, .viewer-image, .viewer-video, .viewer-poster, .carousel-drag-preview) {
  animation: none;
  translate: var(--carousel-offset, 0px) 0;
}
.carousel-settling > :is(.tile-art, .stream-original, .stream-placeholder, .viewer-image, .viewer-video, .viewer-poster, .carousel-drag-preview) {
  transition: translate 180ms ease-out;
}
.carousel-drag-preview { position: absolute; z-index: 1; inset-block: 0; width: 100%; background: #000; pointer-events: none; }
.carousel-drag-preview :is(img, video) { width: 100%; height: 100%; object-fit: contain; }
.carousel-controls { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.carousel-arrow.icon-button { position: absolute; top: 50%; width: 44px; height: 44px; transform: translateY(-50%); border-radius: 50%; color: #fff; background: #111d; pointer-events: auto; }
.carousel-arrow.icon-button:disabled { visibility: hidden; }
.carousel-arrow:first-child { left: 12px; }
.carousel-arrow:nth-child(2) { right: 12px; }
.tile .carousel-arrow { width: 32px; height: 32px; }
.tile .carousel-arrow:first-child { left: 5px; }
.tile .carousel-arrow:nth-child(2) { right: 5px; }
:is(.tile, .stream-slide) .carousel-arrow.icon-button { opacity: 0; pointer-events: none; transition: opacity 140ms ease; }
:is(.tile, .stream-slide):is(:hover, .is-pointer-hovered, :has(:focus-visible)) .carousel-arrow.icon-button { opacity: 1; pointer-events: auto; }
.viewer-body > .carousel-controls .carousel-arrow:first-child { left: max(12px, calc(var(--media-left-gap, 0px) - 54px)); }
.viewer-body > .carousel-controls .carousel-arrow:nth-child(2) { right: max(12px, calc(var(--media-right-gap, 0px) - 54px)); }
.viewer-body.is-zoom-mode :is(.viewer-actions, #fullscreen, .carousel-arrow) { visibility: hidden; }
.viewer-body.is-touch-zoomed > :is(.viewer-close, .viewer-actions, .photo-progress, .zoom-toggle, #fullscreen, .carousel-controls) { visibility: hidden; }
.carousel-dots { position: absolute; bottom: var(--carousel-dots-bottom, 10px); left: 50%; display: flex; gap: 5px; align-items: center; transform: translateX(-50%); padding: 5px 7px; border-radius: 20px; background: #0c0c0cbb; }
.carousel-dots > span[aria-hidden] { width: 5px; height: 5px; border-radius: 50%; background: #b6b6bd; }
.carousel-dots > span.is-current { width: 7px; height: 7px; background: #fff; }
.tile:has(.tile-playback) { --carousel-dots-bottom: 12px; }
.stream-slide:has(video.stream-original), .viewer-body:has(.viewer-video) { --carousel-dots-bottom: 56px; }
.carousel-leaving { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; overflow: hidden; pointer-events: none; }
.carousel-leaving > .tile-art { width: 100%; }
[data-carousel-direction] { animation: carousel-enter 220ms cubic-bezier(.22,.68,.26,1); }
[data-carousel-direction="forward"] { --carousel-enter-offset: var(--carousel-travel, 100%); }
[data-carousel-direction="back"] { --carousel-enter-offset: calc(-1 * var(--carousel-travel, 100%)); }
.stage > [data-carousel-direction] { --carousel-travel: 100cqw; }
@keyframes carousel-enter { from { translate: var(--carousel-enter-offset) 0; } }

.viewer { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; background: #000; color: #f4f4f5; transition: width var(--drawer-duration) cubic-bezier(.2, .75, .3, 1); }
.viewer::backdrop { background: #000; }
body:has(.panel-right[open]):has(.viewer[open], .stream:not([hidden])) { --drawer-width: min(384px, 76vw); }
body:has(.viewer[open], .stream:not([hidden])) .panel-right::backdrop { background: transparent; backdrop-filter: none; }
body:has(.panel-right[open]) :is(.viewer[open], .stream) { width: calc(100% - var(--drawer-width)); }
body:has(.panel-right[open]) :is(.viewer-close, .photo-progress, .viewer-actions, .zoom-toggle, .stream-actions, .viewer-body > .carousel-controls) { visibility: hidden; }
.viewer-body { position: relative; width: 100%; height: 100%; --viewer-close-top: 12px; --viewer-close-left: 12px; --viewer-close-size: 40px; }
.viewer-close, #fullscreen { position: fixed; z-index: 1; top: 12px; }
.viewer-close { top: var(--viewer-close-top); left: var(--viewer-close-left); }
.viewer-close svg, #fullscreen svg { width: 17px; height: 17px; }
.photo-progress { position: absolute; z-index: 1; top: calc(var(--viewer-close-top) + var(--viewer-close-size) + 4px); left: var(--viewer-close-left); display: grid; justify-items: center; gap: 3px; width: var(--viewer-close-size); padding: 5px 0; color: #f4f4f5; font-size: .75rem; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; }
#fullscreen { right: 12px; }
.zoom-toggle.icon-button { position: absolute; z-index: 1; top: 12px; left: 56px; color: #e4e4e7; background: #101213cc; }
.zoom-toggle.icon-button[aria-pressed="true"] { color: var(--accent); background: var(--accent-surface); }
.zoom-toggle svg { width: 19px; height: 19px; }
.stage { position: absolute; inset: 0; display: grid; place-items: center; container-type: size; overflow: hidden; text-align: center; touch-action: none; }
.comic-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: min(76%, 520px); height: 100%; padding-block: 12px; }
.comic-preview-cover { display: block; width: 100%; min-height: 0; max-height: calc(100% - 56px); object-fit: contain; }
.comic-preview-cover:not([src]) { display: none; }
.comic-read, .comic-reader-download { padding: 10px 18px; border: 1px solid #494954; border-radius: 8px; background: #25252d; color: #fff; font: inherit; text-decoration: none; white-space: nowrap; }
.comic-read:disabled { opacity: .55; }
.comic-read:not(:disabled):hover, .comic-reader-download:hover { border-color: var(--accent); }
.comic-reader { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; background: #0a0a0c; color: #f4f4f5; }
.comic-reader[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.comic-reader::backdrop { background: #0a0a0c; }
.comic-reader-header { display: flex; align-items: center; gap: clamp(6px, 2vw, 18px); padding: calc(4px + var(--safe-top)) max(8px, var(--safe-right)) 4px max(8px, var(--safe-left)); border-bottom: 1px solid #292932; }
.comic-reader-header .icon-button { font-size: 1.5rem; }
.comic-reader-title { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.comic-reader-position { white-space: nowrap; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.comic-reader-zoom svg { width: 19px; height: 19px; fill: none; stroke: currentColor; }
.comic-reader-zoom[aria-pressed="true"] { background: var(--accent-surface); }
.comic-reader-download { padding: 7px 9px; font-size: .75rem; }
.comic-reader-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: var(--safe-bottom); }
.comic-reader-pages { width: min(calc(100% * var(--comic-scale, 1)), calc(900px * var(--comic-scale, 1))); margin-inline: auto; }
.is-comic-zoomed .comic-reader-pages { cursor: grab; }
.comic-reader-scroll.is-dragging, .comic-reader-scroll.is-dragging .comic-reader-pages { cursor: grabbing; user-select: none; }
.comic-page { position: relative; aspect-ratio: 2 / 3; background: #19191d; }
.comic-page canvas { display: block; width: 100%; height: auto; }
.comic-reader-status { margin: 20px 12px; color: var(--muted); text-align: center; }
.comic-page > .comic-reader-status { position: absolute; inset-inline: 0; top: 20%; }
.viewer-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; visibility: hidden; pointer-events: none; }
.viewer-poster.is-loaded { visibility: visible; }
.stage:has(.viewer-poster.is-loaded) .stage-spinner { visibility: hidden; }
.viewer-image { position: absolute; top: 50%; left: 50%; display: block; user-select: none; max-width: none; transform-origin: center; }
.viewer-image.is-zoomed { cursor: grab; }
.viewer-image.is-dragging { cursor: grabbing; }
.viewer-video { --media-ratio: 1.777778; display: block; width: min(100cqw, calc(100cqh * var(--media-ratio))); height: min(100cqh, calc(100cqw / var(--media-ratio))); min-width: 0; min-height: 0; object-fit: contain; background: #000; }
.stage-message { margin: 0; padding-inline: 52px; color: var(--muted); line-height: 1.5; }
.stage-spinner { color: var(--muted); }
.preview-spinner { position: absolute; z-index: 2; inset: calc(50% - 10px) auto auto calc(50% - 10px); width: 20px; height: 20px; border: 2px solid #52525b; border-top-color: var(--accent); border-radius: 50%; pointer-events: none; animation: spin 1.2s linear infinite; }
.toast, .viewer-status { position: fixed; z-index: 5; top: 67px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 8px 12px; border-radius: 7px; background: var(--surface-raised); text-align: center; font-size: .875rem; }

@media (min-width: 1200px) {
  .grid { --tile-columns: 3; width: calc(100% - 24px); }
}
@media (min-width: 1600px) {
  .grid { --tile-columns: 4; }
}
@media (min-width: 2000px) {
  .grid { --tile-columns: 5; }
}
@media (hover: hover) and (min-width: 1000px) {
  #fullscreen:not(:is(:hover, :focus-visible)) { opacity: 0; }
}
@media (max-width: 899px) {
  .header-select { display: none; }
}
@media (max-width: 615px) {
  .toolbar { height: calc(56px + var(--safe-top)); gap: 4px; padding: var(--safe-top) max(8px, var(--safe-right)) 0 max(8px, var(--safe-left)); }
  .toolbar-brand { gap: 4px; }
  .toolbar-right { gap: 2px; }
  .toolbar .icon-button { width: 44px; height: 44px; }
  .toolbar .icon-button svg { width: 20px; height: 20px; }
  .toolbar .search-toggle svg { width: 22px; height: 22px; }
  .wordmark { font-size: 24px; }
  .grid { --tile-gap: 1px; --tile-tools-height: 44px; width: calc(100% - max(4px, var(--safe-left)) - max(4px, var(--safe-right))); margin-top: 9px; }
  .tile-open, .tile-tools, .show-tile-tools .tile:is(:hover, :has(:focus-visible), .is-pointer-hovered) .tile-open { border-radius: 0; }
  .tile-tools svg { width: 20px; height: 20px; }
  body { --drawer-width: min(384px, calc(100vw - 12px)); }
  body:has(.panel-right[open]):has(.viewer[open], .stream:not([hidden])) { --drawer-width: min(384px, calc(100vw - 12px)); }
  body:has(.panel-right[open]) :is(.viewer[open], .stream) { width: 100%; }
  body:has(.viewer[open], .stream:not([hidden])) .panel-right::backdrop { background: #0009; backdrop-filter: blur(3px); }
  .panel:is(.panel-left, .panel-right) { padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
  .panel:is(.panel-left, .panel-right) .panel-header { height: 56px; min-height: 56px; padding-inline: 16px; }
  .panel-header .icon-button, .dropdown-trigger, .dropdown-item, .settings-options button,
  button.metadata-chip, .accent-button, .admin-button { min-height: 44px; }
  .search-body, .panel-right .panel-footer { padding: 16px; }
  .search-options { gap: 8px; padding-top: 16px; }
  .search-body input, .metadata-form :is(input, textarea) { font-size: 16px; }
  .search-body .metadata-picker > input { height: 44px; padding-right: 48px; }
  .metadata-toggle { width: 44px; height: 42px; }
  .stream-actions { right: max(8px, var(--safe-right)); bottom: max(18%, calc(68px + var(--safe-bottom))); gap: 6px; }
  .viewer-actions { right: 0; bottom: var(--safe-bottom); left: 0; display: flex; justify-content: center; gap: clamp(0px, 1.8vw, 8px); padding: 8px max(4px, var(--safe-right)) 8px max(4px, var(--safe-left)); }
  .viewer-actions .icon-button, .stream-actions .icon-button { width: 44px; height: 44px; }
  .viewer-actions svg, .stream-actions svg { width: 22px; height: 22px; }
  .viewer-actions .viewer-nav svg { width: 17px; height: 17px; }
  .viewer-close, #fullscreen, .zoom-toggle.icon-button { top: calc(4px + var(--safe-top)); width: 44px; height: 44px; }
  .viewer-body { --viewer-close-top: calc(4px + var(--safe-top)); --viewer-close-left: max(4px, var(--safe-left)); --viewer-close-size: 44px; }
  #fullscreen { right: max(4px, var(--safe-right)); }
  .zoom-toggle.icon-button { left: calc(52px + var(--safe-left)); }
  .zoom-toggle svg { width: 18px; height: 18px; }
  .viewer-body > :is(.stage, .carousel-controls) { top: calc(52px + var(--safe-top)); bottom: calc(60px + var(--safe-bottom)); }
  .viewer-body.is-zoom-mode > :is(.stage, .carousel-controls) { bottom: var(--safe-bottom); }
  .stream-slide .carousel-dots { bottom: calc(var(--carousel-dots-bottom, 10px) + var(--safe-bottom)); }
  .admin-page { width: calc(100% - 20px); margin-block: 16px; }
  .admin-heading { padding: 12px; }
  .admin-card { grid-template-columns: minmax(0, min(30vw, 112px)) minmax(0, 1fr); gap: 10px; padding: 10px; }
  .admin-card-actions { gap: 6px; }
  .admin-login { margin-top: 24px; padding: 16px; }
}
@media (hover: none) and (pointer: coarse) {
  .zoom-toggle.icon-button { display: none; }
  .photo-progress { top: var(--viewer-close-top); left: calc(var(--viewer-close-left) + var(--viewer-close-size) + 4px); height: var(--viewer-close-size); align-content: center; padding: 0; }
  .carousel-arrow, .tile-tools, .tile-playback { display: none !important; }
  .grid.show-tile-tools:not(:empty) { margin-bottom: var(--safe-bottom); }
}
@media (prefers-reduced-motion: reduce) {
  :root { --drawer-duration: 0s; }
  .is-loading svg, .preview-spinner, .dropdown-list:not([hidden]) { animation: none; }
  .tile, .tile-tools, .tile-tools-row, :is(.tile, .stream-slide) .carousel-arrow.icon-button { transition: none; }
  [data-carousel-direction] { animation: none; }
}

