:root {
  --bg: #f4efe6;
  --bg-strong: #e9dcc6;
  --ink: #1f2421;
  --muted: #58605b;
  --line: rgba(31, 36, 33, 0.12);
  --panel: rgba(255, 251, 245, 0.9);
  --panel-strong: #fffdf8;
  --accent: #9d4a28;
  --accent-soft: #d77a42;
  --forest: #2d5d4b;
  --danger: #b2362b;
  --shadow: 0 24px 60px rgba(76, 55, 34, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Baskerville", "Palatino Linotype", "Times New Roman", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(
      circle at top left,
      rgba(215, 122, 66, 0.16),
      transparent 26%
    ),
    radial-gradient(
      circle at top right,
      rgba(45, 93, 75, 0.14),
      transparent 24%
    ),
    linear-gradient(180deg, #f8f2e8 0%, var(--bg) 100%);
  font-family: var(--font-body);
}

body.is-modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 32px;
}

body.is-diagnosis-started .page-shell {
  padding-bottom: 176px;
}

.hero {
  display: grid;
  gap: 20px;
  align-items: start;
}

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

.hero-copy,
.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-copy {
  padding: 18px 28px 14px;
}

.hero-card {
  padding: 28px;
  display: grid;
  gap: 18px;
  align-content: center;
}

.hero-card-compact {
  align-content: start;
  justify-items: start;
  padding: 18px 20px;
}

.result-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.result-back-link {
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 10px 18px;
  border-color: rgba(45, 93, 75, 0.2);
  background: rgba(248, 247, 239, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}

.hero-stat {
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    rgba(157, 74, 40, 0.08),
    rgba(45, 93, 75, 0.1)
  );
}

.hero-stat strong {
  display: block;
  font: 700 2.2rem/1 var(--font-display);
}

.hero-stat span,
.hero-text,
.panel-tip,
.subtle-copy {
  color: var(--muted);
}

.page-title {
  position: relative;
  margin: 4px 0 16px;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 72px;
  gap: 20px;
}

.account-bar {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border: 1px solid rgba(31, 36, 33, 0.12);
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.86);
  box-shadow: 0 12px 30px rgba(76, 55, 34, 0.1);
}

.account-copy {
  display: grid;
  gap: 2px;
}

.account-name {
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 700;
}

.account-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.account-bar .ghost-button {
  width: auto;
  min-width: 96px;
  padding-left: 16px;
  padding-right: 16px;
}

.page-title h1 {
  flex: 1;
  min-width: min(100%, 320px);
  color: var(--ink);
  line-height: 1.06;
  text-align: left;
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.75rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.7rem, 3.6vw, 3rem);
  line-height: 1.02;
  width: 100%;
}

.hero-text {
  margin: 8px 0 0;
  font-size: 0.98rem;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.layout,
.result-grid {
  display: grid;
  gap: 24px;
}

.layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  align-items: start;
}

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

.result-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

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

.panel {
  padding: 28px;
}

.panel-highlight {
  background: linear-gradient(
    135deg,
    rgba(255, 253, 248, 0.94),
    rgba(240, 232, 219, 0.9)
  );
  padding-top: 18px;
}

.main-panel {
  padding-bottom: 28px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.title-inline {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ghost-button {
  padding: 10px 14px;
  border: 1px solid rgba(31, 36, 33, 0.14);
  border-radius: 999px;
  background: rgba(255, 251, 245, 0.82);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.ghost-button:hover {
  border-color: rgba(157, 74, 40, 0.32);
  background: rgba(255, 248, 241, 0.96);
  transform: translateY(-1px);
}

.section-spacer {
  margin-top: 18px;
}

.auth-screen {
  min-height: calc(100dvh - 160px);
  display: flex;
  align-items: center;
}

.auth-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 460px);
  gap: 24px;
  align-items: stretch;
}

.auth-copy,
.auth-panel {
  padding: 28px;
}

.auth-copy {
  display: grid;
  gap: 18px;
  align-content: center;
}

.auth-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.login-mode-switch {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid rgba(31, 36, 33, 0.12);
  border-radius: 999px;
  background: rgba(248, 243, 235, 0.92);
}

.login-mode-button {
  min-width: 112px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.login-mode-button.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fffaf3;
  box-shadow: 0 8px 20px rgba(157, 74, 40, 0.22);
}

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

.auth-step-item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 36, 33, 0.08);
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 253, 249, 0.88),
    rgba(246, 239, 227, 0.76)
  );
}

.auth-step-item strong {
  font-size: 0.96rem;
}

.auth-step-item span {
  color: var(--muted);
  line-height: 1.6;
}

.entry-screen {
  min-height: calc(100dvh - 140px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.intro-card {
  padding: 18px 20px;
  border: 1px solid rgba(31, 36, 33, 0.08);
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(255, 253, 249, 0.82),
    rgba(246, 239, 227, 0.76)
  );
}

.intro-text {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
}

.intro-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.62;
}

.intro-list li + li {
  margin-top: 4px;
}

.entry-actions {
  display: flex;
  justify-content: center;
  margin-top: auto;
  padding-top: 14px;
}

.diagnosis-screen {
  padding-bottom: 112px;
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.process-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 251, 245, 0.72);
}

.process-card h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.process-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--forest), var(--accent-soft));
  transition: width 0.2s ease;
}

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

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

.field-wide {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 0.92rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.required-mark {
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(157, 74, 40, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid rgba(157, 74, 40, 0.18);
  border-color: rgba(157, 74, 40, 0.4);
}

.legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.stage-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.legend-item,
.info-list li,
.score-item,
.dimension-item,
.meta-item,
.stage-tab,
.blocker-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
}

.legend-item {
  padding: 14px;
}

.legend-item strong {
  display: block;
  margin-bottom: 4px;
}

.legend-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stage-stack {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.stage-overview {
  margin-top: 20px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(31, 36, 33, 0.08);
  border-radius: 24px;
  background: linear-gradient(
    180deg,
    rgba(255, 253, 249, 0.78),
    rgba(247, 240, 229, 0.7)
  );
}

.stage-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 0 4px;
}

.stage-progress-track {
  position: relative;
  flex: 1;
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: rgba(31, 36, 33, 0.08);
}

.stage-progress-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.stage-tab {
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}

.stage-tab span,
.stage-tab small {
  display: block;
}

.stage-tab small {
  margin-top: 6px;
  color: var(--muted);
}

.stage-tab-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(31, 36, 33, 0.08);
}

.stage-tab-line {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.stage-rule-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.stage-rule-item {
  margin: 0;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.stage-rule-item strong {
  color: var(--accent);
}

.stage-rule-item.is-high {
  background: rgba(45, 93, 75, 0.08);
  color: #315646;
}

.stage-rule-item.is-high strong {
  color: var(--forest);
}

.stage-rule-item.is-mid {
  background: rgba(197, 148, 42, 0.12);
  color: #7b5d19;
}

.stage-rule-item.is-mid strong {
  color: #a07410;
}

.stage-rule-item.is-low {
  background: rgba(178, 54, 43, 0.08);
  color: #8e3a31;
}

.stage-rule-item.is-low strong {
  color: var(--danger);
}

.stage-tab-score {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
}

.stage-tab-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.stage-tab.is-active {
  border-color: rgba(157, 74, 40, 0.42);
  background: linear-gradient(
    135deg,
    rgba(157, 74, 40, 0.12),
    rgba(215, 122, 66, 0.08)
  );
  transform: translateY(-2px);
}

.stage-tab.is-complete {
  border-color: rgba(45, 93, 75, 0.28);
}

.stage-tab.is-locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.stage-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.question-list {
  display: grid;
}

.question-row {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.question-row:first-child {
  border-top: 0;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.question-title {
  display: block;
  font-size: 1rem;
  line-height: 1.38;
}

.question-number {
  margin-right: 4px;
  color: inherit;
}

.dimension-badge,
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(45, 93, 75, 0.12);
  color: var(--forest);
  font-size: 0.85rem;
}

.dimension-badge.is-core {
  background: rgba(157, 74, 40, 0.12);
  color: var(--accent);
}

.score-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.score-option {
  position: relative;
}

.score-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.score-option label {
  display: block;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 6px;
  text-align: center;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.score-option label strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.84rem;
  line-height: 1.1;
}

.score-option label span {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.1;
}

.score-option input:checked + label {
  border-color: rgba(157, 74, 40, 0.56);
  background: linear-gradient(
    135deg,
    rgba(157, 74, 40, 0.14),
    rgba(215, 122, 66, 0.08)
  );
  transform: translateY(-2px);
}

.actions {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  width: auto;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 251, 245, 0.92);
  box-shadow: 0 18px 42px rgba(76, 55, 34, 0.18);
  backdrop-filter: blur(16px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 36, 33, 0.36);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(80vh, 760px);
  overflow: auto;
  border: 1px solid rgba(31, 36, 33, 0.08);
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 28px 60px rgba(31, 36, 33, 0.18);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 20px 22px 14px;
}

.modal-close {
  padding: 8px 14px;
  border: 1px solid rgba(31, 36, 33, 0.12);
  border-radius: 999px;
  background: rgba(255, 251, 245, 0.92);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.modal-body {
  padding: 0 22px 22px;
}

.score-rule-table {
  border: 1px solid rgba(31, 36, 33, 0.1);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.score-rule-row {
  display: grid;
  grid-template-columns: 92px 130px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid rgba(31, 36, 33, 0.08);
}

.score-rule-row:first-child {
  border-top: 0;
}

.score-rule-row.is-head {
  background: rgba(31, 36, 33, 0.06);
  font-weight: 700;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row > * {
  flex: 1 1 220px;
}

.primary-button,
.secondary-link,
.secondary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 14px 22px;
  text-decoration: none;
  font-weight: 600;
}

.primary-button {
  border: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  box-shadow: 0 16px 36px rgba(157, 74, 40, 0.22);
}

.entry-actions .primary-button {
  min-width: 220px;
  padding: 17px 30px;
  font-size: 1rem;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 40px rgba(157, 74, 40, 0.24);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.secondary-link,
.secondary-button {
  border: 1px solid rgba(45, 93, 75, 0.16);
  background: rgba(45, 93, 75, 0.12);
  color: var(--forest);
}

.secondary-button {
  cursor: pointer;
}

.message {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.error {
  color: var(--danger);
  background: rgba(178, 54, 43, 0.08);
  border: 1px solid rgba(178, 54, 43, 0.2);
}

.stage-evaluation {
  margin-top: 20px;
  padding: 22px 24px;
}

.stage-blockers {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(178, 54, 43, 0.06);
  color: var(--danger);
}

.result-copy,
.suggestion,
.dimension-highlight {
  margin: 14px 0 0;
}

.suggestion {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.55;
}

.score-list,
.dimension-list,
.meta-grid,
.blocker-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.compact-list {
  margin-top: 14px;
}

.score-item,
.dimension-item,
.meta-item,
.blocker-item {
  padding: 16px;
}

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

.score-item-head,
.dimension-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.score-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(31, 36, 33, 0.08);
}

.score-track-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest), var(--accent-soft));
}

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

.blocker-item {
  display: grid;
  gap: 6px;
}

.meta-item span,
.score-item p,
.dimension-item span:last-child {
  color: var(--muted);
}

#radar-chart {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 0.84;
  margin-top: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9),
    rgba(246, 240, 231, 0.85)
  );
}

@media (max-width: 1080px) {
  .auth-layout,
  .layout,
  .result-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .page-shell {
    padding: 20px 14px 24px;
  }

  body.is-diagnosis-started .page-shell {
    padding-bottom: 190px;
  }

  .page-title {
    margin: 0 0 12px;
  }

  .page-title-row {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    gap: 12px;
  }

  .account-bar {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .intro-card {
    padding: 16px;
    border-radius: 18px;
  }

  .entry-screen {
    min-height: auto;
    gap: 14px;
  }

  .auth-screen {
    min-height: auto;
  }

  .form-grid,
  .legend,
  .stage-nav,
  .score-options,
  .meta-grid,
  .process-strip {
    grid-template-columns: 1fr;
  }

  .stage-overview {
    padding: 12px;
  }

  .stage-progress {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .actions {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 12px;
    border-radius: 18px;
  }

  .panel-head,
  .question-meta,
  .score-item-head,
  .dimension-item {
    flex-direction: column;
    align-items: start;
  }

  .title-inline {
    width: 100%;
    align-items: flex-start;
  }

  .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .account-bar .ghost-button {
    width: auto;
    justify-content: center;
  }

  .hero-card-compact {
    justify-items: stretch;
    padding: 14px 16px;
  }

  .result-hero-head {
    flex-direction: column;
    gap: 12px;
  }

  .result-back-link {
    width: 100%;
    margin-top: 0;
  }

  .entry-actions .primary-button {
    width: 100%;
    min-width: 0;
    padding: 16px 24px;
  }

  .modal-backdrop {
    padding: 14px;
  }

  .modal-card {
    max-height: 86vh;
    border-radius: 20px;
  }

  .modal-head,
  .modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .score-rule-row {
    grid-template-columns: 72px 96px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    font-size: 0.9rem;
  }

  .question-row {
    padding-left: 14px;
    padding-right: 14px;
  }
}
