:root {
  --stage-size: 280px;
  --pet-size: 176px;
  --pet-yellow: #ffd65c;
  --pet-yellow-dark: #efad35;
  --pet-orange: #ff9f2d;
  --ink: #22201c;
  --muted: #6e665c;
  --line: rgba(43, 38, 31, 0.12);
  --paper: #fffaf1;
  --green: #4b7f5b;
  --green-dark: #26513a;
  --accent: #f4b53c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #fffaf1;
}

body {
  overflow-x: hidden;
}

body.desktop {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

html.desktop,
html.desktop body,
html.desktop .pet-world,
html.desktop .pet-stage,
html.desktop .pet-sprite {
  background: transparent !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-shell {
  min-height: 100vh;
}

body.desktop .site-shell {
  display: none;
}

.site-header {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(1120px, calc(100vw - 32px));
  min-height: 58px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 16px;
  background: rgba(255, 250, 241, 0.82);
  box-shadow: 0 16px 48px rgba(45, 37, 24, 0.16);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.brand {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #ffd961;
  box-shadow: inset 0 -5px 10px rgba(174, 113, 24, 0.18);
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: rgba(34, 32, 28, 0.72);
  font-size: 14px;
}

.site-nav a:hover {
  color: var(--green-dark);
}

.header-cta,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  font-weight: 750;
  white-space: nowrap;
}

.header-cta,
.primary-button {
  background: var(--green-dark);
  color: #fffdf6;
  box-shadow: 0 10px 26px rgba(38, 81, 58, 0.25);
}

.header-cta {
  padding: 0 18px;
  font-size: 14px;
}

.primary-button,
.secondary-button {
  padding: 0 22px;
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.74);
  color: #263126;
}

.hero-section {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: 34px;
  align-items: center;
  padding: 128px max(28px, calc((100vw - 1120px) / 2)) 72px;
  overflow: hidden;
}

.hero-photo,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(15, 20, 13, 0.72) 0%, rgba(28, 31, 20, 0.42) 46%, rgba(255, 250, 241, 0.1) 100%),
    linear-gradient(180deg, rgba(255, 250, 241, 0.08) 0%, rgba(255, 250, 241, 0.86) 100%);
}

.hero-copy,
.hero-demo {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 630px;
  color: #fffdf6;
}

.eyebrow {
  margin: 0 0 12px;
  color: #d99c1f;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy .eyebrow {
  color: #ffe08a;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(40px, 5.8vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
}

h3 {
  margin-bottom: 6px;
  font-size: 19px;
}

.hero-lede {
  max-width: 560px;
  color: rgba(255, 253, 246, 0.86);
  font-size: 18px;
  line-height: 1.7;
}

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

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-metrics span {
  display: inline-flex;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 253, 246, 0.86);
  backdrop-filter: blur(12px);
}

.hero-metrics strong {
  color: #fffdf6;
}

.hero-demo {
  justify-self: end;
  width: min(100%, 460px);
}

.demo-window {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 22px;
  background: rgba(255, 253, 246, 0.74);
  box-shadow: 0 30px 90px rgba(14, 17, 12, 0.38);
  backdrop-filter: blur(18px);
}

.demo-titlebar {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(38, 44, 31, 0.1);
  color: rgba(36, 34, 29, 0.68);
  font-size: 12px;
}

.demo-titlebar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ef7b6d;
}

.demo-titlebar span:nth-child(2) {
  background: #efbd44;
}

.demo-titlebar span:nth-child(3) {
  background: #5abb70;
  margin-right: 5px;
}

.demo-screen {
  position: relative;
  height: 390px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.95), transparent 18%),
    linear-gradient(165deg, #edf6e9 0%, #f9f2df 48%, #e9d3ad 100%);
}

.demo-screen::before {
  content: "";
  position: absolute;
  left: 38px;
  right: 38px;
  bottom: 52px;
  height: 72px;
  border-radius: 50%;
  background: rgba(116, 93, 54, 0.16);
  filter: blur(18px);
}

.demo-hint {
  position: absolute;
  left: 18px;
  top: 18px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(38, 46, 34, 0.72);
  font-size: 12px;
}

.demo-cursor {
  position: absolute;
  left: 72%;
  top: 32%;
  width: 14px;
  height: 14px;
  border: 2px solid #243426;
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(36, 52, 38, 0.12);
  transform: translate(-50%, -50%);
}

.demo-pet {
  position: absolute;
  left: 120px;
  top: 210px;
  width: 112px;
  height: 112px;
  transform-origin: 50% 82%;
}

.demo-pet-cutout {
  position: absolute;
  inset: -18px;
  z-index: 2;
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 14px 14px rgba(42, 31, 14, 0.24));
}

.demo-pet-cutout:not([src]),
.demo-pet-cutout[src=""] {
  display: none;
}

.demo-pet-cutout[src]:not([src=""]) + .duck-body {
  display: none;
}

.duck-body {
  position: absolute;
  inset: 12px 8px 16px 8px;
  border-radius: 54% 48% 48% 52%;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.62), transparent 16%),
    linear-gradient(145deg, #fff1a2 0%, #ffd65c 54%, #e9a92f 100%);
  box-shadow: inset -10px -12px 18px rgba(154, 103, 29, 0.18);
}

.duck-eye {
  position: absolute;
  left: 26px;
  top: 26px;
  width: 12px;
  height: 14px;
  border-radius: 999px;
  background: #16120f;
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.55);
}

.duck-beak {
  position: absolute;
  left: 36px;
  top: 40px;
  width: 38px;
  height: 18px;
  border-radius: 8px 22px 18px 10px;
  background: #f28b22;
  transform: rotate(5deg);
}

.duck-wing {
  position: absolute;
  left: 12px;
  top: 52px;
  width: 44px;
  height: 36px;
  border-radius: 60% 45% 55% 50%;
  background: rgba(238, 174, 57, 0.42);
}

.duck-foot {
  position: absolute;
  bottom: -12px;
  width: 28px;
  height: 13px;
  border-radius: 999px 999px 7px 7px;
  background: #ef8f22;
}

.duck-foot-a {
  left: 28px;
}

.duck-foot-b {
  right: 20px;
}

.demo-shadow {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 5px;
  height: 16px;
  border-radius: 999px;
  background: rgba(57, 43, 25, 0.2);
  filter: blur(8px);
}

.demo-pet[data-mode="idle"] {
  animation: idle-breathe 1.8s ease-in-out infinite;
}

.demo-pet[data-mode="walk"] {
  animation: walk-bob 420ms ease-in-out infinite;
}

.demo-pet[data-mode="run"] {
  animation: run-bob 240ms ease-in-out infinite;
}

.studio-section,
.desktop-section,
.download-section {
  padding: 88px max(24px, calc((100vw - 1120px) / 2));
}

.studio-section {
  background: #fffaf1;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 30px;
}

.section-heading p,
.desktop-copy p,
.download-section p,
.panel-head p,
.behavior-list span {
  color: var(--muted);
  line-height: 1.7;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr);
  gap: 18px;
}

.studio-panel {
  min-height: 360px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 48px rgba(82, 65, 40, 0.08);
}

.panel-head {
  display: flex;
  gap: 13px;
  margin-bottom: 18px;
}

.step-badge {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #f5d057;
  color: #3a2b11;
  font-weight: 850;
}

.studio-upload {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 132px;
  padding: 20px;
  border: 1.5px dashed rgba(38, 81, 58, 0.35);
  border-radius: 8px;
  background: #f7f3e6;
  cursor: pointer;
  text-align: center;
}

.studio-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.studio-upload span {
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 850;
}

.studio-upload small,
.download-actions small,
.preview-placeholder small {
  color: var(--muted);
  line-height: 1.5;
}

.crop-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.crop-row button {
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  background: #fff0bb;
  color: #5f4a25;
  cursor: pointer;
}

.crop-row button:hover {
  background: #f4d159;
}

.upload-tip {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.background-options {
  display: grid;
  gap: 12px;
}

.scene-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.scene-card span {
  display: block;
  height: 100%;
  min-height: 84px;
  border-radius: 8px 0 0 8px;
  background:
    radial-gradient(circle at 66% 25%, rgba(255, 255, 255, 0.9), transparent 24%),
    linear-gradient(145deg, #dfeeda, #f5e6c4 55%, #b7c99d);
}

.scene-card[data-scene="desk"] span {
  background:
    radial-gradient(circle at 72% 28%, rgba(255, 255, 255, 0.84), transparent 22%),
    linear-gradient(150deg, #d9e8dc, #d6b98d 58%, #7f674b);
}

.scene-card[data-scene="sofa"] span {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.9), transparent 25%),
    linear-gradient(150deg, #e7dbc9, #d0ba9e 55%, #88a07a);
}

.scene-card.active {
  border-color: rgba(38, 81, 58, 0.5);
  box-shadow: 0 0 0 3px rgba(75, 127, 91, 0.14);
}

.transparent-preview {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checker {
  position: absolute;
  inset: 0;
  background-color: #f7f7f7;
  background-image:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.transparent-preview .pet-image {
  position: absolute;
  z-index: 2;
  inset: 28px;
  width: calc(100% - 56px);
  height: calc(100% - 56px);
  object-fit: contain;
  display: none;
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.16));
}

.transparent-preview.has-image .pet-image {
  display: block;
}

.preview-placeholder {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  gap: 8px;
  place-content: center;
  padding: 22px;
  text-align: center;
}

.transparent-preview.has-image .preview-placeholder {
  display: none;
}

.candidate-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.candidate-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(43, 38, 31, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
}

.candidate-card.active {
  border-color: #d99c1f;
  box-shadow: 0 0 0 2px rgba(217, 156, 31, 0.18);
}

.candidate-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  background: #00dada;
}

.candidate-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-video {
  position: absolute;
  z-index: 4;
  inset: 18px;
  display: none;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  border-radius: 10px;
  background: #111;
  object-fit: contain;
}

.transparent-preview.has-video .generated-video {
  display: block;
}

.transparent-preview.has-video .pet-image {
  display: none;
}

.action-generator {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.action-generator p {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.action-package-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.action-package-options label {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid rgba(43, 38, 31, 0.13);
  border-radius: 8px;
  background: #fffaf1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.action-package-options input {
  accent-color: var(--green);
}

.action-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.action-buttons button {
  min-height: 42px;
  border: 1px solid rgba(43, 38, 31, 0.14);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.action-buttons button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.action-alert {
  padding: 10px 11px;
  border: 1px solid rgba(186, 72, 44, 0.35);
  border-radius: 8px;
  background: #fff1ec;
  color: #87351f;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.action-alert[hidden] {
  display: none;
}

.action-progress {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(26, 108, 76, 0.18);
  border-radius: 8px;
  background: #f2f8ed;
}

.action-progress[hidden] {
  display: none;
}

.action-progress-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.action-progress-bar {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(26, 108, 76, 0.14);
}

.action-progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f6a43, #79ba6b);
  transition: width 0.35s ease;
}

.action-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.action-generator small {
  color: var(--muted);
  line-height: 1.5;
}

.action-pack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.action-pack-card {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 9px 8px;
  border: 1px solid rgba(43, 38, 31, 0.13);
  border-radius: 8px;
  background: #fffaf1;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.action-pack-card:disabled {
  cursor: wait;
}

.action-pack-card strong,
.action-pack-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-pack-card strong {
  font-size: 13px;
}

.action-pack-card span {
  color: var(--muted);
  font-size: 12px;
}

.action-pack-card.running {
  border-color: rgba(26, 108, 76, 0.32);
  background: #eff8ee;
}

.action-pack-card.succeeded {
  border-color: rgba(26, 108, 76, 0.45);
  background: #eef9ef;
}

.action-pack-card.failed {
  border-color: rgba(186, 72, 44, 0.42);
  background: #fff1ec;
}

.desktop-next-step {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(26, 108, 76, 0.28);
  border-radius: 8px;
  background: #edf8ef;
}

.desktop-next-step[hidden] {
  display: none;
}

.desktop-next-step strong {
  color: var(--ink);
  font-size: 16px;
}

.desktop-next-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.desktop-next-actions a {
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.mini-duck {
  display: block;
  width: 66px;
  height: 58px;
  margin: 0 auto 4px;
  border-radius: 54% 48% 45% 52%;
  background: linear-gradient(145deg, #fff2a5, #f3bd35);
}

.desktop-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 26px;
  align-items: start;
  background: #eff5e9;
}

.desktop-copy {
  max-width: 510px;
}

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

.behavior-list div {
  min-height: 132px;
  padding: 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(38, 81, 58, 0.12);
}

.behavior-list strong,
.behavior-list span {
  display: block;
}

.behavior-list strong {
  margin-bottom: 9px;
  font-size: 18px;
}

.download-section {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  background: #fffaf1;
}

.download-section > div:first-child {
  max-width: 660px;
}

.download-actions {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.pet-world {
  position: relative;
  width: 100%;
  height: 100%;
}

body:not(.desktop) .pet-world {
  display: none;
}

.upload-panel {
  position: fixed;
  z-index: 30;
  left: 16px;
  top: 16px;
  width: min(520px, calc(100vw - 32px));
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 40px rgba(35, 29, 24, 0.14);
  backdrop-filter: blur(12px);
}

body.desktop .upload-panel {
  display: none;
}

.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.upload-button,
.upload-row button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #ffdf7c;
  color: #493722;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.upload-button {
  position: relative;
  overflow: hidden;
  font-weight: 600;
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pet-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--stage-size);
  height: var(--stage-size);
  user-select: none;
}

.pet-sprite {
  position: absolute;
  left: 48px;
  top: 42px;
  width: var(--pet-size);
  height: var(--pet-size);
  cursor: pointer;
  transform-origin: 50% 82%;
  transform: translate3d(0, 0, 0) scaleX(var(--face-scale, 1));
  transition: filter 180ms ease;
  -webkit-app-region: no-drag;
}

.pet-sprite[data-facing="left"] {
  --face-scale: -1;
}

.pet-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: none;
  object-fit: contain;
  pointer-events: none;
}

.pet-image {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: none;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.2));
}

.rig-pet {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.2));
}

.pet-sprite.has-rig .rig-pet {
  display: block;
}

.pet-sprite.has-rig .pet-image {
  opacity: 0.18;
  animation: none !important;
  filter: blur(0.2px) drop-shadow(0 16px 18px rgba(0, 0, 0, 0.08));
}

.rig-part {
  position: absolute;
  overflow: hidden;
  transform-origin: var(--origin-x, 50%) var(--origin-y, 70%);
  will-change: transform;
}

.rig-part img {
  position: absolute;
  left: calc(-1 * var(--part-x));
  top: calc(-1 * var(--part-y));
  width: var(--pet-size);
  height: var(--pet-size);
  object-fit: contain;
}

.rig-head {
  --part-x: 42px;
  --part-y: 10px;
  --origin-x: 52%;
  --origin-y: 78%;
  left: var(--part-x);
  top: var(--part-y);
  width: 92px;
  height: 78px;
}

.rig-body {
  --part-x: 24px;
  --part-y: 54px;
  --origin-x: 50%;
  --origin-y: 78%;
  left: var(--part-x);
  top: var(--part-y);
  width: 130px;
  height: 104px;
}

.rig-tail {
  --part-x: 2px;
  --part-y: 54px;
  --origin-x: 86%;
  --origin-y: 58%;
  left: var(--part-x);
  top: var(--part-y);
  width: 66px;
  height: 86px;
}

.rig-leg {
  --part-y: 116px;
  --origin-x: 50%;
  --origin-y: 18%;
  top: var(--part-y);
  width: 58px;
  height: 54px;
}

.rig-leg-left {
  --part-x: 48px;
  left: var(--part-x);
}

.rig-leg-right {
  --part-x: 82px;
  left: var(--part-x);
}

.pet-sprite.has-image .pet-image,
.pet-sprite.has-video .pet-video {
  display: block;
}

.pet-sprite.has-image .css-pet,
.pet-sprite.has-image .pet-video,
.pet-sprite.has-video .css-pet {
  display: none;
}

.css-pet {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.pet-body {
  position: absolute;
  left: 26px;
  top: 30px;
  width: 124px;
  height: 118px;
  border-radius: 54% 50% 46% 48%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.55), transparent 20%),
    linear-gradient(145deg, #ffe889 0%, var(--pet-yellow) 52%, #f8be3f 100%);
  box-shadow:
    inset -12px -14px 22px rgba(201, 132, 34, 0.18),
    inset 12px 10px 18px rgba(255, 255, 255, 0.22);
}

.pet-ear {
  position: absolute;
  z-index: 1;
  top: 24px;
  width: 46px;
  height: 52px;
  border-radius: 70% 70% 35% 35%;
  background: linear-gradient(160deg, #ffe98a, #efb13f);
}

.pet-ear-left {
  left: 33px;
  transform: rotate(-18deg);
}

.pet-ear-right {
  right: 34px;
  transform: rotate(18deg);
}

.pet-face {
  position: absolute;
  left: 22px;
  top: 29px;
  width: 82px;
  height: 62px;
}

.pet-eye {
  position: absolute;
  top: 15px;
  width: 13px;
  height: 16px;
  border-radius: 999px;
  background: #1f1a17;
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.46);
}

.pet-eye-left {
  left: 14px;
}

.pet-eye-right {
  right: 14px;
}

.pet-mouth {
  position: absolute;
  left: 27px;
  top: 34px;
  width: 29px;
  height: 18px;
  border-radius: 0 0 20px 20px;
  border-bottom: 4px solid #7a4a21;
}

.pet-cheek {
  position: absolute;
  top: 64px;
  width: 18px;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 143, 102, 0.45);
}

.pet-cheek-left {
  left: 25px;
}

.pet-cheek-right {
  right: 28px;
}

.pet-tail {
  position: absolute;
  z-index: 0;
  right: 9px;
  top: 81px;
  width: 42px;
  height: 52px;
  border-radius: 70% 42% 70% 46%;
  background: linear-gradient(145deg, #ffe889, #eaa33c);
  transform-origin: 8px 38px;
}

.pet-foot {
  position: absolute;
  z-index: 1;
  bottom: 18px;
  width: 40px;
  height: 18px;
  border-radius: 999px 999px 12px 12px;
  background: var(--pet-orange);
}

.pet-foot-left {
  left: 42px;
}

.pet-foot-right {
  right: 44px;
}

.pet-shadow {
  position: absolute;
  z-index: 0;
  left: 34px;
  right: 34px;
  bottom: 17px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  filter: blur(10px);
  transform: scaleX(var(--face-scale, 1));
}

.sleep-mark {
  position: absolute;
  z-index: 4;
  right: 28px;
  top: 8px;
  color: rgba(80, 91, 128, 0.8);
  font-size: 22px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
}

.pet-bubble {
  position: absolute;
  z-index: 6;
  left: 46px;
  right: 46px;
  top: 16px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #4a433d;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.pet-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.pet-menu {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 156px;
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 7px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 40px rgba(35, 29, 24, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px) scale(0.96);
  transition: opacity 150ms ease, transform 150ms ease;
  -webkit-app-region: no-drag;
}

.pet-menu.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.pet-menu button {
  min-width: 50px;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff3cc;
  color: #5d4934;
  font-size: 12px;
  cursor: pointer;
}

.pet-menu button:hover {
  background: #ffdf7c;
}

.debug-panel {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 20;
  display: none;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.62);
  color: white;
  font: 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: none;
}

body.debug .debug-panel {
  display: block;
}

.pet-sprite[data-mode="idle"] {
  animation: idle-breathe 1.8s ease-in-out infinite;
}

.pet-sprite[data-mode="idle"].has-image .pet-image {
  animation: image-idle 1.8s ease-in-out infinite;
}

.pet-sprite[data-mode="idle"].has-rig .rig-head {
  animation: rig-head-idle 2.1s ease-in-out infinite;
}

.pet-sprite[data-mode="idle"].has-rig .rig-body {
  animation: rig-body-idle 1.8s ease-in-out infinite;
}

.pet-sprite[data-mode="idle"].has-rig .rig-tail {
  animation: rig-tail-idle 1.6s ease-in-out infinite;
}

.pet-sprite[data-mode="walk"],
.pet-sprite[data-mode="chase"] {
  animation: walk-bob 360ms ease-in-out infinite;
}

.pet-sprite[data-mode="walk"].has-image .pet-image,
.pet-sprite[data-mode="chase"].has-image .pet-image {
  animation: image-walk 360ms ease-in-out infinite;
}

.pet-sprite[data-mode="walk"].has-rig .rig-head,
.pet-sprite[data-mode="chase"].has-rig .rig-head {
  animation: rig-head-walk 520ms ease-in-out infinite;
}

.pet-sprite[data-mode="walk"].has-rig .rig-body,
.pet-sprite[data-mode="chase"].has-rig .rig-body {
  animation: rig-body-walk 360ms ease-in-out infinite;
}

.pet-sprite[data-mode="walk"].has-rig .rig-leg-left,
.pet-sprite[data-mode="chase"].has-rig .rig-leg-left {
  animation: rig-leg-a 360ms ease-in-out infinite;
}

.pet-sprite[data-mode="walk"].has-rig .rig-leg-right,
.pet-sprite[data-mode="chase"].has-rig .rig-leg-right {
  animation: rig-leg-b 360ms ease-in-out infinite;
}

.pet-sprite[data-mode="walk"].has-rig .rig-tail,
.pet-sprite[data-mode="chase"].has-rig .rig-tail {
  animation: rig-tail-walk 460ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"] {
  animation: run-bob 210ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"].has-image .pet-image {
  animation: image-run 210ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"].has-rig .rig-head {
  animation: rig-head-run 300ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"].has-rig .rig-body {
  animation: rig-body-run 210ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"].has-rig .rig-leg-left {
  animation: rig-leg-run-a 210ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"].has-rig .rig-leg-right {
  animation: rig-leg-run-b 210ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"].has-rig .rig-tail {
  animation: rig-tail-run 240ms ease-in-out infinite;
}

.pet-sprite[data-mode="play"] {
  animation: play-hop 560ms cubic-bezier(0.2, 0.82, 0.28, 1.08) infinite;
}

.pet-sprite[data-mode="play"].has-image .pet-image {
  animation: image-play 560ms cubic-bezier(0.2, 0.82, 0.28, 1.08) infinite;
}

.pet-sprite[data-mode="play"].has-rig .rig-head {
  animation: rig-head-play 560ms cubic-bezier(0.2, 0.82, 0.28, 1.08) infinite;
}

.pet-sprite[data-mode="play"].has-rig .rig-body {
  animation: rig-body-play 560ms cubic-bezier(0.2, 0.82, 0.28, 1.08) infinite;
}

.pet-sprite[data-mode="play"].has-rig .rig-tail {
  animation: rig-tail-play 560ms ease-in-out infinite;
}

.pet-sprite[data-mode="rest"] {
  animation: rest-settle 2.4s ease-in-out infinite;
  filter: saturate(0.94);
}

.pet-sprite[data-mode="rest"].has-image .pet-image {
  animation: image-rest 2.4s ease-in-out infinite;
}

.pet-sprite[data-mode="rest"].has-rig .rig-head,
.pet-sprite[data-mode="rest"].has-rig .rig-body {
  animation: rig-rest 2.4s ease-in-out infinite;
}

.pet-sprite[data-mode="sleep"] {
  animation: sleep-breathe 2.6s ease-in-out infinite;
  filter: brightness(0.92) saturate(0.86);
}

.pet-sprite[data-mode="sleep"].has-image .pet-image {
  animation: image-sleep 2.6s ease-in-out infinite;
}

.pet-sprite[data-mode="sleep"].has-rig .rig-head,
.pet-sprite[data-mode="sleep"].has-rig .rig-body,
.pet-sprite[data-mode="sleep"].has-rig .rig-tail,
.pet-sprite[data-mode="sleep"].has-rig .rig-leg {
  animation: rig-sleep 2.6s ease-in-out infinite;
}

.pet-sprite[data-mode="sleep"] .sleep-mark {
  animation: sleep-z 1.8s ease-in-out infinite;
}

.pet-sprite[data-mode="walk"] .pet-shadow,
.pet-sprite[data-mode="chase"] .pet-shadow {
  animation: shadow-walk 360ms ease-in-out infinite;
}

.pet-sprite[data-mode="run"] .pet-shadow {
  animation: shadow-run 210ms ease-in-out infinite;
}

.pet-sprite[data-mode="play"] .pet-shadow {
  animation: shadow-play 560ms ease-in-out infinite;
}

@keyframes idle-breathe {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 3px; }
}

@keyframes image-idle {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.018, 0.985); }
}

@keyframes walk-bob {
  0%, 100% { translate: -2px 0; rotate: -2.2deg; }
  50% { translate: 2px -7px; rotate: 2.2deg; }
}

@keyframes image-walk {
  0%, 100% { transform: translateX(-2px) scale(0.985, 1.035) skewX(-1deg); }
  50% { transform: translateX(2px) scale(1.025, 0.975) skewX(1deg); }
}

@keyframes run-bob {
  0%, 100% { translate: -4px 1px; rotate: -4deg; }
  50% { translate: 4px -12px; rotate: 4deg; }
}

@keyframes image-run {
  0%, 100% { transform: translateX(-5px) scale(0.96, 1.07) skewX(-3deg); }
  50% { transform: translateX(5px) scale(1.06, 0.94) skewX(3deg); }
}

@keyframes play-hop {
  0%, 100% { translate: 0 0; rotate: -7deg; }
  38% { translate: 0 -28px; rotate: 10deg; }
  70% { translate: 0 -5px; rotate: -10deg; }
}

@keyframes image-play {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  32% { transform: scale(0.94, 1.08) rotate(4deg); }
  58% { transform: scale(1.08, 0.92) rotate(-4deg); }
}

@keyframes rest-settle {
  0%, 100% { translate: 0 10px; scale: 1.05 0.92; }
  50% { translate: 0 12px; scale: 1.06 0.9; }
}

@keyframes image-rest {
  0%, 100% { transform: scale(1.08, 0.9) translateY(10px); }
  50% { transform: scale(1.1, 0.88) translateY(12px); }
}

@keyframes sleep-breathe {
  0%, 100% { translate: 0 16px; scale: 1.08 0.86; }
  50% { translate: 0 18px; scale: 1.1 0.84; }
}

@keyframes image-sleep {
  0%, 100% { transform: rotate(-4deg) scale(1.16, 0.76) translateY(22px); }
  50% { transform: rotate(-4deg) scale(1.18, 0.74) translateY(24px); }
}

@keyframes sleep-z {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-18px) scale(1.18); }
}

@keyframes shadow-walk {
  0%, 100% { transform: scaleX(0.9); opacity: 0.18; }
  50% { transform: scaleX(0.72); opacity: 0.12; }
}

@keyframes shadow-run {
  0%, 100% { transform: scaleX(0.86); opacity: 0.18; }
  50% { transform: scaleX(0.58); opacity: 0.1; }
}

@keyframes shadow-play {
  0%, 100% { transform: scaleX(0.9); opacity: 0.18; }
  38% { transform: scaleX(0.48); opacity: 0.08; }
  70% { transform: scaleX(0.76); opacity: 0.13; }
}

@keyframes rig-head-idle {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(2px) rotate(1.5deg); }
}

@keyframes rig-body-idle {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.025, 0.982) translateY(2px); }
}

@keyframes rig-tail-idle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(6deg); }
}

@keyframes rig-head-walk {
  0%, 100% { transform: translate(-1px, 1px) rotate(-3deg); }
  50% { transform: translate(2px, -3px) rotate(3deg); }
}

@keyframes rig-body-walk {
  0%, 100% { transform: translate(-2px, 2px) scale(0.99, 1.03); }
  50% { transform: translate(2px, -5px) scale(1.025, 0.97); }
}

@keyframes rig-leg-a {
  0%, 100% { transform: translate(-5px, 4px) rotate(9deg) scale(0.94, 1.08); }
  50% { transform: translate(5px, -3px) rotate(-8deg) scale(1.04, 0.96); }
}

@keyframes rig-leg-b {
  0%, 100% { transform: translate(5px, -3px) rotate(-8deg) scale(1.04, 0.96); }
  50% { transform: translate(-5px, 4px) rotate(9deg) scale(0.94, 1.08); }
}

@keyframes rig-tail-walk {
  0%, 100% { transform: rotate(8deg) translateY(1px); }
  50% { transform: rotate(-10deg) translateY(-2px); }
}

@keyframes rig-head-run {
  0%, 100% { transform: translate(-3px, 2px) rotate(-5deg); }
  50% { transform: translate(4px, -6px) rotate(5deg); }
}

@keyframes rig-body-run {
  0%, 100% { transform: translate(-4px, 3px) scale(0.96, 1.08); }
  50% { transform: translate(4px, -9px) scale(1.07, 0.92); }
}

@keyframes rig-leg-run-a {
  0%, 100% { transform: translate(-8px, 6px) rotate(14deg) scale(0.9, 1.14); }
  50% { transform: translate(8px, -5px) rotate(-14deg) scale(1.1, 0.9); }
}

@keyframes rig-leg-run-b {
  0%, 100% { transform: translate(8px, -5px) rotate(-14deg) scale(1.1, 0.9); }
  50% { transform: translate(-8px, 6px) rotate(14deg) scale(0.9, 1.14); }
}

@keyframes rig-tail-run {
  0%, 100% { transform: rotate(15deg); }
  50% { transform: rotate(-15deg); }
}

@keyframes rig-head-play {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  36% { transform: translate(5px, -22px) rotate(14deg); }
  70% { transform: translate(-3px, -4px) rotate(-12deg); }
}

@keyframes rig-body-play {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  36% { transform: translateY(-18px) scale(0.94, 1.08); }
  70% { transform: translateY(-3px) scale(1.08, 0.92); }
}

@keyframes rig-tail-play {
  0%, 100% { transform: rotate(-12deg); }
  40% { transform: rotate(18deg); }
  70% { transform: rotate(-18deg); }
}

@keyframes rig-rest {
  0%, 100% { transform: translateY(10px) scale(1.08, 0.9); }
  50% { transform: translateY(12px) scale(1.1, 0.88); }
}

@keyframes rig-sleep {
  0%, 100% { transform: rotate(-5deg) translateY(20px) scale(1.12, 0.78); }
  50% { transform: rotate(-5deg) translateY(23px) scale(1.14, 0.76); }
}

@media (max-width: 920px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-nav {
    display: none;
  }

  .hero-section,
  .desktop-section,
  .download-section {
    grid-template-columns: 1fr;
  }

  .hero-demo {
    justify-self: start;
  }

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

  .download-section {
    display: grid;
  }
}

@media (max-width: 640px) {
  .site-header {
    top: 10px;
    width: calc(100vw - 20px);
  }

  .header-cta {
    display: none;
  }

  .hero-section {
    min-height: auto;
    padding-top: 112px;
  }

  h1 {
    font-size: 39px;
  }

  .demo-screen {
    height: 300px;
  }

  .studio-section,
  .desktop-section,
  .download-section {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .behavior-list {
    grid-template-columns: 1fr;
  }

  :root {
    --stage-size: 240px;
    --pet-size: 160px;
  }
}
