/* Theme tokens */
:root {
  --bg: #1a0932;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7f2ff;
  --muted: #bfb3dc;
  --radius: 14px;
  --shadow: 0 20px 38px rgba(8, 3, 20, 0.45);

  --text-strong: #efe9ff;
  --text-soft: #d8c9fb;
  --focus-ring: rgba(255, 154, 214, 0.85);

  --glass-1: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.05);
  --glass-3: rgba(255, 255, 255, 0.04);
  --glass-4: rgba(255, 255, 255, 0.03);
  --glass-5: rgba(255, 255, 255, 0.02);
}

/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Outfit", "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 61, 122, 0.22), transparent 40%),
    radial-gradient(circle at 84% 20%, rgba(123, 73, 255, 0.22), transparent 40%),
    linear-gradient(180deg, #2a0f52 0%, #1c0b38 54%, #150826 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: min(var(--content-width, 1040px), 94vw);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 34px) 0 clamp(28px, 4vw, 48px);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1 {
  margin: 0 0 8px;
  text-align: center;
  font-family: "Space Grotesk", "Outfit", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4.8vw, 3rem);
  letter-spacing: -0.02em;
  color: #ff74ac;
  text-shadow: 0 8px 30px rgba(194, 86, 255, 0.25);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  h1 {
    background-image: linear-gradient(92deg, #ff3d7a 0%, #ff74ac 32%, #c85cff 66%, #7b49ff 100%);
    background-size: 100% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

.subtitle {
  margin: 0 0 22px;
  text-align: center;
  color: var(--text-soft);
}

/* Shared surface primitives */
.toolbar,
article,
.policy {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.site-footer > span {
  opacity: 0.65;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

.footer-link:hover {
  color: #ece6ff;
  border-bottom-color: rgba(236, 230, 255, 0.5);
}

/* Search bar */
.toolbar {
  background: linear-gradient(160deg, var(--glass-1), var(--glass-5));
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}

#searchInput {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  outline: none;
}

#searchInput::placeholder {
  color: #b5a8d6;
}

#count {
  margin: 0 0 14px;
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.95rem;
}

#list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: clamp(760px, 120vh, 1260px);
}

#empty {
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
}

/* Asset cards */
article {
  background: linear-gradient(180deg, var(--glass-2), var(--glass-5));
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: clamp(120px, 16vw, 152px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

article h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

article img {
  width: 100%;
  max-width: 152px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  display: block;
}

article a {
  color: var(--text-strong);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--glass-4);
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  display: block;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.card-subtitle {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.card-subtitle-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  font-size: 0.9rem;
  display: inline;
}

.card-subtitle-link:hover {
  color: var(--text-strong);
}

.version-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  position: relative;
}

.version-select-btn,
.version-select {
  min-height: 36px;
  border: 1px solid rgba(255, 131, 196, 0.45);
  border-radius: 12px;
  background: linear-gradient(135deg, #ff4a8b 0%, #d44dff 60%, #7b49ff 100%);
  color: #fff6ff;
  box-shadow: 0 10px 22px rgba(212, 77, 255, 0.22);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 38px 8px 14px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease, border-color 150ms ease;
}

.version-select {
  appearance: none;
  -webkit-appearance: none;
}

.version-select-btn:hover,
.version-select:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 190, 228, 0.72);
  box-shadow: 0 14px 28px rgba(212, 77, 255, 0.32);
  filter: saturate(1.06);
}

.version-select-btn:active,
.version-select:active {
  transform: translateY(0) scale(0.985);
}

.version-select-btn:focus,
.version-select-btn:focus-visible,
.version-select:focus,
.version-select:focus-visible,
.version-select-wrap.is-open .version-select-btn {
  outline: none;
  border-color: rgba(255, 190, 228, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 154, 214, 0.3), 0 14px 28px rgba(212, 77, 255, 0.32);
}

.version-select-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.version-select-value::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff6ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l9 4.5-9 4.5-9-4.5L12 3z'/%3E%3Cpath d='M3 12.5 12 17l9-4.5'/%3E%3Cpath d='M3 17l9 4 9-4'/%3E%3C/svg%3E");
}

.version-menu {
  margin: 0;
  padding: 6px;
  list-style: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 100%;
  border: 1px solid rgba(255, 131, 196, 0.45);
  border-radius: 12px;
  background: linear-gradient(180deg, #3b1d63 0%, #2a1248 100%);
  box-shadow: 0 16px 30px rgba(8, 3, 20, 0.52);
  z-index: 20;
}

.version-menu-item {
  border-radius: 8px;
  padding: 7px 10px;
  color: #f8f4ff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.version-menu-item:hover,
.version-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.version-menu-item.is-selected {
  background: linear-gradient(135deg, #ff4a8b 0%, #d44dff 65%, #7b49ff 100%);
  color: #ffffff;
}

.version-select option {
  background: #2a1248;
  color: #f8f4ff;
}

.version-select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.92;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff6ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  transition: transform 160ms ease, opacity 160ms ease;
}

.version-select-wrap.is-open::after {
  transform: translateY(-50%) rotate(180deg);
  opacity: 1;
}

.card-description-text {
  margin: 0;
  color: #e9e0ff;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  opacity: 0.95;
}

.card-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Meta pills */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.meta-pill {
  color: #e9e0ff;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--glass-2);
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.2;
}

.meta-pill-label {
  color: #b8abda;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.meta-pill-label::after {
  content: ":";
  margin-left: 2px;
  color: #c9bde8;
}

.meta-pill-value {
  color: var(--text);
  font-weight: 700;
}

.meta-pill.is-featured {
  color: #ffe9f2;
  background: linear-gradient(90deg, rgba(255, 61, 122, 0.22), rgba(123, 73, 255, 0.22));
  border-color: rgba(255, 140, 191, 0.45);
  font-weight: 600;
}

.meta-pill-tags {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.meta-pill-value-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.meta-pill-value-btn:hover {
  color: var(--text-strong);
}

.meta-pill-tag-separator {
  color: #c9bde8;
}

.meta-pill-private {
  gap: 6px;
}

.private-lock {
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.9;
  display: inline-block;
  transform: translateY(-0.5px);
}

/* Copy button */
.copy-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 131, 196, 0.45);
  border-radius: 12px;
  background: linear-gradient(135deg, #ff4a8b 0%, #d44dff 60%, #7b49ff 100%);
  color: #fff6ff;
  box-shadow: 0 10px 22px rgba(212, 77, 255, 0.22);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  gap: 8px;
  margin-top: 0;
  min-height: 36px;
  padding: 8px 12px;

  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease, border-color 150ms ease;
}

.copy-btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0) 75%);
  transform: translateX(-130%);
  transition: transform 260ms ease;
}

.copy-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 190, 228, 0.72);
  box-shadow: 0 14px 28px rgba(212, 77, 255, 0.32);
  filter: saturate(1.06);
}

.copy-btn:hover::before {
  transform: translateX(130%);
}

.copy-btn:active {
  transform: translateY(0) scale(0.985);
}

.copy-btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 170ms ease, opacity 170ms ease;
}

.copy-btn-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.copy-btn-icon-success {
  position: absolute;
  left: 12px;
  opacity: 0;
  transform: scale(0.7);
}

.copy-btn-label {
  display: inline-block;
  text-align: center;
  transition: transform 170ms ease;
}

.copy-btn.is-copied {
  border-color: rgba(255, 191, 230, 0.75);
  background: linear-gradient(135deg, #ff5d98 0%, #e25bff 58%, #8a56ff 100%);
  color: #fff6ff;
  box-shadow: 0 12px 24px rgba(226, 91, 255, 0.34);
}

.copy-btn.is-copied .copy-btn-icon-default {
  opacity: 0;
  transform: scale(0.7);
}

.copy-btn.is-copied .copy-btn-icon-success {
  opacity: 1;
  transform: scale(1);
}

/* Unified focus ring */
.copy-btn:focus-visible,
#searchInput:focus-visible,
.card-subtitle-link:focus-visible,
.meta-pill-value-btn:focus-visible,
.version-select-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Privacy page */
.page-privacy .wrap {
  --content-width: 840px;
}

.page-privacy h1 {
  text-align: left;
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
}

.page-privacy .subtitle {
  margin: 0 0 18px;
  text-align: left;
  color: var(--muted);
}

.policy {
  border-radius: 14px;
  padding: 16px;
  background: var(--glass-3);
  color: #ddd2fa;
  line-height: 1.5;
  font-size: 0.92rem;
}

.policy h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: #f4ecff;
}

.policy h3 {
  margin: 14px 0 6px;
  font-size: 0.96rem;
  color: #efe6ff;
}

.policy p {
  margin: 0 0 8px;
}

.policy ul {
  margin: 0 0 10px;
  padding-left: 18px;
}

.policy li {
  margin: 0 0 6px;
}

.actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  text-decoration: none;
  color: #f6eeff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--glass-3);
  font-size: 0.86rem;
  font-weight: 600;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.legal-spacer {
  height: 22px;
}

/* Responsive */
@media (min-width: 1100px) {
  article {
    padding: 16px;
    gap: 16px;
  }
}

@media (max-width: 820px) {
  article {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  article img {
    max-width: min(100%, 260px);
    justify-self: center;
  }
}

@media (max-width: 620px) {
  .site-footer {
    gap: 6px 10px;
    font-size: 0.8rem;
  }

  .site-footer > span {
    display: none;
  }

  .wrap {
    width: 94vw;
  }

  h1 {
    font-size: clamp(1.7rem, 8vw, 2.1rem);
  }

  .subtitle {
    font-size: 0.92rem;
  }

  .toolbar {
    padding: 10px;
    border-radius: 14px;
  }

  #count {
    font-size: 0.9rem;
  }

  article {
    padding: 12px;
  }

  article h3 {
    font-size: 1.08rem;
  }

  .card-subtitle {
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .card-meta {
    gap: 8px;
  }

  #list {
    min-height: clamp(520px, 95vh, 900px);
  }

  .meta-pill {
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  .policy {
    padding: 12px;
    font-size: 0.86rem;
  }
}
