:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: rgba(247, 243, 234, 0.08);
  --panel-strong: rgba(255, 252, 244, 0.94);
  --ink: #f8f4ec;
  --ink-dark: #171a20;
  --muted: rgba(248, 244, 236, 0.66);
  --muted-dark: #68717e;
  --line: rgba(255, 255, 255, 0.14);
  --line-dark: rgba(23, 26, 32, 0.11);
  --accent: #6f3f94;
  --accent-2: #f0c557;
  --radius: 14px;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  --soft-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

[data-theme="night"] {
  color-scheme: light;
  --bg: #eee8dc;
  --panel: rgba(255, 255, 255, 0.64);
  --panel-strong: rgba(255, 253, 248, 0.96);
  --ink: #171a20;
  --ink-dark: #171a20;
  --muted: #69717b;
  --muted-dark: #69717b;
  --line: rgba(23, 26, 32, 0.12);
  --line-dark: rgba(23, 26, 32, 0.12);
  --shadow: 0 30px 90px rgba(73, 57, 35, 0.18);
  --soft-shadow: 0 18px 40px rgba(73, 57, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 16% 12%, color-mix(in srgb, var(--accent) 46%, transparent), transparent 30%),
    radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 24%),
    linear-gradient(135deg, #0d0f13 0%, var(--bg) 58%, #18120f 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1380px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(440px, 1.18fr) minmax(300px, 0.78fr);
  gap: 16px;
}

.control-panel,
.stage-panel,
.library-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.control-panel,
.library-panel {
  padding: 22px;
}

.control-panel {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 18px;
}

.brand-block h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 0.98;
  letter-spacing: 0;
}

.brand-copy,
.selected-card p,
.setup-list p {
  color: var(--muted);
  line-height: 1.68;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.selected-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.selected-card p {
  margin: 0 0 8px;
}

.selected-card h2 {
  margin: 0 0 8px;
  font-size: 36px;
  letter-spacing: 0;
}

.action-stack {
  display: grid;
  gap: 10px;
}

.platform-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.platform-pill {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  appearance: none;
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.platform-pill:hover {
  transform: translateY(-1px);
  color: var(--ink);
}

.platform-pill.active {
  color: #19130f;
  border-color: transparent;
  background: var(--accent-2);
}

.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.primary-button {
  color: #19130f;
  background: linear-gradient(135deg, var(--accent-2), #ffe28b);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--accent-2) 22%, transparent);
}

.install-note {
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  line-height: 1.55;
}

.install-guide {
  align-self: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}

.install-guide h3 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: 0;
}

.install-guide ol {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  list-style: none;
  counter-reset: install-step;
}

.install-guide li {
  counter-increment: install-step;
  min-height: 34px;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.install-guide li::before {
  content: counter(install-step);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #19130f;
  background: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

kbd {
  min-width: 22px;
  min-height: 22px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
}

.secondary-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--line);
}

.ghost-button {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.pet-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--soft-shadow);
}

.stage-panel {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: calc(100vh - 32px);
}

.stage-panel::before {
  content: "";
  position: absolute;
  width: min(640px, 84%);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.2), transparent 36%),
    color-mix(in srgb, var(--accent) 26%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  display: grid;
  place-items: center;
}

.icon-button {
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.stage-orbit {
  position: absolute;
  width: min(620px, 82%);
  aspect-ratio: 1;
  border-radius: 50%;
  animation: slowOrbit 24s linear infinite;
}

.stage-orbit span {
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
    color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 18px 38px rgba(0, 0, 0, 0.16);
  transform: rotate(var(--item-rotate, 0deg));
}

.stage-orbit span::before,
.stage-orbit span::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}

.stage-orbit span:nth-child(1) {
  left: 6%;
  top: 24%;
  --item-rotate: -9deg;
}

.stage-orbit span:nth-child(2) {
  right: 8%;
  top: 13%;
  --item-rotate: 8deg;
}

.stage-orbit span:nth-child(3) {
  right: 16%;
  bottom: 6%;
  --item-rotate: -4deg;
}

.stage-orbit span[data-orbit="tarot"]::before {
  width: 30px;
  height: 42px;
  border: 2px solid var(--accent-2);
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 45%, rgba(255, 255, 255, 0.22) 46% 54%, transparent 55%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 68%, #161216), #25212f);
}

.stage-orbit span[data-orbit="tarot"]::after {
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent-2);
  transform: rotate(45deg);
}

.stage-orbit span[data-orbit="star"]::before {
  width: 34px;
  height: 34px;
  background: var(--accent-2);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 80% 92%, 50% 69%, 20% 92%, 32% 56%, 2% 35%, 39% 35%);
}

.stage-orbit span[data-orbit="crystal"]::before {
  width: 28px;
  height: 44px;
  background: linear-gradient(145deg, #d7f5ff, color-mix(in srgb, var(--accent-2) 54%, #74d7ff));
  clip-path: polygon(50% 0, 88% 24%, 76% 84%, 50% 100%, 24% 84%, 12% 24%);
}

.stage-orbit span[data-orbit="cup"]::before {
  width: 32px;
  height: 34px;
  border: 3px solid color-mix(in srgb, var(--accent) 48%, #fff);
  border-radius: 6px 6px 12px 12px;
  background: color-mix(in srgb, var(--accent-2) 38%, #fff);
}

.stage-orbit span[data-orbit="cup"]::after {
  right: -26px;
  width: 16px;
  height: 18px;
  border: 3px solid color-mix(in srgb, var(--accent) 48%, #fff);
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.stage-orbit span[data-orbit="heart"]::before {
  width: 32px;
  height: 28px;
  background: color-mix(in srgb, var(--accent) 38%, #ff8ca2);
  transform: rotate(-45deg);
  border-radius: 8px 8px 2px 8px;
}

.stage-orbit span[data-orbit="heart"]::after {
  width: 32px;
  height: 28px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 18%),
    color-mix(in srgb, var(--accent) 38%, #ff8ca2);
  transform: rotate(45deg);
  border-radius: 8px 8px 8px 2px;
}

.stage-orbit span[data-orbit="flower"]::before {
  width: 40px;
  height: 40px;
  background:
    radial-gradient(circle, var(--accent-2) 0 18%, transparent 19%),
    radial-gradient(circle at 50% 8%, #ffd3de 0 20%, transparent 21%),
    radial-gradient(circle at 92% 50%, #ffd3de 0 20%, transparent 21%),
    radial-gradient(circle at 50% 92%, #ffd3de 0 20%, transparent 21%),
    radial-gradient(circle at 8% 50%, #ffd3de 0 20%, transparent 21%);
}

.stage-orbit span[data-orbit="shell"]::before {
  width: 40px;
  height: 32px;
  border-radius: 50% 50% 10px 10px;
  background:
    repeating-radial-gradient(ellipse at 50% 95%, color-mix(in srgb, var(--accent-2) 58%, #fff) 0 4px, #fff5d8 5px 7px);
}

.stage-orbit span[data-orbit="paw"]::before {
  width: 18px;
  height: 18px;
  top: 16px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: -15px 9px 0 -2px var(--accent-2), 15px 9px 0 -2px var(--accent-2), 0 22px 0 7px var(--accent-2);
}

.stage-orbit span[data-orbit="bubble"]::before {
  width: 34px;
  height: 34px;
  border: 2px solid color-mix(in srgb, var(--accent-2) 70%, #fff);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.55), transparent 16%);
}

.pet-preview {
  width: min(470px, 76vw);
  height: min(540px, 78vh);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 2;
  animation: floatPet 2.8s ease-in-out infinite;
}

.pet-preview[data-motion="right"] {
  animation: driftRight 2.2s ease-in-out infinite;
}

.pet-preview[data-motion="left"] {
  animation: driftLeft 2.2s ease-in-out infinite;
}

.pet-preview[data-motion="jump"] {
  animation: jumpPet 1.25s cubic-bezier(0.34, 0.04, 0.2, 1) infinite;
}

.pet-preview[data-motion="focus"],
.pet-preview[data-motion="review"] {
  animation: focusPet 1.8s ease-in-out infinite;
}

.pet-preview[data-motion="wave"] img {
  transform-origin: 52% 88%;
  animation: wavePet 1.2s ease-in-out infinite;
}

.pet-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 34px 34px rgba(0, 0, 0, 0.34));
  transition: transform 160ms ease, filter 160ms ease;
}

.pet-preview:hover img {
  transform: scale(1.025);
}

.pet-shadow {
  position: absolute;
  width: 220px;
  height: 28px;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  filter: blur(5px);
  animation: shadowPulse 2.8s ease-in-out infinite;
}

.library-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-height: calc(100vh - 32px);
}

.library-heading {
  display: grid;
  gap: 14px;
}

.library-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.search-box {
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.pet-grid {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.pet-card {
  min-height: 128px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  text-align: left;
  display: grid;
  grid-template-columns: 82px 1fr;
  grid-template-rows: auto auto;
  gap: 10px 12px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.pet-card.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 20%, transparent), var(--soft-shadow);
}

.mini-pet {
  grid-row: span 2;
  width: 82px;
  height: 92px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--card-color) 18%, rgba(255, 255, 255, 0.12));
  overflow: hidden;
}

.mini-pet img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-copy {
  display: grid;
  gap: 4px;
}

.card-copy strong {
  font-size: 18px;
}

.card-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-row em {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 18%, transparent);
  color: var(--accent-2);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.sun-icon,
.install-icon,
.download-icon,
.terminal-icon,
.search-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  position: relative;
}

.sun-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.sun-icon::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px dotted currentColor;
  border-radius: 50%;
}

.download-icon::before,
.install-icon::before,
.terminal-icon::before,
.search-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid currentColor;
}

.install-icon::before {
  border-radius: 4px;
}

.install-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 2px;
  height: 12px;
  background: currentColor;
  box-shadow: -4px 4px 0 -1px currentColor, 4px 4px 0 -1px currentColor;
}

.download-icon::before {
  border-top: 0;
  transform: translateY(4px);
}

.download-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 2px;
  height: 13px;
  background: currentColor;
  box-shadow: -4px 7px 0 -1px currentColor, 4px 7px 0 -1px currentColor;
}

.terminal-icon::before {
  border-radius: 3px;
}

.terminal-icon::after {
  content: ">";
  position: absolute;
  left: 3px;
  top: -3px;
  font-weight: 900;
}

.search-icon::before {
  border-radius: 50%;
  inset: 1px 4px 4px 1px;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 8px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

@keyframes floatPet {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-16px);
  }
}

@keyframes shadowPulse {
  0%,
  100% {
    transform: translateX(-50%) scaleX(1);
    opacity: 0.84;
  }

  50% {
    transform: translateX(-50%) scaleX(0.82);
    opacity: 0.5;
  }
}

@keyframes slowOrbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes driftRight {
  0%,
  100% {
    transform: translateX(-22px) translateY(0);
  }

  50% {
    transform: translateX(22px) translateY(-10px);
  }
}

@keyframes driftLeft {
  0%,
  100% {
    transform: translateX(22px) translateY(0);
  }

  50% {
    transform: translateX(-22px) translateY(-10px);
  }
}

@keyframes jumpPet {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  45% {
    transform: translateY(-48px) scale(1.02);
  }
}

@keyframes focusPet {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-8px) rotate(-1deg);
  }
}

@keyframes wavePet {
  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(2.5deg);
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .stage-panel,
  .library-panel {
    min-height: auto;
  }

  .stage-panel {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 18px, 1380px);
    margin: 9px auto;
  }

  .control-panel,
  .library-panel {
    padding: 18px;
  }

  .brand-block h1 {
    font-size: 38px;
  }

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

  .mini-pet {
    width: 72px;
    height: 82px;
  }
}
