:root {
  color-scheme: light;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ink: #1d211e;
  --muted: #6d716d;
  --line: rgba(29, 33, 30, 0.14);
  --line-strong: rgba(29, 33, 30, 0.24);
  --surface: rgba(250, 250, 247, 0.78);
  --surface-solid: #f7f7f4;
  --accent: #d85b48;
  --accent-dark: #b84535;
  --accent-soft: rgba(216, 91, 72, 0.1);
  --moss: #667267;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e8e9e5;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #e8e9e5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  background: #e8e9e5;
}

.page-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.36;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.app-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 0 28px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 21px;
  height: 22px;
}

.brand-mark i {
  display: block;
  width: 5px;
  background: var(--ink);
}

.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 15px; background: var(--accent); }
.brand-mark i:nth-child(3) { height: 21px; }

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand b {
  font-size: 15px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-note .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6c846e;
  box-shadow: 0 0 0 4px rgba(108, 132, 110, 0.12);
}

.flow-wrap {
  width: min(760px, 100%);
  margin: 22px auto 62px;
}

.flow-intro {
  margin-bottom: 16px;
}

.eyebrow,
.step-kicker {
  margin: 0 0 11px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.flow-intro h1 {
  max-width: 680px;
  margin: 0;
  font-size: 33px;
  font-weight: 640;
  line-height: 1.17;
  letter-spacing: 0;
}

.flow-intro h1 em {
  color: var(--accent);
  font-style: normal;
}

.flow-intro > p:last-child {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  width: 100%;
  height: 2px;
  margin-bottom: 14px;
  overflow: hidden;
  background: rgba(29, 33, 30, 0.1);
}

.progress-track span {
  display: block;
  width: 25%;
  height: 100%;
  background: var(--accent);
  transition: width 240ms ease;
}

.flow-panel {
  min-height: 410px;
  padding: 29px 42px 23px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(42, 46, 42, 0.1), inset 0 0 0 1px var(--line);
  backdrop-filter: blur(20px) saturate(92%);
  -webkit-backdrop-filter: blur(20px) saturate(92%);
}

.step-heading {
  margin-bottom: 25px;
}

.step-heading h2 {
  margin: 0;
  font-size: 27px;
  font-weight: 660;
  line-height: 1.28;
  letter-spacing: 0;
}

.step-heading > p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.direction-lock {
  display: grid;
  grid-template-columns: 115px 1fr auto;
  align-items: center;
  min-height: 68px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.38);
}

.direction-lock span,
.direction-lock small {
  color: var(--muted);
  font-size: 11px;
}

.direction-lock strong {
  font-size: 14px;
  font-weight: 650;
}

.field-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.field-block label,
.field-label {
  color: #424642;
  font-size: 12px;
  font-weight: 650;
}

.field-label small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.compact-field {
  max-width: 410px;
}

.number-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.58);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.number-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.number-field input {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 23px;
  font-weight: 650;
}

.number-field span {
  color: var(--muted);
  font-size: 12px;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.preset-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.preset-row button:hover,
.preset-row button.selected {
  border-color: rgba(216, 91, 72, 0.55);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(29, 33, 30, 0.045);
}

.segmented button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  overflow-wrap: anywhere;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.selected {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 5px rgba(29, 33, 30, 0.1), inset 0 -2px 0 var(--accent);
}

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

.choice-grid.dense {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.34);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.choice:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.66);
}

.choice.selected {
  border-color: rgba(216, 91, 72, 0.75);
  background: var(--accent-soft);
}

.choice-indicator {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border: 1px solid #a8aaa6;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px transparent;
}

.choice.selected .choice-indicator {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface-solid);
}

.choice-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.choice-copy b {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 630;
  line-height: 1.35;
}

.choice-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.major-grid .choice {
  min-height: 69px;
}

.soft-background {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.flow-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--accent-dark);
  font-size: 12px;
}

.flow-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.back-button,
.next-button,
.edit-button,
.detail-button,
.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 4px;
  cursor: pointer;
}

.back-button {
  min-height: 42px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.back-button:hover {
  color: var(--ink);
}

.next-button {
  min-width: 126px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 6px 16px rgba(184, 69, 53, 0.18);
}

.next-button:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.next-button:disabled {
  border-color: #c8c9c5;
  background: #c8c9c5;
  box-shadow: none;
  cursor: not-allowed;
}

.next-button.loading span:last-child {
  animation: nudge 850ms ease-in-out infinite alternate;
}

@keyframes nudge {
  from { transform: translateX(-2px); }
  to { transform: translateX(2px); }
}

.disclaimer {
  margin: 15px 0 0;
  color: #7a7d78;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.results-wrap {
  width: min(1040px, 100%);
  margin: 58px auto 76px;
}

.results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 42px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line-strong);
}

.results-heading h2 {
  margin: 0;
  font-size: 29px;
  font-weight: 660;
  line-height: 1.3;
  letter-spacing: 0;
}

.results-heading > div > p:last-child {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.edit-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.38);
  font-size: 11px;
}

.edit-button:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
}

.results-groups {
  display: grid;
  gap: 54px;
}

.result-group {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 28px;
}

.group-heading {
  align-self: start;
  position: sticky;
  top: 20px;
  display: grid;
  gap: 9px;
  padding-top: 5px;
}

.group-heading .group-index {
  color: var(--accent);
  font: 650 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.group-heading h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 680;
}

.group-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.group-heading > span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.recommendation-list {
  display: grid;
  gap: 10px;
}

.recommendation-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 0.8fr) minmax(170px, 1fr) 58px;
  align-items: center;
  gap: 20px;
  min-width: 0;
  min-height: 142px;
  padding: 21px 19px 21px 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(250, 250, 247, 0.72);
  box-shadow: 0 9px 25px rgba(42, 46, 42, 0.055);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.program-identity {
  min-width: 0;
}

.program-state {
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 700;
}

.program-identity h4 {
  margin: 7px 0 1px;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 680;
  line-height: 1.35;
}

.program-identity p,
.program-identity strong {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.45;
}

.program-identity strong {
  margin-top: 6px;
  color: #4e534e;
  font-size: 10px;
}

.program-facts {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.program-facts div {
  display: grid;
  gap: 3px;
}

.program-facts span {
  color: var(--muted);
  font-size: 9px;
}

.program-facts b {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.program-reasons {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.program-reasons li {
  position: relative;
  padding-left: 12px;
  overflow-wrap: anywhere;
  color: #555a55;
  font-size: 10px;
  line-height: 1.45;
}

.program-reasons li::before {
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--moss);
  content: "";
}

.detail-button {
  min-width: 52px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 10px;
  white-space: nowrap;
}

.detail-button:hover {
  color: var(--ink);
}

.empty-results {
  padding: 64px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.empty-results h3 {
  margin: 0;
  font-size: 18px;
}

.empty-results p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: #80837e;
  font: 550 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(27, 30, 27, 0.38);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(520px, 94vw);
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(246, 246, 242, 0.94);
  box-shadow: -22px 0 55px rgba(25, 29, 25, 0.18);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.detail-drawer > header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 246, 242, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.detail-drawer > header .eyebrow {
  margin: 0;
}

.close-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 24px;
  font-weight: 300;
}

#detail-content {
  padding: 34px 28px 48px;
}

.detail-hero {
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line-strong);
}

.detail-hero p {
  margin: 0 0 9px;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.detail-hero h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 25px;
  line-height: 1.25;
}

.detail-hero span,
.detail-hero strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.detail-hero strong {
  margin-top: 15px;
  color: var(--ink);
}

.detail-section {
  padding: 27px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 17px;
  font-size: 12px;
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 0;
}

.detail-grid div {
  display: grid;
  gap: 5px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 9px;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 630;
}

.detail-note > p {
  margin: 0;
  color: #4f544f;
  font-size: 12px;
  line-height: 1.75;
}

.detail-note .warning-note {
  margin-top: 14px;
  padding: 12px 13px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.official-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-top: 28px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.official-link:hover {
  color: white;
  background: var(--ink);
}

.detail-loading {
  padding: 70px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.drawer-open {
  overflow: hidden;
}

@media (max-width: 920px) {
  .result-group {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 18px;
  }

  .recommendation-row {
    grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.8fr) 52px;
  }

  .program-reasons {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 28px, 560px);
    padding-bottom: 20px;
  }

  .app-header {
    min-height: 64px;
  }

  .privacy-note {
    font-size: 10px;
  }

  .privacy-note .dot {
    display: none;
  }

  .flow-wrap,
  .results-wrap {
    margin-top: 34px;
    margin-bottom: 48px;
  }

  .flow-intro {
    margin-bottom: 25px;
  }

  .flow-intro h1 {
    font-size: 31px;
    line-height: 1.22;
  }

  .flow-intro > p:last-child {
    max-width: 330px;
    font-size: 12px;
  }

  .flow-panel {
    min-height: 0;
    padding: 27px 20px 20px;
  }

  .step-heading {
    margin-bottom: 24px;
  }

  .step-heading h2 {
    font-size: 22px;
  }

  .direction-lock {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 13px 14px;
  }

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

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

  .choice {
    min-height: 46px;
    padding: 10px;
  }

  .major-grid .choice {
    min-height: 62px;
  }

  .soft-background {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .segmented button {
    min-height: 42px;
    padding: 7px 5px;
    font-size: 11px;
  }

  .flow-actions {
    margin-top: 2px;
  }

  .results-heading {
    align-items: start;
    margin-bottom: 34px;
  }

  .results-heading h2 {
    font-size: 23px;
  }

  .edit-button {
    padding: 0 10px;
  }

  .result-group {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .group-heading {
    position: static;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 12px;
  }

  .group-heading > span:last-child {
    padding-top: 4px;
  }

  .recommendation-row {
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 16px;
    min-height: 0;
    padding: 18px 15px 16px 17px;
  }

  .program-identity {
    grid-column: 1;
  }

  .program-facts {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 1fr 1fr;
    padding-top: 13px;
    border-top: 1px solid var(--line);
  }

  .program-reasons {
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: 1fr;
    padding-top: 13px;
  }

  .detail-button {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .app-footer {
    gap: 20px;
  }
}

@media (max-width: 410px) {
  .app-shell {
    width: calc(100% - 20px);
  }

  .brand small,
  .privacy-note {
    display: none;
  }

  .flow-intro h1 {
    font-size: 28px;
  }

  .flow-panel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .choice-grid.dense {
    grid-template-columns: 1fr 1fr;
  }

  .preset-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-heading {
    display: grid;
    gap: 18px;
  }

  .edit-button {
    justify-self: start;
  }

  .detail-drawer {
    width: 100vw;
  }

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

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