:root {
  --bg: #06070b;
  --bg-secondary: #0b0f16;
  --panel: rgba(15, 20, 31, 0.82);
  --panel-strong: rgba(18, 24, 37, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f7fb;
  --text-soft: #94a3b8;
  --text-muted: #64748b;
  --accent: #6ea8ff;
  --accent-soft: rgba(110, 168, 255, 0.16);
  --accent-warm: #ffaf7a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --max-width: 1480px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "SF Pro Display",
    "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(78, 133, 255, 0.16), transparent 28%),
    radial-gradient(circle at 85% 18%, rgba(255, 170, 122, 0.1), transparent 22%),
    linear-gradient(180deg, #05060a 0%, #090d15 48%, #05060a 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(84px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

.ambient-one {
  top: 4vh;
  left: 2vw;
  width: 18rem;
  height: 18rem;
  background: rgba(90, 142, 255, 0.18);
}

.ambient-two {
  right: 5vw;
  top: 18vh;
  width: 20rem;
  height: 20rem;
  background: rgba(255, 169, 120, 0.16);
}

.ambient-three {
  left: 26vw;
  bottom: 4vh;
  width: 24rem;
  height: 24rem;
  background: rgba(92, 196, 255, 0.1);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 1.35rem 0 4rem;
}

.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02)),
    var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.reveal {
  animation: lift-in 560ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.reveal:nth-of-type(2) {
  animation-delay: 90ms;
}

.reveal:nth-of-type(3) {
  animation-delay: 150ms;
}

.reveal:nth-of-type(4) {
  animation-delay: 210ms;
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.3rem 1.4rem;
}

.topbar-copy h1,
.section-heading h2 {
  margin: 0.7rem 0 0;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.topbar-copy h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
}

.topbar-text {
  max-width: 48rem;
  margin: 0.8rem 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.topbar-status {
  margin: 0.9rem 0 0;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.86rem 1.18rem;
  color: var(--text);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, #d8e8ff, #7ea7ff 48%, #4d6fff 100%);
  color: #04111f;
  box-shadow: 0 18px 34px rgba(78, 133, 255, 0.26);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.button-tertiary,
.button-filter {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.button-filter.is-active {
  background: var(--accent-soft);
  border-color: rgba(110, 168, 255, 0.22);
  color: #d7e6ff;
}

.toolbar {
  margin-top: 1rem;
  padding: 1.1rem 1.2rem 1.2rem;
}

.toolbar-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.segmented {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.34rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.segmented-button {
  border: 0;
  padding: 0.72rem 1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
}

.segmented-button.is-active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-field,
.select-field {
  display: grid;
  gap: 0.42rem;
  min-width: min(100%, 18.5rem);
}

.search-field span,
.select-field span {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--text-muted);
}

.search-field input,
.select-field select {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.search-field input,
.select-field select {
  min-height: 3.2rem;
  padding: 0 1rem;
  outline: none;
}

.search-field input::placeholder {
  color: #64748b;
}

.search-field input:focus,
.select-field select:focus {
  border-color: rgba(110, 168, 255, 0.32);
  box-shadow: 0 0 0 4px rgba(110, 168, 255, 0.1);
}

.pill-row,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.58rem;
}

.pill-row {
  margin-top: 1rem;
}

.rarity-pill {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.52rem 0.78rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 700;
}

.rarity-pill.is-active {
  color: #061120;
  border-color: rgba(216, 232, 255, 0.34);
  background: linear-gradient(135deg, #edf5ff, #aacbff);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.stat-card {
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.22);
}

.stat-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 0.34rem;
  font-size: clamp(1.55rem, 2.8vw, 2.35rem);
  letter-spacing: -0.05em;
}

.stat-card small {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-soft);
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(20rem, 0.8fr);
  gap: 1rem;
  margin-top: 1rem;
}

.catalog-panel,
.detail-panel {
  padding: 1.25rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.section-heading h2 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
}

.section-heading p,
#results-count {
  color: var(--text-soft);
}

.empty-state {
  margin-top: 1rem;
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--line-strong);
}

.empty-state h3 {
  margin: 0 0 0.3rem;
}

.empty-state p {
  margin: 0;
  color: var(--text-soft);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.item-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(11, 15, 24, 0.96);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.24);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.item-card:hover,
.item-card.is-selected {
  transform: translateY(-4px);
  border-color: rgba(110, 168, 255, 0.24);
  box-shadow: 0 30px 58px rgba(0, 0, 0, 0.3);
}

.item-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 48%;
  background: linear-gradient(180deg, var(--card-glow, rgba(110, 168, 255, 0.12)), transparent);
  opacity: 0.7;
  pointer-events: none;
}

.card-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.08;
  margin: 0.8rem;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.2), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(110, 168, 255, 0.14));
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.05em;
}

.card-placeholder {
  font-size: 1.5rem;
}

.card-copy {
  position: relative;
  z-index: 1;
  padding: 0 1rem 1rem;
}

.card-topline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.68rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.item-card h3 {
  margin: 0.9rem 0 0.34rem;
  font-size: 1.12rem;
  letter-spacing: -0.04em;
}

.item-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.card-meta,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.card-meta {
  margin-top: 0.95rem;
}

.card-meta span,
.tag,
.detail-link {
  border-radius: 999px;
  padding: 0.46rem 0.68rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.77rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.detail-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-copy h3 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.9rem, 3.2vw, 2.8rem);
  letter-spacing: -0.05em;
}

.detail-copy p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
  word-break: break-word;
}

.detail-tags {
  margin-top: 1rem;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.9rem;
  text-decoration: none;
  color: #d6e7ff;
  background: rgba(110, 168, 255, 0.12);
  border-color: rgba(110, 168, 255, 0.18);
}

.detail-list {
  display: grid;
  gap: 0.85rem;
  margin: 1.25rem 0 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.94rem 0;
  border-top: 1px solid var(--line);
}

.detail-list dt {
  color: var(--text-muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.rarity-common {
  --card-glow: rgba(148, 163, 184, 0.12);
}

.rarity-uncommon {
  --card-glow: rgba(74, 222, 128, 0.12);
}

.rarity-rare {
  --card-glow: rgba(56, 189, 248, 0.13);
}

.rarity-ultra_rare {
  --card-glow: rgba(168, 85, 247, 0.13);
}

.rarity-legendary {
  --card-glow: rgba(251, 146, 60, 0.15);
}

.category-pets {
  --card-glow: rgba(110, 168, 255, 0.12);
}

.category-accessories {
  --card-glow: rgba(255, 175, 122, 0.13);
}

.category-stickers {
  --card-glow: rgba(94, 234, 212, 0.12);
}

@media (max-width: 1180px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: relative;
    top: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--max-width));
    padding-top: 0.75rem;
  }

  .topbar,
  .toolbar,
  .catalog-panel,
  .detail-panel {
    padding: 1rem;
    border-radius: 24px;
  }

  .topbar,
  .toolbar-top,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
    flex-direction: column;
  }

  .search-field,
  .select-field {
    min-width: 100%;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
