:root {
  --text-primary: #102431;
  --text-secondary: #365160;
  --text-accent: #6f4a00;
  --text-muted: rgba(54, 81, 96, 0.62);
  --text-watermark: rgba(54, 81, 96, 0.35);
  --text-inverse: #ffffff;
  --bg-page: #f6f3ec;
  --bg-card: #ffffff;
  --bg-card-soft: #f9f7f1;
  --border-soft: rgba(16, 36, 49, 0.1);
  --border-accent: rgba(111, 74, 0, 0.28);
  --accent-bg-soft: rgba(111, 74, 0, 0.08);
  --shadow-card: 0 12px 28px rgba(16, 36, 49, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 18% 8%, var(--accent-bg-soft), transparent 420px),
    var(--bg-page);
}

button,
textarea {
  font: inherit;
}

button {
  border-radius: 0;
}

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

p,
h1,
h2,
h3 {
  margin: 0;
}

.page {
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 8px;
}

.panel {
  min-height: calc(100vh - 16px);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  padding: clamp(18px, 4vw, 34px);
}

.hero,
.quiz,
.result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-row,
.topbar,
.quiz-title-row,
.identity-topline,
.identity-tags,
.action-row,
.restore-actions {
  display: flex;
  gap: 14px;
}

.brand-row {
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-accent);
  box-shadow: 0 0 24px var(--accent-bg-soft);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
}

.kicker {
  color: var(--text-watermark);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  color: var(--text-primary);
  font-size: clamp(40px, 10vw, 72px);
  line-height: 1.02;
  font-weight: 950;
}

.stp-brief {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stp-brief h2 {
  color: var(--text-primary);
  font-size: clamp(20px, 5vw, 30px);
  line-height: 1.35;
  font-weight: 900;
}

.stp-brief p,
.subtitle,
.entry-note,
.minor-notice,
.idea-copy,
.progress-hint,
.dual-pathway-intro,
.muted-copy,
.disclaimer,
.modal-card p,
.assistant-copy p,
.copy-preview {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.entry-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-compass-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 160px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(231, 198, 118, 0.34);
  background:
    radial-gradient(circle at 82% 12%, rgba(231, 198, 118, 0.25), transparent 84px),
    linear-gradient(135deg, #172435, #0c1722);
  color: #fff6dc;
  text-align: left;
  box-shadow: 0 18px 34px rgba(16, 36, 49, 0.18);
  cursor: pointer;
}

.home-compass-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.home-compass-kicker {
  padding: 5px 10px;
  border: 1px solid rgba(231, 198, 118, 0.4);
  color: #e7c676;
  font-size: 13px;
  font-weight: 900;
}

.home-compass-title {
  position: relative;
  z-index: 2;
  max-width: 70%;
  font-size: 25px;
  line-height: 1.18;
}

.home-compass-copy {
  position: relative;
  z-index: 2;
  max-width: 72%;
  color: rgba(255, 246, 220, 0.78);
  font-size: 15px;
  line-height: 1.45;
}

.home-compass-button {
  position: relative;
  z-index: 2;
  min-height: 38px;
  padding: 9px 18px;
  background: #e7c676;
  color: #172435;
  font-size: 15px;
  font-weight: 950;
}

.home-compass-orbit {
  position: absolute;
  top: -24px;
  right: -24px;
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(231, 198, 118, 0.3);
  border-radius: 50%;
}

.home-compass-core {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(231, 198, 118, 0.14);
  color: #e7c676;
  font-size: 25px;
  font-weight: 950;
}

.home-compass-arrow {
  position: absolute;
  right: 20px;
  bottom: -92px;
  color: rgba(231, 198, 118, 0.82);
  font-size: 28px;
  font-weight: 900;
}

.entry-intro {
  color: var(--text-accent);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 900;
}

.entry-card,
.restore-card,
.question-card,
.identity-card,
.identity-subcard,
.identity-display-lines,
.identity-power-card,
.student-direction-module-card,
.student-direction-card,
.assistant-card,
.intel-card,
.bazi-form,
.major-search-box,
.major-detail-card,
.major-result-card,
.disclaimer {
  border: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
}

.entry-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 112px;
  padding: 18px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.entry-card-major {
  border-color: rgba(111, 74, 0, 0.24);
  background: linear-gradient(135deg, #fffaf0, #f8f1df);
}

.entry-mode {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid var(--border-accent);
  background: var(--accent-bg-soft);
  color: var(--text-accent);
  font-size: 13px;
  font-weight: 900;
}

.entry-title {
  font-size: 22px;
  line-height: 1.25;
}

.entry-copy {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.45;
}

.text-button {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-accent);
  font-size: 14px;
  font-weight: 900;
  text-decoration: underline;
}

.restore-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
}

.restore-card h2 {
  font-size: 22px;
  line-height: 1.3;
}

.restore-actions,
.action-row {
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.back-button,
.option-button,
.dual-pathway-tab {
  border: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
  color: var(--text-primary);
  cursor: pointer;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 18px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.primary-button {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--text-inverse);
}

.secondary-button {
  background: var(--bg-card-soft);
  color: var(--text-primary);
}

.restore-button,
.identity-main-button,
.student-direction-cta-button,
.action-row button {
  flex: 1 1 180px;
}

.topbar {
  align-items: center;
}

.back-button {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.top-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-title-row,
.identity-topline {
  align-items: flex-start;
  justify-content: space-between;
}

.pill,
.archive-code {
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-accent);
  background: var(--accent-bg-soft);
  color: var(--text-accent);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 900;
  white-space: nowrap;
}

.top-title h2 {
  font-size: clamp(24px, 5vw, 38px);
  line-height: 1.15;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(16, 36, 49, 0.1);
  overflow: hidden;
}

.progress-bar,
.power-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #365160, #8fb8a8);
}

.question-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

.question-index {
  color: var(--text-accent);
  font-size: 14px;
  font-weight: 900;
}

.question-text {
  font-size: clamp(24px, 5vw, 40px);
  line-height: 1.2;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-button {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  width: 100%;
  min-height: 78px;
  padding: 16px;
  text-align: left;
}

.option-key {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-accent);
  background: var(--accent-bg-soft);
  color: var(--text-accent);
  font-weight: 950;
}

.option-title {
  display: block;
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 850;
}

.identity-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card-soft);
}

.identity-title {
  max-width: 720px;
  font-size: clamp(34px, 7vw, 58px);
  line-height: 1.05;
  font-weight: 950;
}

.identity-screenshot-line {
  color: var(--text-accent);
  font-size: clamp(19px, 4vw, 28px);
  line-height: 1.35;
  font-weight: 900;
}

.identity-card-parent .identity-screenshot-line,
.identity-card-adult .identity-screenshot-line {
  max-width: 760px;
  font-size: clamp(24px, 5vw, 38px);
  line-height: 1.3;
}

.identity-card-parent .identity-title,
.identity-card-adult .identity-title {
  font-size: clamp(30px, 6vw, 48px);
}

.identity-card-parent .identity-subcard,
.identity-card-adult .identity-subcard {
  background: var(--bg-card);
}

.identity-subcard {
  padding: 18px;
  border-left: 6px solid var(--text-accent);
}

.identity-subcard span {
  color: var(--text-accent);
  font-size: 14px;
  font-weight: 900;
}

.identity-subcard strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.35;
}

.identity-tags {
  flex-wrap: wrap;
}

.identity-tag,
.student-direction-major-chip {
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
}

.identity-tag-muted {
  color: var(--text-muted);
}

.identity-display-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--bg-card);
}

.identity-display-line,
.muted-copy {
  padding-left: 14px;
  border-left: 4px solid var(--border-accent);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

.identity-attribution-line {
  color: var(--text-accent);
  font-weight: 900;
}

.identity-power-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.identity-card-parent .identity-power-card,
.identity-card-adult .identity-power-card,
.identity-card-student .identity-power-card {
  gap: 9px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.58);
}

.identity-card-parent .power-track,
.identity-card-adult .power-track,
.identity-card-student .power-track {
  height: 8px;
}

.identity-card-parent .identity-power-card h3,
.identity-card-adult .identity-power-card h3,
.identity-card-student .identity-power-card h3 {
  font-size: 18px;
}

.identity-power-card h3,
.card-title,
.assistant-copy h2,
.intel-card h2,
.modal-card h2 {
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.2;
}

.power-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.power-row {
  display: grid;
  grid-template-columns: 88px 1fr 40px;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
}

.power-track {
  height: 12px;
  background: rgba(16, 36, 49, 0.1);
  overflow: hidden;
}

.power-row strong {
  color: var(--text-accent);
  text-align: right;
}

.radar-note,
.share-line,
.identity-action-note {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.identity-action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.identity-footnote {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.student-direction-module-card,
.support-detail-card,
.assistant-card,
.intel-card,
.disclaimer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.support-detail-card {
  border: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
}

.support-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.support-detail-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
}

.support-detail-row h3 {
  color: var(--text-accent);
  font-size: 15px;
  line-height: 1.35;
}

.support-detail-row p {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.support-detail-collapsed .support-detail-extra {
  display: none;
}

.support-detail-toggle {
  width: 100%;
}

.dual-pathway-tab-shell {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
}

.dual-pathway-tab-row {
  display: flex;
  width: 100%;
  border-bottom: 1px solid var(--border-soft);
}

.dual-pathway-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
  color: var(--text-secondary);
  font-weight: 900;
}

.dual-pathway-tab:last-child {
  border-right: 0;
}

.dual-pathway-tab-active {
  background: var(--text-primary);
  color: var(--text-inverse);
}

.dual-pathway-panel {
  padding: 12px;
}

.major-boundary-note {
  padding: 12px 14px;
  border: 1px solid var(--border-accent);
  background: var(--accent-bg-soft);
  color: var(--text-accent);
  font-size: 14px;
  line-height: 1.65;
  font-weight: 800;
}

.student-direction-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.major-pool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
}

.major-pool-intro,
.major-pool-risk-note,
.major-pool-layer-description,
.major-pool-more {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.major-pool-risk-note {
  color: var(--text-accent);
  font-weight: 900;
}

.major-pool-layer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.major-pool-layer h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.35;
}

.major-pool-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.major-pool-chip {
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-accent);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.student-direction-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
}

.risk-cabin-card {
  border: 1px solid var(--border-soft);
  border-left: 5px solid var(--text-accent);
}

.student-direction-name {
  font-size: 20px;
  line-height: 1.3;
}

.dual-pathway-compact-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
}

.dual-pathway-compact-line strong {
  flex: 0 0 auto;
  color: var(--text-accent);
  font-size: 14px;
  line-height: 1.6;
}

.dual-pathway-compact-line p {
  min-width: 0;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

.student-direction-major-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.student-direction-caution {
  color: var(--text-secondary);
}

.dual-pathway-cta-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border-accent);
  background: var(--accent-bg-soft);
}

.dual-pathway-cta-block h3 {
  font-size: 21px;
  line-height: 1.3;
}

.dual-pathway-cta-block p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.assistant-card {
  display: grid;
  grid-template-columns: 190px 1fr;
  align-items: center;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
}

.qr-placeholder img {
  display: block;
  width: min(178px, 100%);
  height: auto;
}

.qr-fallback {
  display: none;
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.qr-failed .qr-fallback {
  display: block;
}

.assistant-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistant-contact-button {
  width: 100%;
  margin-top: 2px;
}

.assistant-link-hint {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.assistant-contact-fallback {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.assistant-mode-note {
  padding: 10px 12px;
  border: 1px solid var(--border-accent);
  background: var(--accent-bg-soft);
  color: var(--text-accent);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 800;
}

#current-self-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.disclaimer {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.home-error {
  color: #9d2f20;
  font-size: 14px;
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 36, 49, 0.42);
}

.modal-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(520px, 100%);
  max-height: min(82vh, 720px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.modal-card textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  background: var(--bg-card-soft);
  resize: vertical;
}

.bazi,
.bazi-result,
.major {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bazi-form,
.major-search-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
}

.form-field input,
.form-field select,
.major-search-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-primary);
  padding: 10px 12px;
  font: inherit;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.bazi-profile-grid,
.bazi-major-sections,
.major-result-list {
  display: grid;
  gap: 12px;
}

.bazi-profile-card,
.major-result-card {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--border-soft);
  background: #fff;
  text-align: left;
}

.bazi-profile-card h3,
.major-result-card strong,
.major-detail-card h2 {
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.3;
}

.bazi-profile-card p,
.major-result-card span,
.major-result-card small,
.major-detail-card li,
.major-detail-boundary,
.major-detail-judgement {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.major-result-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.major-detail-card {
  padding: 18px;
}

.major-detail-card section {
  margin-top: 16px;
}

.major-detail-card h3 {
  margin: 0 0 8px;
  color: var(--text-accent);
  font-size: 15px;
}

.major-detail-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.major-risk-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.major-risk-chip {
  padding: 6px 9px;
  border: 1px solid rgba(111, 74, 0, 0.22);
  background: rgba(111, 74, 0, 0.07);
  color: var(--text-accent);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(90vw, 560px);
  padding: 12px 16px;
  background: var(--text-primary);
  color: var(--text-inverse);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .page {
    padding: 6px;
  }

  .panel {
    padding: 18px;
  }

  .quiz-title-row,
  .identity-topline {
    flex-direction: column;
  }

  .assistant-card {
    grid-template-columns: 1fr;
  }

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

  .qr-placeholder {
    min-height: 180px;
  }

  .dual-pathway-compact-line {
    flex-direction: column;
    gap: 4px;
  }

  .power-row {
    grid-template-columns: 78px 1fr 36px;
  }

  .action-row {
    flex-direction: column;
  }
}
