:root {
  --paper: #f8f2e7;
  --paper-strong: #fffaf0;
  --ink: #20231f;
  --muted: #68665e;
  --line: #2f302b;
  --sage: #6f8d6a;
  --sage-dark: #385c48;
  --coral: #ed6a5a;
  --gold: #d8a63a;
  --blue: #70a9a1;
  --rose: #e9a6a6;
  --shadow: 0 20px 60px rgba(32, 35, 31, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "LXGW WenKai", "Source Han Serif SC", "Noto Serif CJK SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, rgba(112, 169, 161, 0.11) 1px, transparent 1px),
    linear-gradient(0deg, rgba(112, 169, 161, 0.09) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
}

button,
a {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(237, 106, 90, 0.18);
}

button {
  cursor: pointer;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.26;
  background-image:
    repeating-linear-gradient(90deg, rgba(32, 35, 31, 0.03) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(32, 35, 31, 0.025) 0 1px, transparent 1px 9px);
  mix-blend-mode: multiply;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 220px;
}

.topbar,
main {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  border-bottom: 2px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  filter: drop-shadow(5px 5px 0 var(--line));
  transition: transform 180ms ease, filter 180ms ease;
}

.brand:hover .brand-mark {
  transform: translate(2px, 2px);
  filter: drop-shadow(3px 3px 0 var(--line));
}

.logo-badge {
  fill: #fff8eb;
  stroke: var(--line);
  stroke-width: 4;
  stroke-linejoin: round;
}

.logo-face {
  fill: var(--ink);
}

.logo-eye,
.logo-smile {
  fill: none;
  stroke: #fff8eb;
  stroke-width: 4;
  stroke-linecap: round;
}

.logo-dot {
  fill: var(--coral);
  stroke: var(--line);
  stroke-width: 3;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 22px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  min-width: 0;
}

.site-nav a {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.is-active {
  border-color: var(--line);
  background: var(--paper-strong);
  box-shadow: 3px 3px 0 var(--line);
}

.top-actions a {
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.icon-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 4px 4px 0 var(--line);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.icon-button {
  width: 44px;
  font-size: 24px;
  line-height: 1;
}

.primary-button,
.secondary-button {
  padding: 0 18px;
  font-weight: 800;
}

.inline-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.primary-button {
  background: var(--coral);
  color: #fffaf0;
}

.secondary-button {
  background: var(--paper-strong);
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--line);
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.88fr) minmax(360px, 1.36fr) minmax(250px, 0.76fr);
  gap: 20px;
  padding-top: 24px;
}

.ambient-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  z-index: 1;
  height: 150px;
  pointer-events: none;
  overflow: hidden;
}

.floor-line {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 38px;
  height: 2px;
  background: rgba(47, 48, 43, 0.22);
}

.floor-line::before,
.floor-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(47, 48, 43, 0.24);
  border-radius: 50%;
  background: var(--paper);
}

.floor-line::before {
  left: 18%;
}

.floor-line::after {
  right: 26%;
}

.cat-walker {
  position: absolute;
  left: -170px;
  bottom: 38px;
  width: 126px;
  height: 78px;
  opacity: 0.78;
  animation: catWalk 22s linear infinite;
  will-change: transform;
}

.cat-body {
  position: absolute;
  left: 28px;
  bottom: 14px;
  width: 72px;
  height: 38px;
  border: 3px solid var(--line);
  border-radius: 54% 46% 42% 48%;
  background: var(--ink);
}

.cat-head {
  position: absolute;
  right: 6px;
  bottom: 29px;
  width: 46px;
  height: 42px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--ink);
}

.cat-head::before,
.cat-head::after {
  content: "";
  position: absolute;
  top: -13px;
  width: 18px;
  height: 22px;
  background: var(--ink);
  border-top: 3px solid var(--line);
  transform: rotate(38deg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.cat-head::before {
  left: 4px;
}

.cat-head::after {
  right: 4px;
  transform: rotate(-38deg);
}

.cat-head i {
  position: absolute;
  top: 19px;
  width: 8px;
  height: 4px;
  border-top: 3px solid var(--paper-strong);
  border-radius: 999px;
  animation: catBlink 4.8s ease-in-out infinite;
}

.cat-head i:first-child {
  left: 12px;
}

.cat-head i:last-child {
  right: 12px;
}

.cat-tail {
  position: absolute;
  left: 2px;
  bottom: 30px;
  width: 42px;
  height: 42px;
  border: 8px solid var(--ink);
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform-origin: 36px 32px;
  animation: tailSway 1.8s ease-in-out infinite;
}

.cat-leg {
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 25px;
  border-radius: 999px;
  background: var(--ink);
  transform-origin: 50% 0;
  animation: legStep 0.9s ease-in-out infinite;
}

.leg-one {
  left: 50px;
}

.leg-two {
  left: 78px;
  animation-delay: 0.45s;
}

.peek-eyes {
  position: absolute;
  bottom: 84px;
  display: flex;
  gap: 18px;
  opacity: 0.24;
  animation: eyesBlink 5.6s ease-in-out infinite;
}

.peek-eyes span {
  width: 16px;
  height: 10px;
  border-top: 4px solid var(--line);
  border-radius: 999px;
}

.eyes-one {
  left: 18%;
}

.eyes-two {
  right: 18%;
  bottom: 112px;
  transform: scale(0.78);
  animation-delay: 1.8s;
}

@keyframes catWalk {
  0% {
    transform: translateX(0) translateY(0);
  }
  48% {
    transform: translateX(calc(100vw + 230px)) translateY(0);
  }
  49% {
    transform: translateX(calc(100vw + 230px)) translateY(999px);
  }
  50% {
    transform: translateX(calc(-100vw - 230px)) translateY(999px) scaleX(-1);
  }
  51% {
    transform: translateX(calc(-100vw - 230px)) translateY(0) scaleX(-1);
  }
  100% {
    transform: translateX(0) translateY(0) scaleX(-1);
  }
}

@keyframes tailSway {
  0%,
  100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(14deg);
  }
}

@keyframes legStep {
  0%,
  100% {
    transform: rotate(-9deg);
  }
  50% {
    transform: rotate(9deg);
  }
}

@keyframes catBlink {
  0%,
  88%,
  100% {
    transform: scaleY(1);
  }
  92% {
    transform: scaleY(0.12);
  }
}

@keyframes eyesBlink {
  0%,
  78%,
  100% {
    opacity: 0.24;
    transform: translateY(0);
  }
  84% {
    opacity: 0.08;
    transform: translateY(2px);
  }
}

.intro-panel,
.question-panel,
.score-panel,
.result-main,
.poster-panel {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.intro-panel {
  display: flex;
  flex-direction: column;
  min-height: 680px;
  overflow: hidden;
}

.intro-panel .eyebrow,
.intro-panel h1,
.intro-panel .lead,
.name-card {
  padding-inline: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 6vw, 78px);
  line-height: 0.95;
}

.lead {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.name-card {
  display: grid;
  gap: 8px;
  margin: 22px 0 24px;
}

.name-card span {
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 900;
}

.name-card input {
  width: min(100%, 260px);
  height: 48px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  outline: none;
  box-shadow: 4px 4px 0 rgba(32, 35, 31, 0.16);
}

.name-card input:focus {
  border-color: var(--sage-dark);
  box-shadow: 4px 4px 0 var(--sage);
}

.double-name-card {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
  padding-inline: 24px;
}

.double-name-card label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.double-name-card input {
  width: 100%;
}

.bond-card {
  position: relative;
  min-height: 304px;
  margin-top: auto;
  overflow: hidden;
  border-top: 2px solid var(--line);
  background:
    radial-gradient(circle at 22% 24%, rgba(237, 106, 90, 0.22) 0 13%, transparent 13.5%),
    linear-gradient(135deg, #e7efe8 0 50%, #f6dda0 50% 100%);
}

.bond-card::before,
.bond-card::after {
  content: "";
  position: absolute;
  border: 2px solid var(--line);
  background: var(--paper-strong);
  box-shadow: 6px 6px 0 rgba(32, 35, 31, 0.12);
}

.bond-card::before {
  width: 116px;
  height: 86px;
  left: 38px;
  bottom: 42px;
  border-radius: 999px 999px 18px 18px;
}

.bond-card::after {
  width: 86px;
  height: 54px;
  right: 42px;
  top: 42px;
  border-radius: 999px;
  transform: rotate(-10deg);
}

.bond-moon {
  position: absolute;
  width: 70px;
  height: 70px;
  right: 60px;
  top: 54px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 5px 5px 0 var(--line);
}

.bond-cat {
  position: absolute;
  left: 48%;
  bottom: 50px;
  width: 142px;
  height: 150px;
  transform: translateX(-50%);
  border-radius: 48% 48% 42% 42%;
  background: var(--ink);
  box-shadow: 10px 10px 0 rgba(32, 35, 31, 0.16);
}

.bond-cat::before,
.bond-cat::after {
  content: "";
  position: absolute;
  top: -44px;
  width: 64px;
  height: 76px;
  background: var(--ink);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.bond-cat::before {
  left: 8px;
  transform: rotate(-10deg);
}

.bond-cat::after {
  right: 8px;
  transform: rotate(10deg);
}

.bond-cat span,
.bond-cat i {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.bond-cat span {
  top: 50px;
  width: 78px;
  height: 22px;
  border-top: 7px solid var(--paper-strong);
  border-radius: 999px;
}

.bond-cat span::before,
.bond-cat span::after {
  content: "";
  position: absolute;
  top: -9px;
  width: 28px;
  height: 22px;
  border-top: 7px solid var(--paper-strong);
  border-radius: 999px;
}

.bond-cat span::before {
  left: -8px;
}

.bond-cat span::after {
  right: -8px;
}

.bond-cat i {
  top: 88px;
  width: 48px;
  height: 24px;
  border-bottom: 7px solid var(--paper-strong);
  border-radius: 0 0 999px 999px;
}

.bond-human {
  position: absolute;
  left: calc(50% - 150px);
  bottom: 58px;
  width: 82px;
  height: 82px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 6px 6px 0 var(--line);
}

.bond-human::before,
.bond-human::after {
  content: "";
  position: absolute;
  top: 34px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
}

.bond-human::before {
  left: 24px;
}

.bond-human::after {
  right: 24px;
}

.bond-line {
  position: absolute;
  left: calc(50% - 94px);
  bottom: 126px;
  width: 116px;
  height: 48px;
  border-top: 7px solid var(--coral);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.hero-cat {
  width: 100%;
  margin-top: auto;
  border-top: 2px solid var(--line);
  background: #e7efe8;
}

.principle-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 2px solid var(--line);
  background: var(--ink);
  color: var(--paper-strong);
}

.principle-band span {
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.principle-band span + span {
  border-left: 2px solid var(--paper-strong);
}

.question-panel {
  min-height: 680px;
  padding: 26px;
  display: flex;
  flex-direction: column;
}

.progress-row,
.score-heading,
.result-title-row,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-row h2 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 44px);
}

.progress-number {
  display: grid;
  place-items: center;
  min-width: 70px;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--gold);
  color: #fffaf0;
  font-size: 18px;
  font-weight: 900;
}

.progress-track {
  height: 14px;
  margin: 22px 0 34px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #eadfce;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--coral), var(--gold));
  transition: width 220ms ease;
}

.question-block {
  display: flex;
  flex: 1;
  flex-direction: column;
}

#questionText,
#bondQuestionText {
  min-height: 128px;
  margin: 0 0 24px;
  font-size: clamp(26px, 3.1vw, 40px);
  font-weight: 900;
  line-height: 1.28;
}

.answer-grid {
  display: grid;
  gap: 12px;
}

.answer-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  width: 100%;
  min-height: 92px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 6px 6px 0 rgba(32, 35, 31, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.answer-card:hover,
.answer-card.is-selected {
  transform: translate(3px, 3px);
  box-shadow: 3px 3px 0 var(--line);
  background: #f5fff5;
}

.answer-card.is-selected .answer-letter {
  background: var(--sage-dark);
}

.answer-letter {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--blue);
  color: #fffaf0;
  font-weight: 900;
}

.answer-copy {
  align-self: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
}

@media (hover: none) {
  .answer-card:hover:not(.is-selected) {
    transform: none;
    box-shadow: 6px 6px 0 rgba(32, 35, 31, 0.12);
    background: #ffffff;
  }

  .answer-card:active {
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0 var(--line);
    background: #f5fff5;
  }
}

.quiz-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.quiz-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: 4px 4px 0 var(--line);
}

.score-panel {
  min-height: 680px;
  padding: 22px;
}

.score-heading {
  margin-bottom: 18px;
}

.score-heading span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--rose);
  font-weight: 900;
}

.dimension-list,
.axis-list {
  display: grid;
  gap: 14px;
}

.dimension-item,
.axis-item {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}

.dimension-top,
.axis-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 900;
}

.mini-track,
.axis-track {
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #ece0ce;
}

.mini-track span,
.axis-track span {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--sage);
  transition: width 200ms ease;
}

.quiet-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 20px;
  padding-top: 24px;
}

.result-main {
  padding: clamp(22px, 4vw, 44px);
}

.result-title-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.result-title-row h2 {
  margin: 0;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 1;
}

.level-pill {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--gold);
  color: #fffaf0;
  font-weight: 900;
}

.result-summary {
  max-width: 900px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 22px;
  margin-top: 28px;
}

.result-grid h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.result-grid p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.axis-item {
  background: #fdf7eb;
}

.axis-item small {
  color: var(--muted);
  font-weight: 700;
}

.alert-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.alert-item {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff2ef;
  font-weight: 800;
}

.result-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 28px;
}

.poster-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

canvas {
  width: 100%;
  height: auto;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf0;
}

.poster-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.download-link,
.share-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--sage-dark);
  color: #fffaf0;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--line);
}

.share-button {
  background: var(--coral);
  color: #fffaf0;
}

.share-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
}

.share-menu button {
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.is-hidden {
  display: none;
}

.tool-page {
  padding-top: 24px;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px;
}

.tool-hero,
.tool-panel,
.tool-result,
.chat-panel {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.tool-hero {
  min-height: 620px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tool-hero h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 0.96;
}

.tool-hero .lead {
  padding: 0;
}

.tool-art {
  margin-top: auto;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: #e7efe8;
}

.tool-art svg {
  width: 100%;
  height: auto;
  display: block;
}

.tool-panel {
  min-height: 620px;
  padding: 28px;
}

.tool-panel h2 {
  margin: 0 0 18px;
  font-size: clamp(28px, 3.6vw, 46px);
}

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

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 900;
}

.tool-input,
.tool-select,
.chat-input {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  outline: none;
  box-shadow: 4px 4px 0 rgba(32, 35, 31, 0.12);
}

.tool-input:focus,
.tool-select:focus,
.chat-input:focus {
  border-color: var(--sage-dark);
  box-shadow: 4px 4px 0 var(--sage);
}

.tool-button {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--coral);
  color: #fffaf0;
  font: inherit;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--line);
}

.tool-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--line);
}

.tool-result {
  margin-top: 20px;
  padding: 20px;
  background: #fff;
}

.result-placeholder {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.7;
}

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

.name-card-result {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fdf7eb;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.name-card-result:hover {
  transform: translate(2px, 2px);
  background: #f5fff5;
  box-shadow: 3px 3px 0 var(--line);
}

.name-card-result strong {
  display: block;
  font-size: 26px;
  line-height: 1.2;
}

.name-card-result span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.weight-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.weight-status strong {
  font-size: 28px;
}

.weight-pill {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--gold);
  color: #fffaf0;
  font-weight: 900;
}

.weight-meter {
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #ece0ce;
}

.weight-meter span {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--sage);
}

.fact-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.fact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.advice-box {
  margin-top: 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff2ef;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.7;
}

.warning-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.warning-list p {
  margin: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff2ef;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.6;
}

.chat-panel {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.chat-header {
  padding: 22px;
  border-bottom: 2px solid var(--line);
}

.chat-header h2 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 46px);
}

.chat-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.chat-window {
  min-height: 360px;
  max-height: 520px;
  overflow-y: auto;
  padding: 18px;
  background: #fffaf0;
}

.message {
  max-width: 82%;
  margin-bottom: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.65;
  font-weight: 800;
}

.message.bot {
  background: #e7efe8;
}

.message.user {
  margin-left: auto;
  background: #fff2ef;
}

.quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 0;
  border-top: 2px solid var(--line);
}

.quick-list button {
  min-height: 36px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 18px 18px;
}

.chat-send {
  min-width: 88px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--sage-dark);
  color: #fffaf0;
  font: inherit;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--line);
}

@media (max-width: 1120px) {
  .app-shell {
    padding-bottom: 34px;
  }

  .quiz-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  }

  .ambient-floor {
    display: none;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }

  .tool-hero,
  .tool-panel,
  .chat-panel {
    min-height: auto;
  }

  .tool-art {
    max-height: 320px;
  }

  .tool-art svg {
    max-height: 280px;
  }

  .intro-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .hero-cat {
    max-height: 330px;
    object-fit: cover;
  }

  .bond-card {
    min-height: 260px;
  }

  .question-panel,
  .score-panel {
    min-height: auto;
  }
}

@media (max-width: 820px) {
  body {
    background-size: 28px 28px;
  }

  .app-shell {
    width: min(100% - 16px, 1500px);
    padding-top: 12px;
    padding-bottom: 22px;
  }

  .topbar,
  .top-actions,
  .progress-row,
  .score-heading {
    align-items: flex-start;
  }

  .topbar,
  .quiz-layout,
  .result-layout,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    gap: 14px;
    padding-bottom: 14px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 4px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    min-height: 40px;
    flex: 0 0 auto;
    padding-inline: 12px;
    scroll-snap-align: start;
  }

  .top-actions {
    width: 100%;
  }

  .question-panel,
  .score-panel,
  .result-main,
  .tool-panel,
  .tool-hero {
    padding: 16px;
  }

  .intro-panel .eyebrow,
  .intro-panel h1,
  .intro-panel .lead,
  .name-card {
    padding-inline: 18px;
  }

  .intro-panel h1 {
    font-size: clamp(38px, 14vw, 56px);
  }

  .lead {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.55;
  }

  .name-card {
    margin: 16px 0 18px;
  }

  .name-card input {
    width: 100%;
    height: 52px;
    font-size: 17px;
  }

  .hero-cat {
    max-height: 190px;
  }

  .bond-card {
    min-height: 218px;
  }

  .progress-row {
    align-items: center;
  }

  .progress-row h2 {
    font-size: 30px;
  }

  .progress-number {
    min-width: 58px;
    height: 42px;
  }

  .progress-track {
    margin: 18px 0 22px;
  }

  .form-grid,
  .name-grid,
  .double-name-card,
  .poster-actions,
  .chat-compose {
    grid-template-columns: 1fr;
  }

  .share-menu {
    grid-template-columns: 1fr;
  }

  .principle-band {
    grid-template-columns: 1fr;
  }

  .principle-band span + span {
    border-left: 0;
    border-top: 2px solid var(--paper-strong);
  }

  #questionText,
  #bondQuestionText {
    min-height: auto;
    margin-bottom: 18px;
    font-size: clamp(24px, 7.6vw, 32px);
    line-height: 1.25;
  }

  .answer-grid {
    gap: 12px;
  }

  .answer-card {
    min-height: 88px;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    padding: 14px;
  }

  .answer-letter {
    width: 38px;
    height: 38px;
  }

  .answer-copy {
    font-size: 17px;
    line-height: 1.4;
  }

  .quiz-controls {
    position: sticky;
    z-index: 4;
    bottom: 10px;
    flex-direction: column;
    margin: 18px -4px -4px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: rgba(255, 250, 240, 0.96);
    box-shadow: 4px 4px 0 rgba(32, 35, 31, 0.18);
  }

  .quiz-controls .secondary-button,
  .poster-actions .download-link,
  .poster-actions .share-button,
  .share-menu button {
    min-height: 48px;
  }

  .score-panel .dimension-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dimension-item,
  .axis-item {
    padding: 12px;
  }

  .quiet-note {
    font-size: 13px;
  }

  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .result-actions .secondary-button,
  .result-actions .inline-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell {
    padding-bottom: 34px;
  }

  .ambient-floor {
    display: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
