:root {
  --ink: #181616;
  --muted: #6b625f;
  --paper: #fffaf2;
  --surface: #ffffff;
  --line: #202020;
  --coral: #ff6b4a;
  --cyan: #00a6a6;
  --lime: #c7ef4b;
  --blue: #4b7bec;
  --shadow: 0 18px 48px rgba(24, 22, 22, 0.12);
  --result-theme: #bd7d42;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0, 166, 166, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 166, 166, 0.12) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  font-family:
    "Inter",
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
  display: grid;
  place-items: center;
}

.quiz-stage {
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(360px, 1.16fr);
  border: 2px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quiz-stage.start-mode {
  width: min(520px, 100%);
  grid-template-columns: 1fr;
}

.quiz-stage.start-mode .brand-panel {
  min-height: min(760px, calc(100vh - 48px));
  border-right: 0;
}

.quiz-stage.quiz-mode {
  width: min(820px, 100%);
  grid-template-columns: 1fr;
}

.quiz-stage.preview-mode {
  width: min(1120px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  grid-template-columns: 1fr;
}

body.result-active {
  background: #fffdf8;
}

body.result-active .app-shell {
  padding: 0;
  background: transparent;
}

.quiz-stage.result-mode {
  width: min(620px, 100vw);
  min-height: 100vh;
  grid-template-columns: 1fr;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.quiz-stage.result-mode .brand-panel {
  display: none;
}

.brand-panel.hidden {
  display: none;
}

.brand-panel {
  padding: clamp(24px, 4vw, 48px);
  border-right: 2px solid var(--line);
  background:
    linear-gradient(135deg, rgba(199, 239, 75, 0.74), rgba(255, 250, 242, 0.9) 46%, rgba(255, 107, 74, 0.22)),
    var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.start-actions {
  display: grid;
  gap: 12px;
}

.start-button {
  width: 100%;
  margin-top: 4px;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--cyan);
}

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

h1 {
  max-width: 9.5em;
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h1 span {
  display: block;
  white-space: nowrap;
}

.lede {
  max-width: 28rem;
  margin-bottom: 0;
  color: #3c3735;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.75;
}

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

.home-stats div {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
}

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

.home-stats strong {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.home-stats span {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 900;
}

.quiz-panel,
.result-panel {
  min-height: 100%;
  padding: clamp(22px, 4vw, 48px);
}

.quiz-panel {
  display: flex;
  flex-direction: column;
}

.preview-panel {
  min-height: 100%;
  padding: clamp(22px, 4vw, 44px);
}

.preview-panel.hidden {
  display: none;
}

.preview-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.preview-heading h2 {
  max-width: 10em;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

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

.preview-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  align-items: center;
  border: 3px solid var(--preview-theme);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.preview-card:hover,
.preview-card:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--line);
  outline: none;
}

.preview-card img {
  width: 82px;
  aspect-ratio: 1;
  display: block;
  object-fit: contain;
  background: color-mix(in srgb, var(--preview-theme) 7%, #fff);
}

.preview-card h3 {
  margin: 0 0 3px;
  color: var(--preview-theme);
  font-size: 1.08rem;
  line-height: 1.15;
}

.preview-english,
.preview-caption {
  margin: 0;
  line-height: 1.35;
}

.preview-english {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.preview-caption {
  margin-top: 5px;
  font-size: 0.88rem;
  font-weight: 800;
}

.progress-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(36px, 8vh, 76px);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.progress-track {
  height: 10px;
  border: 2px solid var(--line);
  background: #f2eee5;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 16.66%;
  background: linear-gradient(90deg, var(--coral), var(--lime), var(--cyan));
  transition: width 220ms ease;
}

.question-block {
  margin-bottom: 26px;
}

.question-kicker {
  margin-bottom: 12px;
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 900;
}

.question-block h2 {
  max-width: 12em;
  margin-bottom: 0;
  font-size: clamp(2rem, 4.4vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.options-grid {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.option-button {
  min-height: 70px;
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.option-button:hover,
.option-button:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--line);
  outline: none;
}

.option-button.selected {
  background: var(--lime);
  box-shadow: 5px 5px 0 var(--line);
}

.option-key {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-weight: 950;
}

.option-text {
  min-width: 0;
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nav-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 900;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

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

.ghost-button {
  color: var(--ink);
  background: #fff;
}

.primary-button:not(:disabled):hover,
.ghost-button:not(:disabled):hover,
.primary-button:focus-visible,
.ghost-button:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--line);
  outline: none;
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.result-panel.hidden,
.quiz-panel.hidden {
  display: none;
}

.result-panel {
  grid-column: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: clamp(24px, 5vh, 56px) 18px 28px;
  color: #4d3510;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 240, 0.96)),
    #fff;
  position: relative;
}

.quiz-stage.result-mode .result-panel {
  grid-column: 1;
}

.result-card-section {
  width: min(560px, 100%);
  position: relative;
  padding: clamp(18px, 3vw, 24px);
  color: var(--result-theme);
  background: #fff;
  border: 5px solid var(--result-theme);
  border-radius: 4px;
  box-shadow:
    0 22px 44px rgba(80, 55, 24, 0.08),
    0 0 0 8px color-mix(in srgb, var(--result-theme) 10%, transparent);
}

.personality-card {
  min-height: clamp(520px, 72vh, 660px);
  padding: clamp(30px, 5vh, 46px) 22px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 0;
  background:
    radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--result-theme) 5%, #ffffff) 0%, #ffffff 58%, #fbfaf5 100%),
    #fff;
  box-shadow: none;
}

.card-pretitle {
  margin-bottom: clamp(35px, 5.4vh, 55px);
  color: #6f6f6c;
  font-size: clamp(1.65rem, 5vw, 2.45rem);
  font-weight: 800;
}

.personality-card h2 {
  max-width: 100%;
  margin-bottom: 10px;
  color: var(--result-theme);
  font-size: clamp(3.25rem, 13vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

.result-english {
  margin-bottom: 22px;
  color: color-mix(in srgb, var(--result-theme) 56%, #f6c98f);
  font-size: clamp(1.7rem, 6vw, 2.75rem);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
}

.result-character {
  width: min(78%, 360px);
  min-height: clamp(250px, 35vh, 360px);
  display: grid;
  place-items: center;
  margin-top: auto;
}

.result-character img {
  width: 100%;
  max-height: 360px;
  display: block;
  object-fit: contain;
}

.result-card-note {
  min-height: 70px;
  margin: 0;
  padding: 18px 6px 0;
  color: var(--result-theme);
  font-size: clamp(1.15rem, 4.4vw, 1.9rem);
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hidden-copy {
  display: none;
}

.simple-reading {
  width: min(560px, 100%);
  border: 1px solid color-mix(in srgb, var(--result-theme) 28%, #e7ddcf);
  border-radius: 8px;
  padding: 16px 18px 18px;
  background: #fff;
  color: #4d3510;
}

.simple-reading h3 {
  margin: 0 0 8px;
  color: var(--result-theme);
  font-size: 1.05rem;
  line-height: 1.25;
}

.simple-reading p {
  margin: 0;
  color: #644d32;
  font-size: 0.98rem;
  line-height: 1.65;
}

.clean-actions {
  width: min(560px, 100%);
  justify-content: center;
  margin-top: 6px;
}

.clean-actions .primary-button,
.clean-actions .ghost-button {
  min-width: 118px;
}

.clean-actions .primary-button {
  background: var(--result-theme);
  color: #fff;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px;
    place-items: stretch;
  }

  .quiz-stage {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .quiz-stage.start-mode,
  .quiz-stage.quiz-mode,
  .quiz-stage.preview-mode {
    width: 100%;
  }

  .preview-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .brand-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  h1 {
    max-width: none;
  }

  .quiz-panel,
  .result-panel {
    padding: 22px;
  }

  .quiz-stage.result-mode .result-panel {
    padding: 20px 18px 24px;
  }

  .progress-row {
    grid-template-columns: 1fr;
  }

  .progress-row {
    gap: 10px;
    margin-bottom: 36px;
  }

  .question-block h2 {
    max-width: none;
  }

  .option-button {
    min-height: 64px;
    grid-template-columns: 38px 1fr;
    padding: 12px 14px;
  }

  .option-key {
    width: 38px;
    height: 38px;
  }

  .personality-card {
    min-height: 520px;
  }
}

@media (max-width: 480px) {
  body {
    background-size: 24px 24px;
  }

  .app-shell {
    padding: 0;
    min-height: 100svh;
  }

  .quiz-stage {
    width: 100%;
    min-height: 100svh;
    border-left: 0;
    border-right: 0;
    border-top: 0;
  }

  .brand-panel {
    padding: 20px 18px 18px;
    gap: 18px;
  }

  .quiz-stage.start-mode {
    border: 0;
    box-shadow: none;
  }

  .quiz-stage.start-mode .brand-panel {
    position: relative;
    overflow: hidden;
    min-height: 100svh;
    justify-content: center;
    gap: 28px;
    padding: 32px 20px;
    border-bottom: 0;
    background:
      radial-gradient(circle at 18% 8%, rgba(199, 239, 75, 0.88), rgba(199, 239, 75, 0) 32%),
      radial-gradient(circle at 90% 78%, rgba(255, 107, 74, 0.26), rgba(255, 107, 74, 0) 38%),
      linear-gradient(135deg, #fbffdf 0%, #fffaf2 52%, #ffe1d2 100%);
  }

  .quiz-stage.start-mode .brand-panel::before,
  .quiz-stage.start-mode .brand-panel::after {
    content: "";
    position: absolute;
    z-index: 0;
    pointer-events: none;
    border: 4px solid rgba(24, 22, 22, 0.08);
    border-radius: 8px;
  }

  .quiz-stage.start-mode .brand-panel::before {
    right: -76px;
    bottom: 86px;
    width: 210px;
    height: 210px;
    transform: rotate(-11deg);
  }

  .quiz-stage.start-mode .brand-panel::after {
    right: 34px;
    bottom: -58px;
    width: 138px;
    height: 138px;
    transform: rotate(8deg);
  }

  .quiz-stage.start-mode .brand-panel > div:first-child {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 18px;
    max-width: 22rem;
    transform: translateY(-2svh);
  }

  h1 {
    max-width: 100%;
    margin-bottom: 0;
    font-size: 52px;
    line-height: 1.15;
  }

  .lede {
    max-width: 22em;
    color: #2e2a28;
    font-size: 16px;
    line-height: 1.65;
  }

  .start-actions {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 22rem;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
    transform: translateY(-2svh);
  }

  .start-button {
    min-height: 52px;
    margin-top: 0;
    padding-inline: 12px;
  }

  .start-button.primary-button {
    box-shadow: 4px 4px 0 var(--line);
  }

  .home-stats {
    gap: 8px;
  }

  .home-stats div {
    min-height: 70px;
    padding: 10px;
  }

  .home-stats strong {
    font-size: 2rem;
  }

  .home-stats span {
    margin-top: 5px;
    font-size: 0.8rem;
  }

  .quiz-panel {
    min-height: calc(100svh - 265px);
    padding: 20px 18px 24px;
  }

  .progress-row {
    margin-bottom: 28px;
  }

  .question-block {
    margin-bottom: 22px;
  }

  .question-block h2 {
    font-size: clamp(1.8rem, 9vw, 2.55rem);
    line-height: 1.08;
  }

  .options-grid {
    gap: 10px;
  }

  .option-button {
    min-height: 58px;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    padding: 10px 12px;
  }

  .option-key {
    width: 34px;
    height: 34px;
  }

  .option-text {
    font-size: 0.98rem;
  }

  .nav-row,
  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .preview-panel {
    padding: 20px 18px 24px;
  }

  .preview-heading h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

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

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

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

  .preview-card img {
    width: 72px;
  }

  .result-active .app-shell {
    min-height: 100vh;
  }

  .quiz-stage.result-mode {
    width: 100vw;
  }

  .result-card-section {
    padding: 14px;
  }

  .personality-card {
    min-height: 500px;
    padding: 26px 16px 18px;
  }

  .card-pretitle {
    margin-bottom: 32px;
    font-size: 1.45rem;
  }

  .personality-card h2 {
    margin-bottom: 8px;
    font-size: clamp(2.8rem, 15vw, 4.25rem);
  }

  .result-english {
    margin-bottom: 16px;
    font-size: clamp(1.4rem, 7vw, 2.15rem);
  }

  .result-character {
    width: min(82%, 280px);
    min-height: 250px;
  }

  .result-card-note {
    min-height: 58px;
    font-size: 1.14rem;
  }

  .simple-reading {
    padding: 14px 15px 16px;
  }

  .simple-reading p {
    font-size: 0.94rem;
  }
}

body.result-active .app-shell {
  padding: 0;
  place-items: center;
}

body.result-active .quiz-stage.result-mode {
  width: min(620px, 100vw);
}
