:root {
  --bg: #f7f1e8;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #21342f;
  --muted: #66736f;
  --green: #244c42;
  --teal: #2e6f67;
  --coral: #d8755d;
  --rose: #9f5d58;
  --gold: #b48952;
  --line: rgba(36, 76, 66, 0.14);
  --shadow: 0 18px 45px rgba(32, 45, 39, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f1e8 0%, #f3eee3 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(33, 52, 47, 0.04);
}

.screen {
  display: none;
  min-height: 100vh;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.screen.is-active {
  display: block;
}

.hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #e9ddce;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.18) 0%, rgba(255, 253, 248, 0.08) 38%, rgba(247, 241, 232, 0.8) 78%, #f7f1e8 100%),
    linear-gradient(90deg, rgba(255, 253, 248, 0.08), rgba(216, 117, 93, 0.08));
}

.hero-copy {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 56px 22px max(46px, env(safe-area-inset-bottom));
}

.brand-mark,
.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
}

.hero-copy .brand-mark {
  color: var(--teal);
  text-shadow: 0 1px 10px rgba(255, 253, 248, 0.74);
}

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

h1 {
  max-width: 9em;
  margin: 0;
  color: var(--green);
  font-size: clamp(30px, 8.2vw, 42px);
  line-height: 1.08;
  font-weight: 760;
  text-shadow: 0 1px 12px rgba(255, 253, 248, 0.82);
}

.hero-copy p:not(.brand-mark) {
  margin: 16px 0 24px;
  max-width: 24em;
  color: #38534c;
  font-size: 16px;
  line-height: 1.75;
  text-shadow: 0 1px 10px rgba(255, 253, 248, 0.72);
}

.primary-btn,
.secondary-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  min-height: 48px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  padding: 0 22px;
  color: #fffdf8;
  background: var(--green);
  box-shadow: 0 12px 28px rgba(36, 76, 66, 0.22);
  font-weight: 700;
}

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

.primary-btn:active,
.secondary-btn:active,
.icon-btn:active {
  transform: translateY(0);
}

.primary-btn.full-width {
  width: 100%;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: var(--green);
  background: rgba(36, 76, 66, 0.08);
  font-weight: 700;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  color: var(--green);
  background: rgba(255, 253, 248, 0.74);
  font-size: 30px;
  line-height: 1;
}

.topbar,
.quiz-top {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(247, 241, 232, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  color: var(--green);
  font-weight: 760;
}

.content-narrow {
  padding: 34px 20px 24px;
}

.content-narrow h2,
.result-hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
  color: var(--green);
}

.muted {
  color: var(--muted);
  line-height: 1.75;
}

.profile-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.profile-form label {
  display: grid;
  gap: 8px;
  color: var(--green);
  font-weight: 700;
}

.profile-form input,
.profile-form select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  outline: 0;
}

.profile-form input:focus,
.profile-form select:focus {
  border-color: rgba(46, 111, 103, 0.55);
  box-shadow: 0 0 0 3px rgba(46, 111, 103, 0.12);
}

.form-note,
.copy-state {
  min-height: 22px;
  margin: 0;
  color: var(--rose);
  font-size: 14px;
  line-height: 1.55;
}

.quiz-top {
  align-items: flex-start;
}

.quiz-progress {
  flex: 1;
  padding-top: 2px;
}

.progress-meta {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 13px;
}

.progress-meta span {
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(36, 76, 66, 0.12);
  overflow: hidden;
}

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

.question-card {
  margin: 22px 16px 0;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-card h2 {
  min-height: 118px;
  margin: 0 0 22px;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.48;
}

.scale-options {
  display: grid;
  gap: 10px;
}

.scale-option {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fffaf3;
  text-align: left;
}

.scale-option strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--green);
  background: rgba(46, 111, 103, 0.1);
}

.scale-option.is-selected {
  border-color: rgba(216, 117, 93, 0.72);
  background: #fff2ea;
  box-shadow: 0 0 0 3px rgba(216, 117, 93, 0.12);
}

.scale-option.is-selected strong {
  color: #fffdf8;
  background: var(--coral);
}

.quiz-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 18px 16px 0;
}

.quiz-actions button {
  width: 100%;
}

.result-hero {
  padding: 30px 20px 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(247, 241, 232, 0.98)),
    url("./assets/hero.jpg") center 38% / cover;
  border-bottom: 1px solid var(--line);
}

.result-hero p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.score-overview,
.section-block,
.cta-panel {
  margin: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(32, 45, 39, 0.07);
}

.score-overview {
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: center;
  gap: 16px;
}

.score-ring {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 58%, transparent 59%),
    conic-gradient(var(--coral) 0deg, var(--teal) 0deg, rgba(36, 76, 66, 0.12) 0deg 360deg);
}

.score-ring span {
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  color: var(--green);
}

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

.score-band {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 19px;
  font-weight: 800;
}

.score-overview .muted {
  margin: 0;
}

.section-block h3,
.cta-panel h3 {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 21px;
  line-height: 1.35;
}

.section-block p:not(.eyebrow),
.cta-panel p {
  margin: 0;
  color: var(--ink);
  line-height: 1.8;
}

.warning-block {
  border-color: rgba(216, 117, 93, 0.26);
  background: #fff8f1;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin-bottom: 0;
}

.score-hint {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.chart-block {
  overflow: hidden;
}

.dimension-chart {
  position: relative;
  min-height: 250px;
  padding: 0 0 2px;
}

.chart-grid {
  position: absolute;
  inset: 0 0 38px 0;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  pointer-events: none;
}

.chart-grid span {
  position: relative;
  padding-left: 2px;
  color: rgba(102, 115, 111, 0.62);
  font-size: 11px;
}

.chart-grid span::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 0;
  top: 8px;
  height: 1px;
  background: rgba(36, 76, 66, 0.08);
}

.chart-bars {
  position: relative;
  z-index: 1;
  height: 212px;
  margin-left: 28px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  align-items: end;
}

.chart-item {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 8px;
}

.chart-bar-wrap {
  width: 100%;
  height: 178px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  border-bottom: 1px solid rgba(36, 76, 66, 0.12);
}

.chart-bar {
  width: min(44px, 76%);
  min-height: 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  border-radius: 7px 7px 4px 4px;
  box-shadow: 0 8px 18px rgba(32, 45, 39, 0.12);
}

.chart-value {
  padding-top: 6px;
  color: #fffdf8;
  font-size: 12px;
  font-weight: 800;
}

.chart-label {
  max-width: none;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.chart-label.is-two-line {
  max-width: 3em;
  line-height: 1.18;
  white-space: normal;
}

.dimension-list {
  display: grid;
  gap: 12px;
}

.dimension-item {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.dimension-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.dimension-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.dimension-name {
  font-weight: 800;
  color: var(--green);
}

.dimension-score {
  color: var(--coral);
  font-weight: 800;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(36, 76, 66, 0.1);
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.dimension-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.dimension-level {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(180, 137, 82, 0.14);
  font-size: 12px;
  font-weight: 700;
}

.cta-panel {
  background: var(--green);
  color: #fffdf8;
}

.cta-panel h3,
.cta-panel p {
  color: #fffdf8;
}

.cta-panel p {
  opacity: 0.92;
}

.cta-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.cta-panel .primary-btn {
  width: 100%;
  background: var(--coral);
  box-shadow: none;
}

.cta-panel .secondary-btn {
  width: 100%;
  color: #fffdf8;
  background: rgba(255, 253, 248, 0.14);
}

.cta-panel .primary-btn,
.cta-panel .secondary-btn {
  min-width: 0;
  padding: 0 10px;
  white-space: nowrap;
  font-size: 15px;
}

.copy-state {
  margin-top: 10px;
  color: #fbe4d8;
}

body.has-modal {
  overflow: hidden;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(33, 52, 47, 0.52);
  backdrop-filter: blur(12px);
}

.image-modal[hidden] {
  display: none;
}

.image-modal-card {
  position: relative;
  width: min(100%, 430px);
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 20px 16px 18px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(20, 32, 28, 0.28);
}

.image-modal-card h3 {
  margin: 0;
  color: var(--green);
  font-size: 22px;
  line-height: 1.35;
}

.image-modal-card p {
  margin: 8px 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

.image-modal-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
}

.image-modal-card .modal-save-hint {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fffdf8;
  background: var(--coral);
  text-align: center;
  font-weight: 800;
}

.image-modal-card .modal-help {
  margin: 12px 0 0;
  color: var(--green);
  font-size: 14px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--green);
  background: rgba(36, 76, 66, 0.08);
  font-size: 24px;
  line-height: 1;
}

.qr-card {
  max-width: 360px;
  text-align: center;
}

.qr-card img {
  width: min(100%, 280px);
  margin: 8px auto 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  color: rgba(102, 115, 111, 0.82);
  background: #fffdf8;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: rgba(36, 76, 66, 0.82);
  text-decoration: none;
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 8px;
    overflow: hidden;
  }

  .hero,
  .hero-copy,
  .screen {
    min-height: calc(100vh - 48px);
  }
}

@media (max-width: 380px) {
  .score-overview {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .question-card h2 {
    font-size: 21px;
  }

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