:root {
  color-scheme: light;
  --ink: #171712;
  --muted: #59635f;
  --canvas: #f6fbf7;
  --paper: #ffffff;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(23, 23, 18, 0.14);
  --mint: #14a67d;
  --coral: #f05d3b;
  --gold: #f2b705;
  --sky: #218bff;
  --night: #151716;
  --shadow: 0 24px 70px rgba(35, 43, 38, 0.14);
  --font-display: "LXGW WenKai Screen", "ZCOOL XiaoWei", "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", "Songti SC", serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --font-body: "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(20, 166, 125, 0.1) 0 12px, transparent 12px 32px),
    linear-gradient(90deg, rgba(23, 23, 18, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 18, 0.08) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px, 28px 28px, 28px 28px, auto;
  font-family: var(--font-body);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(33, 139, 255, 0.25);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 251, 247, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
}

.brand img {
  width: 38px;
  height: 38px;
  image-rendering: pixelated;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.site-header nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;
}

.site-header nav a:hover {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 0.82fr);
  gap: clamp(28px, 5vw, 66px);
  align-items: center;
  min-height: 650px;
  padding: 42px 0 22px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1,
h2 {
  line-height: 1.08;
}

h1 {
  display: grid;
  max-width: 640px;
  font-family: var(--font-display);
  font-size: 4.35rem;
  font-weight: 900;
}

h1 span {
  display: block;
}

h2 {
  max-width: 860px;
  font-family: var(--font-serif);
  font-size: 2.42rem;
  font-weight: 900;
}

.lede {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.82;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero-badges span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.9rem;
  font-weight: 850;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 900;
}

.button-primary {
  color: #fff;
  background: var(--night);
  box-shadow: 0 14px 34px rgba(21, 23, 22, 0.22);
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.button-tertiary {
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 14px 34px rgba(242, 183, 5, 0.18);
  cursor: pointer;
}

.hero-stage {
  position: relative;
  min-height: 500px;
  border: 1px solid rgba(23, 23, 18, 0.82);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, rgba(20, 166, 125, 0.22), transparent 42%),
    #111412;
  background-size: 26px 26px, 26px 26px, auto, auto;
  box-shadow: var(--shadow);
}

.hero-stage::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(240, 93, 59, 0.22));
}

.hero-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0 45%, rgba(255, 255, 255, 0.08) 50%, transparent 55% 100%);
  opacity: 0.5;
  transform: translateY(-100%);
  animation: scan-stage 7s linear infinite;
  pointer-events: none;
}

.stage-label,
.stage-note {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 9px 11px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.stage-label {
  left: 18px;
  top: 18px;
}

.stage-note {
  right: 18px;
  bottom: 18px;
}

.pet {
  position: absolute;
  width: clamp(112px, 13vw, 172px);
  height: clamp(112px, 13vw, 172px);
  image-rendering: pixelated;
  filter: drop-shadow(0 28px 24px rgba(0, 0, 0, 0.24));
  animation: pet-float 5.8s ease-in-out infinite;
}

.pet-a { left: 12%; top: 13%; }
.pet-b { right: 10%; top: 26%; animation-delay: -1.6s; }
.pet-c { left: 24%; bottom: 16%; animation-delay: -3.2s; }
.pet-d { right: 20%; bottom: 10%; animation-delay: -4.1s; }

@keyframes scan-stage {
  to {
    transform: translateY(100%);
  }
}

@keyframes pet-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -10px;
  }
}

.stats-panel,
.slider-section,
.collections-section,
.gallery-section,
.usage-section {
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 54px rgba(35, 43, 38, 0.08);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  padding: 1px;
}

.stats-panel div {
  min-height: 118px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.stats-panel strong,
.stats-panel span {
  display: block;
}

.stats-panel strong {
  color: var(--mint);
  font-size: 2rem;
}

.stats-panel span {
  margin-top: 10px;
  color: var(--muted);
}

.slider-section,
.collections-section,
.gallery-section,
.usage-section {
  padding: clamp(20px, 4vw, 44px);
}

.slider-section {
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(20, 166, 125, 0.08), transparent 34%, rgba(240, 93, 59, 0.07)),
    var(--panel);
}

.slider-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.slider-head h2 {
  font-size: 2.05rem;
}

.slider-controls {
  display: inline-flex;
  gap: 8px;
}

.slider-controls button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.slider-controls button:hover {
  color: #fff;
  border-color: var(--night);
  background: var(--night);
}

.pet-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 168px;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 2px 2px 14px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--mint) rgba(23, 23, 18, 0.1);
}

.pet-carousel:focus-visible {
  outline: 3px solid rgba(33, 139, 255, 0.25);
  outline-offset: 4px;
}

.slide-pet {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 186px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(20, 166, 125, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.78);
  text-decoration: none;
  scroll-snap-align: start;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.slide-pet::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(23, 23, 18, 0.14);
  border-radius: 8px;
  pointer-events: none;
}

.slide-pet:hover,
.slide-pet:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(240, 93, 59, 0.48);
  box-shadow: 0 18px 32px rgba(35, 43, 38, 0.13);
}

.slide-pet img {
  width: 104px;
  height: 104px;
  image-rendering: pixelated;
  transition: transform 0.22s ease;
}

.slide-pet:hover img,
.slide-pet:focus-visible img {
  transform: scale(1.08) rotate(-2deg);
}

.slide-pet span {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.slide-pet.is-large {
  grid-column: span 2;
}

.slide-pet.is-large img {
  width: 132px;
  height: 132px;
}

.section-head {
  max-width: 920px;
  margin-bottom: 24px;
}

.section-head p:last-child {
  color: var(--muted);
  line-height: 1.78;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.collection-card,
.code-card,
.pet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.collection-card {
  min-height: 230px;
  padding: 14px;
}

.collection-card.is-dark {
  color: #fff;
  border-color: rgba(23, 23, 18, 0.82);
  background: var(--night);
}

.pet-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 96px;
  margin-bottom: 18px;
}

.pet-strip img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  image-rendering: pixelated;
}

.collection-card span,
.code-card span,
.pet-meta {
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.collection-card.is-dark span {
  color: var(--gold);
}

.collection-card h3 {
  margin-top: 12px;
  font-size: 1.06rem;
  line-height: 1.35;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.82);
}

.search-box span {
  color: var(--coral);
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#search {
  width: 100%;
  min-height: 48px;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

#search:focus {
  outline: 0;
}

.search-box:focus-within {
  outline: 3px solid rgba(33, 139, 255, 0.22);
  border-color: var(--sky);
}

.toolbar-actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.toolbar-actions button,
.filters button,
.pet-card button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 850;
}

.toolbar-actions {
  grid-column: 2;
}

.toolbar-actions button:hover,
.pet-card button:hover {
  color: #fff;
  border-color: var(--night);
  background: var(--night);
}

.filters {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.filters button span {
  color: var(--mint);
  font-weight: 950;
}

.filters .is-active {
  color: #fff;
  border-color: var(--night);
  background: var(--night);
}

.filters .is-active span {
  color: var(--gold);
}

.result-count {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 850;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}

.pet-card {
  display: grid;
  gap: 9px;
  min-height: 252px;
  padding: 14px;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  content-visibility: auto;
  contain-intrinsic-size: 252px;
}

.pet-card:hover {
  transform: translateY(-3px);
  border-color: rgba(20, 166, 125, 0.54);
  box-shadow: 0 14px 30px rgba(35, 43, 38, 0.12);
}

.pet-card img {
  width: 104px;
  height: 104px;
  justify-self: center;
  image-rendering: pixelated;
}

.pet-card h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
}

.pet-size {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.pet-card code {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-self: end;
}

.card-actions button {
  min-width: 0;
  color: var(--ink);
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 190px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  text-align: center;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.code-card {
  min-height: 190px;
  padding: 18px;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
}

code {
  font-family: var(--font-mono);
}

.pet-dialog {
  width: min(920px, calc(100% - 28px));
  border: 1px solid rgba(23, 23, 18, 0.24);
  border-radius: 10px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 34px 90px rgba(21, 23, 22, 0.24);
}

.pet-dialog::backdrop {
  background: rgba(14, 18, 16, 0.55);
  backdrop-filter: blur(8px);
}

.pet-dialog[open] {
  display: grid;
  grid-template-columns: minmax(260px, 0.86fr) minmax(0, 1fr);
  gap: 0;
}

.dialog-close {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 23, 18, 0.74);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.dialog-preview {
  display: grid;
  min-height: 420px;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    #101412;
  background-size: 24px 24px;
}

.dialog-preview img {
  width: min(260px, 64%);
  aspect-ratio: 1;
  image-rendering: pixelated;
  filter: drop-shadow(0 22px 22px rgba(0, 0, 0, 0.24));
}

.dialog-info {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: clamp(24px, 4vw, 46px);
}

.dialog-info h2 {
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.dialog-info code {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: rgba(246, 251, 247, 0.84);
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dialog-actions button,
.dialog-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.dialog-actions button:hover,
.dialog-actions a:hover {
  color: #fff;
  border-color: var(--night);
  background: var(--night);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto 0;
  padding: 28px 0 42px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 1040px) {
  h1 {
    font-size: 3.55rem;
  }

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

@media (max-width: 900px) {
  .site-header,
  .hero,
  .toolbar,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
    align-items: flex-start;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    font-size: 3rem;
  }

  h2,
  .slider-head h2 {
    font-size: 2.15rem;
  }

  .hero-stage {
    min-height: 390px;
  }

  .stats-panel,
  .usage-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    justify-content: flex-start;
  }

  .toolbar-actions {
    grid-column: 1;
    justify-content: flex-start;
  }

  .slider-head {
    align-items: flex-start;
  }

  .pet-dialog[open] {
    grid-template-columns: 1fr;
  }

  .dialog-preview {
    min-height: 300px;
  }
}

@media (max-width: 620px) {
  main,
  .site-footer {
    width: min(100% - 22px, 1180px);
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.82rem;
  }

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

  .pet {
    width: 112px;
    height: 112px;
  }

  .stage-label,
  .stage-note {
    font-size: 0.68rem;
  }

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

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

  .pet-carousel {
    grid-auto-columns: 136px;
  }

  .slide-pet {
    min-height: 164px;
  }

  .slide-pet.is-large {
    grid-column: span 1;
  }

  .slide-pet img,
  .slide-pet.is-large img {
    width: 92px;
    height: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
