:root {
  --paper: #fffaf1;
  --ink: #251f1d;
  --muted: #6b625c;
  --line: #e5d8c6;
  --teal: #168b86;
  --coral: #f36b52;
  --berry: #8d4e8f;
  --leaf: #5d8d4f;
  --mustard: #d89b2b;
  --sky: #4d7fbf;
  --shadow: 0 20px 60px rgba(42, 30, 24, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(243, 107, 82, 0.14), transparent 34rem),
    linear-gradient(135deg, #fffaf1 0%, #fff4e5 42%, #eef7f4 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
}

.hidden {
  display: none !important;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  margin-bottom: 28px;
  color: #4f4038;
  font-size: 15px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 1px;
}

.intro-screen,
.quiz-screen,
.result-screen {
  animation: fadeIn 260ms ease-out;
}

.intro-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  min-height: calc(100vh - 96px);
}

.eyebrow,
.question-kicker {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

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

h1 {
  max-width: 680px;
  margin-bottom: 18px;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 580px;
  color: var(--muted);
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.75;
}

.intro-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 30px;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 8px;
  font-weight: 900;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-btn {
  gap: 10px;
  background: var(--ink);
  color: #fffaf1;
  box-shadow: 0 12px 28px rgba(37, 31, 29, 0.22);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-2px);
}

.time-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.dog-stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(78px, 1fr));
  gap: 16px;
  align-content: center;
  min-height: 520px;
}

.dog-card {
  position: relative;
  min-height: 154px;
  padding: 12px 10px 10px;
  overflow: hidden;
  border: 1px solid rgba(37, 31, 29, 0.08);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 20%, white);
  box-shadow: 0 12px 30px rgba(60, 44, 35, 0.09);
}

.dog-card:nth-child(2n) {
  transform: translateY(22px);
}

.dog-card:nth-child(3n) {
  transform: translateY(-14px);
}

.dog-label {
  position: relative;
  z-index: 2;
  display: block;
  color: color-mix(in srgb, var(--accent) 64%, #1f1917);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.dog-figure {
  --coat: #d9a262;
  --patch: #fff2d8;
  --dark: #38241c;
  --accent: #168b86;
  position: relative;
  width: 104px;
  height: 112px;
  margin: 8px auto 0;
  animation: floatDog 3.2s ease-in-out infinite;
  animation-delay: var(--delay, 0ms);
}

.dog-figure.large {
  width: 250px;
  height: 250px;
  margin: 0;
}

.dog-figure.medium {
  width: 144px;
  height: 144px;
  margin: 0;
}

.dog-figure.small {
  width: 108px;
  height: 104px;
  margin: 0 auto;
}

.image-dog {
  display: grid;
  place-items: center;
  overflow: visible;
}

.dog-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 18px rgba(48, 36, 28, 0.16));
  transform-origin: 50% 88%;
  transition:
    filter 180ms ease,
    transform 180ms ease;
}

.dog-card:hover .dog-art {
  filter: drop-shadow(0 22px 20px rgba(48, 36, 28, 0.2));
  transform: scale(1.04) rotate(1deg);
}

.dog-body {
  position: absolute;
  left: 18%;
  bottom: 8%;
  width: 64%;
  height: 48%;
  border-radius: 48% 52% 42% 42%;
  background: var(--coat);
  box-shadow: inset -10px -10px 0 rgba(0, 0, 0, 0.08);
}

.dog-chest {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 28%;
  height: 50%;
  border-radius: 50% 50% 42% 42%;
  background: var(--patch);
  transform: translateX(-50%);
}

.dog-head {
  position: absolute;
  left: 50%;
  top: 8%;
  width: 58%;
  height: 56%;
  border-radius: var(--head-radius, 45% 45% 46% 46%);
  background: var(--coat);
  box-shadow: inset -9px -7px 0 rgba(0, 0, 0, 0.07);
  transform: translateX(-50%);
  z-index: 3;
}

.dog-ear {
  position: absolute;
  top: 14%;
  width: var(--ear-width, 22%);
  height: var(--ear-height, 42%);
  border-radius: var(--ear-radius, 55% 55% 48% 48%);
  background: var(--ear, var(--coat));
  transform-origin: top center;
  z-index: 2;
}

.dog-ear.left {
  left: var(--ear-left, 12%);
  transform: rotate(var(--ear-left-rotate, -20deg));
}

.dog-ear.right {
  right: var(--ear-right, 12%);
  transform: rotate(var(--ear-right-rotate, 20deg));
}

.dog-muzzle {
  position: absolute;
  left: 50%;
  bottom: 13%;
  width: var(--muzzle-width, 42%);
  height: var(--muzzle-height, 28%);
  border-radius: var(--muzzle-radius, 50% 50% 44% 44%);
  background: var(--patch);
  transform: translateX(-50%);
}

.dog-eye {
  position: absolute;
  top: 40%;
  width: 7%;
  height: 8%;
  border-radius: 50%;
  background: var(--dark);
  animation: blink 4.8s infinite;
}

.dog-eye.left {
  left: 34%;
}

.dog-eye.right {
  right: 34%;
}

.dog-nose {
  position: absolute;
  left: 50%;
  top: 49%;
  width: 10%;
  height: 7%;
  border-radius: 50% 50% 60% 60%;
  background: var(--dark);
  transform: translateX(-50%);
  z-index: 4;
}

.dog-mouth {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 22%;
  height: 14%;
  border-bottom: 3px solid var(--dark);
  border-radius: 0 0 50% 50%;
  transform: translateX(-50%);
  z-index: 4;
}

.dog-tail {
  position: absolute;
  right: 7%;
  bottom: 39%;
  width: var(--tail-width, 28%);
  height: var(--tail-height, 12%);
  border-radius: 999px;
  background: var(--coat);
  transform-origin: left center;
  transform: rotate(var(--tail-rotate, -28deg));
  animation: wag 560ms ease-in-out infinite alternate;
}

.dog-leg {
  position: absolute;
  bottom: 0;
  width: 13%;
  height: 22%;
  border-radius: 999px 999px 6px 6px;
  background: color-mix(in srgb, var(--coat) 86%, #2b1d18);
}

.dog-leg.one {
  left: 28%;
}

.dog-leg.two {
  right: 28%;
}

.dog-spot {
  position: absolute;
  border-radius: 50%;
  background: var(--spot, transparent);
  opacity: var(--spot-opacity, 1);
}

.dog-spot.face {
  top: 13%;
  left: 20%;
  width: 26%;
  height: 36%;
}

.dog-spot.back {
  top: 48%;
  left: 23%;
  width: 28%;
  height: 30%;
  z-index: 2;
}

.frenchie {
  --coat: #c99a76;
  --patch: #fff1df;
  --ear: #b98767;
  --dark: #34241f;
  --head-radius: 45% 45% 40% 40%;
  --ear-width: 25%;
  --ear-height: 46%;
  --ear-left: 8%;
  --ear-right: 8%;
  --ear-left-rotate: -18deg;
  --ear-right-rotate: 18deg;
  --muzzle-width: 48%;
  --muzzle-height: 24%;
  --tail-width: 13%;
  --tail-height: 13%;
  --tail-rotate: 12deg;
}

.frenchie .dog-head {
  width: 63%;
  height: 54%;
}

.frenchie .dog-tail {
  border-radius: 50%;
}

.labrador {
  --coat: #dfb15d;
  --patch: #ffe9b8;
  --ear: #c89142;
  --dark: #3b2b20;
  --ear-width: 20%;
  --ear-height: 44%;
  --ear-left-rotate: 16deg;
  --ear-right-rotate: -16deg;
  --muzzle-width: 43%;
  --tail-width: 31%;
  --tail-height: 11%;
}

.labrador .dog-head {
  top: 10%;
}

.golden {
  --coat: #e7ba53;
  --patch: #fff0bd;
  --ear: #ce8e31;
  --dark: #3f2d1f;
  --ear-width: 22%;
  --ear-height: 48%;
  --ear-left-rotate: 18deg;
  --ear-right-rotate: -18deg;
  --muzzle-width: 44%;
  --tail-width: 36%;
}

.golden .dog-tail {
  box-shadow: 0 5px 0 rgba(255, 240, 189, 0.72);
}

.shepherd {
  --coat: #b8743d;
  --patch: #e1b16f;
  --ear: #46332c;
  --dark: #2b211f;
  --spot: #46332c;
  --head-radius: 42% 42% 48% 48%;
  --ear-width: 24%;
  --ear-height: 48%;
  --ear-left: 10%;
  --ear-right: 10%;
  --ear-left-rotate: -8deg;
  --ear-right-rotate: 8deg;
  --tail-width: 32%;
}

.shepherd .dog-spot.back {
  width: 44%;
  height: 36%;
  left: 18%;
  top: 38%;
  border-radius: 42% 58% 52% 48%;
}

.dachshund {
  --coat: #a85a31;
  --patch: #efbf72;
  --ear: #734022;
  --dark: #321f18;
  --head-radius: 46% 46% 48% 48%;
  --ear-width: 25%;
  --ear-height: 52%;
  --ear-left-rotate: 20deg;
  --ear-right-rotate: -20deg;
  --tail-width: 28%;
  --tail-height: 9%;
}

.dachshund .dog-body {
  left: 8%;
  width: 76%;
  height: 36%;
  border-radius: 48% 56% 36% 36%;
}

.dachshund .dog-head {
  left: 37%;
  top: 18%;
  width: 48%;
  height: 46%;
}

.dachshund .dog-leg {
  height: 17%;
}

.dachshund .dog-leg.one {
  left: 24%;
}

.dachshund .dog-leg.two {
  right: 18%;
}

.poodle {
  --coat: #f3efe8;
  --patch: #ffffff;
  --ear: #ddd3c7;
  --dark: #2f2926;
  --head-radius: 50%;
  --ear-width: 21%;
  --ear-height: 43%;
  --tail-width: 23%;
}

.poodle .dog-head::before,
.poodle .dog-head::after,
.poodle .dog-body::before,
.poodle .dog-body::after {
  position: absolute;
  display: block;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: #fff8ef;
  content: "";
}

.poodle .dog-head::before {
  top: -9%;
  left: 18%;
}

.poodle .dog-head::after {
  top: -10%;
  right: 20%;
}

.poodle .dog-body::before {
  left: -3%;
  top: -2%;
}

.poodle .dog-body::after {
  right: -2%;
  top: 3%;
}

.beagle {
  --coat: #d79a52;
  --patch: #fff2dd;
  --ear: #5f3529;
  --dark: #30211c;
  --spot: #5f3529;
  --ear-width: 24%;
  --ear-height: 52%;
  --ear-left-rotate: 19deg;
  --ear-right-rotate: -19deg;
  --tail-width: 29%;
}

.beagle .dog-spot.face {
  top: 9%;
  left: 15%;
  width: 32%;
  height: 42%;
}

.beagle .dog-spot.back {
  width: 35%;
  height: 34%;
  top: 40%;
  left: 18%;
}

.rottweiler {
  --coat: #2b2422;
  --patch: #b7753a;
  --ear: #231d1b;
  --dark: #161210;
  --spot: #b7753a;
  --ear-width: 22%;
  --ear-height: 40%;
  --muzzle-width: 45%;
  --tail-width: 16%;
  --tail-height: 10%;
  --tail-rotate: -14deg;
}

.rottweiler .dog-spot.face {
  top: 38%;
  left: 28%;
  width: 10%;
  height: 9%;
}

.rottweiler .dog-spot.face::after {
  position: absolute;
  top: 0;
  left: 230%;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--spot);
  content: "";
}

.rottweiler .dog-chest {
  width: 34%;
}

.gsp {
  --coat: #83523f;
  --patch: #f4ebe0;
  --ear: #6b4435;
  --dark: #2a211d;
  --spot: #6d4432;
  --spot-opacity: 0.85;
  --ear-width: 22%;
  --ear-height: 48%;
  --tail-width: 35%;
  --tail-height: 9%;
}

.gsp .dog-head {
  top: 10%;
}

.gsp .dog-body {
  background:
    radial-gradient(circle at 30% 35%, var(--spot) 0 8%, transparent 9%),
    radial-gradient(circle at 68% 56%, var(--spot) 0 7%, transparent 8%),
    var(--patch);
}

.gsp .dog-spot.face {
  top: 8%;
  left: 18%;
  width: 36%;
  height: 42%;
}

.bulldog {
  --coat: #d59a6c;
  --patch: #fff0dd;
  --ear: #bd7f58;
  --dark: #2e201b;
  --spot: #ffffff;
  --head-radius: 38% 38% 46% 46%;
  --ear-width: 19%;
  --ear-height: 30%;
  --ear-left-rotate: -38deg;
  --ear-right-rotate: 38deg;
  --muzzle-width: 58%;
  --muzzle-height: 25%;
  --tail-width: 12%;
  --tail-height: 12%;
  --tail-rotate: 8deg;
}

.bulldog .dog-head {
  width: 68%;
  height: 52%;
}

.bulldog .dog-body {
  left: 13%;
  width: 72%;
  height: 43%;
  border-radius: 40% 45% 38% 38%;
}

.bulldog .dog-tail {
  border-radius: 50%;
}

.quiz-screen {
  max-width: 900px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 52px;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 52px;
}

.ghost-btn {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 22px;
  font-weight: 900;
  transition: transform 180ms ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--coral), var(--mustard));
  transition: width 240ms ease;
}

.question-area {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  align-items: center;
}

.question-dog {
  display: grid;
  min-height: 160px;
  place-items: center;
}

.question-copy {
  min-width: 0;
}

.question-copy h2 {
  margin-bottom: 30px;
  font-size: clamp(28px, 5vw, 50px);
  line-height: 1.18;
  letter-spacing: 0;
}

.options-grid {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.option-btn {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid rgba(37, 31, 29, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.option-btn span:first-child {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, var(--teal)) 17%, white);
  color: color-mix(in srgb, var(--accent, var(--teal)) 75%, #251f1d);
  font-weight: 900;
}

.option-btn span:last-child {
  min-width: 0;
  font-weight: 800;
  line-height: 1.35;
}

.option-btn:hover,
.option-btn:focus-visible {
  border-color: color-mix(in srgb, var(--accent, var(--teal)) 70%, #251f1d);
  background: color-mix(in srgb, var(--accent, var(--teal)) 11%, white);
  outline: 0;
  transform: translateX(4px);
}

.result-screen {
  padding: 24px 0 56px;
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  min-height: 360px;
  margin-bottom: 28px;
}

.result-dog {
  display: grid;
  min-height: 300px;
  place-items: center;
}

.result-copy h1 {
  margin-bottom: 12px;
}

.result-subtitle {
  max-width: 680px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.8;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tag {
  padding: 8px 11px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 16%, white);
  color: color-mix(in srgb, var(--accent) 75%, #211a18);
  font-size: 13px;
  font-weight: 900;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.76fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid rgba(37, 31, 29, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 14px 44px rgba(47, 35, 28, 0.08);
}

.result-panel,
.radar-panel,
.alt-panel {
  padding: clamp(20px, 3vw, 30px);
}

.panel h2 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.2;
}

.result-panel > p,
.alt-panel p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.insight-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.insight-list div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.insight-list span {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.insight-list p {
  margin-bottom: 0;
  color: #443a35;
  line-height: 1.7;
}

.radar-panel {
  display: grid;
  align-content: start;
}

#radarCanvas {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  height: auto;
  margin: 0 auto 18px;
}

.score-list {
  display: grid;
  gap: 10px;
}

.score-item {
  display: grid;
  grid-template-columns: 84px 1fr 42px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.score-bar span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--accent, var(--teal));
}

.alt-panel {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 20px;
  align-items: center;
  margin-top: 18px;
}

.alt-panel p {
  margin-bottom: 0;
}

.alt-dog {
  display: grid;
  place-items: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatDog {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

@keyframes wag {
  from {
    transform: rotate(calc(var(--tail-rotate, -28deg) - 10deg));
  }
  to {
    transform: rotate(calc(var(--tail-rotate, -28deg) + 12deg));
  }
}

@keyframes blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  96% {
    transform: scaleY(0.08);
  }
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 24px, 760px);
    padding-top: 18px;
  }

  .intro-layout,
  .result-hero,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .intro-layout {
    min-height: auto;
  }

  .dog-stage {
    grid-template-columns: repeat(5, 1fr);
    min-height: 360px;
    order: -1;
  }

  .dog-card {
    min-height: 126px;
    padding-inline: 6px;
  }

  .dog-stage .dog-figure {
    width: 82px;
    height: 90px;
  }

  .dog-label {
    font-size: 11px;
  }

  .result-hero {
    text-align: center;
  }

  .result-copy h1,
  .result-subtitle {
    margin-inline: auto;
  }

  .tag-row,
  .result-actions {
    justify-content: center;
  }

  .result-dog {
    min-height: 220px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 520px);
  }

  .brand-row {
    margin-bottom: 18px;
  }

  h1 {
    font-size: clamp(42px, 15vw, 64px);
  }

  .lead,
  .result-subtitle {
    font-size: 16px;
  }

  .dog-stage {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    min-height: auto;
  }

  .dog-card:nth-child(n) {
    transform: none;
  }

  .dog-stage .dog-figure.small {
    width: 132px;
    height: 116px;
  }

  .quiz-topbar {
    margin-bottom: 30px;
  }

  .question-area {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .question-dog {
    min-height: 118px;
  }

  .question-copy h2 {
    margin-bottom: 20px;
    font-size: 28px;
  }

  .option-btn {
    grid-template-columns: 36px 1fr;
    min-height: 58px;
    padding: 10px 12px;
  }

  .option-btn span:first-child {
    width: 34px;
    height: 34px;
  }

  .result-dog {
    min-height: 190px;
  }

  .dog-figure.large {
    width: 190px;
    height: 190px;
  }

  .alt-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .score-item {
    grid-template-columns: 76px 1fr 36px;
  }
}
