/* Remix library — dark KN-style cards */
.remix-page { color: #e2e8f0; padding: 4px 0 28px; }
.remix-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.remix-hero h1 { font-size: 1.7rem; font-weight: 800; margin: 0; color: #fff; display: flex; align-items: center; gap: 10px; }
.remix-help-btn {
  width: 26px; height: 26px; border-radius: 999px; padding: 0;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08);
  color: #e2e8f0; font-size: 12px; font-weight: 800; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.remix-help-btn:hover { background: color-mix(in srgb, var(--theme-accent, #f97316) 25%, transparent); border-color: color-mix(in srgb, var(--theme-accent, #f97316) 50%, transparent); }
.remix-help-ol { margin: 0; padding-left: 1.15rem; color: #cbd5e1; font-size: 13.5px; line-height: 1.55; }
.remix-help-ol li { margin: 0 0 8px; }
.remix-help-note { margin: 14px 0 0; font-size: 13px; color: #94a3b8; line-height: 1.5; }
.remix-hero p { color: #94a3b8; margin: 6px 0 0; font-size: .92rem; }
.remix-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.remix-toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin: 0 0 28px; }
.remix-search-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.remix-search { background: rgba(15,23,42,.7); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; color: #e2e8f0; padding: 9px 14px; flex: 1 1 220px; min-width: 180px; max-width: 420px; }
.remix-sort { display: flex; flex-wrap: wrap; gap: 8px; }
.remix-kind { margin-bottom: 8px; }
.remix-sort a { padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; text-decoration: none; color: #94a3b8; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.remix-sort a.on { color: #fff; background: var(--primary-gradient); border-color: transparent; }

.remix-masonry { position: relative; min-height: 80px; margin-top: 4px; }
.remix-masonry:not(.is-packed) {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
@media (max-width: 1280px) { .remix-masonry:not(.is-packed) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .remix-masonry:not(.is-packed) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .remix-masonry:not(.is-packed) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .remix-masonry:not(.is-packed) { grid-template-columns: 1fr; } }
.remix-masonry.is-packed { display: block; }
.remix-masonry.is-packed .remix-card {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
}

.remix-card { background: #111827; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; overflow: hidden; display: block; }
.remix-media { position: relative; background: #111827; aspect-ratio: 9 / 16; overflow: hidden; width: 100%; }
.remix-media[data-ar="16:9"] { aspect-ratio: 16 / 9; }
.remix-media[data-ar="1:1"] { aspect-ratio: 1 / 1; }
.remix-media[data-ar="4:3"] { aspect-ratio: 4 / 3; }
.remix-media[data-ar="3:4"] { aspect-ratio: 3 / 4; }
.remix-media[data-ar="9:16"] { aspect-ratio: 9 / 16; }
.remix-media > video,
.remix-media > img {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover; display: block; background: transparent;
}
.remix-poster {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
  transition: opacity .2s ease;
}
.remix-media.is-playing .remix-poster { opacity: 0; }
.remix-load {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.remix-media.is-loading .remix-load,
.remix-media.is-error .remix-load,
.remix-preview-stage.is-loading .remix-load,
.remix-preview-stage.is-error .remix-load { opacity: 1; }
.remix-media.is-playing .remix-load,
.remix-preview-stage.is-playing .remix-load { opacity: 0; }
.remix-load-shimmer {
  position: absolute; inset: 0;
  opacity: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.14) 42%, transparent 72%);
  background-size: 220% 100%;
}
.remix-media.is-loading .remix-load-shimmer,
.remix-preview-stage.is-loading .remix-load-shimmer {
  opacity: 1;
  animation: remixShimmer 1.1s linear infinite;
}
.remix-load-spin {
  display: none;
  position: absolute; left: 50%; top: 50%;
  width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 2px solid rgba(255,255,255,.28);
  border-top-color: #fff;
  border-radius: 50%;
}
.remix-media.is-loading-slow .remix-load-spin,
.remix-preview-stage.is-loading-slow .remix-load-spin {
  display: block;
  animation: remixSpin .7s linear infinite;
}
.remix-load-retry {
  display: none;
  pointer-events: auto;
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.72);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.remix-media.is-error .remix-load-retry,
.remix-preview-stage.is-error .remix-load-retry { display: inline-flex; }
.remix-media.is-error .remix-load-shimmer,
.remix-media.is-error .remix-load-spin,
.remix-preview-stage.is-error .remix-load-shimmer,
.remix-preview-stage.is-error .remix-load-spin { display: none; opacity: 0; }
.remix-media.is-constrained:not(.is-playing):not(.is-loading)::after {
  content: '';
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: 0; height: 0;
  margin: -14px 0 0 -8px;
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent rgba(255,255,255,.92);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.55));
  pointer-events: none;
}
.remix-buf {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  z-index: 2; background: rgba(255,255,255,.12);
  pointer-events: none;
}
.remix-buf-bar {
  height: 100%; width: 0;
  background: var(--theme-accent, #ea580c);
  transition: width .15s linear;
}
@keyframes remixShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes remixSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .remix-load-shimmer, .remix-load-spin { animation: none !important; }
  .remix-media.is-loading .remix-load-shimmer,
  .remix-preview-stage.is-loading .remix-load-shimmer {
    background: rgba(0,0,0,.35);
  }
}
.remix-eye {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.65);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}
.remix-eye:hover { background: var(--theme-accent, #ea580c); border-color: transparent; }
.remix-eye svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
dialog.remix-preview-dlg {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px 16px;
  border: 0;
  background: rgba(2, 6, 23, .52);
  color: #e2e8f0;
  z-index: 2147483000;
  align-items: center;
  justify-content: center;
}
dialog.remix-preview-dlg[open] { display: flex; }
dialog.remix-preview-dlg::backdrop {
  background: rgba(2, 6, 23, .52);
  backdrop-filter: blur(12px);
}
.remix-preview-card {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 28px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(249,115,22,.18);
}
.remix-preview-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #000;
}
.remix-preview-stage[data-ar="16:9"] { aspect-ratio: 16 / 9; }
.remix-preview-stage[data-ar="1:1"] { aspect-ratio: 1 / 1; }
.remix-preview-stage[data-ar="4:3"] { aspect-ratio: 4 / 3; }
.remix-preview-stage[data-ar="3:4"] { aspect-ratio: 3 / 4; }
.remix-preview-stage[data-ar="9:16"] { aspect-ratio: 9 / 16; }
.remix-preview-stage video,
.remix-preview-stage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.remix-preview-stage video::-webkit-media-controls-enclosure { display: none !important; }
.remix-preview-stage video::-internal-media-controls-download-button { display: none !important; }
.remix-preview-fade {
  pointer-events: none;
  position: absolute; left: 0; right: 0; bottom: 0; height: 88px;
  background: linear-gradient(to top, rgba(15,23,42,.92), transparent);
}
.remix-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 12px;
}
.remix-preview-title {
  margin: 0;
  min-width: 0;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.remix-preview-close {
  flex-shrink: 0;
  width: 34px; height: 34px; padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.remix-preview-close:hover { background: var(--theme-accent, #ea580c); border-color: transparent; }
.remix-media video, .remix-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.remix-media, .remix-media video, .remix-media img, .remix-chip {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.remix-media video::-webkit-media-controls-enclosure { overflow: hidden; }
.remix-media video::-internal-media-controls-download-button { display: none; }
.remix-chip { position: absolute; left: 8px; bottom: 8px; z-index: 2; width: 42px; height: 42px; border-radius: 10px; overflow: hidden; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.remix-chip.is-dead { display: none !important; }
.remix-chip img { width: 100%; height: 100%; object-fit: cover; }
.remix-flag { position: absolute; top: 8px; right: 8px; z-index: 2; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: var(--primary-gradient); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.remix-body { padding: 10px 12px 12px; }
.remix-title { font-size: 13.5px; font-weight: 700; color: #f1f5f9; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 6px; }
.remix-meta { font-size: 11.5px; color: #94a3b8; display: flex; flex-wrap: wrap; gap: 8px; }
.remix-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.remix-fav {
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(244,63,94,.4);
  background: rgba(244,63,94,.12);
  color: #fb7185;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12.5px;
  font-family: inherit;
  line-height: 1;
}
.remix-fav i { font-size: 14px; pointer-events: none; }
.remix-fav.is-on { background: rgba(244,63,94,.28); border-color: rgba(251,113,133,.7); }
.remix-fav-count { font-variant-numeric: tabular-nums; color: #fda4af; pointer-events: none; }
.remix-btn { border: none; cursor: pointer; border-radius: 10px; font-weight: 700; font-size: 12.5px; padding: 8px 12px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.remix-btn-use { background: var(--primary-gradient); color: #fff; flex: 1; justify-content: center; min-width: 72px; }
.remix-btn-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; background: rgba(255,255,255,.08); color: #94a3b8; }
.remix-btn-ghost { background: rgba(255,255,255,.06); color: #cbd5e1; border: 1px solid rgba(255,255,255,.1); }
.remix-icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06); color: #cbd5e1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.remix-icon-btn i { font-size: 14px; pointer-events: none; }
.remix-icon-btn:hover { border-color: rgba(255,255,255,.28); color: #fff; }
.remix-empty { text-align: center; color: #64748b; padding: 48px 16px; }

.remix-more-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 4px;
}
.remix-load-more {
  appearance: none;
  -webkit-appearance: none;
  min-width: 132px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: #111827;
  color: #f1f5f9;
  font-family: inherit;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}
.remix-load-more:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #fff;
}
.remix-load-more:focus-visible {
  outline: 2px solid rgba(249, 115, 22, .7);
  outline-offset: 2px;
}
.remix-load-more.is-loading {
  opacity: .6;
  pointer-events: none;
}

.remix-banner { background: rgba(249,115,22,.12); border: 1px solid rgba(249,115,22,.35); color: #fdba74; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }

dialog.remix-modal-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 20px;
  border: 0;
  background: rgba(0,0,0,.65);
  color: #e2e8f0;
  color-scheme: dark;
  z-index: 2147483000;
  align-items: center;
  justify-content: center;
}
dialog.remix-modal-bg[open] { display: flex; }
dialog.remix-modal-bg::backdrop { background: rgba(0,0,0,.65); }
.remix-modal-x {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
  justify-content: center;
  padding: 0;
  color: #fff;
  background: rgba(15,23,42,.9);
  border: 1px solid rgba(255,255,255,.2);
}
.remix-modal { background: #0f172a; color: #e2e8f0; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; max-width: 560px; width: 100%; max-height: 86vh; overflow: auto; padding: 20px; padding-bottom: 16px; position: relative; }
.remix-modal h3 { margin: 0 0 12px; color: #fff; }
.remix-kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.remix-kv dt { color: #94a3b8; }
.remix-kv dd { margin: 0; color: #e2e8f0; }
.remix-prompt { white-space: pre-wrap; background: rgba(2,6,23,.55); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 10px; font-size: 13px; line-height: 1.55; color: #e2e8f0; }
.remix-modal .d-flex { position: sticky; bottom: 0; background: #0f172a; padding-top: 10px; }
.remix-inputs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.remix-inputs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }

.ru-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ru-overlay[hidden] { display: none !important; }
.ru-sheet {
  width: min(440px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  color: #e2e8f0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(249,115,22,.18), transparent 42%),
    linear-gradient(180deg, rgba(30,41,59,.96), rgba(15,23,42,.98));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0,0,0,.55);
  overflow: hidden;
}
.ru-head, .ru-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; }
.ru-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.08); }
.ru-kicker { margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #fdba74; font-weight: 700; }
.ru-head h3 { margin: 2px 0 0; font-size: 1.15rem; color: #fff; line-height: 1.25; }
.ru-x {
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06); color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
}
.ru-body { overflow: auto; padding: 4px 16px 8px; -webkit-overflow-scrolling: touch; }
.ru-label { margin: 12px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #94a3b8; }
.ru-dur {
  display: grid;
  grid-template-columns: 1.15fr 0.7fr minmax(64px, 0.9fr) 0.7fr 1.15fr;
  gap: 8px;
  align-items: center;
}
.ru-step {
  min-height: 48px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: #fff;
  border-radius: 14px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.ru-step:disabled { opacity: .35; cursor: default; }
.ru-dur-val {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #e11d48);
}
.ru-chip, .ru-size, .ru-ar {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: #e2e8f0;
  border-radius: 14px;
  min-height: 44px;
  cursor: pointer;
}
.ru-chip { flex: 0 0 auto; scroll-snap-align: center; padding: 0 14px; font-weight: 700; }
.ru-chip.is-on, .ru-size.is-on, .ru-ar.is-on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #f97316, #e11d48);
}
.ru-stack { display: grid; gap: 8px; }
.ru-size { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; text-align: left; }
.ru-size span { color: #94a3b8; font-size: 12px; }
.ru-size.is-on span { color: rgba(255,255,255,.86); }
.ru-aspects { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ru-ar { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; font-size: 11px; font-weight: 700; }
.ru-ar-shape { display: block; border: 2px solid currentColor; border-radius: 4px; opacity: .9; }
.ru-ar-shape[data-shape="16:9"] { width: 36px; height: 20px; }
.ru-ar-shape[data-shape="9:16"] { width: 18px; height: 32px; }
.ru-ar-shape[data-shape="1:1"] { width: 26px; height: 26px; }
.ru-ar-shape[data-shape="4:3"] { width: 32px; height: 24px; }
.ru-ar-shape[data-shape="3:4"] { width: 22px; height: 30px; }
.ru-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ru-pair .ru-chip { width: 100%; }
.ru-toggle {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 4px;
  font-weight: 700;
}
.ru-toggle input { width: 22px; height: 22px; accent-color: #f97316; }
.ru-cost { margin-top: 8px; font-size: 13px; color: #fdba74; font-weight: 700; }
.ru-enter {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  background: linear-gradient(135deg, #f97316, #e11d48);
}
@media (max-width: 720px) {
  .ru-overlay { align-items: flex-end; padding: 0; }
  .ru-sheet {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }
  .ru-aspects { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
