/* NightKillerYT — UI Resources (/ui-resources): the library, the category pages, favorites, one resource's page,
   the quick view and "Download all". Loaded after site.css on these pages only; uses its tokens (--glass-*, --text-*,
   --accent, --radius-*, --ease-out) and components (.hero, .kicker, .btn, .chip, .empty-state, .toast).

   The look is the home page's: see-through glass cards on the page grid (like the game cards: the picture on top,
   a Sora title and one quiet line below, a small lift on hover), one pink accent, no badges or decorative icons.
   Pictures sit right on the glass; the preview background switch adds a checkerboard or a light backdrop. */

/* ---------- glass cards ---------- */
.res-card,
.res-tile,
.res-stage,
.res-item-info,
.res-shared,
.res-soon,
.res-empty {
  border: 1px solid var(--glass-border);
  background: var(--glass-1);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-md);
}

.res-card,
.res-tile {
  transition:
    transform var(--medium) var(--ease-out),
    border-color var(--medium) var(--ease-out),
    box-shadow var(--medium) var(--ease-out);
}

.res-card:hover,
.res-tile:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* ---------- preview backgrounds: dark (the glass itself), checkerboard, light ---------- */
/* Only behind pictures: a sound's waveform, a file's type and a link stay on the glass. */
.res-grid[data-bg="checker"] .res-card-media:has(.res-img),
.res-stage[data-bg="checker"]:has(.res-img),
.res-qv-stage[data-bg="checker"]:has(.res-img) {
  background: repeating-conic-gradient(#1f1b29 0% 25%, #2a2533 0% 50%) 50% / 18px 18px;
}

.res-grid[data-bg="light"] .res-card-media:has(.res-img),
.res-stage[data-bg="light"]:has(.res-img),
.res-qv-stage[data-bg="light"]:has(.res-img) {
  background: #f1f0f5;
}

/* A very dark picture (a black face, say) gets a light backdrop instead of the dark glass. */
.res-grid[data-bg="dark"] .res-card[data-ink="dark"] .res-card-media,
.res-tile-media[data-ink="dark"],
.res-stage[data-bg="dark"][data-ink="dark"],
.res-qv-stage[data-bg="dark"][data-ink="dark"] {
  background: #dedbe5;
}

/* Every picture box is one grid cell of a known size, so a picture always fits inside it. */
.res-card-art,
.res-tile-media,
.res-stage-view,
.res-qv-view {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}

/* ---------- hero ---------- */
.res-hero {
  padding-bottom: clamp(32px, 5vw, 56px);
}

.res-hero .hero-lead {
  max-width: 56ch;
}

.res-hero-title {
  font-size: clamp(2.4rem, 6.5vw, 5rem);
}

/* The small pink label above a title, as a link one level up. */
.res-kicker {
  min-height: 40px;
  margin-bottom: 4px;
  transition: color var(--medium) var(--ease-out);
}

.res-kicker:hover {
  color: var(--text);
}

.res-search {
  position: relative;
  width: min(100%, 600px);
  margin: clamp(22px, 3vw, 32px) auto 0;
}

.res-search-icon {
  position: absolute;
  top: 50%;
  left: 20px;
  z-index: 1;
  width: 20px;
  height: 20px;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.res-search-input {
  width: 100%;
  height: 58px;
  padding: 0 56px 0 52px;
  border: 1px solid var(--glass-border-hover);
  border-radius: 18px;
  background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font: 500 17px/1 var(--font-body);
  transition:
    border-color var(--medium) var(--ease-out),
    box-shadow var(--medium) var(--ease-out);
}

.res-search-input::placeholder {
  color: var(--text-3);
}

.res-search-input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow:
    0 0 0 4px rgba(255, 92, 168, 0.12),
    var(--shadow-md);
}

.res-search-input::-webkit-search-cancel-button {
  filter: invert(0.7);
}

.res-search-key {
  position: absolute;
  top: 50%;
  right: 16px;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font: 600 12.5px/1 var(--font-mono);
  transform: translateY(-50%);
  transition: opacity var(--fast) var(--ease-out);
}

.res-search-input:focus + .res-search-key,
.res-search-input:not(:placeholder-shown) + .res-search-key {
  opacity: 0;
}

/* One quiet line under the search. */
.res-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  color: var(--text-3);
  font-size: 14.5px;
}

.res-stats > * + *::before {
  content: "·";
  margin: 0 10px;
  color: var(--text-3);
  opacity: 0.7;
}

.res-stats .res-num {
  color: var(--text-2);
}

.res-fav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--text-2);
  font-weight: 600;
  transition: color var(--medium) var(--ease-out);
}

.res-fav-link:hover {
  color: var(--text);
}

.res-fav-count {
  margin-left: 7px;
  color: var(--accent-ink);
  font: 600 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.res-fav-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.res-fav-actions .btn {
  min-height: 40px;
}

/* Numbers, sizes and lengths. */
.res-num {
  font-family: var(--font-mono);
  font-size: 0.93em;
  font-variant-numeric: tabular-nums;
}

/* ---------- section heads, category chips, tags ---------- */
.res-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: clamp(16px, 2.4vw, 24px);
}

.res-section-head .link-arrow {
  min-height: 40px;
}

.res-section-title,
.res-results-title {
  font: 600 clamp(1.3rem, 2.2vw, 1.6rem) / 1.2 var(--font-display);
  letter-spacing: -0.025em;
}

.res-chips-wrap {
  padding-top: 0;
}

.res-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.res-chips .chip {
  background: var(--glass-1);
}

/* Tags filter the list: quiet words, the chosen one gets the accent. */
.res-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: -4px 0 18px -10px;
}

.res-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 600 13.5px/1 var(--font-body);
  white-space: nowrap;
  cursor: var(--nc-hand, pointer);
  transition:
    background-color var(--medium) var(--ease-out),
    border-color var(--medium) var(--ease-out),
    color var(--medium) var(--ease-out);
}

.res-tag:hover {
  background: var(--glass-1);
  color: var(--text);
}

.res-tag[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
}

.res-tag-count {
  color: var(--text-3);
  font: 500 11.5px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.res-tag-more {
  color: var(--text-3);
}

/* ---------- category cards ---------- */
.res-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 196px), 1fr));
  gap: clamp(12px, 1.6vw, 18px);
}

.res-tiles > li {
  display: flex;
  min-width: 0;
}

.res-tile {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

/* The newest picture of the category, right on the glass (full pictures fill the top and fade into the card). */
.res-tile-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  padding: 12% 16% 6%;
  overflow: hidden;
}

.res-tile-media[data-fit="cover"] {
  padding: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, rgba(0, 0, 0, 0.35) 84%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 55%, rgba(0, 0, 0, 0.35) 84%, transparent 100%);
}

.res-tile-media .res-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.res-tile-media[data-fit="cover"] .res-img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

.res-tile-media .res-wave {
  height: 56%;
}

.res-tile-media .res-file-ext {
  font-size: 17px;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .res-tile:hover .res-img {
    transform: scale(1.05);
  }
}

.res-tile-body {
  display: grid;
  gap: 3px;
  padding: 6px 16px 16px;
}

.res-tile-name {
  color: var(--text);
  font: 600 16px/1.25 var(--font-display);
  letter-spacing: -0.02em;
}

.res-tile-count {
  color: var(--text-3);
  font-size: 13.5px;
}

.res-soon-line {
  margin-top: 16px;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- the list's toolbar ---------- */
.res-results {
  scroll-margin-top: calc(var(--header-height) + 8px);
}

.res-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.res-toolbar-text {
  min-width: 0;
}

.res-count {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.res-results-title.sr-only + .res-count {
  margin-top: 0;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
}

.res-toolbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.res-sort {
  position: relative;
}

.res-select {
  height: 42px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--glass-border-hover);
  border-radius: 13px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d879f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 12px center / 16px no-repeat,
    var(--glass-1);
  color: var(--text);
  font: 600 14px/1 var(--font-body);
  appearance: none;
  cursor: var(--nc-hand, pointer);
  transition: border-color var(--medium) var(--ease-out);
}

.res-select:hover {
  border-color: var(--border-hover);
}

.res-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.res-select option {
  background: var(--surface-2);
}

/* The preview background: three swatches, the chosen one ringed in pink. */
.res-bg-switch {
  display: inline-flex;
  align-items: center;
}

.res-bg-switch button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: var(--nc-hand, pointer);
}

.res-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24) inset;
  outline: 1.5px solid transparent;
  outline-offset: 2px;
  transition:
    outline-color var(--medium) var(--ease-out),
    transform var(--medium) var(--ease-out);
}

.res-swatch[data-swatch="dark"] {
  background: #0d0b12;
}

.res-swatch[data-swatch="checker"] {
  background: repeating-conic-gradient(#4a4357 0% 25%, #1d1926 0% 50%) 50% / 10px 10px;
}

.res-swatch[data-swatch="light"] {
  background: #f1f0f5;
}

.res-bg-switch button:hover .res-swatch {
  transform: scale(1.1);
}

.res-bg-switch button[aria-pressed="true"] .res-swatch {
  outline-color: var(--accent);
}

.res-zip-button {
  min-height: 42px;
}

/* Controls that only work with JavaScript (early.js marks the page before it paints). */
html:not(.js) :is(.res-bg-switch, .res-sort, .res-zip-button, .res-zoom-tools, .res-fav-actions, .res-item-more, .res-heart, .res-save, .res-play) {
  display: none;
}

/* ---------- the grid and its cards ---------- */
.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 212px), 1fr));
  gap: clamp(12px, 1.6vw, 20px);
}

.res-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  content-visibility: auto;
  contain-intrinsic-size: auto 290px;
}

/* The picture on top, on the glass. Full pictures (backgrounds, textures) fill it and fade into the card. */
.res-card-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: zoom-in;
  transition: background-color var(--medium) var(--ease-out);
}

.res-card-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 13% 15% 9%;
}

.res-card[data-fit="cover"] .res-card-art {
  padding: 0;
}

.res-card[data-fit="cover"] .res-card-media {
  -webkit-mask-image: linear-gradient(180deg, #000 58%, rgba(0, 0, 0, 0.35) 86%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 58%, rgba(0, 0, 0, 0.35) 86%, transparent 100%);
}

.res-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition:
    transform 900ms var(--ease-out),
    opacity 450ms var(--ease-out);
}

.res-card[data-fit="cover"] .res-img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

.res-js :is(.res-card, .res-tile) .res-img:not(.is-loaded) {
  opacity: 0;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .res-card:hover .res-img {
    transform: scale(1.05);
  }
}

/* A file without a picture: its type, in words. */
.res-file {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-width: 0;
  text-align: center;
}

.res-file-ext {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font: 600 19px/1.2 var(--font-mono);
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-file-kind {
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
}

/* A sound: its waveform. The played part lights up (--progress, 0% to 100%). */
.res-wave {
  width: 100%;
  height: 52%;
  overflow: visible;
}

.res-wave-base {
  fill: rgba(255, 255, 255, 0.24);
}

.res-wave-fill {
  fill: var(--accent);
  clip-path: inset(0 calc(100% - var(--progress, 0%)) 0 0);
  transition: clip-path 120ms linear;
}

/* Heart (top right), download (bottom right) and play (middle) float over the picture. */
.res-card-tools {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  aspect-ratio: 4 / 3;
  pointer-events: none;
}

.res-card-tools > * {
  pointer-events: auto;
}

.res-card .res-heart,
.res-card .res-get {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(10, 8, 14, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: var(--nc-hand, pointer);
  transition:
    opacity var(--medium) var(--ease-out),
    background-color var(--medium) var(--ease-out),
    border-color var(--medium) var(--ease-out),
    color var(--medium) var(--ease-out);
}

.res-card .res-heart {
  top: 10px;
  right: 10px;
}

.res-card .res-get {
  right: 10px;
  bottom: 10px;
}

.res-card .res-heart:hover,
.res-card .res-get:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(10, 8, 14, 0.78);
}

.res-heart .icon,
.res-get .icon {
  width: 18px;
  height: 18px;
}

.res-card .res-heart[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.res-heart[aria-pressed="true"] .icon,
.res-save[aria-pressed="true"] .icon {
  fill: currentColor;
}

:is(.res-heart, .res-save).is-popping .icon {
  animation: res-pop 460ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.res-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.9);
  color: #fff;
  cursor: var(--nc-hand, pointer);
  transform: translate(-50%, -50%);
  transition:
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color var(--medium) var(--ease-out);
}

.res-play:hover {
  background: var(--accent-ink);
  transform: translate(-50%, -50%) scale(1.05);
}

.res-play .icon {
  width: 20px;
  height: 20px;
}

.res-icon-pause,
.is-playing .res-icon-play {
  display: none;
}

.is-playing .res-icon-pause {
  display: block;
}

.res-icon-play {
  margin-left: 3px;
}

.res-card-body {
  display: grid;
  gap: 4px;
  padding: 12px 16px 15px;
}

.res-card-title {
  overflow: hidden;
  font: 600 15px/1.3 var(--font-display);
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-card-meta {
  display: flex;
  align-items: baseline;
  overflow: hidden;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.res-card-meta > span {
  flex: none;
}

.res-card-meta > span + span::before {
  content: "·";
  margin: 0 7px;
  font-family: var(--font-body);
  opacity: 0.7;
}

.res-card-meta > span:first-child {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* On screens with a mouse the buttons show on hover (a saved heart always shows). */
@media (hover: hover) and (pointer: fine) {
  .res-card .res-heart:not([aria-pressed="true"]),
  .res-card .res-get {
    opacity: 0;
  }

  .res-card:hover .res-heart,
  .res-card:hover .res-get,
  .res-card:focus-within .res-heart,
  .res-card:focus-within .res-get {
    opacity: 1;
  }
}

.res-card.is-playing {
  border-color: var(--accent-line);
}

.res-card-skeleton {
  pointer-events: none;
}

.res-card-skeleton .res-card-media {
  background: rgba(255, 255, 255, 0.025);
}

.res-card-skeleton .res-card-body {
  gap: 8px;
}

.res-card-skeleton .skeleton-line {
  display: block;
  height: 11px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.res-card-skeleton .skeleton-line.short {
  width: 55%;
}

.res-more {
  display: flex;
  justify-content: center;
  margin-top: clamp(22px, 3vw, 34px);
}

.res-empty {
  margin-top: 4px;
  border-style: solid;
}

.res-empty p {
  max-width: 48ch;
}

.res-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.res-empty-actions:empty {
  display: none;
}

.res-noscript {
  margin-top: 18px;
  color: var(--text-3);
  text-align: center;
}

/* ---------- favorites: a shared list ---------- */
.res-shared-wrap {
  padding-top: 8px;
}

.res-shared {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 18px 22px;
  border-color: var(--accent-line);
  border-radius: var(--radius-lg);
}

.res-shared-text {
  display: grid;
  flex: 1 1 260px;
  gap: 3px;
  min-width: 0;
}

.res-shared-title {
  font: 600 1.05rem/1.3 var(--font-display);
  letter-spacing: -0.02em;
}

.res-shared-text p + p {
  color: var(--text-2);
  font-size: 14.5px;
}

.res-shared-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.res-shared-actions .btn {
  min-height: 40px;
}

/* ---------- coming soon ---------- */
.res-soon {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 780px;
  margin-inline: auto;
  padding: clamp(28px, 5vw, 52px) clamp(20px, 4vw, 44px);
  border-radius: var(--radius-xl);
  text-align: center;
}

.res-soon-title {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  letter-spacing: -0.03em;
}

.res-soon p {
  max-width: 54ch;
  color: var(--text-2);
}

.res-soon .res-soon-cats {
  color: var(--text-3);
  font-size: 14px;
}

.res-soon .btn {
  margin-top: 6px;
}

/* ---------- one resource's page ---------- */
.res-item {
  position: relative;
  isolation: isolate;
  padding-top: clamp(20px, 3.5vw, 40px);
  padding-bottom: clamp(20px, 3vw, 36px);
}

.res-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 600;
}

.res-crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.res-crumbs li + li::before {
  content: "/";
  opacity: 0.45;
}

.res-crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  transition: color var(--medium) var(--ease-out);
}

.res-crumbs a:hover {
  color: var(--text);
}

.res-crumbs [aria-current] {
  overflow: hidden;
  max-width: 40ch;
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-item-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 36px);
  align-items: start;
  margin-top: clamp(8px, 1.4vw, 16px);
}

.res-item-media {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  min-width: 0;
}

/* The big picture: a glass card (dark), or the checkerboard or light backdrop. */
.res-stage {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

/* A sound, a file or a link without a picture needs less room. */
.res-stage:not(:has(.res-img)) {
  aspect-ratio: 16 / 10;
}

.res-stage-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 9%;
  overflow: hidden;
  touch-action: pan-y;
}

.res-stage[data-fit="cover"] .res-stage-view {
  padding: 0;
}

.res-stage[data-fit="cover"] .res-img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

.res-stage[data-kind="image"] .res-stage-view,
.res-stage[data-kind="vector"] .res-stage-view {
  cursor: zoom-in;
}

.res-stage.is-zoomed .res-stage-view {
  cursor: grab;
  touch-action: none;
}

.res-stage.is-dragging .res-stage-view {
  cursor: grabbing;
}

.res-zoomable {
  transform-origin: 50% 50%;
  transition: transform 180ms var(--ease-out) !important;
  will-change: transform;
}

.is-dragging .res-zoomable {
  transition: none !important;
}

.res-stage .res-wave {
  height: 40%;
}

.res-stage .res-file-ext {
  font-size: clamp(22px, 3vw, 32px);
}

.res-stage .res-file-kind {
  font-size: 15px;
}

.res-stage-play {
  position: absolute;
  bottom: 12%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.9);
  color: #fff;
  cursor: var(--nc-hand, pointer);
  transform: translateX(-50%);
  transition:
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color var(--medium) var(--ease-out);
}

.res-stage-play:hover {
  background: var(--accent-ink);
  transform: translateX(-50%) scale(1.05);
}

.res-stage-play .icon {
  width: 24px;
  height: 24px;
}

.res-stage-time {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  color: var(--text-2);
  font: 600 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.res-stage[data-kind="audio"] .res-stage-view {
  cursor: var(--nc-hand, pointer);
}

.res-stage:fullscreen {
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background-color: var(--bg);
}

.res-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-top: 8px;
}

.res-zoom-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.res-zoom-tools button {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  cursor: var(--nc-hand, pointer);
  transition:
    background-color var(--medium) var(--ease-out),
    color var(--medium) var(--ease-out);
}

.res-zoom-tools button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.res-zoom-tools .icon {
  width: 18px;
  height: 18px;
}

.res-zoom-value {
  min-width: 58px;
  font: 600 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* The facts and buttons: one glass card. */
.res-item-info {
  min-width: 0;
  padding: clamp(22px, 2.8vw, 32px);
  border-radius: var(--radius-xl);
}

.res-item-title {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  overflow-wrap: break-word;
}

.res-item-by {
  margin-top: 10px;
  color: var(--text-3);
}

.res-item-by a,
.res-item-by strong {
  color: var(--text);
  font-weight: 650;
  transition: color var(--medium) var(--ease-out);
}

.res-item-by a:hover {
  color: var(--accent-ink);
}

.res-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.res-item-get-meta {
  margin-left: 2px;
  padding-left: 11px;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0.85;
}

.res-save .icon {
  width: 19px;
  height: 19px;
  transition: color var(--medium) var(--ease-out);
}

.res-save[aria-pressed="true"] .icon {
  color: var(--accent);
}

/* Small text buttons (Share, Copy image), lined up with the text above. */
.res-item-more,
.res-qv-more {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 8px 0 0 -10px;
}

.res-text-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: 600 14px/1 var(--font-body);
  cursor: var(--nc-hand, pointer);
  transition:
    background-color var(--medium) var(--ease-out),
    color var(--medium) var(--ease-out);
}

.res-text-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.res-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  margin-top: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.res-facts > div {
  min-width: 0;
}

.res-facts dt {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.res-facts dd {
  margin: 4px 0 0;
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.res-item-desc {
  margin-top: 22px;
  font-size: 1rem;
}

.res-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin-top: 16px;
}

.res-tag-list a {
  display: inline-flex;
  align-items: center;
  min-width: 40px;
  min-height: 40px;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 600;
  transition: color var(--medium) var(--ease-out);
}

.res-tag-list a:hover {
  color: var(--accent-ink);
}

.res-license {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--glass-border);
  color: var(--text-2);
  font-size: 15px;
}

.res-license-title {
  margin-bottom: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.res-item-report {
  margin-top: 18px;
  color: var(--text-3);
  font-size: 14px;
}

.res-related {
  padding-top: clamp(28px, 4vw, 48px);
}

/* ---------- quick view ---------- */
html.res-qv-open {
  overflow: hidden;
}

.res-qv {
  width: min(1180px, calc(100vw - 40px));
  height: min(780px, calc(100dvh - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--radius-xl);
  background: rgba(19, 16, 26, 0.86);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.res-qv::backdrop {
  background: rgba(5, 4, 8, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.res-qv[open] {
  animation: res-qv-in 340ms var(--ease-out);
}

.res-qv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: 100%;
}

.res-qv-stage {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
}

.res-qv-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 7%;
  overflow: hidden;
  touch-action: pan-y;
}

.res-qv-stage[data-fit="cover"] .res-qv-view {
  padding: 0;
}

.res-qv-stage[data-kind="image"] .res-qv-view,
.res-qv-stage[data-kind="vector"] .res-qv-view {
  cursor: zoom-in;
}

.res-qv-stage.is-zoomed .res-qv-view {
  cursor: grab;
  touch-action: none;
}

.res-qv-stage.is-dragging .res-qv-view {
  cursor: grabbing;
}

.res-qv-view .res-img {
  max-width: 100%;
  max-height: 100%;
}

.res-qv-stage[data-fit="cover"] .res-qv-view .res-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.res-qv-view .res-wave {
  height: 34%;
}

.res-qv-view .res-file-ext {
  font-size: clamp(22px, 3vw, 30px);
}

/* Buttons over the picture: small round glass. */
.res-qv-close,
.res-qv-nav {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(10, 8, 14, 0.55);
  color: var(--text);
  cursor: var(--nc-hand, pointer);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition:
    background-color var(--medium) var(--ease-out),
    border-color var(--medium) var(--ease-out),
    opacity var(--medium) var(--ease-out);
}

.res-qv-close:hover,
.res-qv-nav:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(10, 8, 14, 0.8);
}

.res-qv-close {
  top: 14px;
  left: 14px;
}

.res-qv-nav {
  top: 50%;
  margin-top: -22px;
}

.res-qv-nav[data-dir="prev"] {
  left: 14px;
}

.res-qv-nav[data-dir="next"] {
  right: 14px;
}

.res-qv-nav:disabled {
  opacity: 0;
  pointer-events: none;
}

.res-qv-bottom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.res-qv-bottom > * {
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(10, 8, 14, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.res-qv-bottom .res-zoom-tools button {
  border-radius: 999px;
}

.res-qv-counter {
  position: absolute;
  top: 26px;
  right: 20px;
  z-index: 4;
  color: var(--text-2);
  font: 600 12.5px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.res-qv-play {
  position: absolute;
  bottom: 22%;
  left: 50%;
  z-index: 3;
}

.res-qv-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 26px 26px 22px;
  overflow-y: auto;
  border-left: 1px solid var(--glass-border);
  overscroll-behavior: contain;
}

.res-qv-info > * {
  flex-shrink: 0;
}

.res-qv-info > .res-kicker {
  align-self: flex-start;
  margin-bottom: -10px;
}

.res-qv-title {
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.res-qv-by {
  margin-top: -6px;
  color: var(--text-3);
  font-size: 14.5px;
}

.res-qv-by strong {
  color: var(--text-2);
}

.res-qv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.res-qv-actions .btn-primary {
  flex: 1 1 160px;
  min-width: 0;
}

.res-qv-more {
  margin-top: -8px;
}

.res-qv .res-facts {
  margin-top: 0;
  padding-top: 16px;
}

.res-qv .res-tag-list {
  margin-top: -6px;
}

.res-qv-open {
  margin-top: auto;
}

.res-qv-open .link-arrow {
  min-height: 40px;
}

/* ---------- "Download all" progress ---------- */
.res-zip-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 110;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  padding: 16px 18px 14px;
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--radius-lg);
  background: rgba(19, 16, 26, 0.88);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  animation: res-rise 360ms var(--ease-out);
}

.res-zip-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.res-zip-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font: 600 15px/1.3 var(--font-display);
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-zip-text {
  color: var(--text-2);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.res-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.res-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  transition: transform 220ms var(--ease-out);
}

.res-zip-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.res-zip-actions .btn {
  min-height: 40px;
}

.res-zip-panel.is-warn {
  border-color: var(--warn-line);
}

.res-zip-actions[hidden] {
  display: none;
}

/* ---------- small shared pieces ---------- */
:is(.res-hero, .res-shared-wrap, .res-results, .res-item, .res-qv, .res-zip-panel) :is(.btn, .res-text-button):disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.toast[data-tone="warn"] .icon {
  color: var(--warn);
}

.toast[data-tone="error"] .icon {
  color: #ff8a8a;
}

.toast[data-tone="info"] .icon {
  color: var(--info);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: res-spin 0.8s linear infinite;
}

/* ---------- motion ---------- */
@keyframes res-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes res-qv-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

@keyframes res-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes res-card-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes res-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .res-card.is-new {
    animation: res-card-in 520ms var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 30ms);
  }
}

/* ---------- touch screens ---------- */
@media (hover: none) {
  .res-card:hover,
  .res-tile:hover {
    transform: none;
  }

  .res-card:active,
  .res-tile:active {
    transform: scale(0.985);
    transition-duration: 90ms;
  }
}

@media (pointer: coarse) {
  .res-tag {
    height: 40px;
  }

  .res-chips .chip {
    height: 40px;
  }
}

/* ---------- smaller screens ---------- */
@media (max-width: 960px) {
  .res-qv-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .res-qv-info {
    max-height: 46dvh;
    border-top: 1px solid var(--glass-border);
    border-left: 0;
  }
}

@media (max-width: 900px) {
  .res-item-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .res-item-media {
    position: static;
  }
}

@media (max-width: 700px) {
  .res-qv {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .res-qv-info {
    gap: 12px;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .res-qv-close {
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
  }

  .res-qv-counter {
    top: calc(24px + env(safe-area-inset-top));
  }

  .res-qv-nav {
    width: 40px;
    height: 40px;
    margin-top: -20px;
  }

  .res-qv-nav[data-dir="prev"] {
    left: 8px;
  }

  .res-qv-nav[data-dir="next"] {
    right: 8px;
  }
}

/* Phones get the same glass with a lighter blur, like the home page. */
@media (max-width: 600px) {
  .res-card,
  .res-tile,
  .res-stage,
  .res-item-info,
  .res-shared,
  .res-soon,
  .res-empty {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .res-search-input {
    height: 54px;
    padding-right: 16px;
    border-radius: 16px;
    font-size: 16px;
  }

  .res-search-key {
    display: none;
  }

  .res-stats {
    font-size: 14px;
  }

  .res-chips {
    flex-wrap: nowrap;
    margin-inline: calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  }

  .res-chips::-webkit-scrollbar,
  .res-tags::-webkit-scrollbar,
  .res-tiles::-webkit-scrollbar {
    display: none;
  }

  .res-chips .chip {
    flex: none;
    scroll-snap-align: start;
  }

  .res-tags {
    flex-wrap: nowrap;
    margin-inline: calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  }

  .res-tag {
    flex: none;
  }

  .res-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .res-toolbar-tools {
    gap: 6px;
  }

  .res-select {
    font-size: 16px;
  }

  .res-zip-button {
    flex: 1 1 auto;
  }

  .res-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .res-card {
    border-radius: 18px;
    contain-intrinsic-size: auto 220px;
  }

  .res-card-art {
    padding: 12% 12% 8%;
  }

  .res-card-body {
    padding: 10px 12px 12px;
  }

  .res-card-title {
    display: -webkit-box;
    font-size: 14px;
    white-space: normal;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: break-word;
  }

  .res-card-meta {
    font-size: 12px;
  }

  .res-card .res-heart {
    top: 6px;
    right: 6px;
  }

  .res-card .res-get {
    right: 6px;
    bottom: 6px;
  }

  .res-play {
    width: 46px;
    height: 46px;
  }

  .res-file-ext {
    font-size: 15px;
  }

  .res-file-kind {
    font-size: 12px;
  }

  /* Category cards: one row that swipes sideways (the next one peeks in). */
  .res-tiles {
    grid-template-columns: none;
    grid-auto-columns: min(44%, 200px);
    grid-auto-flow: column;
    gap: 10px;
    margin-inline: calc(var(--gutter) * -1);
    padding: 4px var(--gutter) 10px;
    overflow-x: auto;
    scroll-padding-inline: var(--gutter);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .res-tiles > li {
    scroll-snap-align: start;
  }

  .res-tile {
    border-radius: 18px;
  }

  .res-tile-body {
    padding: 4px 12px 13px;
  }

  .res-tile-name {
    font-size: 15px;
  }

  .res-tile-count {
    font-size: 12.5px;
  }

  .res-item-actions .btn-lg:first-child {
    flex: 1 1 100%;
  }

  .res-item-actions .res-save {
    flex: 1 1 auto;
  }

  .res-facts {
    gap: 14px 16px;
  }

  .res-zip-panel {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 16px;
    width: auto;
  }
}

@media (max-width: 380px) {
  .res-grid {
    gap: 8px;
  }

  .res-card-body {
    padding: 9px 10px 11px;
  }

  .res-card-meta > span:nth-child(n + 2) {
    display: none;
  }
}
