:root {
  color-scheme: light;
  --fp-ink: #211a12;
  --fp-muted: #6e6257;
  --fp-soft: #f8f1e6;
  --fp-paper: #fffaf2;
  --fp-card: rgba(255, 250, 242, 0.9);
  --fp-line: rgba(70, 45, 22, 0.16);
  --fp-line-strong: rgba(70, 45, 22, 0.26);
  --fp-gold: #b8893f;
  --fp-gold-dark: #865f23;
  --fp-cinnabar: #a43d32;
  --fp-jade: #466b54;
  --fp-shadow: 0 28px 70px rgba(49, 35, 20, 0.13);
  --fp-shadow-soft: 0 14px 34px rgba(49, 35, 20, 0.09);
  --fp-radius-xl: 34px;
  --fp-radius-lg: 24px;
  --fp-radius-md: 16px;
  --fp-max: 1180px;
  --fp-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% -10%, rgba(184, 137, 63, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(70, 107, 84, 0.18), transparent 30rem),
    linear-gradient(180deg, #fffaf2 0%, #f8f1e6 58%, #f0e4d2 100%);
  color: var(--fp-ink);
  font-family: var(--fp-font);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  background-image:
    linear-gradient(90deg, rgba(70, 45, 22, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(70, 45, 22, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}

a { color: inherit; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-140%);
  border-radius: 999px;
  background: var(--fp-ink);
  color: #fff;
  padding: 0.7rem 1rem;
  text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  padding: 1rem clamp(1rem, 3vw, 2rem) 0;
}

.site-header__inner {
  width: min(100%, var(--fp-max));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--fp-line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: var(--fp-shadow-soft);
  padding: 0.75rem 0.9rem;
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: max-content;
  color: var(--fp-ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--fp-ink), #4c2c18);
  color: #fff3dd;
  font-size: 1.2rem;
  font-weight: 900;
}

.brand strong,
.brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 1rem; letter-spacing: -0.02em; }
.brand small { margin-top: 0.18rem; color: var(--fp-muted); font-weight: 750; }

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.primary-nav a {
  border-radius: 999px;
  color: var(--fp-muted);
  font-size: 0.94rem;
  font-weight: 800;
  padding: 0.66rem 0.88rem;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  background: rgba(184, 137, 63, 0.14);
  color: var(--fp-ink);
}

main {
  width: min(100% - 2rem, var(--fp-max));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: end;
  padding: clamp(3rem, 8vw, 6rem) 0 2rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--fp-gold-dark);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--fp-ink);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h1 { max-width: 10ch; font-size: clamp(3.2rem, 10vw, 7.7rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.8rem); }

.lead {
  max-width: 64ch;
  margin: 1.35rem 0 0;
  color: var(--fp-muted);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
}

.hero-card,
.panel,
.method-note {
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 250, 242, 0.95), rgba(255, 255, 255, 0.66)),
    radial-gradient(circle at 100% 0%, rgba(184, 137, 63, 0.14), transparent 20rem);
  box-shadow: var(--fp-shadow-soft);
}

.hero-card {
  padding: 1.4rem;
}

.hero-card p { margin: 0 0 0.6rem; }
.hero-card ul { margin: 0; padding-left: 1.1rem; color: var(--fp-muted); }
.hero-card li + li { margin-top: 0.35rem; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.48fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
}

.panel {
  padding: clamp(1.1rem, 3vw, 2rem);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading .eyebrow { margin: 0; }
.section-heading--spaced { margin-top: 2rem; }

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

label span,
.field-note {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--fp-muted);
  font-size: 0.92rem;
  font-weight: 850;
}

input,
select {
  width: 100%;
  border: 1px solid var(--fp-line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--fp-ink);
  font: inherit;
  font-weight: 720;
  outline: 0;
  padding: 0.92rem 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus {
  border-color: rgba(184, 137, 63, 0.72);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(184, 137, 63, 0.18);
}

.helper-box {
  margin-top: 1rem;
  border: 1px dashed var(--fp-line-strong);
  border-radius: var(--fp-radius-md);
  background: rgba(255, 250, 242, 0.64);
  padding: 0.85rem 1rem;
}

.helper-box summary {
  cursor: pointer;
  color: var(--fp-gold-dark);
  font-weight: 900;
}

.helper-box p { margin: 0.65rem 0 0; color: var(--fp-muted); }

.basis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0;
  border: 0;
  padding: 0;
}

.basis-card {
  position: relative;
  display: grid;
  gap: 0.35rem;
  cursor: pointer;
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius-lg);
  background: rgba(255, 255, 255, 0.46);
  min-height: 132px;
  padding: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.basis-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(49, 35, 20, 0.08);
}

.basis-card input {
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--fp-gold-dark);
}

.basis-card:has(input:checked) {
  border-color: rgba(184, 137, 63, 0.72);
  background: rgba(255, 246, 225, 0.82);
  box-shadow: 0 0 0 4px rgba(184, 137, 63, 0.13);
}

.basis-card--wide { grid-column: 1 / -1; min-height: 104px; }
.basis-card__title { padding-right: 1.6rem; font-size: 1.12rem; font-weight: 950; }
.basis-card__location { color: var(--fp-muted); font-weight: 800; }
.basis-card__meta { align-self: end; color: var(--fp-gold-dark); font-size: 0.92rem; font-weight: 900; }

.birth-location-extra {
  margin-top: 1rem;
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius-lg);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.42);
}

.field-note { align-self: end; margin: 0; }

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  border: 1px solid var(--fp-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  padding: 0.35rem;
}

.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  border-radius: 999px;
  color: var(--fp-muted);
  font-weight: 900;
  padding: 0.7rem 1rem;
  text-align: center;
}
.segmented input:checked + span {
  background: var(--fp-ink);
  color: #fff4df;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.4rem;
}
.actions--stacked { display: grid; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  padding: 0.85rem 1.15rem;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--fp-ink); color: #fff4df; box-shadow: 0 14px 30px rgba(33, 26, 18, 0.16); }
.button-secondary { border-color: var(--fp-line-strong); background: rgba(255, 255, 255, 0.55); color: var(--fp-ink); }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px dashed var(--fp-line-strong);
  border-radius: var(--fp-radius-lg);
  color: var(--fp-muted);
  padding: 1.4rem;
  text-align: center;
}

.result-card {
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius-lg);
  background: rgba(255, 255, 255, 0.56);
  padding: 1.1rem;
}

.result-card--primary {
  background:
    radial-gradient(circle at 100% 0%, rgba(184, 137, 63, 0.20), transparent 16rem),
    linear-gradient(145deg, rgba(255, 246, 225, 0.92), rgba(255, 255, 255, 0.7));
}

.result-label,
.result-branch { margin: 0; color: var(--fp-muted); font-weight: 850; }
.result-time { display: grid; gap: 0.2rem; margin: 0.75rem 0; }
.result-time span { color: var(--fp-gold-dark); font-size: 1rem; font-weight: 950; }
.result-time strong { font-size: clamp(2.8rem, 7vw, 4.8rem); letter-spacing: -0.07em; line-height: 0.9; }
.result-branch strong { color: var(--fp-ink); }

.details-list {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
}

.details-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0.8rem;
  border-bottom: 1px solid rgba(70, 45, 22, 0.10);
  padding-bottom: 0.55rem;
}

.details-list dt { color: var(--fp-muted); font-weight: 850; }
.details-list dd { margin: 0; font-weight: 850; overflow-wrap: anywhere; }

.warnings {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.warning {
  border: 1px solid rgba(164, 61, 50, 0.24);
  border-radius: var(--fp-radius-md);
  background: rgba(164, 61, 50, 0.08);
  color: #763128;
  padding: 0.8rem 0.9rem;
  font-weight: 820;
}

.comparison-panel,
.method-note {
  margin-top: 1.5rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--fp-line);
  padding: 0.85rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--fp-muted);
  font-size: 0.86rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td { font-weight: 780; }
tr.is-selected td { background: rgba(184, 137, 63, 0.10); }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(70, 107, 84, 0.12);
  color: var(--fp-jade);
  font-size: 0.82rem;
  font-weight: 950;
  padding: 0.25rem 0.58rem;
}
.badge--warn { background: rgba(164, 61, 50, 0.10); color: var(--fp-cinnabar); }

.method-note {
  padding: clamp(1.1rem, 3vw, 2rem);
}
.method-note h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.method-note p { max-width: 80ch; color: var(--fp-muted); }

.site-footer {
  width: min(100% - 2rem, var(--fp-max));
  margin: 1.5rem auto 2rem;
  color: var(--fp-muted);
  font-size: 0.9rem;
  text-align: center;
}

.is-hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 940px) {
  .site-header__inner { align-items: flex-start; border-radius: 28px; flex-direction: column; }
  .primary-nav { justify-content: flex-start; }
  .hero,
  .layout { grid-template-columns: 1fr; }
  h1 { max-width: 12ch; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  main,
  .site-footer { width: min(100% - 1rem, var(--fp-max)); }
  .site-header { padding-inline: 0.5rem; }
  .site-header__inner { padding: 0.7rem; }
  .primary-nav a { font-size: 0.88rem; padding: 0.58rem 0.68rem; }
  .form-grid,
  .basis-grid { grid-template-columns: 1fr; }
  .basis-card--wide { grid-column: auto; }
  .section-heading { align-items: start; flex-direction: column; }
  .details-list div { grid-template-columns: 1fr; gap: 0.1rem; }
  .segmented { width: 100%; }
  .actions .button { width: 100%; }
}

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