:root {
  --ink: #1d2933;
  --muted: #6d7880;
  --line: #d9e1e4;
  --line-soft: #edf1f2;
  --paper: #ffffff;
  --canvas: #f6f8f8;
  --accent: #206b68;
  --accent-dark: #15514f;
  --accent-soft: #e8f3f1;
  --warm: #a86f39;
  --warm-soft: #fbf3e8;
  --success: #2a7b5a;
  --shadow: 0 14px 34px rgba(23, 49, 55, 0.08);
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(32, 107, 104, 0.2);
  outline-offset: 2px;
}

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

.topbar {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 28px;
  gap: 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #fff;
  background: var(--accent);
  font-family: serif;
  font-size: 18px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0.06em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.desktop-nav {
  display: flex;
  align-self: stretch;
  gap: 4px;
  flex: 1;
}

.nav-link {
  position: relative;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.nav-link.is-active { color: var(--accent); font-weight: 700; }
.nav-link.is-active::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.account-actions { display: flex; align-items: center; gap: 8px; }
.wallet-button, .login-button, .mobile-menu-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
}
.login-button { border-color: var(--accent); background: var(--accent); color: #fff; }
.mobile-menu-button { display: none; }

.workspace { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 64px; }

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 25px;
}

.page-heading h1 { margin: 0; font-size: clamp(25px, 3vw, 32px); letter-spacing: 0.02em; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.prototype-badge, .pending-label, .template-tag {
  color: var(--warm);
  background: var(--warm-soft);
  font-size: 11px;
}
.prototype-badge { padding: 8px 11px; border: 1px solid #ecdcc5; white-space: nowrap; }

.method-tabs {
  display: flex;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.method-tab {
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
}
.method-tab.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(290px, 0.72fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.primary-panel, .side-panel { border: 1px solid var(--line); background: var(--paper); }
.primary-panel { padding: 23px; }
.side-panel { padding: 20px; }
.side-panel + .side-panel { margin-top: 16px; }

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-heading.compact { padding-bottom: 16px; }
.eyebrow { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.04em; }
.panel-heading h2, .report-topline h2, .confirmation-header h2 { margin: 5px 0 0; font-size: 18px; letter-spacing: 0.01em; }
.step-count { color: var(--muted); font-size: 11px; white-space: nowrap; }

.form-section { padding: 21px 0; border-bottom: 1px solid var(--line-soft); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h3, .side-note h3 { margin: 0; font-size: 14px; }
.pending-label, .optional-label, .required-label { padding: 3px 7px; }
.optional-label { color: var(--muted); font-size: 10px; }
.required-label { color: var(--accent); background: var(--accent-soft); font-size: 10px; }
.form-hint { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.choice-grid { display: grid; gap: 8px; }
.choice-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-card {
  display: block;
  position: relative;
  min-height: 66px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
.choice-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card span, .choice-card small { display: block; }
.choice-card span { font-size: 12px; font-weight: 700; }
.choice-card small { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.choice-card.is-selected small { color: var(--accent-dark); }

.people-grid, .date-time-grid, .advanced-content, .confirmation-grid, .report-columns { display: grid; gap: 12px; }
.people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.date-time-grid { grid-template-columns: 1.2fr 1fr 1.1fr; }
.person-block { padding: 12px; background: var(--canvas); }
.field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.inline-fields { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 7px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}
input, select { min-height: 38px; padding: 0 10px; font-size: 12px; }
textarea { min-height: 116px; padding: 12px; resize: vertical; font-size: 13px; line-height: 1.6; }
textarea::placeholder { color: #9ba5a9; }

.advanced-section { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.advanced-section summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.advanced-section summary::-webkit-details-marker { display: none; }
.advanced-section summary strong, .advanced-section summary small { display: block; }
.advanced-section summary strong { font-size: 13px; }
.advanced-section summary small { margin-top: 4px; color: var(--warm); font-size: 10px; }
.summary-arrow { color: var(--muted); font-size: 18px; line-height: 1; }
.advanced-content { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 15px; }
select:disabled { color: var(--muted); background: #f3f5f5; }
.advanced-note { margin: 13px 0 0; color: var(--warm); font-size: 10px; line-height: 1.5; }
.question-section { border-bottom: 0; padding-bottom: 15px; }
.textarea-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 10px; }

.form-footer, .report-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
}
.form-footer strong, .form-footer span { display: block; }
.form-footer strong { font-size: 12px; }
.form-footer span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.primary-button, .secondary-button, .text-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.primary-button { color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { border-color: var(--line); background: var(--paper); color: var(--ink); }
.text-button { border-color: transparent; background: transparent; color: var(--accent); }

.progress-list { margin: 18px 0 22px; padding: 0; list-style: none; }
.progress-list li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding-bottom: 23px; }
.progress-list li:last-child { padding-bottom: 0; }
.progress-list li:not(:last-child)::after { position: absolute; top: 28px; bottom: 0; left: 13px; border-left: 1px solid var(--line); content: ""; }
.progress-number {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
}
.progress-list li.is-current .progress-number { border-color: var(--accent); background: var(--accent); color: #fff; }
.progress-list li.is-done .progress-number { border-color: var(--success); background: var(--success); color: #fff; }
.progress-list strong, .progress-list small { display: block; }
.progress-list strong { margin-top: 4px; font-size: 12px; }
.progress-list small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.status-box { padding: 12px; background: var(--canvas); }
.status-box div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.status-box div:first-child { padding-top: 0; }
.status-box div:last-child { padding-bottom: 0; border-bottom: 0; }
.status-box span { color: var(--muted); }
.status-box strong { color: var(--accent); font-weight: 600; text-align: right; }
.notice-box { margin-top: 14px; padding: 12px; background: var(--warm-soft); color: #805a35; font-size: 10px; line-height: 1.6; }
.side-note p { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.hidden-view { display: none; }
.hidden-view.is-visible { display: block; }
.confirmation-header, .report-topline { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.success-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.confirmation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 22px; }
.confirmation-grid > div { padding: 13px; background: var(--canvas); }
.confirmation-grid p { margin: 0; font-size: 12px; line-height: 1.55; }
.confirmation-note, .uncertainty-box { margin-top: 18px; padding: 14px; background: var(--warm-soft); color: #805a35; font-size: 11px; line-height: 1.6; }
.confirmation-note { margin-bottom: 20px; }
.report-topline { justify-content: space-between; align-items: flex-start; }
.template-tag { padding: 5px 8px; white-space: nowrap; }
.report-summary { margin-top: 20px; padding: 17px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.report-summary p { margin: 7px 0 0; color: var(--accent-dark); font-size: 18px; line-height: 1.55; }
.report-block { padding: 20px 0; border-bottom: 1px solid var(--line-soft); }
.report-block p { margin: 0; color: #43515a; font-size: 12px; line-height: 1.75; }
.factor-list { display: grid; gap: 10px; }
.factor-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.factor-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; }
.factor-dot.favorable { background: var(--success); }
.factor-dot.caution { background: var(--warm); }
.factor-dot.neutral { background: #8d9aa0; }
.factor-row strong, .factor-row p { display: block; }
.factor-row strong { font-size: 12px; }
.factor-row p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.factor-row b { color: var(--muted); font-size: 10px; font-weight: 600; }
.report-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.advice-list { margin: 0; padding-left: 17px; color: #43515a; font-size: 12px; line-height: 1.75; }
.uncertainty-box { color: #705333; }
.uncertainty-box strong { display: block; margin-bottom: 5px; font-size: 12px; }
.uncertainty-box p { margin: 0; }
.report-actions { margin-top: 18px; border-top: 0; }

.mobile-bottom-nav { display: none; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(330px, calc(100vw - 36px));
  padding: 12px 14px;
  transform: translateY(15px);
  border: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.is-visible { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 820px) {
  .topbar { padding: 0 18px; gap: 16px; }
  .desktop-nav, .account-actions { display: none; }
  .mobile-menu-button { display: block; margin-left: auto; }
  .workspace { width: min(100% - 28px, 620px); padding-top: 24px; padding-bottom: 84px; }
  .page-heading { align-items: start; flex-direction: column; gap: 12px; }
  .prototype-badge { align-self: flex-start; }
  .main-grid { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .primary-panel { padding: 18px; }
  .choice-grid.three, .date-time-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: auto; }
  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px 3px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
  }
  .mobile-bottom-nav button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
  }
  .mobile-bottom-nav span { display: block; margin-bottom: 2px; font-size: 16px; }
  .mobile-bottom-nav button.is-active { color: var(--accent); font-weight: 700; }
}

@media (max-width: 520px) {
  .brand { min-width: 0; }
  .brand strong { font-size: 14px; }
  .workspace { width: calc(100% - 22px); }
  .method-tabs { overflow-x: auto; }
  .method-tab { flex: 0 0 auto; }
  .people-grid, .advanced-content, .confirmation-grid, .report-columns { grid-template-columns: 1fr; }
  .form-footer, .report-actions { align-items: stretch; flex-direction: column; }
  .form-footer > div:first-child { width: 100%; }
  .primary-button, .secondary-button { width: 100%; }
  .report-summary p { font-size: 16px; }
  .report-topline { gap: 10px; }
  .template-tag { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
