:root {
  --ink: #18352e;
  --ink-deep: #102923;
  --ink-2: #38554d;
  --ivory: #f7f1e6;
  --paper: #fffdf8;
  --gold: #c8943f;
  --gold-soft: #f1dfbd;
  --focus: #7a5318;
  --mint: #dcebe5;
  --line: #cad8d2;
  --danger: #9a352d;
  --danger-soft: #fff1ed;
  --shadow: 0 22px 70px rgba(24, 53, 46, 0.15);
  color: var(--ink);
  background: var(--ivory);
  font-family: "Noto Serif TC", "Songti TC", "Microsoft JhengHei", serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ivory);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 86% 9%, rgba(195, 222, 210, 0.78) 0, transparent 34%),
    radial-gradient(circle at 4% 92%, rgba(224, 198, 147, 0.2) 0, transparent 28%),
    linear-gradient(135deg, #fbf7ee, #eef6f2);
}

button,
input,
textarea {
  font: inherit;
}

button,
.button-link,
.fallback-actions a {
  min-height: 48px;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px rgba(255, 253, 248, 0.92);
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 46%, rgba(255, 255, 255, 0.48)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(24, 53, 46, 0.018) 80px);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: hidden;
  border: 1px solid rgba(202, 216, 210, 0.9);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand.disabled {
  cursor: wait;
  opacity: 0.62;
  pointer-events: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px 13px 5px 5px;
  color: #f4d594;
  background: var(--ink);
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.2;
}

.brand-copy strong {
  letter-spacing: 0.08em;
}

.brand-copy small {
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: 0.22em;
}

.privacy-chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.64);
  font-size: 13px;
}

.privacy-chip span {
  color: var(--gold);
  font-weight: 900;
}

.hero,
.wizard,
.result {
  width: min(100%, 940px);
  margin: auto;
  padding: clamp(30px, 6vw, 76px);
}

.hero {
  display: grid;
  min-height: 650px;
  align-content: center;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.72fr);
  gap: clamp(36px, 7vw, 76px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: #936927;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1,
.question-card h2,
.result h2 {
  margin: 0 0 18px;
  text-wrap: balance;
  font-size: clamp(34px, 5.5vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.hero h1:focus,
.question-card h2:focus,
.result h2:focus,
.result h3[tabindex]:focus {
  outline: none;
}

.hero-copy,
.question-hint {
  color: var(--ink-2);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.8;
}

.hero-copy {
  max-width: 620px;
  margin: 0 0 24px;
}

.intro-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin: 20px 0 28px;
  color: var(--ink-2);
  font-size: 14px;
}

.intro-meta span::before {
  margin-right: 7px;
  color: var(--gold);
  content: "◆";
  font-size: 8px;
}

.consultant-note {
  position: relative;
  padding: 28px 24px 24px;
  border: 1px solid rgba(200, 148, 63, 0.42);
  border-radius: 22px 22px 22px 7px;
  background: linear-gradient(145deg, #fffaf0, #f3ead9);
  box-shadow: 0 18px 44px rgba(24, 53, 46, 0.1);
  transform: rotate(1.2deg);
}

.consultant-note::before {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(24, 53, 46, 0.16);
  border-radius: 50%;
  color: var(--gold);
  content: "魏";
  display: grid;
  place-items: center;
  font-weight: 900;
}

.consultant-note small {
  color: #936927;
  letter-spacing: 0.14em;
}

.consultant-note blockquote {
  margin: 20px 0;
  color: var(--ink-deep);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.7;
}

.consultant-note p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
}

.primary,
#nextButton {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(24, 53, 46, 0.18);
}

.primary,
#nextButton,
#backButton,
.secondary,
.fallback-actions button,
.fallback-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 14px;
  padding: 12px 22px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary:hover,
#nextButton:hover {
  background: var(--ink-deep);
  transform: translateY(-1px);
}

.secondary,
#backButton,
.fallback-actions button,
.fallback-actions a {
  color: var(--ink);
  background: transparent;
}

.secondary:hover,
#backButton:hover,
.fallback-actions button:hover,
.fallback-actions a:hover {
  background: var(--mint);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
  transform: none;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 42px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

.progress-track {
  height: 6px;
  flex: 1;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.progress-track i {
  display: block;
  width: 16.66%;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 0.25s ease;
}

.question-card {
  animation: card-in 0.32s ease both;
}

.question-card h2 {
  max-width: 760px;
}

.question-hint {
  max-width: 700px;
  margin: 0;
}

.advisor-tip {
  max-width: 720px;
  margin: 22px 0 30px;
  padding: 15px 17px;
  border-left: 4px solid var(--gold);
  border-radius: 0 14px 14px 0;
  color: var(--ink-2);
  background: #fff7e8;
  line-height: 1.65;
}

.advisor-tip strong {
  color: var(--ink);
}

fieldset {
  min-width: 0;
  margin: 30px 0 0;
  padding: 0;
  border: 0;
}

legend,
.field > span {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

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

.choice {
  position: relative;
  min-width: 0;
  min-height: 54px;
  padding: 14px 44px 14px 16px;
  overflow-wrap: anywhere;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.choice::after {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.choice:hover {
  border-color: rgba(24, 53, 46, 0.48);
  box-shadow: 0 8px 20px rgba(24, 53, 46, 0.08);
  transform: translateY(-1px);
}

.choice.selected {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(24, 53, 46, 0.16);
}

.choice.selected::after {
  display: grid;
  place-items: center;
  color: var(--ink);
  border-color: var(--gold-soft);
  background: var(--gold-soft);
  content: "✓";
  font-size: 13px;
  font-weight: 900;
}

.field {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.custom-field {
  margin-top: 14px;
  padding-left: 12px;
  border-left: 3px solid var(--line);
}

.field input,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #7a8e87;
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field-guidance {
  min-height: 20px;
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}

.field-guidance.error {
  color: var(--danger);
  font-weight: 700;
}

.field-error {
  display: block;
  margin-top: 9px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.field input:disabled,
.consent:has(input:disabled) {
  cursor: wait;
  color: var(--ink-2);
  background: #edf1ee;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 34px;
}

.form-error {
  min-height: 0;
  margin-top: 24px;
  color: var(--danger);
}

.form-error:empty {
  display: none;
}

.form-error:not(:empty) {
  padding: 14px 16px;
  border: 1px solid rgba(154, 53, 45, 0.35);
  border-radius: 12px;
  background: var(--danger-soft);
}

.form-error strong,
.form-error span {
  display: block;
}

.form-error span,
.form-error ul {
  margin: 5px 0 0;
  line-height: 1.6;
}

.form-error ul {
  padding-left: 20px;
}

.result {
  display: grid;
  gap: 18px;
}

.result-card {
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, #fffdf8, #edf6f2);
  box-shadow: 0 14px 36px rgba(24, 53, 46, 0.08);
}

.result-card h2 {
  font-size: clamp(30px, 4.4vw, 52px);
}

.result-card h3 {
  margin: 28px 0 10px;
  font-size: 20px;
}

.result-card p,
.result-card li {
  color: var(--ink-2);
  line-height: 1.75;
}

.result-card ul,
.result-card ol {
  margin: 10px 0 0;
  padding-left: 24px;
}

.direction-list li::marker,
.strategy-list li::marker,
.video-list li::marker {
  color: var(--gold);
  font-weight: 900;
}

.result-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 18px;
  padding: 5px 10px;
  color: var(--ink);
  border: 1px solid rgba(200, 148, 63, 0.45);
  border-radius: 999px;
  background: #fff5df;
  font-size: 13px;
  font-weight: 800;
}

.contact-card {
  background: var(--paper);
}

.contact-card > h3 {
  margin-top: 0;
  font-size: clamp(24px, 3.5vw, 34px);
}

.contact-intro {
  max-width: 660px;
  margin: 0 0 26px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.contact-grid .field {
  margin-top: 0;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 22px 0 6px;
  padding: 14px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f8f6;
  line-height: 1.6;
}

.consent input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--ink);
}

.submit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.submit-state {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.fallback-actions a {
  min-width: 150px;
}

.fallback-actions a.call-action {
  gap: 6px;
  background: var(--mint);
}

.fallback-actions a.call-action:hover {
  background: var(--paper);
}

.complete-seal {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  place-items: center;
  color: #f6ddb0;
  border-radius: 50%;
  background: var(--ink);
  font-size: 24px;
}

/*
 * 動畫全部掛在 .animate-in 上，由 app.js 在分頁真的看得到時才加。
 * 預設狀態就是「完全可見」——萬一 JS 沒跑或動畫沒動，成功頁照樣讀得到，
 * 不會停在 opacity 0 變成一張白卡。
 */
.complete-card.animate-in .complete-seal {
  animation: seal-pop 0.5s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

/* 送出成功後往外擴散一次的光圈，只跑一輪，不干擾閱讀。 */
.complete-card.animate-in .complete-seal::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  animation: seal-ring 0.9s ease-out 0.18s both;
}

.complete-card.animate-in > *:not(.complete-seal) {
  animation: card-in 0.5s ease both;
}

.complete-card.animate-in > *:nth-child(2) { animation-delay: 0.16s; }
.complete-card.animate-in > *:nth-child(3) { animation-delay: 0.24s; }
.complete-card.animate-in > *:nth-child(4) { animation-delay: 0.32s; }
.complete-card.animate-in > *:nth-child(5) { animation-delay: 0.4s; }
.complete-card.animate-in > *:nth-child(6) { animation-delay: 0.48s; }
.complete-card.animate-in > *:nth-child(7) { animation-delay: 0.56s; }
.complete-card.animate-in > *:nth-child(8) { animation-delay: 0.64s; }

@keyframes seal-pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes seal-ring {
  from {
    opacity: 0.5;
    transform: scale(0.82);
  }

  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

.contact-signature {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.contact-signature a {
  color: var(--ink);
  font-weight: 800;
}

.video-list {
  min-inline-size: 0;
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}

.video-list legend {
  margin-bottom: 14px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 800;
}

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

.video-check-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.72);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.video-check-item:hover {
  border-color: rgba(20, 67, 55, 0.42);
}

.video-check-item:has(input:checked) {
  border-color: rgba(20, 67, 55, 0.48);
  background: rgba(220, 235, 229, 0.9);
  box-shadow: inset 3px 0 var(--ink);
}

.video-check-item.relevant {
  background: rgba(220, 235, 229, 0.72);
}

.video-check-item input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--ink);
}

.video-question-text {
  color: var(--ink-2);
  line-height: 1.65;
}

.video-relevant-badge {
  padding: 3px 8px;
  color: #6f4a16;
  border: 1px solid rgba(167, 119, 48, 0.3);
  border-radius: 999px;
  background: rgba(246, 221, 176, 0.42);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  color: #fff;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(24, 53, 46, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 130%);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .brand-bar {
    min-height: 70px;
    padding: 12px 16px;
  }

  .privacy-chip {
    display: none;
  }

  .hero,
  .wizard,
  .result {
    padding: 30px 18px;
  }

  .hero {
    min-height: calc(100vh - 70px);
  }

  .hero-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .consultant-note {
    display: none;
  }

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

  .choice {
    min-height: 56px;
  }

  .progress-row {
    margin-bottom: 30px;
  }

  .wizard-actions {
    position: sticky;
    z-index: 3;
    bottom: 0;
    margin-inline: -4px;
    padding: 20px 4px 10px;
    background: linear-gradient(transparent, var(--paper) 28%);
  }

  .wizard-actions button {
    flex: 1;
  }

  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .submit-row .primary {
    width: 100%;
  }

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

  .video-check-item {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .video-relevant-badge {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 380px) {
  .hero h1,
  .question-card h2 {
    font-size: 32px;
  }

  .brand-copy strong {
    font-size: 15px;
  }
}

@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;
  }
}
